Files
Facilitor/APPL/CAD/ShowRoom.asp
Jos Groot Lipman fa5f745ba5 YKPN#64569 ShowRoom popupje kan nu ook in 3D via &showmode=3
svn path=/Website/trunk/; revision=57290
2022-09-15 07:35:20 +00:00

207 lines
8.0 KiB
Plaintext

<%@language = "javascript" %>
<% /*
$Revision$
$Id$
File: ShowRoom.asp
Description: Toon een ruimte in 2D plaatje
Parameters:
rKey ALG_RUIMTE.ALG_RUIMTE_KEY
vKey ALG_VERDIEPING.ALG_VERDIEPING_KEY
ins_key Een ins_deel. Ruimte wordt er bij gezocht
res_ruimte_key Een reserveerbare ruimte. Ruimte(s) worden er bij gezocht
showmode 2=2D, 3=3D
Context:
Note: Als rKey niet is gegeven moet vKey gedefieerd zijn
anders wordt hij er wel bij gezocht.
*/
%>
<!-- #include file="../Shared/common.inc" -->
<!-- #include file="../Shared/iface.inc" -->
<!-- #include file="../CAD/FGII.inc" -->
<!-- #include file="../SlnkDWF/Slnk2IMG.inc" -->
<%
FCLTHeader.Requires({ js: ["jquery.js"] });
var ins_key = getQParamInt("ins_key", -1); // Optioneel object.
var discArray = getQParamIntArray("disc_key",[]); // Optionele disciplines aanzetten.
var thema_key = getQParamInt("thema", -1);
var caddwgx = getQParamFloat("caddwgx", null); // x coördinaat van een specifieke plek in de ruimte die gehighlight moet worden.
var caddwgy = getQParamFloat("caddwgy", null); // y coördinaat van een specifieke plek in de ruimte die gehighlight moet worden.
var mld_key_dwgxy = getQParamInt("mld_key_dwgxy", -1); // Melding van de meegegeven coördinaten x en y.
var showmode = getQParamInt("showmode", 2); // 2=only2d, 3=only3d TODO: toggle?
if (ins_key > 0)
{
oRs = Oracle.Execute("SELECT ins_discipline_key" +
" FROM ins_deel" +
" WHERE ins_deel_key = " + ins_key);
discArray.push(oRs("ins_discipline_key").Value); // zou dubbel kunnen zijn
oRs.Close();
}
else
{
var sql = "SELECT DISTINCT d.ins_discipline_key"
+ " FROM fac_v_my_disciplines m, ins_v_aanwezigdiscipline d, ins_disc_params dp "
+ " WHERE d.ins_discipline_key=m.ins_discipline_key"
+ " AND d.ins_discipline_min_level = 1"
+ " AND dp.ins_disc_params_cadlayers IS NOT NULL"
+ " AND BITAND(dp.ins_disc_params_type, 1) > 0" // binnen
+ " AND BITAND(dp.ins_disc_params_type, 4) > 0" // default aan
+ " AND dp.ins_discipline_key = d.ins_discipline_key"
+ " AND fac_functie_code IN ('WEB_INSUSE')"
+ " AND prs_perslid_key = " + user_key;
var oRs = Oracle.Execute(sql);
while (!oRs.Eof)
{
discArray.push(oRs("ins_discipline_key").Value);
oRs.MoveNext();
}
oRs.Close();
}
if (S("fg_publiclayers").length)
discArray = discArray.concat(S("fg_publiclayers"));
prKey = getQParamInt("rKey",-1);
rrkey = getQParamInt("res_ruimte_key",-1);
if (prKey > 0)
{
oRs = Oracle.Execute("SELECT alg_verdieping_key FROM alg_ruimte WHERE alg_ruimte_key = " + prKey);
if (oRs.Eof)
{
Response.Write("Showroom/internal error: Ruimte niet gevonden");
Response.End;
}
vKey = oRs("alg_verdieping_key").Value;
oRs.Close();
}
else if (rrkey > 0) // reserveerbare ruimte
{
var sql = "SELECT ar.alg_verdieping_key, ar.alg_ruimte_key"
+ " FROM res_alg_ruimte rar, alg_ruimte ar"
+ " WHERE res_ruimte_key = " + rrkey
+ " AND res_alg_ruimte_verwijder IS NULL"
+ " AND alg_ruimte_verwijder IS NULL"
+ " AND rar.alg_ruimte_key = ar.alg_ruimte_key";
var oRs = Oracle.Execute(sql);
vKey = oRs("alg_verdieping_key").Value;
prKeys = [];
while (!oRs.Eof)
{
prKeys.push(oRs("alg_ruimte_key").Value);
oRs.MoveNext();
}
oRs.Close();
prKey = prKeys.join(",");
}
else // vkey verplicht
{
vKey = getQParamInt("vKey");
}
oRs = Oracle.Execute("SELECT alg_locatie_code, alg_gebouw_upper, alg_verdieping_omschrijving" +
" FROM alg_v_verdieping_gegevens" +
" WHERE alg_verdieping_key = " + vKey);
var titel = L("lcl_graphics") + " " + oRs("alg_locatie_code").Value + "-"
+ oRs("alg_gebouw_upper").Value + "-"
+ oRs("alg_verdieping_omschrijving").Value;
oRs.Close();
%>
<html>
<head>
<% FCLTHeader.Generate() %>
<script>
var showmode = <%=showmode%>;
function resizeIframes()
{
var height = parseInt(document.documentElement.clientHeight);
document.getElementById('MMap').style.height = (height) +"px";
};
function MMap_onClick(SlnkEvent)
{
return false; // Don't process
}
var params = "&vKey=<%=vKey%>&scenario_key=0"
+ "&highlight=<%=prKey%>"
+ "&mode=<%=MODE_IN%>"
+ "&discs=<%=discArray.join(",")%>"
+ "&thema=<%=thema_key%>"
+ "&ins_key=<%=ins_key%>"
+ "<%=caddwgx != null && caddwgy != null? '&caddwgx=' + caddwgx + '&caddwgy=' + caddwgy : ''%>"
+ "<%=mld_key_dwgxy > 0? '&mld_key_dwgxy=' + mld_key_dwgxy : ''%>";
function onFullScreen()
{
var url = "./maximize.asp?x=x" + params;
FcltMgr.windowopen(url,'FGShow',
"directories=no,location=no,menubar=no,"
+ "resizable=yes,status=no,titlebar=yes,toolbar=no");
FcltMgr.closeDetail(window); // zelf kunnen we nu wel dicht
}
function MMap_onMapperLoad(pSLNKEvent)
{
var ob = document.getElementById('MinMaxBtn');
ob.style.display = 'block'; // Zodat weer zichtbaar
//ob.style.top = ($("#docBody").offset().top + 1) + "px";
}
function init()
{
if (showmode == 2) // 2D
{
MMap.Reset();
MMap.SetIMGGenerator("../CAD/mySlnk2IMG.asp");
MMap.SetCustomParameters(params)
MMap.SetLabelPosition(<%=S("fg_labelPosition")%>);
MMap.SetPaperColor(<%=S("fg_paperColor")%>);
MMap.Refresh(true); // Try to zoom extents
}
else // 3D
{
MMap.SetCustomParameters(params);
// Eerst een keer het plaatje heel globaal renderen om dwg-info te achterhalen
$.getJSON("../CAD/mySlnk2IMG.asp?AsMap=1&vKey=<%=vKey%>", { }, function (pSLNKEvent)
{
MMap.gSLNKEvent = pSLNKEvent;
var zoomDWGX = (pSLNKEvent.DWGminX + pSLNKEvent.DWGmaxX) / 2;
var zoomDWGY = (pSLNKEvent.DWGminY + pSLNKEvent.DWGmaxY) / 2;
var zoomScale = Math.min(window.innerWidth / (pSLNKEvent.DWGmaxX - pSLNKEvent.DWGminX),
window.innerHeight / (pSLNKEvent.DWGmaxY - pSLNKEvent.DWGminY));
MMap.zoom2DWG(zoomDWGX, zoomDWGY, zoomScale * 2); // TODO waarom is hij zonder de '* 2' te klein?
MMap.Refresh(); // Try not to zoom extents
} );
}
}
</script>
<title><%=safe.html(titel)%></title>
</head>
<%
if (showmode == 2)
var mapper = "../SlnkDWF/ToonIMG.asp";
else
var mapper = "3dize.asp";
%>
<body class='modal' id='docBody' onLoad='javascript:init();'>
<!-- ==========================
HET plaatje
============================ -->
<span onclick="onFullScreen(event)"
class="fgindicator"
alt="fullscreen"
id="MinMaxBtn"
title="<%=L("lcl_cad_maximize")%>"
style="display:none"><%=I("fa-external-link fa-lg")%></span>
<iframe id="MMap" name="MMap" src="<%=mapper%>"
frameborder="0" framespacing="0" scrolling="no"
style="width: 100%; height:100%">
</iframe>
</body>
</html>
<% ASPPAGE_END(); %>