<% /* $Revision$ $Id$ File: symbols.inc Description: Functies om symbolen (ins_deel) te tekenen Parameters: Context: Note: */ var datumfilter = getQParamDate("datumfilter", null); var deel2res = getQParamInt("deel2res", 0); // is het een reserveerbaar deel // Result: false: ik mag niet schrijven // true: ik mag wel schrijven // Veronderstel dat autorisatie minimaal verdieping is, ruimte wordt niet ondersteund function canWriteInsDeel(deel_key, vKey, scenario_key) { // Hebben we wel schrijfrechten op dit symbool op deze verdieping? // bepaal eerst de discipline if (scenario_key > 0) { var sql = "SELECT ins_discipline_key" + " FROM prj_deel pdd," + " ins_srtdeel isd," + " ins_srtgroep isg" + " WHERE pdd.ins_srtdeel_key = isd.ins_srtdeel_key" + " AND isd.ins_srtgroep_key = isg.ins_srtgroep_key" + " AND prj_deel_key = " + deel_key; } else { var sql = "SELECT ins_discipline_key" + " FROM ins_deel idd" + " WHERE ins_deel_key = " + deel_key; } var oRs = Oracle.Execute(sql); var disc_key = oRs("ins_discipline_key").value; oRs.Close(); var sql = "SELECT MIN(fac_gebruiker_alg_level_write) lvl" + " FROM fac_v_webgebruiker w, fac_functie f " + " WHERE w.ins_discipline_key = " + disc_key + " AND w.fac_functie_key = f.fac_functie_key " + " AND w.prs_perslid_key = " + user_key + " AND fac_functie_code = " + safe.quoted_sql(scenario_key <= 0? 'WEB_INSMAN' : 'WEB_INSPRJ'); var oRs = Oracle.Execute(sql); if (oRs.eof) return false; // Geen rechten var ALGWriteLevel = oRs("lvl").value; oRs.Close(); if (ALGWriteLevel == 9) return false; // Geen rechten if (ALGWriteLevel < 0) return true; // Alle rechten var fac_v_my_disc_onrgoed_write = "" + "SELECT a.alg_ruimte_key" + " FROM alg_v_onrgoed_familie a," + " alg_v_onrgoed_familie aa," + " alg_v_my_room mr" + " WHERE mr.alg_ruimte_key = aa.alg_ruimte_key" + " AND mr.prs_perslid_key = " + user_key + " AND a.alg_onrgoed_elder_key = aa.alg_onrgoed_elder_key" + " AND aa.niveau = a.niveau" // Noodzakelijk want ALG_LOCATIE heeft eigen sequence + " AND aa.niveau >= " + ALGWriteLevel var rsql = " SELECT 1" // plaatsgebonden en gebruiker heeft een plaats (werkplek) + " FROM (" + fac_v_my_disc_onrgoed_write + ") oga, alg_ruimte ar" + " WHERE oga.alg_ruimte_key = ar.alg_ruimte_key" + " AND ar.alg_verdieping_key = " + vKey return !(Oracle.Execute(rsql).eof); } /************************************************************\ * Voeg alle symbolen van de huidige discipline(s) toe aan * de tekening * Een en ander altijd binnen te tonen disciplines waarbij * een ins_srtdeel_acadsymbol is ingevuld * * Merk op dat een dobbelsteen verschillende symbolen kan bevatten * * LOOP: Per ruimte/aantal binnen verdieping met objecten zonder XY * - Bepaal linksboven van de dobbelsteen * LOOP: Per srtdeel binnen te tonen disciplines * - Maak een symbool aan * - LOOP: per object van deze soort in deze ruimte * Teken een symbool van dit object volgens * volgende positie dobbelpatroon * LOOP: Per srtdeel * - Maak een symbool aan * - LOOP: per object met ingevulde XY * - Teken het symbool op XY * \************************************************************/ var _symbolDefs = []; // Welke hebben we al gedefinieerd. var fa_symbol_codes = null; // fontawesome --> @1234 coding function DefineSymbol(cHandle, acadSymbol, acadInsertion) { var symbolname = acadSymbol; if (symbolname in _symbolDefs) return symbolname; // Direct klaar if (symbolname.substr(0, 3) == "fa-") { if (!fa_symbol_codes) { cHandle.SetSymbolFont(S("fg_symbolfont")); // scannen gebeurt elke page-request opnieuw maar duurt zo'n 20ms, acceptabel. var cssfile = Server.MapPath("../FontAwesome/css/fontawesome.min.css"); __Log("Scanning " + cssfile); fa_symbol_codes = {}; var fso = new ActiveXObject("Scripting.FileSystemObject"); var fread = fso.OpenTextFile(cssfile, 1); // For Reading var css = fread.ReadAll(); fread.Close() // .fa-coffee:before{content:"\f0f4"} versie 5 // .fa-coffee:before,.fa-mug-saucer:before{content:"\f0f4"} versie 6 //var re2 = /\.(fa-[a-z\-]+)\:before\{content\:\"\\([0-9a-f]+)\"\}/g; var re2 = /(\.fa-[a-z\d\-]+\:before)(?:\,(\.fa-[a-z\d\-]+\:before))*\{content\:\"\\([0-9a-f]+)\"\}/g; var cnt = 0; var match = re2.exec(css); while (match != null) { for (var i = 1; i < match.length - 1; i++) { var name = match[i]; if (name) { cnt++; fa_symbol_codes[name.split(":")[0].substring(1)] = match[match.length - 1]; } } match = re2.exec(css); } __Log("Found {0} FontAwesome symbols".format(cnt)); } return "@" + (fa_symbol_codes[symbolname] || "f128"); // f128 is Question mark/not found } if (symbolname.substr(0, 1) == "@") { //_symbolDefs[symbolname] = true; return symbolname; } //Maak symbool definitie var symbolFile = S("flexfilespath") + "/cad/symbols/" + acadSymbol + ".dwf" var fso = new ActiveXObject("Scripting.FileSystemObject"); if (!fso.FileExists(symbolFile)) var symbolFile = Server.MapPath("../shared/" + acadSymbol + ".dwf"); // Fallback naar shared if (fso.FileExists(symbolFile)) { if (S("fg_move_origin") & 2) // ellipse1.dwf van YKPN gaf overflow bij draggen { var xd = new ActiveXObject("SLNKDWF.DWFFile"); xd.Open(symbolFile); var y = new ActiveXObject("SLNKDWF.WhipFile"); y.SetLayers("NotExist", "NotExist"); if (xd.EplotSections.Count == 0) y.Load(symbolFile); else { var epl = xd.EplotSections.Item(0); y.LoadStream(epl); } var tmp_dwf = shared.tempFolder() + "/CAD_" + acadSymbol +".w2d"; symbolFile = tmp_dwf; // wordt na 24 uur in fgii.inc/cleanup_tempfolder wel opgeruimd y.SaveAs(symbolFile); } var xs = new ActiveXObject("SLNKDWF.DWFFile") xs.Open(symbolFile); try { // De DLL ondersteunt dat een DWG een symbool bibliotheek is met een symbool // per pagina. In de praktijk ondersteunen we dat hier niet en pakken altijd het // ene eerste symbool if (xs.EplotSections.Count > 0) var symcnt = cHandle.DefineSymbol(symbolname, xs.EplotSections.Item(0)); else var symcnt = cHandle.DefineW2DSymbol(symbolname, symbolFile); // ook als S("fg_move_origin") op 2 staat } catch (ee) { throw "Error defining symbol " + acadSymbol + "\n" + ee.description; } var oAbout = new ActiveXObject("SLNKDWF.About"); if (oAbout.VersionString >= "4,24") { if (acadInsertion && acadInsertion.orgx != null && acadInsertion.orgy != null) { cHandle.SymbolOrigin(symbolname, acadInsertion.orgx, acadInsertion.orgy); } } // Boundingbox overrulen // Commentaarregels daarin met # begonnen vallen er vanzelf uit if (fso.FileExists(symbolFile + ".bounds")) { var f = fso.OpenTextFile(symbolFile + ".bounds"); while (!f.AtEndOfStream) { var r = f.ReadLine(); var xy = r.split(","); if (xy.length == 2 && !isNaN(parseFloat(xy[0])) && !isNaN(parseFloat(xy[1]))) symcnt.AddPoint(parseFloat(xy[0]), parseFloat(xy[1])); } f.Close(); } } else { // Symbool bestand niet gevonden. Later wordt dit vanzelf een *STAR symbool } _symbolDefs[symbolname] = true; return symbolname; } // Callbackunctie om een OCTAGON achter een object te leggen function fnHighlight(rs, cHandle, dwgX, dwgY, scl, params) { if ("I:"+params.highlight_ins_deel_key == rs(0).value) { var scl = scl||1; var star = cHandle.AddSymbol(dwgX, dwgY,"*OCTAGON"); // TODO: meer cirkel of punaise? star.scale = 1.5*scl; //star.Contour.Label = "[cff0000]"+safe.nvl(rs("oms").Value); star.Contour.SetoutlineColor(S("fg_hilitebordercolor"), 232); star.Contour.SetColor(S("fg_hilitesymbolfillcolor"), 128); } } // Voeg alle symbolen (INS_DEEL) toe aan de tekening // Gelukkig bevat pDiscs_arr alleen disciplines waar we leesrechten op hebben dus // dat hoeven we niet meer te controleren. // Globalen als colKey etc. zijn al gezet function addObjecten(cHandle, highlight_ins_deel_key) { if ( (pDiscs_arr.length == 0 || pDiscs_arr.join(",").indexOf("-1") != -1) && (pSrtG_arr.length == 0 || pSrtG_arr.join(",").indexOf("-1") != -1) && (pSrtD_arr.length == 0 || pSrtD_arr.join(",").indexOf("-1") != -1) ) return; var symbolArray = []; // Hierin onthouden we even onze symbolen om later labels te kunnen zetten // // Bepaal afmeting dobbelsteen // Tel per ruimte over alle disciplines heen waar symboolnaam in ingevuld // Dat aantal moeten we van te voren weten om linksboven de dobbel te // kunnen beginnen sql = "SELECT ins_alg_ruimte_key alg_ruimte_key, count(*) aantal" + " FROM ins_v_deelenonderdeel id, ins_srtdeel isd, ins_srtgroep isg, " + dbTable + " SYNC" + " WHERE id.ins_alg_ruimte_key = SYNC." + colKey // + " AND id.ins_alg_ruimte_type = 'R'" + " AND id.ins_srtdeel_key = isd.ins_srtdeel_key" + " AND ins_deel_dwgx IS NULL AND ins_deel_dwgy IS NULL" + " AND "+syncParent+" = " + pvKey + " AND ins_deel_verwijder IS NULL" + " AND (ins_deel_vervaldatum IS NULL OR ins_deel_vervaldatum > TRUNC(SYSDATE))" + " AND ins_deel_parent_key IS NULL" + " AND isd.ins_srtgroep_key = isg.ins_srtgroep_key" + " AND ins_srtdeel_acadsymbol IS NOT NULL" + " AND ( 1=0" + (pDiscs_arr.length ? " OR id.ins_discipline_key IN (" + pDiscs_arr.join(",") +")" : "") + (pSrtG_arr.length ? " OR isg.ins_srtgroep_key IN (" + pSrtG_arr.join(",") +")" : "") + (pSrtD_arr.length ? " OR isd.ins_srtdeel_key IN (" + pSrtD_arr.join(",") +")" : "") + " )" + " GROUP BY ins_alg_ruimte_key" oRsRuimte = Oracle.Execute(sql); while (!oRsRuimte.EOF) { var symbols = buildDobbel(cHandle, { aantal: oRsRuimte("aantal").value, // Zoveel symbolen voor onze dobbelsteen ruimte: oRsRuimte("alg_ruimte_key").value, highlight_ins_deel_key: highlight_ins_deel_key, fnPreProcess: fnHighlight, fnLabel: function (rs) { if (!(rs("ins_disc_params_type").Value & 16)) // Hide default label return ""; return "[c][S"+S("fg_dobbelScale")*S("fg_inINSLabelSize")+"][c808080]" + safe.nvl(rs("oms").Value); }, sql : "SELECT 'I:'||ins_deel_key key, ins_deel_omschrijving oms," + " ins_srtdeel_acadsymbol symbolname, ins_disc_params_type," + " ins_srtdeel_acadsymbol_dwgx orgx, ins_srtdeel_acadsymbol_dwgy orgy, di.ins_discipline_color color" + " FROM ins_v_deelenonderdeel id, ins_srtdeel isd, ins_srtgroep isg," + " ins_disc_params isdp, ins_tab_discipline di" + " WHERE id.ins_alg_ruimte_key = " + oRsRuimte("alg_ruimte_key").Value + " AND id.ins_srtdeel_key = isd.ins_srtdeel_key" + " AND ins_deel_dwgx IS NULL AND ins_deel_dwgy IS NULL" + " AND isd.ins_srtgroep_key = isg.ins_srtgroep_key" + " AND ins_srtdeel_acadsymbol IS NOT NULL" + " AND isdp.ins_discipline_key = id.ins_discipline_key" + " AND di.ins_discipline_key = id.ins_discipline_key" + " AND di.ins_discipline_verwijder IS NULL" + " AND ( 1=0" + (pDiscs_arr.length ? " OR id.ins_discipline_key IN (" + pDiscs_arr.join(",") +")" : "") + (pSrtG_arr.length ? " OR isg.ins_srtgroep_key IN (" + pSrtG_arr.join(",") +")" : "") + (pSrtD_arr.length ? " OR isd.ins_srtdeel_key IN (" + pSrtD_arr.join(",") +")" : "") + " )" + " AND ins_deel_verwijder IS NULL" + " AND (ins_deel_vervaldatum IS NULL OR ins_deel_vervaldatum > TRUNC(SYSDATE))" + " AND ins_deel_parent_key IS NULL" + " ORDER BY isg.ins_discipline_key, isg.ins_srtgroep_key, " + " isd.ins_srtdeel_key, ins_deel_omschrijving" } ) for (var xx in symbols) symbolArray[xx] = symbols[xx]; oRsRuimte.MoveNext(); } oRsRuimte.Close(); // // Nu nog de ins_deel met ingevulde XY // sql = "SELECT 'I:'||ins_deel_key key, ins_deel_omschrijving oms, "+ lcl.xsqla('isd.ins_srtdeel_omschrijving', 'isd.ins_srtdeel_key')+"," + " ins_deel_dwgx dwgx, ins_deel_dwgy dwgy," + " ins_deel_dwgrotatie rot, ins_deel_dwgschaal scl," + " ins_srtdeel_acadsymbol symbolname, " + dbLabel + " dblabel," + " ins_srtdeel_acadsymbol_dwgx orgx, ins_srtdeel_acadsymbol_dwgy orgy," + " ins_srtdeel_acadlabelpos lpos, ins_srtdeel_acadlabelsize lsize," + " id.ins_alg_ruimte_key cadkey, ins_disc_params_type, di.ins_discipline_color color" + " FROM ins_v_deelenonderdeel id, ins_srtdeel isd, ins_srtgroep isg, "+dbTable+" SYNC," + " ins_disc_params isdp, ins_tab_discipline di" + " WHERE id.ins_alg_ruimte_key = SYNC."+colKey + " AND id.ins_srtdeel_key = isd.ins_srtdeel_key" // + " AND id.ins_alg_ruimte_type = 'R'" + " AND ins_deel_dwgx IS NOT NULL" + " AND "+syncParent+" = " + pvKey + " AND ins_deel_verwijder IS NULL" + " AND (ins_deel_vervaldatum IS NULL OR ins_deel_vervaldatum > TRUNC(SYSDATE))" + " AND ins_deel_parent_key IS NULL" + " AND isd.ins_srtgroep_key = isg.ins_srtgroep_key" + " AND INS_SRTDEEL_ACADSYMBOL IS NOT NULL" + " AND di.ins_discipline_key = id.ins_discipline_key" + " AND di.ins_discipline_verwijder IS NULL" + " AND isdp.ins_discipline_key = id.ins_discipline_key" + " AND ( 1=0" + (pDiscs_arr.length ? " OR id.ins_discipline_key IN (" + pDiscs_arr.join(",") +")" : "") + (pSrtG_arr.length ? " OR isg.ins_srtgroep_key IN (" + pSrtG_arr.join(",") +")" : "") + (pSrtD_arr.length ? " OR isd.ins_srtdeel_key IN (" + pSrtD_arr.join(",") +")" : "") + " )" + " ORDER BY isd.ins_srtdeel_key" symbols = buildSymbols(cHandle, { sql : sql, fnLabel: function (rs) { if (!(rs("ins_disc_params_type").Value & 16)) // Hide default label; kan nu beter via ins_srtdeel_acadlabelsize=0 return ""; if ("I:"+highlight_ins_deel_key == rs("key").value) return "[cff0000][S"+4*S("fg_inINSLabelSize")+"]" + safe.nvl(rs("oms").Value); // TODO waarom rood; er ligt al een octagon achter? if (rs("lsize").Value == null || rs("lsize").Value > 0) { return "[c][S"+(rs("lsize").Value||S("fg_inINSLabelSize"))+"]" +"[c"+toHexValue(rs("color").Value, { autobackground: true })+"]" + safe.nvl(rs("oms").Value); } }, highlight_ins_deel_key: highlight_ins_deel_key, fnPreProcess: fnHighlight } ); for (var xx in symbols) symbolArray[xx] = symbols[xx]; themaProps={ symbols: symbolArray, labelThema_key: pLabel_key, kleurThema_key: pThema_key, fnSql: function (viewName) { return "SELECT 'I:'||id.ins_deel_key key, thema.*" + " FROM ins_v_deelenonderdeel id, ins_srtdeel isd, ins_srtgroep isg, "+dbTable+" SYNC, " + viewName + " THEMA" + " WHERE id.ins_alg_ruimte_key = SYNC."+colKey + " AND id.ins_srtdeel_key = isd.ins_srtdeel_key" + " AND "+syncParent+" = " + pvKey + " AND ins_deel_verwijder IS NULL" + " AND (ins_deel_vervaldatum IS NULL OR ins_deel_vervaldatum > TRUNC(SYSDATE))" + " AND ins_deel_parent_key IS NULL" + " AND isd.ins_srtgroep_key = isg.ins_srtgroep_key" + " AND ins_srtdeel_acadsymbol IS NOT NULL" + " AND ( 1=0" + (pDiscs_arr.length ? " OR id.ins_discipline_key IN (" + pDiscs_arr.join(",") +")" : "") + (pSrtG_arr.length ? " OR isg.ins_srtgroep_key IN (" + pSrtG_arr.join(",") +")" : "") + (pSrtD_arr.length ? " OR isd.ins_srtdeel_key IN (" + pSrtD_arr.join(",") +")" : "") + " )" + " AND THEMA.ins_deel_key = id.ins_deel_key" + (datumfilter && hasColumn(viewName, 'fclt_f_datum', 'DATE') ? " AND THEMA.fclt_f_datum = " + datumfilter.toSQL():"") + (hasColumn(viewName, 'fclt_f_3d_user_key', 'NUMBER') ? " AND THEMA.fclt_f_3d_user_key = " + user_key:"") + " ORDER BY isd.ins_srtdeel_key" } } // Symbool kleur thema's if ((themaType & 0x18) == 0x10) // Bit 4/5 moet 10 zijn voor objecten kleurThema(cHandle, themaProps) if (pThemaI_key > 0) { themaProps.kleurThema_key = pThemaI_key; kleurThema(cHandle, themaProps); } // Symbool label thema's, komen bewust na de kleurthema's zodat evt. labeltooltip prevaleert if ((labelType & 0x18) == 0x10) // Bit 4/5 moet 10 zijn voor objecten labelThema(cHandle, themaProps) if (pLabelI_key > 0) { themaProps.labelThema_key = pLabelI_key; labelThema(cHandle, themaProps); } } // INS_DEELen die gekoppeld zijn aan werkplekken ('inventaris'); // We tonen ze alleen als ze XY hebben function addWerkplekObjecten(cHandle) { if (pDiscs_arr.length == 0 || pDiscs_arr.join(",").indexOf("-1") != -1) return; // // Nu nog de gewone objecten met XY // sql = "SELECT ins_deel_key, ins_deel_omschrijving oms, "+ lcl.xsqla('isd.ins_srtdeel_omschrijving', 'isd.ins_srtdeel_key')+"," + " coalesce(ins_deel_dwgx,0) dwgx, coalesce(ins_deel_dwgy,0) dwgy, " + " coalesce(ins_deel_dwgrotatie,0)ins_deel_dwgrotatie, coalesce(ins_deel_dwgschaal,1.0)ins_deel_dwgschaal," + " prs_werkplek_dwgx wdwgx, prs_werkplek_dwgy wdwgy," + " prs_werkplek_dwgrotatie, prs_werkplek_dwgschaal," + " isd.ins_srtdeel_key, ins_srtdeel_acadsymbol, " + dbLabel + " dblabel," + " ins_srtdeel_acadsymbol_dwgx orgx, ins_srtdeel_acadsymbol_dwgy orgy," + " '#000000' color" //zwart? + " FROM ins_v_deelenonderdeel id, ins_srtdeel isd, ins_srtgroep isg, alg_ruimte ar," + " prs_werkplek pw" + " WHERE pw.prs_alg_ruimte_key = ar.alg_ruimte_key" + " AND id.ins_alg_ruimte_key = pw.prs_werkplek_key" + " AND id.ins_alg_ruimte_type = 'W'" + " AND id.ins_srtdeel_key = isd.ins_srtdeel_key" + " AND prs_werkplek_dwgx IS NOT NULL" // werkplek moet wel geplaatst zijn + " AND alg_verdieping_key = " + pvKey + " AND isg.ins_discipline_key in (" + pDiscs_arr.join(",") +")" + " AND ins_deel_verwijder IS NULL" + " AND (ins_deel_vervaldatum IS NULL OR ins_deel_vervaldatum > TRUNC(SYSDATE))" + " AND ins_deel_parent_key IS NULL" + " AND isd.ins_srtgroep_key = isg.ins_srtgroep_key" + " AND ins_srtdeel_acadsymbol IS NOT NULL" + " ORDER BY isd.ins_srtdeel_key" var oRs = Oracle.Execute(sql); var symbolArray = []; while (!oRs.EOF) { var insertionpoint = ( (oRs("orgx").Value === null && oRs("orgy").Value === null) ? null : {orgx: oRs("orgx").Value, orgy: oRs("orgy").Value} ); var symbolName = DefineSymbol(cHandle, oRs("ins_srtdeel_acadsymbol").Value, insertionpoint); var wRot = oRs("prs_werkplek_dwgrotatie").value; if (wRot==null) wRot=0; dwRot = wRot*3.1415926/180; var scl = 1.0; if (oRs("prs_werkplek_dwgschaal").value != null) scl=oRs("prs_werkplek_dwgschaal").value; var insX=oRs("wdwgX").Value+scl*(Math.cos(dwRot)*oRs("dwgX").Value-Math.sin(dwRot)*oRs("dwgY").Value); var insY=oRs("wdwgY").Value+scl*(Math.cos(dwRot)*oRs("dwgY").Value+Math.sin(dwRot)*oRs("dwgX").Value); var symbol = cHandle.AddSymbol(insX, insY, oRs("ins_srtdeel_acadsymbol").Value); if (oRs("ins_deel_dwgrotatie").value != null) symbol.rotation = (wRot+oRs("ins_deel_dwgrotatie").Value+360)%360; var scl = 1.0; if (oRs("ins_deel_dwgschaal").value != null) scl = oRs("ins_deel_dwgschaal").value; symbol.scale = scl; symbol.Contour.Key = "IW:"+oRs("ins_deel_key").Value; symbolArray[symbol.Contour.Key] = symbol; // Onthouden voor later symbol.Contour.Label = "[c][S"+S("fg_inINSLabelSize")+"][c"+toHexValue(oRs("color").Value)+"]"+safe.nvl(oRs("oms").Value); symbol.Contour.SetUrl("", safe.nvl(oRs("oms").Value)); //symbol.Contour.SetColor(0x0000FF, 64); //symbol.SetColor(0xFF0000,255); // Maak onzichtbaar oRs.MoveNext(); } oRs.Close(); // thema's themaProps={ symbols: symbolArray, labelThema_key: pLabel_key, kleurThema_key: pThema_key, fnSql: function (viewName) { return "SELECT 'IW:'||id.ins_deel_key key, waarde" + " FROM ins_v_deelenonderdeel id, ins_srtdeel isd, ins_srtgroep isg, " + " alg_ruimte SYNC, " + viewName + " THEMA," + " prs_werkplek pw" + " WHERE pw.prs_alg_ruimte_key = SYNC.alg_ruimte_key" + " AND id.ins_alg_ruimte_key = pw.prs_werkplek_key" + " AND id.ins_alg_ruimte_type = 'W'" + " AND id.ins_srtdeel_key = isd.ins_srtdeel_key" + " AND alg_verdieping_key = " + pvKey + " AND ins_deel_verwijder IS NULL" + " AND (ins_deel_vervaldatum IS NULL OR ins_deel_vervaldatum > TRUNC(SYSDATE))" + " AND ins_deel_parent_key IS NULL" + " AND isd.ins_srtgroep_key = isg.ins_srtgroep_key" + " AND ins_srtdeel_acadsymbol IS NOT NULL" + " AND isg.ins_discipline_key in (" + pDiscs_arr.join(",") +")" + " AND THEMA.ins_deel_key = id.ins_deel_key" + (datumfilter && hasColumn(viewName, 'fclt_f_datum', 'DATE') ? " AND THEMA.fclt_f_datum = " + datumfilter.toSQL():"") + (hasColumn(viewName, 'fclt_f_3d_user_key', 'NUMBER') ? " AND THEMA.fclt_f_3d_user_key = " + user_key:"") + " ORDER BY isd.ins_srtdeel_key" } } // Symbool label thema's if ((labelType & 0x18) == 0x10) // Bit 4/5 moet 10 zijn voor objecten labelThema(cHandle, themaProps) // Symbool kleur thema's if ((themaType & 0x18) == 0x10) // Bit 4/5 moet 10 zijn voor objecten kleurThema(cHandle, themaProps) } // Plaats de ruimtegebonden objecten (werkplekgebonden gebeurt in addPRJWerkplekObjecten) function addPRJObjecten(cHandle) { if (pDiscs_arr.length == 0 || pDiscs_arr.join(",").indexOf("-1") != -1) return; var symbolArray = []; // Hierin onthouden we even onze symbolen om later labels te kunnen zetten // // Bepaal afmeting dobbelsteen // Tel per ruimte over alle disciplines heen waar symboolnaam in ingevuld // Dat aantal moeten we van te voren weten om linksboven de dobbel te // kunnen beginnen sql = "SELECT id.prj_ruimte_key, count(*) aantal" + " FROM prj_deel id, ins_srtdeel isd, ins_srtgroep isg, "+dbTable+" SYNC" + " WHERE id.prj_ruimte_key = SYNC."+colKey + " AND id.prj_werkplek_key is null" + " AND id.ins_srtdeel_key = isd.ins_srtdeel_key" + " AND prj_deel_dwgx IS NULL AND prj_deel_dwgy IS NULL" + " AND "+syncParent+" = " + pvKey + " AND prj_deel_verwijder IS NULL" + " AND isd.ins_srtgroep_key = isg.ins_srtgroep_key" + " AND ins_srtdeel_acadsymbol IS NOT NULL" + " AND isg.ins_discipline_key in (" + pDiscs_arr.join(",") +")" + " AND prj_scenario_key = " + scenario_key + " GROUP BY id.prj_ruimte_key" oRsRuimte = Oracle.Execute(sql); while (!oRsRuimte.EOF) { var symbols = buildDobbel(cHandle, { aantal: oRsRuimte("aantal").value, // Zoveel symbolen voor onze dobbelsteen ruimte: oRsRuimte("prj_ruimte_key").Value, fnLabel: function (rs) { return "[c][S"+S("fg_dobbelScale")*S("fg_inINSLabelSize")+"][c808080]" + safe.nvl(rs("oms").Value); }, sql : "SELECT 'P:'||prj_deel_key key, prj_deel_omschrijving oms, "+ lcl.xsqla('isd.ins_srtdeel_omschrijving', 'isd.ins_srtdeel_key')+"," + " NULL dwgx, NULL dwgy," + " NULL rot, NULL scl," + " ins_srtdeel_acadsymbol symbolname," + " ins_srtdeel_acadsymbol_dwgx orgx, ins_srtdeel_acadsymbol_dwgy orgy," + " id.prj_ruimte_key cadkey, " + " prj_deel_verwijder, di.ins_discipline_color color" + " FROM prj_deel id, ins_srtdeel isd, ins_srtgroep isg, ins_tab_discipline di" + " WHERE id.prj_ruimte_key = " + oRsRuimte("prj_ruimte_key").Value + " AND id.prj_werkplek_key is null" + " AND id.ins_srtdeel_key = isd.ins_srtdeel_key" + " AND prj_deel_dwgx IS NULL AND prj_deel_dwgy IS NULL" + " AND isd.ins_srtgroep_key = isg.ins_srtgroep_key" + " AND di.ins_discipline_key = isg.ins_discipline_key" + " AND ins_srtdeel_acadsymbol IS NOT NULL" + " AND isg.ins_discipline_key in (" + pDiscs_arr.join(",") + ")" + " AND prj_deel_verwijder IS NULL" + " ORDER BY isg.ins_discipline_key, isg.ins_srtgroep_key, " + " isd.ins_srtdeel_key, prj_deel_omschrijving" } ) for (var xx in symbols) symbolArray[xx] = symbols[xx]; oRsRuimte.MoveNext(); } oRsRuimte.Close(); // // Nu nog de prj_deel met ingevulde XY // sql = "SELECT 'P:'||prj_deel_key key, prj_deel_omschrijving oms, "+ lcl.xsqla('isd.ins_srtdeel_omschrijving', 'isd.ins_srtdeel_key')+"," + " prj_deel_dwgx dwgx, prj_deel_dwgy dwgy," + " prj_deel_dwgrotatie rot, prj_deel_dwgschaal scl," + " ins_srtdeel_acadsymbol symbolname, " + dbLabel + " dblabel," + " ins_srtdeel_acadsymbol_dwgx orgx, ins_srtdeel_acadsymbol_dwgy orgy," + " ins_srtdeel_acadlabelpos lpos, ins_srtdeel_acadlabelsize lsize," + " id.prj_ruimte_key cadkey, " + " prj_deel_verwijder, di.ins_discipline_color color" + " FROM prj_deel id, ins_srtdeel isd, ins_srtgroep isg, " + dbTable + " SYNC, ins_tab_discipline di" + " WHERE id.prj_ruimte_key = SYNC."+colKey + " AND id.ins_srtdeel_key = isd.ins_srtdeel_key" + " AND prj_deel_dwgx IS NOT NULL" + " AND "+syncParent+" = " + pvKey // + " AND prj_deel_verwijder IS NULL" + " AND isd.ins_srtgroep_key = isg.ins_srtgroep_key" + " AND INS_SRTDEEL_ACADSYMBOL IS NOT NULL" + " AND di.ins_discipline_key = isg.ins_discipline_key" + " AND di.ins_discipline_verwijder IS NULL" + " AND isg.ins_discipline_key in (" + pDiscs_arr.join(",") +")" + " AND prj_scenario_key = " + scenario_key + " ORDER BY isd.ins_srtdeel_key" symbols = buildSymbols(cHandle, { sql : sql, fnLabel: function (rs) { if (rs("prj_deel_verwijder").Value == null) return "[c][s30][c"+toHexValue(rs("color").Value)+"]" + safe.nvl(rs("oms").Value); else return "[c][s30][c404040]" + L("lcl_fg_obj_deleted") + "\n[c][s30][c404040]" + safe.nvl(rs("oms").Value); }, fnProcess: function (symbol, rs) { //symbol.Contour.Hatch = 3; //symbol.Contour.SetColor(0xFF00FF, 64); // Blauwe achtergrond if (rs("prj_deel_verwijder").Value != null) symbol.SetColor(0x404040, 255); // grijs maken } } ); for (var xx in symbols) symbolArray[xx] = symbols[xx]; themaProps= { symbols: symbolArray, labelThema_key: pLabel_key, kleurThema_key: pThema_key, fnSql:function (viewName) { return "SELECT 'P:'||id.prj_deel_key key, waarde" + " FROM prj_deel id, ins_srtdeel isd, ins_srtgroep isg, " + " PRJ_RUIMTE SYNC, " + viewName + " THEMA" + " WHERE id.prj_ruimte_key = SYNC.prj_ruimte_key" + " AND id.prj_werkplek_key is null" + " AND id.ins_srtdeel_key = isd.ins_srtdeel_key" + " AND alg_verdieping_key = " + pvKey + " AND prj_deel_verwijder IS NULL" + " AND isd.ins_srtgroep_key = isg.ins_srtgroep_key" + " AND ins_srtdeel_acadsymbol IS NOT NULL" + " AND isg.ins_discipline_key in (" + pDiscs_arr.join(",") +")" + " AND THEMA.prj_deel_key = id.prj_deel_key" + " AND prj_scenario_key = " + scenario_key + (datumfilter && hasColumn(viewName, 'fclt_f_datum', 'DATE') ? " AND THEMA.fclt_f_datum = " + datumfilter.toSQL():"") + (hasColumn(viewName, 'fclt_f_3d_user_key', 'NUMBER') ? " AND THEMA.fclt_f_3d_user_key = " + user_key:"") + " ORDER BY isd.ins_srtdeel_key" } } // Symbool label thema's if ((labelType & 0x18) == 0x10) // Bit 4/5 moet 10 zijn voor objecten labelThema(cHandle, themaProps); // Symbool kleur thema's if ((themaType & 0x18) == 0x10) // Bit 4/5 moet 10 zijn voor objecten kleurThema(cHandle, themaProps) } // INS_DEELen die gekoppeld zijn aan werkplekken ('inventaris') // voor werkplek gebonden objecten doen we (nog) geen dobbelsteen function addPRJWerkplekObjecten(cHandle) { if (pDiscs_arr.length == 0 || pDiscs_arr.join(",").indexOf("-1") != -1) return; // // Nu nog de gewone objecten met XY // sql = "SELECT prj_deel_key, prj_deel_omschrijving oms, "+ lcl.xsqla('isd.ins_srtdeel_omschrijving', 'isd.ins_srtdeel_key')+"," + " coalesce(prj_deel_dwgx,0) dwgx, coalesce(prj_deel_dwgy,0) dwgy, " + " coalesce(prj_deel_dwgrotatie,0) rot, coalesce(prj_deel_dwgschaal,1.0) scl," + " prj_werkplek_dwgx wdwgx, prj_werkplek_dwgy wdwgy," + " prj_werkplek_dwgrotatie wrot, prj_werkplek_dwgschaal wscl," + " isd.ins_srtdeel_key, ins_srtdeel_acadsymbol, " + dbLabel + " dblabel," + " ins_srtdeel_acadsymbol_dwgx orgx, ins_srtdeel_acadsymbol_dwgy orgy," + " '#000000' color" // zwart? + " FROM prj_deel id, ins_srtdeel isd, ins_srtgroep isg, prj_ruimte SYNC," + " prj_werkplek pw" + " WHERE pw.prj_ruimte_key = SYNC.prj_ruimte_key" + " AND id.prj_werkplek_key = pw.prj_werkplek_key" + " AND id.ins_srtdeel_key = isd.ins_srtdeel_key" + " AND prj_werkplek_dwgx IS NOT NULL" // werkplek moet wel geplaatst zijn + " AND alg_verdieping_key = " + pvKey + " AND isg.ins_discipline_key in (" + pDiscs_arr.join(",") +")" + " AND prj_deel_verwijder IS NULL" + " AND isd.ins_srtgroep_key = isg.ins_srtgroep_key" + " AND ins_srtdeel_acadsymbol IS NOT NULL" + " AND prj_scenario_key = " + scenario_key + " ORDER BY isd.ins_srtdeel_key" var oRs = Oracle.Execute(sql); var symbolArray = []; while (!oRs.EOF) { var insertionpoint = ( (oRs("orgx").Value === null && oRs("orgy").Value === null) ? null : {orgx: oRs("orgx").Value, orgy: oRs("orgy").Value} ); var symbolName = DefineSymbol(cHandle, oRs("ins_srtdeel_acadsymbol").Value, insertionpoint); var wRot = oRs("wrot").value; if (wRot==null) wRot=0; var dwRot = wRot*3.1415926/180; var scl = 1.0; if (oRs("wscl").value != null) scl=oRs("wscl").value; var insX=oRs("wdwgX").Value+scl*(Math.cos(dwRot)*oRs("dwgX").Value-Math.sin(dwRot)*oRs("dwgY").Value); var insY=oRs("wdwgY").Value+scl*(Math.cos(dwRot)*oRs("dwgY").Value+Math.sin(dwRot)*oRs("dwgX").Value); var symbol = cHandle.AddSymbol(insX, insY, oRs("ins_srtdeel_acadsymbol").Value); if (oRs("rot").value != null) symbol.rotation = (wRot+oRs("rot").Value+360)%360; var scl = 1.0; if (oRs("scl").value != null) scl = oRs("scl").value; symbol.scale = scl; symbol.Contour.Key = "IW:"+oRs("prj_deel_key").Value; symbolArray[symbol.Contour.Key] = symbol; // Onthouden voor later symbol.Contour.Label = "[c][s20][c"+toHexValue(rs("color").Value)+"]"+safe.nvl(rs("oms").Value); symbol.Contour.SetUrl("", safe.nvl(rs("oms").Value)); //symbol.Contour.SetColor(0x0000FF, 64); //symbol.SetColor(0xFF0000,255); // Maak onzichtbaar oRs.MoveNext(); } oRs.Close(); // thema's themaProps={ symbols: symbolArray, labelThema_key: pLabel_key, kleurThema_key: pThema_key, fnSql: function (viewName) { return "SELECT 'IW:'||id.prj_deel_key key, waarde" + " FROM prj_deel id, ins_srtdeel isd, ins_srtgroep isg, " + " prj_RUIMTE SYNC, " + viewName + " THEMA," + " prj_werkplek pw" + " WHERE pw.prj_ruimte_key = SYNC.prj_ruimte_key" + " AND id.prj_werkplek_key = pw.prj_werkplek_key" + " AND id.ins_srtdeel_key = isd.ins_srtdeel_key" + " AND alg_verdieping_key = " + pvKey + " AND prj_deel_verwijder IS NULL" // leuke thema's + " AND isd.ins_srtgroep_key = isg.ins_srtgroep_key" + " AND ins_srtdeel_acadsymbol IS NOT NULL" + " AND isg.ins_discipline_key in (" + pDiscs_arr.join(",") +")" + " AND THEMA.prj_deel_key = id.prj_deel_key" + (datumfilter && hasColumn(viewName, 'fclt_f_datum', 'DATE') ? " AND THEMA.fclt_f_datum = " + datumfilter.toSQL():"") + (hasColumn(viewName, 'fclt_f_3d_user_key', 'NUMBER') ? " AND THEMA.fclt_f_3d_user_key = " + user_key:"") + " ORDER BY isd.ins_srtdeel_key" } } // Symbool label thema's if ((labelType & 0x18) == 0x10) // Bit 4/5 moet 10 zijn voor objecten labelThema(cHandle, themaProps) // Symbool kleur thema's if ((themaType & 0x18) == 0x10) // Bit 4/5 moet 10 zijn voor objecten kleurThema(cHandle, themaProps) } %>