From b1ba6edda5c041ded730fb43b48c144e7b159ec6 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期四, 04 一月 2024 17:19:32 +0800
Subject: [PATCH] 开户空间统计~

---
 TEWin/Resources/SpaceStatistics/SpaceStatistics.html |   89 ++++++++++++++++++++++++++++++++------------
 1 files changed, 65 insertions(+), 24 deletions(-)

diff --git a/TEWin/Resources/SpaceStatistics/SpaceStatistics.html b/TEWin/Resources/SpaceStatistics/SpaceStatistics.html
index e563a77..0dfbac5 100644
--- a/TEWin/Resources/SpaceStatistics/SpaceStatistics.html
+++ b/TEWin/Resources/SpaceStatistics/SpaceStatistics.html
@@ -21,33 +21,33 @@
     }
   </style>
   <script>
+    var gAsync = true;
+    var gDebug = false;
+    var groupName = "绌洪棿缁熻";
+
+    function getGroupId()  {
+      var gid = SGWorld.ProjectTree.FindItem(groupName);
+      if (gid) return gid;
+
+      return SGWorld.ProjectTree.CreateLockedGroup(groupName);
+    }
+
+    function delGroup() {
+      try {
+        var gid = SGWorld.ProjectTree.FindItem(groupName);
+        if (gid) SGWorld.ProjectTree.DeleteItem(gid);
+      }
+      catch (e) {
+        console.log(e);
+      }
+    }
+
     $(function () {
       init();
     });
 
     function init() {
       window.ondragstart = function () { return false; }
-
-      refreshList();
-    }
-
-    function refreshList() {
-      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) {
-        console.log(e);
-      }
     }
 
     function changeLayer(e) {
@@ -75,8 +75,49 @@
     }
 
     function startQuery(e) {
-      var id = parseInt($("#SelectType").val());
-      SGWorld.Command.Execute(id, null);
+      delGroup();
+      if (drawing.drawingEditMode != -1) {
+        drawing.abort();
+        return;
+      }
+
+      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.Window.ShowMessageBarText("鎸� Esc 閿��鍑�");
+      SGWorld.ProjectTree.EnableRedraw(0);
+    }
+
+    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>
@@ -156,7 +197,7 @@
     </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>

--
Gitblit v1.9.3