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

---
 TEWin/TEWin.csproj                                   |   10 ++++-
 TEWin/Resources/SpaceStatistics/lang.js              |    3 +
 TEWin/Resources/SpaceStatistics/SpaceStatistics.html |   89 ++++++++++++++++++++++++++++++++------------
 TEWin/Resources/SpaceStatistics/2052/lang.js         |    3 +
 TEWin/Resources/SpaceStatistics/cursor_m.cur         |    0 
 5 files changed, 79 insertions(+), 26 deletions(-)

diff --git a/TEWin/Resources/SpaceStatistics/2052/lang.js b/TEWin/Resources/SpaceStatistics/2052/lang.js
new file mode 100644
index 0000000..bfce754
--- /dev/null
+++ b/TEWin/Resources/SpaceStatistics/2052/lang.js
@@ -0,0 +1,3 @@
+锘縎GLang.lang = $.extend(SGLang.lang, {
+    //
+});
\ No newline at end of file
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>
diff --git a/TEWin/Resources/SpaceStatistics/cursor_m.cur b/TEWin/Resources/SpaceStatistics/cursor_m.cur
new file mode 100644
index 0000000..4e0076c
--- /dev/null
+++ b/TEWin/Resources/SpaceStatistics/cursor_m.cur
Binary files differ
diff --git a/TEWin/Resources/SpaceStatistics/lang.js b/TEWin/Resources/SpaceStatistics/lang.js
new file mode 100644
index 0000000..bfce754
--- /dev/null
+++ b/TEWin/Resources/SpaceStatistics/lang.js
@@ -0,0 +1,3 @@
+锘縎GLang.lang = $.extend(SGLang.lang, {
+    //
+});
\ No newline at end of file
diff --git a/TEWin/TEWin.csproj b/TEWin/TEWin.csproj
index b18a2c0..d6269cc 100644
--- a/TEWin/TEWin.csproj
+++ b/TEWin/TEWin.csproj
@@ -178,10 +178,16 @@
     </COMReference>
   </ItemGroup>
   <ItemGroup>
-    <EmbeddedResource Include="Resources\SpaceStatistics\img\delete.png">
+    <EmbeddedResource Include="Resources\SpaceStatistics\cursor_m.cur">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </EmbeddedResource>
-    <EmbeddedResource Include="Resources\SpaceStatistics\img\clean.png">
+    <EmbeddedResource Include="Resources\SpaceStatistics\2052\lang.js">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Resources\SpaceStatistics\lang.js">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </EmbeddedResource>
+    <EmbeddedResource Include="Resources\SpaceStatistics\img\delete.png">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </EmbeddedResource>
     <EmbeddedResource Include="Resources\SpaceStatistics\img\ToolIcon.png">

--
Gitblit v1.9.3