Files
Facilitor/APPL/CAD/Werkplek.inc
2023-04-13 22:29:26 +00:00

268 lines
13 KiB
C++

<% /*
$Revision$
$Id$
File: werkplek.inc
Description: Functies om werkplekken te tekenen
Parameters:
Context: onderdeel van mySlnk2IMG
Note:
*/
var _WPLINEWEIGHT = S("fg_symbolweight");
var _WPDOBBELLINEWEIGHT = S("fg_symbolweight")*2/3;
// Voeg een symbool voor alle werkplekken toe aan de tekening.
// Zie ook addPRJWerkplekken
function WPlabel(rs)
{
if (S("prs_werkplek_implicit") == 1 && rs("prs_werkplek_type") != 1) // Impliciet alleen de flex labelen
return "";
if (rs("prs_werkplek_type") == 1 && __Logging > 0) // Debugging flex labelen
return "[s50](flex)";
return "[c][S"+S("fg_inWPLabelSize")+"][c000000]" + safe.nvl(rs("oms").Value);
}
function addWerkplekken(cHandle)
{
if (inoutMode == MODE_OUT)
return;
var WPArray = []; // Hierin onthouden we even onze symbolen om later labels te kunnen zetten
//
// Bepaal afmeting dobbelsteen
// Tel per ruimte over alle werkplekken heen zonder XY
// Dat aantal moeten we van te voren weten om linksboven de dobbel te
// kunnen beginnen
sql = "SELECT prs_alg_ruimte_key, count(*) aantal"
+ " FROM prs_werkplek pw, alg_ruimte ar"
+ " WHERE pw.prs_alg_ruimte_key = ar.ALG_RUIMTE_KEY"
+ " AND prs_werkplek_dwgx IS NULL AND prs_werkplek_dwgy IS NULL"
+ " AND ALG_VERDIEPING_KEY = " + pvKey
+ " AND prs_werkplek_virtueel = 0"
+ " GROUP BY prs_alg_ruimte_key"
+ " HAVING count(*) > 0"
oRsRuimte = Oracle.Execute(sql);
while (!oRsRuimte.Eof)
{
var symbols =
buildDobbel(cHandle,
{ aantal: oRsRuimte("aantal").value, // Zoveel symbolen voor onze dobbelsteen
ruimte: oRsRuimte("prs_alg_ruimte_key").Value,
labelPosition: 2, // middenin symbool
fnLabel: WPlabel,
sql : "SELECT 'W:'||prs_werkplek_key key, "
+ safe.quoted_sql(S("fg_werkpleksymbool"))+" symbolname, " // Vooralsnog vast symbool
+ " prs_werkplek_omschrijving oms, prs_werkplek_type,"
+ " NULL orgx, NULL orgy, NULL color"
+ " FROM prs_werkplek pw"
+ " WHERE pw.prs_alg_ruimte_key = " + oRsRuimte("prs_alg_ruimte_key").Value
+ " AND prs_werkplek_dwgx IS NULL AND prs_werkplek_dwgy IS NULL"
+ " AND prs_werkplek_virtueel = 0"
+ " ORDER BY prs_werkplek_omschrijving ",
fnProcess: function (symbol, oRs)
{
symbol.contour.SetColor(0x008080,32);
symbol.scale *= S("fg_WPScale");
symbol.SetLineweight(_WPDOBBELLINEWEIGHT);
if (oRs("prs_werkplek_type").Value != 1) // Impliciet vast
{
symbol.SetColor(0xD0D0D0);
symbol.contour.SetColor(0x00A0A0,8);
}
}
}
)
for (var xx in symbols)
WPArray[xx] = symbols[xx];
oRsRuimte.MoveNext();
}
oRsRuimte.Close();
//
// Nu de werkplekken met XY. Allemaal hetzelfde symbool
//
sql = "SELECT 'W:'||prs_werkplek_key key, prs_werkplek_omschrijving oms,"
+ " prs_werkplek_dwgx dwgx, prs_werkplek_dwgy dwgy, prs_werkplek_type,"
+ " prs_werkplek_dwgrotatie rot, prs_werkplek_dwgschaal scl,"
+ " wp.prs_alg_ruimte_key cadkey, "+safe.quoted_sql(S("fg_werkpleksymbool"))+" symbolname,"
+ " NULL lpos, NULL lsize,"
+ " NULL orgx, NULL orgy, alg_ruimte_nr dbLabel, NULL color"
+ " FROM prs_werkplek wp, alg_ruimte ar"
+ " WHERE wp.prs_alg_ruimte_key = ar.alg_ruimte_key"
+ " AND prs_werkplek_dwgx IS NOT NULL"
+ " AND alg_verdieping_key = " + pvKey;
symbols = buildSymbols(cHandle, { sql : sql,
fnLabel: WPlabel,
labelPosition: 2, // middenin symbool
fnProcess: function (symbol, oRs)
{ symbol.contour.SetColor(0x000080,16);
symbol.scale *= S("fg_WPScale");
symbol.SetLineweight(_WPLINEWEIGHT);
if (oRs("prs_werkplek_type").Value != 1) // Impliciet vast
{
symbol.SetColor(0xD0D0D0);
symbol.contour.SetColor(0x00A0A0,8);
}
}
} );
for (var xx in symbols)
WPArray[xx] = symbols[xx];
themaProps= { symbols: WPArray,
labelThema_key: pLabel_key,
kleurThema_key: pThema_key,
fnLabel: function (rs)
{ return "[c][S"+S("fg_inWPLabelSize")+"][c000000]" + safe.nvl(rs("oms").Value);
},
fnSql: function (viewName)
{
return "SELECT 'W:'||pw.prs_werkplek_key key, thema.*"
+ " FROM prs_werkplek pw, alg_ruimte sync, " + viewName + " THEMA"
+ " WHERE pw.prs_alg_ruimte_key = sync.alg_ruimte_key"
+ " AND alg_verdieping_key = " + pvKey
+ " AND THEMA.prs_werkplek_key = pw.prs_werkplek_key"
+ (hasColumn(viewName, 'fclt_f_3d_user_key', 'NUMBER') ? " AND THEMA.fclt_f_3d_user_key = " + user_key:"")
+ scenFilter
+ " ORDER BY pw.prs_werkplek_key"
}
}
// Werkplek label thema's komen met prefix W: voor key door.
if ((labelType & 0x18) == 0x08) // Bit 4/5 moet 01 zijn voor werkplekken
labelThema(cHandle, themaProps);
if (pLabelW_key > 0)
{
themaProps.labelThema_key = pLabelW_key;
labelThema(cHandle, themaProps);
}
if ((themaType & 0x18) == 0x08) // Bit 4/5 moet 01 zijn voor werkplekken
kleurThema(cHandle, themaProps);
if (pThemaW_key > 0)
{
themaProps.kleurThema_key = pThemaW_key;
kleurThema(cHandle, themaProps);
}
}
// Voeg alle PRJ werkplekken toe aan de tekening. Zie ook addWerkplekken
function addPRJWerkplekken(cHandle, scenario_key)
{
if (inoutMode == MODE_OUT)
return;
var WPArray = []; // Hierin onthouden we even onze symbolen om later labels te kunnen zetten
//
// Bepaal afmeting dobbelsteen
// Tel per ruimte over alle werkplekken heen zonder XY
// Dat aantal moeten we van te voren weten om linksboven de dobbel te
// kunnen beginnen
sql = "SELECT pw.prj_ruimte_key, count(*) aantal"
+ " FROM prj_werkplek pw, prj_ruimte ar"
+ " WHERE pw.prj_ruimte_key = ar.PRJ_RUIMTE_KEY"
+ " AND prj_werkplek_dwgx IS NULL AND prj_werkplek_dwgy IS NULL"
+ " AND ALG_VERDIEPING_KEY = " + pvKey
+ " AND prj_werkplek_verwijder IS NULL"
+ " AND prj_scenario_key = " + scenario_key
+ " AND NOT EXISTS (SELECT * FROM prj_selectie"
+ " WHERE prj_selectie.prj_selectie_tabelkey = pw.prj_werkplek_key)"
+ " GROUP BY pw.prj_ruimte_key"
+ " HAVING count(*) > 0"
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_inWPLabelSize")+"][c808080]" + safe.nvl(rs("oms").Value);
},
sql : "SELECT 'W:'||prj_werkplek_key key, "
+ safe.quoted_sql(S("fg_werkpleksymbool"))+" symbolname, " // Vooralsnog vast symbool
+ " prj_werkplek_dwgx orgx, prj_werkplek_dwgy orgy, " // denk ik
+ " prj_werkplek_omschrijving oms, NULL color"
+ " FROM prj_werkplek pw"
+ " WHERE pw.prj_ruimte_key = " + oRsRuimte("prj_ruimte_key").Value
+ " AND prj_werkplek_dwgx IS NULL AND prj_werkplek_dwgy IS NULL"
+ " AND prj_werkplek_verwijder IS NULL"
+ " AND NOT EXISTS (SELECT * FROM prj_selectie"
+ " WHERE prj_selectie.prj_selectie_tabelkey = pw.prj_werkplek_key)"
+ " ORDER BY prj_werkplek_omschrijving ",
fnProcess: function (symbol)
{
symbol.contour.SetColor(0x000080,64);
}
}
)
for (var xx in symbols)
WPArray[xx] = symbols[xx];
oRsRuimte.MoveNext();
}
oRsRuimte.Close();
//
// Nu nog de werkplekken met XY. Allemaal hetzelfde symbool
//
sql = "SELECT 'W:'||prj_werkplek_key key, prj_werkplek_omschrijving oms,"
+ " prj_werkplek_dwgx dwgx, prj_werkplek_dwgy dwgy, "
+ " prj_werkplek_dwgrotatie rot, prj_werkplek_dwgschaal scl,"
+ " wp.prj_ruimte_key cadkey, "+safe.quoted_sql(S("fg_werkpleksymbool")) + " symbolname,"
+ " NULL lpos, NULL lsize,"
+ " NULL orgx, NULL orgy, prj_ruimte_nr dbLabel, NULL color"
+ " FROM prj_werkplek wp, prj_ruimte pr"
+ " WHERE wp.prj_ruimte_key = pr.prj_ruimte_key"
+ " AND prj_werkplek_dwgx IS NOT NULL"
+ " AND alg_verdieping_key = " + pvKey
+ " AND prj_scenario_key = " + scenario_key
+ " AND prj_werkplek_verwijder IS NULL"
+ " AND NOT EXISTS (SELECT * FROM prj_selectie"
+ " WHERE prj_selectie.prj_selectie_tabelkey = wp.prj_werkplek_key)"
symbols = buildSymbols(cHandle, { sql : sql,
fnLabel: function (rs)
{ return "[c][S"+S("fg_inWPLabelSize")+"][c000000]" + safe.nvl(rs("oms").Value);
},
fnProcess: function (symbol)
{ symbol.contour.SetColor(0x000080,64);
symbol.scale *= S("fg_WPScale");
}
}
);
for (var xx in symbols)
WPArray[xx] = symbols[xx];
themaProps= { symbols: WPArray,
labelThema_key: pLabel_key,
kleurThema_key: pThema_key,
fnSql:function (viewName)
{
return "SELECT 'W:'||pw.prj_werkplek_key key, waarde"
+ " FROM prj_werkplek pw, prj_ruimte sync, " + viewName + " THEMA"
+ " WHERE pw.prj_ruimte_key = sync.prj_ruimte_key"
+ " AND alg_verdieping_key = " + pvKey
+ " AND prj_werkplek_verwijder IS NULL"
+ " AND THEMA.prj_werkplek_key = pw.prj_werkplek_key"
+ (hasColumn(viewName, 'fclt_f_3d_user_key', 'NUMBER') ? " AND THEMA.fclt_f_3d_user_key = " + user_key:"")
+ " ORDER BY pw.prj_werkplek_key"
}
}
// Labelthema's voor werkplekken bij prj-mode
if ((labelType & 0x18) == 0x08) // Bit 4/5 moet 01 zijn voor werkplekken
labelThema(cHandle, themaProps)
// Kleurthema's voor werkplekken bij prj-mode
if ((themaType & 0x18) == 0x08) // Bit 4/5 moet 01 zijn voor werkplekken
kleurThema(cHandle, themaProps)
}
%>