| | |
| | | } |
| | | </style> |
| | | <script> |
| | | var gAsync = true; |
| | | var gDebug = false; |
| | | var groupName = "空间统计"; |
| | | |
| | | $(function () { |
| | | init(); |
| | | }); |
| | | |
| | | function init() { |
| | | window.ondragstart = function () { return false; } |
| | | |
| | | refreshList(); |
| | | } |
| | | |
| | | function refreshList() { |
| | | function getGroupId() { |
| | | var gid = SGWorld.ProjectTree.FindItem(groupName); |
| | | if (gid) return gid; |
| | | |
| | | return SGWorld.ProjectTree.CreateLockedGroup(groupName); |
| | | } |
| | | |
| | | function delGroup() { |
| | | try { |
| | | $("#LayerId").html(""); |
| | | |
| | | var layers = [], index = 0; |
| | | BuildObjectsList(SGWorld.ProjectTree.RootID, layers, 36); |
| | | |
| | | layers.forEach(function (val) { |
| | | var name = SGWorld.ProjectTree.GetItemName(val); |
| | | $("#LayerId").append("<option value=" + val + (0 == index ? " selected='selected' " : "") + ">" + name + "</option>"); |
| | | index++; |
| | | }); |
| | | |
| | | if (layers.length) SGWorld.ProjectTree.SelectItem(layers[0]); |
| | | } catch (e) { |
| | | var gid = SGWorld.ProjectTree.FindItem(groupName); |
| | | if (gid) SGWorld.ProjectTree.DeleteItem(gid); |
| | | } |
| | | catch (e) { |
| | | console.log(e); |
| | | } |
| | | } |
| | | |
| | | function changeLayer(e) { |
| | | var id = $(e).val(); |
| | | if (id) SGWorld.ProjectTree.SelectItem(id); |
| | | function getFeatureLayers() { |
| | | var layers = [], index = 0; |
| | | BuildObjectsList(SGWorld.ProjectTree.RootID, layers, 36); |
| | | |
| | | return layers; |
| | | } |
| | | |
| | | var buffer = 0; |
| | | |
| | | function changeBuffer(e) { |
| | | var val = $(e).val(); |
| | | if (val == buffer || isNaN(val)) return; |
| | | |
| | | buffer = parseFloat(val); |
| | | SGWorld.Command.Execute(1096, buffer); |
| | | } |
| | | |
| | | function changeSR(e) { |
| | | var val = parseInt($(e).val()); |
| | | SGWorld.Command.Execute(1097, val); |
| | | } |
| | | |
| | | function openPropTab(e) { |
| | | SGWorld.Command.Execute(1086, null); |
| | | function clear(e) { |
| | | $("#totalNum").html("0"); //要素总个数 |
| | | $("#lineLen").html("0"); // 线对象长度 |
| | | $("#polyArea").html("0"); // 多边形面积 |
| | | $("#volume").html("0"); // 三维体体积 |
| | | $("#minHeight").html("0"); //三维体最低高度 |
| | | $("#maxHeight").html("0"); // 三维体最高高度 |
| | | } |
| | | |
| | | function startQuery(e) { |
| | | var id = parseInt($("#SelectType").val()); |
| | | SGWorld.Command.Execute(id, null); |
| | | delGroup(); |
| | | if (drawing.drawingEditMode != -1) { |
| | | drawing.abort(); |
| | | return; |
| | | } |
| | | |
| | | SGWorld.Window.ShowMessageBarText("按 Esc 键退出"); |
| | | drawing.drawPolygon({ |
| | | style: { |
| | | lineColor: "#ff0000", |
| | | lineWidth: 3, |
| | | }, |
| | | altitudeMethod: 2, // use 2 of "OnTerrain" and 3 for "Absolute" (above mean sea level) |
| | | deleteWhenExit: false, // |
| | | parentGoupID: getGroupId(), |
| | | saveOnExit: true, // save the polyline/polygon when exiting the project. Default = false |
| | | onFinish: DrawPoly, |
| | | onAbort: ResetAsync |
| | | }); |
| | | } |
| | | |
| | | function DrawPoly(geometry, type, altitudeType) { |
| | | SGWorld.ProjectTree.EnableRedraw(0); |
| | | //alert(null==geometry); |
| | | } |
| | | |
| | | function ResetAsync(FirstTime, FromMouseInputMode) { |
| | | if (gAsync) |
| | | setTimeout(function () { Reset(FirstTime, FromMouseInputMode); }, 100); |
| | | else |
| | | Reset(FirstTime, FromMouseInputMode); |
| | | } |
| | | |
| | | function Reset(FirstTime, FromMouseInputMode) { |
| | | try { |
| | | if (gPolyObj != null) SGWorld.Creator.DeleteObject(gPolyObj.ID); |
| | | } catch (e) { } |
| | | |
| | | gPolyObj = null; |
| | | SGWorld.ProjectTree.EnableRedraw(1); |
| | | SGWorld.Window.HideMessageBarText(); |
| | | bInEdit = false; |
| | | |
| | | if (FirstTime != 1 && FromMouseInputMode == 0) SGWorld.Window.SetInputMode(0); |
| | | } |
| | | </script> |
| | | </head> |
| | | <body> |
| | | <table style="border: 0; padding: 0; border-spacing: 0; border-spacing: 2px; width: 100%;"> |
| | | <body class="hideUntillTranslated"> |
| | | <table style="width: 100%; border: 0;" cellspacing="0" cellpadding="2"> |
| | | <tr> |
| | | <td class="ToolTopArea" width="100%" valign="middle"> |
| | | <td class="ToolTopArea" id="TopAreaTD" width="100%" valign="middle"> |
| | | <table border="0" width="100%" cellspacing="0" cellpadding="0"> |
| | | <tr> |
| | | <td width="55px"> |
| | | <img style="margin-left: 5px;" src="img/ToolIcon.png" alt="" /></td> |
| | | <td id="TitleTD" align="center" class="s12w i18n">空间统计</td> |
| | | <td align="right" id="CloseHelpTd"> |
| | | <img style="margin-right: 5px;" alt="" src="../CommonImg/help.png" border="0" class="i18n" alt="help" title="帮助" onclick="DisplayHelpPopup6(SGLang.i18nFile('help.html'),SGLang.i18n('help'))" style="cursor: pointer;"/></td> |
| | | <img style="margin-right: 5px; cursor: pointer;" alt="" src="../CommonImg/help.png" border="0" class="i18n" alt="help" title="帮助" onclick="DisplayHelpPopup6(SGLang.i18nFile('help.html'),SGLang.i18n('help'))" /></td> |
| | | </tr> |
| | | </table> |
| | | </td> |
| | |
| | | <tr> |
| | | <td class="ToolTopSeperator"></td> |
| | | </tr> |
| | | <tr> |
| | | <tr class="s8"> |
| | | <td> |
| | | <table class="PropertiesSheet" style="border: 0; padding: 0; border-spacing: 0; border-spacing: 2px;"> |
| | | <table class="PropertiesSheet" cellspacing="0" cellpadding="2"> |
| | | <tr class='TableOtherLine'> |
| | | <td class="s8b"> |
| | | <label for="Mode" class="i18n">选择图层</label> |
| | | <label for="Mode" class="i18n">要素总个数</label> |
| | | </td> |
| | | <td> <select id="LayerId" onchange="changeLayer(this);" style="width: 200pt;"></select> |
| | | <span id="refresh" onclick="refreshList();" style="text-decoration: underline; cursor: pointer;" class="i18n">刷新</span> |
| | | <td> <span id="totalNum">0</span> 个 |
| | | </td> |
| | | </tr> |
| | | <tr> |
| | | <td class="s8b"> |
| | | <label for="Mode" class="i18n">缓冲距离</label> |
| | | <label for="Mode" class="i18n">线对象长度</label> |
| | | </td> |
| | | <td> <input id="Buffer" type="text" style="width: 95pt;" value="0" size="7" onchange="CheckNumberEx(Buffer, 0, 0, 9999999); changeBuffer(this);" /> |
| | | 米 |
| | | <td> <span id="lineLen">0</span> 千米 |
| | | </td> |
| | | </tr> |
| | | <tr> |
| | | <td class="s8b"> |
| | | <label for="Mode" class="i18n">空间关系</label> |
| | | <label for="Mode" class="i18n">多边形面积</label> |
| | | </td> |
| | | <td> <select id="SpatialRelationship" onchange="changeSR(this);" style="width: 100pt;"> |
| | | <option class="i18n" value="1" selected="selected">相交</option> |
| | | <option class="i18n" value="2">包含</option> |
| | | </select> |
| | | <td> <span id="polyArea">0</span> 平方千米 |
| | | </td> |
| | | </tr> |
| | | <tr> |
| | | <td class="s8b"> |
| | | <label for="Mode" class="i18n">查询类型</label> |
| | | <label for="Mode" class="i18n">三维体体积</label> |
| | | </td> |
| | | <td> <select id="SelectType" style="width: 100pt;"> |
| | | <option value="1074">点查</option> |
| | | <option value="1072">线查</option> |
| | | <option value="1071" selected="selected">面查</option> |
| | | <option value="1156">选择对象</option> |
| | | </select> |
| | | <td> <span id="volume">0</span> 立方千米 |
| | | </td> |
| | | </tr> |
| | | <tr> |
| | | <td class="s8b"> |
| | | <label for="Mode" class="i18n">三维体高度</label> |
| | | </td> |
| | | <td> 最低 <span id="minHeight">0</span> 米,最高 <span id="maxHeight">0</span> 米 |
| | | </td> |
| | | </tr> |
| | | </table> |
| | | </td> |
| | | </tr> |
| | | <tr> |
| | | <tr class="s8"> |
| | | <td align="center" class="ToolButtonsArea"> |
| | | <div id="SurfaceDiv"> |
| | | <button id="clipboardButton" class="MenuButton" onclick="openPropTab(this);" style="cursor: pointer;"> |
| | | <button id="clipboardButton" class="MenuButton" onclick="clear(this);" style="cursor: pointer;"> |
| | | <img src="img/delete.png" /><br /> |
| | | <span class="i18n">清 除</span></button> |
| | | <button id="DrawPlaneBtn" class="MenuButton MenuButtonLast" onclick="startQuery(this);" style="cursor: pointer;"> |
| | |
| | | </tr> |
| | | <tr> |
| | | <td> |
| | | <object id="SGWorld" classid="CLSID:3a4f9199-65a8-11d5-85c1-0001023952c1"></object> |
| | | <object id="SGWorld" style="display:none" classid="CLSID:3a4f9199-65a8-11d5-85c1-0001023952c1"></object> |
| | | </td> |
| | | </tr> |
| | | </table> |