696 lines
28 KiB
Plaintext
696 lines
28 KiB
Plaintext
<%@language = "javascript" %>
|
|
<% /*
|
|
$Revision$
|
|
$Id$
|
|
|
|
File: mySlnkIMG.asp
|
|
Description: Genereer een PNG image/Image MAP/Find informatie
|
|
Parameters:
|
|
vKey required: ALG_VERDIEPING.ALG_VERDIEPING_KEY
|
|
mode optional: MODE_IN (default) or MODE_OUT
|
|
Thema optional: THM_THEMA.THEM_THEMA_KEY
|
|
Label optional: THM_THEMA.THEM_THEMA_KEY
|
|
Discs optional: comma-separated INS_DISCIPLINE_KEY
|
|
contmode optional: -1 uit, 0 default, 1 en voor alt1 en alt2
|
|
werkplek 1 aan, 0 uit
|
|
highlight optional: comma-separated ALG_RUIMTE_KEY
|
|
scenario_key optional: dan zitten we in PRJ-mode (en impliciet binnen)
|
|
Context: Called from SlnkDwf\ToonIMG.js through gIMGGenerator
|
|
Note:
|
|
*/
|
|
|
|
DOCTYPE_Disable = 1;
|
|
%>
|
|
|
|
<!-- #include file='../Shared/common.inc' -->
|
|
<!-- #include file='../CAD/FGII.inc' -->
|
|
<!-- #include file='../CAD/symbols.inc' -->
|
|
<!-- #include file='../CAD/werkplek.inc' -->
|
|
<!-- #include file='../shared/flexfiles.inc' -->
|
|
<!-- #include file="../SlnkDWF/Slnk2IMG.inc" -->
|
|
<%
|
|
if (!fso.FolderExists(S("flexFilesPath") + "/CAD"))
|
|
{
|
|
var vAttachPath = Server.MapPath(rooturl + "/cust/" + customerId + "/dwf");
|
|
CreateFullPath(S("flexFilesPath") + "/CAD");
|
|
try
|
|
{
|
|
fso.MoveFolder(vAttachPath + "/*.*", S("flexFilesPath") + "/CAD"); /**/
|
|
}
|
|
catch(mfolder_err)
|
|
{
|
|
__DoLog("MoveFolder " + vAttachPath + " naar " + S("flexFilesPath") + "/CAD" + " mislukt: " + mfolder_err.description);
|
|
}
|
|
try
|
|
{
|
|
fso.MoveFile(vAttachPath + "/*.*", S("flexFilesPath") + "/CAD"); /**/
|
|
}
|
|
catch(mfiles_err)
|
|
{
|
|
__DoLog("MoveFiles " + vAttachPath + "/*.*" + " naar " + S("flexFilesPath") + "/CAD" + " mislukt: " + mfiles_err.description);
|
|
}
|
|
}
|
|
|
|
var pvKey = getQParamInt("vKey", -1);
|
|
if (pvKey == -1)
|
|
{
|
|
new SLNKDWF({}).Warning(L("lcl_fg_select_floor"));
|
|
Response.End;
|
|
}
|
|
|
|
var highlight_arr = getQParamIntArray("highlight", []); // Comma-separated room_key_list (terrains). Optional
|
|
var ins_key = getQParamInt("ins_key", -1); // highlight
|
|
var pDiscs_arr = getQParamIntArray("discs", []);
|
|
var pContmode = getQParam("contmode", "");
|
|
var pWerkplek = getQParam("werkplek", "0");
|
|
var pThema_key = getQParamInt("thema", -1);
|
|
var noLabel = getQParamInt("nolabel", 0) == 1; // Onderdruk default ruimtelabel
|
|
var pLabel_key = getQParamInt("label", getQParamInt("bordlabel_key", -1));
|
|
var pLabelW_key = getQParamInt("labelW", -1); // *moet* een werkplek label zijn
|
|
var pLabelI_key = getQParamInt("labelI", -1); // *moet* een ins (objecten) label zijn
|
|
var pThemaW_key = getQParamInt("themaW", -1); // *moet* een werkplek thema zijn
|
|
var pThemaI_key = getQParamInt("themaI", -1); // *moet* een ins (objecten) thema zijn
|
|
var inoutMode = getQParam("mode", MODE_IN);
|
|
var concept = getQParamInt("concept", 0);
|
|
var scenario_key = getQParamInt("scenario_key", 0); // current scenario, 0 voor geen
|
|
var pRuimteFilter = getQParamInt("resruimtefilter", 0);
|
|
var themaType = 0x0; // bitmap
|
|
var thema_click_urlR = null;
|
|
var thema_click_urlI = null;
|
|
var thema_click_urlW = null;
|
|
var labelType = 0x0; // bitmap
|
|
|
|
if (inoutMode == MODE_IN && scenario_key == 0 && (S("ph_placeFG") == 0 || (pDiscs_arr.length > 0 && pDiscs_arr.join(",").indexOf("-1") == -1)))
|
|
{
|
|
var xfunc = user.func_enabled2((scenario_key==0)? "CAD" : "PRJ",
|
|
{ alg_key: pvKey,
|
|
isOptional: true }); // alleen isOptional omdat we grafische foutmelding willen geven.
|
|
var autfunction=(scenario_key == 0)? "WEB_CADUSE" : "WEB_PRJBOF";
|
|
if (!xfunc || !xfunc.canRead(autfunction))
|
|
{
|
|
new SLNKDWF({}).Warning(L("lcl_no_auth"));
|
|
Response.End;
|
|
}
|
|
}
|
|
|
|
function myGeoProcessor(cHandle)
|
|
{
|
|
var geo_sample =
|
|
{ "type": "FeatureCollection",
|
|
"features": [
|
|
{ "type": "Feature",
|
|
"geometry": {"type": "Point", "coordinates": [102.0, 0.5]},
|
|
"properties": {"prop0": "value0"}
|
|
},
|
|
{ "type": "Feature",
|
|
"geometry": {
|
|
"type": "LineString",
|
|
"coordinates": [
|
|
[102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]
|
|
]
|
|
},
|
|
"properties": {
|
|
"prop0": "value0",
|
|
"prop1": 0.0
|
|
}
|
|
},
|
|
{ "type": "Feature",
|
|
"geometry": {
|
|
"type": "Polygon",
|
|
"coordinates": [
|
|
[ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0],
|
|
[100.0, 1.0], [100.0, 0.0] ]
|
|
]
|
|
},
|
|
"properties": {
|
|
"prop0": "value0",
|
|
"prop1": {"this": "that"}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
|
|
var geo =
|
|
{ "type": "FeatureCollection",
|
|
"features": []
|
|
}
|
|
for (var i2=0; i2 < cHandle.ContourCount; i2++)
|
|
{
|
|
var c = cHandle.ContourItem(i2);
|
|
var feat =
|
|
{ "type": "Feature",
|
|
"geometry": {"type": "Polygon", "coordinates": []},
|
|
"properties": {"key": c.Key,
|
|
"name": c.Label,
|
|
"area": c.area }
|
|
}
|
|
var poly = [];
|
|
for (var i =0; i < c.PointCount; i++)
|
|
{
|
|
var pt = c.PointItem(i);
|
|
poly.push([Math.round(pt.dwgX), Math.round(pt.dwgY)])
|
|
}
|
|
feat.geometry.coordinates.push(poly);
|
|
geo.features.push(feat);
|
|
}
|
|
Response.ContentType = "application/json";
|
|
Response.Write(JSON.stringify(geo));
|
|
Response.End;
|
|
}
|
|
|
|
/************************************************************\
|
|
* Processes Theme and room highlight
|
|
* Voeg symbolen en werkplekken toe
|
|
\************************************************************/
|
|
function myContourProcessor(cHandle)
|
|
{
|
|
__Log("Scanning found {0} contours".format(cHandle.ContourCount));
|
|
if (cHandle.DwgLimits)
|
|
{
|
|
__Log("DWG Limits: ({0}, {1})-({2}, {3})".format(Math.round(cHandle.DwgLimits.min.DwgX), Math.round(cHandle.DwgLimits.min.DwgY),
|
|
Math.round(cHandle.DwgLimits.max.DwgX), Math.round(cHandle.DwgLimits.max.DwgY)));
|
|
}
|
|
if (inoutMode == MODE_IN)
|
|
{
|
|
if (scenario_key == 0)
|
|
{
|
|
dbTable = "alg_ruimte";
|
|
dbLabel = "alg_ruimte_nr";
|
|
colKey = "alg_ruimte_key";
|
|
syncView = S("fg_syncruimteview"); //"ALG_V_AANWEZIGRUIMTE";
|
|
syncParent = "alg_verdieping_key";
|
|
scenFilter = "";
|
|
rarFilter = ( pRuimteFilter > 0 // Verwijderde en vervallen ruimten uitsluiten.
|
|
? " AND EXISTS"
|
|
+ " (SELECT 1"
|
|
+ " FROM res_ruimte x_rr"
|
|
+ " , alg_ruimte x_ar"
|
|
+ " , res_alg_ruimte x_rar"
|
|
+ " WHERE x_rar.alg_ruimte_key = x_ar.alg_ruimte_key"
|
|
+ " AND x_rar.res_ruimte_key = x_rr.res_ruimte_key"
|
|
+ " AND x_rar.res_alg_ruimte_verwijder IS NULL"
|
|
+ " AND x_rr.res_ruimte_verwijder IS NULL"
|
|
+ " AND ( (x_rr.res_ruimte_vervaldatum IS NULL)"
|
|
+ " OR (x_rr.res_ruimte_vervaldatum > " + datumfilter.toSQL() +")"
|
|
+ " )"
|
|
+ " AND x_ar.alg_verdieping_key = " + pvKey
|
|
+ " AND x_ar.alg_ruimte_key = ar.alg_ruimte_key"
|
|
+ " )"
|
|
: ""
|
|
);
|
|
}
|
|
else
|
|
{
|
|
dbTable = "prj_ruimte";
|
|
dbLabel = "prj_ruimte_nr";
|
|
colKey = "prj_ruimte_key";
|
|
syncView = S("fg_prj_syncruimteview"); //"PRJ_RUIMTE";
|
|
syncParent = "alg_verdieping_key";
|
|
scenFilter = " AND ar.prj_scenario_key = " + scenario_key; // En in eigen scenario
|
|
rarFilter = "";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
dbTable = "alg_terreinsector";
|
|
dbLabel = "alg_terreinsector_code";
|
|
colKey = "alg_terreinsector_key";
|
|
syncView = S("fg_syncterreinview");
|
|
syncParent = "alg_locatie_key";
|
|
scenFilter = "";
|
|
rarFilter = "";
|
|
}
|
|
|
|
// Doorloop zo snel mogelijk alle ruimtes van onze verdieping
|
|
// en zoek de ruimte_key erbij. Die stoppen we met R:12345 in de contour.key
|
|
// zodat alle volg-queries geen syncView meer nodig hebben (die soms duur is)
|
|
sql = "SELECT sync.cadlabel, ar." + dbLabel + " dbNummer, sync." + colKey + " colkey"
|
|
+ " FROM " + syncView + " sync, " + dbTable + " ar"
|
|
+ " WHERE sync." + syncParent + " = " + pvKey
|
|
+ " AND ar." + colKey + " = sync." + colKey
|
|
+ scenFilter
|
|
+ rarFilter;
|
|
oRs = Oracle.Execute(sql);
|
|
while (!oRs.Eof)
|
|
{
|
|
var rnrTek = oRs("cadlabel").value; // Zoals in de tekening
|
|
var cnt = cHandle.Contour(rnrTek); //
|
|
if (cnt)
|
|
{
|
|
cnt.Key = "R:" + oRs("colkey").Value;
|
|
cnt.Label = oRs("dbNummer").Value
|
|
}
|
|
oRs.MoveNext();
|
|
}
|
|
oRs.Close();
|
|
|
|
if (getQParamInt("AsGeo", 0) == 1)
|
|
myGeoProcessor(cHandle)
|
|
|
|
//
|
|
// Het mooie: vanaf hier is syncView en cadlabel nooit meer nodig!
|
|
//
|
|
|
|
if (pThema_key != -1)
|
|
{ // Haal de schema definitie op
|
|
sql = "SELECT cad_thema_type "
|
|
+ " FROM cad_thema"
|
|
+ " WHERE cad_thema_key = " + pThema_key
|
|
oRs = Oracle.Execute(sql);
|
|
themaType = oRs("cad_thema_type").Value;
|
|
oRs.Close();
|
|
}
|
|
if (pLabel_key != -1)
|
|
{ // Haal de schema definitie op
|
|
sql = "SELECT cad_label_type "
|
|
+ " FROM cad_label"
|
|
+ " WHERE cad_label_key = " + pLabel_key
|
|
oRs = Oracle.Execute(sql);
|
|
labelType = oRs(0).Value;
|
|
oRs.Close();
|
|
}
|
|
|
|
// Als je een werkplek thema kiest automatisch werkplekken aanzetten
|
|
if ((labelType & 0x18) == 0x08 || (themaType & 0x18) == 0x08)
|
|
pWerkplek = 1;
|
|
|
|
cHandle.SetLabelFont("Tahoma", (inoutMode==MODE_IN?S("fg_inlabelsize"):S("fg_outlabelsize")));
|
|
|
|
// Dit gaat langs alle ruimtes ongeacht of ze in de database zijn gevonden
|
|
var labelRot = getQParamInt("labelrot", 0);
|
|
for (var i2=0; i2 < cHandle.ContourCount; i2++)
|
|
{
|
|
var cont = cHandle.ContourItem(i2);
|
|
cont.setcolor(0x00ff00); // grijs randjes
|
|
if (labelRot != 0) // Voor als nog niet DLL versie 3.01
|
|
cont.LabelRotation = labelRot;
|
|
// contouren kleiner dan een bepaalde oppervlakte geven we een pro forma 10% label
|
|
if (cont.area < S("fg_areathreshold")*1000000) //setting im m2, area im mm2
|
|
{
|
|
cont.Label = "[s10]" + cont.Label;
|
|
}
|
|
cont.lineweight = S("fg_contourweight");
|
|
if (noLabel)
|
|
cont.Label = "";
|
|
|
|
if (concept == 0 || cont.Key.match(/^R:/))
|
|
cont.SetColor(S("fg_contourcolor"), S("fg_contouralpha")); // Alle herkende ruimtes initieel transparant
|
|
else if (concept == 1)
|
|
cont.SetColor(S("fg_contourcolorcpt"), 255); // Concept kleur niet herkende ruimtes
|
|
}
|
|
|
|
/************************************************************\
|
|
* Highlight specifieke ruimtes
|
|
* Voor thema doen: die kan eventueel andere kleur geven
|
|
\************************************************************/
|
|
for (var r in highlight_arr)
|
|
{
|
|
var cnt = cHandle.Contour("R:" + highlight_arr[r]);
|
|
if (cnt)
|
|
{
|
|
cnt.SetColor(getQParamInt("highlightcolor", S("fg_hilitefillcolor")), 255); // door 255 onderliggend
|
|
cnt.Lineweight = Math.min(250, 5 * getQParamFloat("hintScale", 100)); // Constant 5 pixel width maar niet te dik
|
|
cnt.SetoutlineColor(getQParamInt("highlightbordercolor", S("fg_hilitebordercolor")), 255);
|
|
cnt.Hatch = getQParamInt("highlighthatch", 3); // Diagonal Cross
|
|
cnt.MoveTop();
|
|
}
|
|
}
|
|
|
|
/************************************************************\
|
|
* Kleur de ruimtes in aan de hand van een thema
|
|
* Let wel: we ondersteunen ook terreinsectoren
|
|
\************************************************************/
|
|
|
|
if (themaType>0&&(themaType & 0x18) == 0x00) // Bit 4/5 moet 00 zijn voor contouren
|
|
{
|
|
kleurThema(cHandle, { kleurThema_key: pThema_key,
|
|
fnSql:function (viewName)
|
|
{ return "SELECT 'R:' || ar." + colKey + " key, waarde"
|
|
+ " FROM " + dbTable + " ar, " + viewName + " thema"
|
|
+ " WHERE thema." + colKey + "= ar." + colKey
|
|
+ " AND ar." + syncParent + "=" + pvKey
|
|
+ (datumfilter && hasColumn(viewName, 'fclt_f_datum', 'DATE') ? " AND THEMA.fclt_f_datum = " + datumfilter.toSQL():"")
|
|
+ scenFilter
|
|
}
|
|
}
|
|
)
|
|
}
|
|
|
|
/************************************************************\
|
|
* Label de ruimtes in aan de hand van een thema
|
|
* Als het thema meerdere records oplevert voor een ruimte
|
|
* dan worden die teksten onder elkaar geplaatst
|
|
* Let wel: we ondersteunen ook terreinsectoren
|
|
\************************************************************/
|
|
if (labelType > 0 && (labelType & 0x18) == 0x00) // Bit 4/5 moet 00 zijn voor contouren
|
|
{ // Haal de schema definitie op
|
|
sql = "SELECT cad_label_view"
|
|
+ " , cad_label_size"
|
|
+ " , cad_label_visible"
|
|
+ " FROM cad_label"
|
|
+ " WHERE cad_label_key = " + pLabel_key
|
|
oRs = Oracle.Execute(sql)
|
|
var viewName = oRs("cad_label_view").value;
|
|
var zichtbaar = oRs("cad_label_visible").value;
|
|
var ls = oRs("cad_label_size").value; // negatief als we default label niet willen hebben
|
|
var lh = (ls * 100 / S("fg_inlabelsize") ).toFixed(0);
|
|
var lhs = "[s" + lh + "]";
|
|
oRs.Close();
|
|
if (!zichtbaar) // dan de default teksten wissen
|
|
{
|
|
for (var i=0; i < cHandle.ContourCount; i++)
|
|
{
|
|
var cont = cHandle.ContourItem(i);
|
|
cont.Label = "";
|
|
}
|
|
}
|
|
// Doorloop alle ruimtes van onze verdieping en zoek de label-tekst er bij
|
|
// TH.* omdat iets verderop de HIGHLIGHT optioneel is
|
|
sql = "SELECT th.*, ar." + dbLabel + " dbNummer, ar." + colKey + " colkey"
|
|
+ " FROM " + viewName + " th, " + dbTable + " ar"
|
|
+ " WHERE ar." + syncParent + " = " + pvKey
|
|
+ " AND th." + colKey + "(+) = ar." + colKey
|
|
+ (datumfilter && hasColumn(viewName, 'fclt_f_datum', 'DATE') ? " AND th.fclt_f_datum = " + datumfilter.toSQL():"")
|
|
+ scenFilter
|
|
+ " ORDER BY ar." + colKey +", waarde"
|
|
|
|
rs_r = Oracle.Execute(sql);
|
|
if (!rs_r.EOF)
|
|
{
|
|
var hasHighlightField = false;
|
|
var hasPhotoField = false;
|
|
for (i=0; i<rs_r.Fields.Count; i++)
|
|
{
|
|
if (rs_r.Fields(i).Name.toUpperCase() == "HIGHLIGHT")
|
|
hasHighlightField = true;
|
|
if (rs_r.Fields(i).Name.toUpperCase() == "PHOTO")
|
|
hasPhotoField = true;
|
|
}
|
|
prevContour = null;
|
|
var urltxt; // Tooltip zonder opmaak codes in wording
|
|
while (!rs_r.EOF)
|
|
{
|
|
var rkey = "R:" + rs_r("colkey").value; // Dit zit in de DWF
|
|
if (!prevContour || prevContour.Key != rkey)
|
|
{
|
|
if (prevContour && (pThema_key == -1))
|
|
prevContour.SetUrl("", urltxt)
|
|
prevContour = cHandle.Contour(rkey);
|
|
urltxt = rs_r("dbNummer").value;
|
|
if (prevContour)
|
|
{
|
|
prevContour.Key = rkey;
|
|
if (zichtbaar)
|
|
prevContour.Label = "[u]"+rs_r("dbNummer").value;
|
|
else
|
|
prevContour.Label = "";
|
|
if (getQParamInt("labelPos", -1) == 2)
|
|
{ // Als gecentreerd dan individuele tekstregels
|
|
// ook centreren binnen de bounding-box
|
|
prevContour.Label = "[c]"+prevContour.Label;
|
|
}
|
|
}
|
|
}
|
|
var w = rs_r("waarde").value;
|
|
if (w != null)
|
|
{
|
|
if (hasPhotoField && rs_r("photo").value)
|
|
{
|
|
var photo_x = prevContour.Center.DwgX;
|
|
var photo_y = prevContour.Center.DwgY;
|
|
|
|
var symbolname = rs_r("photo").value;
|
|
var module = symbolname.split(":")[0];;
|
|
var key = symbolname.split(":")[1];
|
|
var symbolFile = Server.MapPath("../Pictures/avatar0.jpg");
|
|
var flexparam = flexProps(module, key, null, null, { getFiles: true });
|
|
if (flexparam.files.length)
|
|
{
|
|
var file = flexparam.files[0];
|
|
symbolFile = flexparam.AttachPath + file.name;
|
|
}
|
|
|
|
var dyRoom = prevContour.Extents.max.dwgY - prevContour.Extents.min.dwgY;
|
|
var symcnt = cHandle.DefineBitmapSymbol(symbolname, symbolFile, dyRoom / 2);
|
|
var symbol = cHandle.AddSymbol(photo_x, photo_y, symbolname);
|
|
// cnt.LabelPosition = 5; // 5 is OUTSIDEBOTTOM
|
|
}
|
|
|
|
urltxt+= "\n" + w;
|
|
if (w.substring(0,1)=="[") w = "[" + w;
|
|
if (hasHighlightField)
|
|
{
|
|
var hghl = rs_r("HIGHLIGHT").Value;
|
|
if (hghl & 0x2) // rood
|
|
w = "[cff0000][i]" + w;
|
|
else if (hghl & 0x1) // grijs
|
|
w = "[ca0a0a0][i]" + w;
|
|
}
|
|
if (prevContour)
|
|
prevContour.Label += (prevContour.Label&&prevContour.Label!="[c]"?"\n":"") + lhs + w;
|
|
}
|
|
rs_r.MoveNext();
|
|
}
|
|
if (prevContour && (pThema_key == -1)) // Last one
|
|
prevContour.SetUrl("", urltxt)
|
|
}
|
|
rs_r.Close();
|
|
}
|
|
|
|
// Nu de symbolen
|
|
if (S("fg_ins_symbols"))
|
|
{
|
|
if (scenario_key == 0)
|
|
addObjecten(cHandle, ins_key);
|
|
else
|
|
addPRJObjecten(cHandle);
|
|
}
|
|
|
|
// En de werkplekken als ze aanstaan
|
|
if (pWerkplek==1)
|
|
{
|
|
if (scenario_key == 0)
|
|
addWerkplekken(cHandle);
|
|
else
|
|
addPRJWerkplekken(cHandle, scenario_key);
|
|
|
|
// En de symbolen gekoppeld aan werkplekken
|
|
if (S("fg_ins_symbols"))
|
|
{
|
|
if (scenario_key == 0)
|
|
addWerkplekObjecten(cHandle);
|
|
else
|
|
addPRJWerkplekObjecten(cHandle);
|
|
}
|
|
}
|
|
|
|
// PRJ Aantekeningen
|
|
if (scenario_key > 0)
|
|
{
|
|
sql = "SELECT prj_scenario_note_nr, prj_scenario_note_nr || ': ' || prj_scenario_note_omschrijving oms,"
|
|
+ " prj_scenario_note_dwgx dwgx, prj_scenario_note_dwgy dwgy"
|
|
+ " FROM prj_scenario_note"
|
|
+ " WHERE prj_scenario_note_dwgx IS NOT NULL"
|
|
+ " AND prj_scenario_note_dwgy IS NOT NULL"
|
|
+ " AND prj_scenario_key = " + scenario_key
|
|
+ " AND alg_verdieping_key = " + pvKey
|
|
var oRs = Oracle.Execute(sql);
|
|
while (!oRs.EOF)
|
|
{
|
|
var symbol = cHandle.AddSymbol(oRs("dwgX").Value, oRs("dwgY").Value,"*STAR"); // liever *DIAMOND, bestaat die?
|
|
symbol.Contour.Key = oRs("prj_scenario_note_nr").Value;
|
|
symbol.Contour.Label = "[c000000]" + oRs("oms").Value;
|
|
oRs.MoveNext();
|
|
}
|
|
oRs.close();
|
|
}
|
|
|
|
// Pas op: dit geldt globaal voor alle applicaties die de DLL gebruiken
|
|
// opt = new ActiveXObject("SLNKDWF.Options")
|
|
// opt.SetOption("SYMBOLOUTLINEALPHA", 0)
|
|
|
|
cHandle.SetFilterLayers(myFilterLayer(pDiscs_arr));
|
|
}
|
|
|
|
// Kleurvertalingen callback functie
|
|
// S("fg_translateprintcolor") = [{paper: 0xffffff, from:0x00ffff, to:0x000000}];
|
|
function myIMGProcessor(IMGHandle)
|
|
{
|
|
IMGHandle.setAntialias(getQParamInt("antialias", S("fg_antialias")));
|
|
|
|
// De meeste gefilterde lagen zitten niet eens meer in de temp-dwf
|
|
// De SLNK contour lagen zitten er echter altijd (sinds ergens tussen DLL 2.70 en 2.84)
|
|
// in dus die verbergen we hier
|
|
if (pContmode<0)
|
|
IMGHandle.SetLayers(myFilterLayer(pDiscs_arr));
|
|
|
|
var i;
|
|
for (i = 0; i< S("fg_translateprintcolor").length; i++)
|
|
{
|
|
var clr = S("fg_translateprintcolor")[i];
|
|
IMGHandle.ReplaceColor(clr.paper, clr.from, clr.to); // Geel naar zwart
|
|
}
|
|
}
|
|
|
|
// Vanuit SLNKDWF krijgen we alleen een aangewezen tekst of een contournaam (ruimtenummer)
|
|
// Vertaal dat zo mogelijk naar alg_ruimte_key dan wel ins_deel_key
|
|
function myFindKeys(SlnkEvent)
|
|
{
|
|
if (SlnkEvent.TextLabel != "" && SlnkEvent.TextLayer == "SLNK Labels")
|
|
{ // Precies op ruimte label geklikt negeren we
|
|
SlnkEvent.TextLabel = "";
|
|
SlnkEvent.TextLayer = "";
|
|
}
|
|
SlnkEvent.click_urlR = thema_click_urlR;
|
|
SlnkEvent.click_urlI = thema_click_urlI;
|
|
SlnkEvent.click_urlW = thema_click_urlW;
|
|
if (SlnkEvent.TextLabel != "")
|
|
{ // Op objectlabel (willekeurige AutoCAD tekst bij object) geklikt. Zoek het object
|
|
// Volgens mij alleen bij AKZA in gebruik
|
|
// Op het moment negeren we de laag omdat in de database een (ATL)Wildcard
|
|
// staat waar we niets meer mee kunnen.
|
|
// Eventueel TODO: De SLNKDWF DLL uitbreiden om ATLREGEXP te testen en True/False op
|
|
// te leveren
|
|
__Log("Zoeken TextLabel '{0}'".format(SlnkEvent.TextLabel));
|
|
if (inoutMode==MODE_IN)
|
|
sql = "SELECT INS_DEEL_KEY "
|
|
+ " FROM ins_v_aanwezigdeel id, alg_ruimte ar, ins_disc_params idp"
|
|
+ " WHERE id.ins_discipline_key = idp.ins_discipline_key"
|
|
+ " AND ID.ins_alg_ruimte_key = ar.alg_ruimte_key"
|
|
+ " AND alg_verdieping_key = " + pvKey
|
|
// + " AND " + safe.quoted_sql(SlnkEvent.TextLayer + " LIKE idp.ins_disc_params_cadlayers||'%'"
|
|
+ " AND ins_deel_omschrijving = " + safe.quoted_sql(SlnkEvent.TextLabel);
|
|
else
|
|
sql = "SELECT ins_deel_key "
|
|
+ " FROM ins_v_aanwezigdeel id, ins_disc_params idp"
|
|
+ " WHERE id.ins_discipline_key = idp.ins_discipline_key"
|
|
+ " AND ins_alg_locatie_key = " + pvKey
|
|
+ " AND ins_alg_ruimte_type = 'T'"
|
|
// + " AND " + safe.quoted_sql(SlnkEvent.TextLayer) + " LIKE idp.ins_disc_params_cadlayers||'%'"
|
|
+ " AND ins_deel_omschrijving = " + safe.quoted_sql(SlnkEvent.TextLabel);
|
|
}
|
|
else if (SlnkEvent.ContourKey != "")
|
|
{
|
|
__Log("Zoeken ContourKey '{0}'".format(SlnkEvent.ContourKey));
|
|
if (SlnkEvent.ContourLayer == "SLNK Symbols")
|
|
{
|
|
if (scenario_key > 0)
|
|
return; // In scenario mode kunnen we (nog) niets met werkplekken of symbolen
|
|
SlnkEvent.Key = SlnkEvent.ContourKey;
|
|
if (SlnkEvent.ContourKey.match(/^W:/))
|
|
{ // Bij impliciet willen we heel graag weten of de werkplek vast dan wel flex is
|
|
// omdat vervolg acties er nog wel eens van af willen hangen.
|
|
var sql = "SELECT prs_werkplek_type"
|
|
+ " , prs_werkplek_omschrijving"
|
|
+ " FROM prs_werkplek"
|
|
+ " WHERE prs_werkplek_key = " + parseInt(SlnkEvent.Key.substring(2),10);
|
|
var oRs = Oracle.Execute(sql);
|
|
SlnkEvent.wp_type = oRs("prs_werkplek_type").Value;
|
|
SlnkEvent.ContourLabel = oRs("prs_werkplek_omschrijving").Value;
|
|
oRs.Close();
|
|
}
|
|
return;
|
|
}
|
|
if (SlnkEvent.ContourKey.match(/^R:/))
|
|
{
|
|
SlnkEvent.Key = parseInt(SlnkEvent.ContourKey.substr(2),10);
|
|
// Zoek het contourlabel (zoals zichtbaar in de tekening) en dbLabel (zoals in de db) er bij
|
|
sql = "SELECT sync.cadlabel, ar." + dbLabel + " dbNummer, sync." + colKey + " colkey"
|
|
+ " FROM " + dbTable + " ar, " + syncView + " sync"
|
|
+ " WHERE sync." + syncParent + " = " + pvKey
|
|
+ " AND ar." + colKey + " = sync." + colKey
|
|
+ " AND ar." + colKey + " = " + SlnkEvent.Key
|
|
+ scenFilter;
|
|
oRs = Oracle.Execute(sql);
|
|
if (!oRs.EOF)
|
|
{
|
|
SlnkEvent.ContourLabel = oRs("cadlabel").Value;
|
|
SlnkEvent.DbLabel = oRs("dbNummer").Value;
|
|
}
|
|
else
|
|
__DoLog("mySlnk2IMG.asp: Vreemd, " + SlnkEvent.ContourKey + " niet terug te vinden?", "#FFFF00");
|
|
oRs.Close();
|
|
return;
|
|
}
|
|
// Hier komen we als je klikt in een ruimte die geen database record heeft.
|
|
// Dan is de ContourKey nog altijd default gevuld met het label
|
|
// Dat negeren we verder
|
|
return;
|
|
}
|
|
else
|
|
return;
|
|
|
|
oRs = Oracle.Execute(sql);
|
|
if (!oRs.EOF)
|
|
{
|
|
SlnkEvent.Key = String(oRs(0).Value);
|
|
}
|
|
oRs.Close();
|
|
}
|
|
|
|
dwfPath = SetVerdPlanDWF(pvKey, inoutMode, scenario_key, concept);
|
|
if (dwfPath)
|
|
{
|
|
var lCont = S("fg_contourlayers");
|
|
var lLabel = S("fg_labellayers");
|
|
if (pContmode==1) // Alt1
|
|
{
|
|
lCont = S("fg_contourlayers_alt1");
|
|
lLabel = S("fg_labellayers_alt1");
|
|
}
|
|
else
|
|
{
|
|
if (pContmode==2) // Alt2
|
|
{
|
|
lCont = S("fg_contourlayers_alt2");
|
|
lLabel = S("fg_labellayers_alt2");
|
|
}
|
|
}
|
|
|
|
// Sommige DWF's hebben extreme coordinaat problemen
|
|
// Door ze hier eerst te herschrijven wordt het vanzelf
|
|
// een versie rond (0, 0) een hebben we geen overflow meer
|
|
var tmp_dwf;
|
|
if (S("fg_move_origin") & 1)
|
|
{
|
|
var xd = new ActiveXObject("SLNKDWF.DWFFile");
|
|
xd.Open(dwfPath);
|
|
var y = new ActiveXObject("SLNKDWF.WhipFile");
|
|
y.SetLayers("NotExist", "NotExist");
|
|
|
|
if (xd.EplotSections.Count == 0)
|
|
y.Load(dwfPath);
|
|
else
|
|
{
|
|
var epl = xd.EplotSections.Item(0);
|
|
y.LoadStream(epl);
|
|
}
|
|
var tmp_dwf = shared.tempFolder() + "/CAD_" + shared.random(16) +".w2d"
|
|
dwfPath = tmp_dwf;
|
|
y.SaveAs(dwfPath);
|
|
}
|
|
|
|
var myProps = { dwfFile : dwfPath,
|
|
dwfProcessor : myContourProcessor,
|
|
imgProcessor : myIMGProcessor,
|
|
fndProcessor : myFindKeys,
|
|
contourLayers: lCont,
|
|
labelLayers : lLabel,
|
|
minArea : S("fg_contour_minarea"),
|
|
minmergedistance: S("fg_minmergedistance"),
|
|
maximize : S("fg_maximize"),
|
|
tempFolder : shared.tempFolder(),
|
|
keepTemp : (__Logging & 8) == 8,
|
|
asciiTemp : (__Logging & 8) == 8
|
|
};
|
|
var mySLNKDWF = new SLNKDWF(myProps);
|
|
mySLNKDWF.Process();
|
|
if (myProps.cached)
|
|
__Log("myContourProcessor not called because tempfile {0} was reused".format(myProps.tempfile));
|
|
|
|
if (tmp_dwf && (__Logging & 8) != 8)
|
|
fso.DeleteFile(tmp_dwf);
|
|
}
|
|
%>
|
|
<% ASPPAGE_END(); %>
|