From 122511b3a46bc66b82f2de9ee0b6ef43a05b1081 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期四, 11 一月 2024 17:06:55 +0800 Subject: [PATCH] 1 --- TEWin/Resources/SpaceStatistics/SpaceStatistics.html | 86 ++++++++++++++++++++++++++++++++++++++----- TEWin/Resources/sample.fly | 0 2 files changed, 76 insertions(+), 10 deletions(-) diff --git a/TEWin/Resources/SpaceStatistics/SpaceStatistics.html b/TEWin/Resources/SpaceStatistics/SpaceStatistics.html index 6529d9c..77bdd0d 100644 --- a/TEWin/Resources/SpaceStatistics/SpaceStatistics.html +++ b/TEWin/Resources/SpaceStatistics/SpaceStatistics.html @@ -24,6 +24,7 @@ var gAsync = true; var gDebug = false; var groupName = "绌洪棿缁熻"; + var layerName = "JMD_1002"; var rs = { count: 0, // 瑕佺礌鎬讳釜鏁� @@ -34,18 +35,38 @@ volume: 0, // 涓夌淮浣撲綋绉� + minHeight: 0, // 涓夌淮浣撴渶浣庨珮搴� + + maxHeight: 0, // 涓夌淮浣撴渶楂橀珮搴� + reset: function () { this.count = 0; this.lineLen = 0; this.polyArea = 0; - this.valueOf = 0; + this.volume = 0; + this.minHeight = 0; + this.maxHeight = 0; + + return this; + }, + + format: function () { + this.lineLen = parseFloat(this.lineLen.toFixed(2)); + this.polyArea = parseFloat(this.polyArea.toFixed(2)); + this.volume = parseFloat(this.volume.toFixed(2)); + this.minHeight = parseFloat(this.minHeight.toFixed(2)); + this.maxHeight = parseFloat(this.maxHeight.toFixed(2)); + + return this; }, setVal: function () { - $("#totalNum").html(this.count.toString()); - $("#lineLen").html(this.lineLen.toString()); - $("#polyArea").html(this.polyArea.toString()); - $("#volume").html(this.volume.toString()); + $("#totalNum").html("" + this.count); + $("#lineLen").html("" + this.lineLen); + $("#polyArea").html("" + this.polyArea); + $("#volume").html("" + this.volume); + $("#minHeight").html("" + this.minHeight); + $("#maxHeight").html("" + this.maxHeight); } }; @@ -75,7 +96,7 @@ } function getFeatureLayers() { - var layers = [], index = 0; + var layers = []; BuildObjectsList(SGWorld.ProjectTree.RootID, layers, 36); return layers; @@ -88,7 +109,7 @@ } function startQuery(e) { - delGroup(); + this.clear(); if (drawing.drawingEditMode != -1) { drawing.abort(); return; @@ -110,8 +131,46 @@ } function DrawPoly(geometry, type, altitudeType) { - SGWorld.ProjectTree.EnableRedraw(0); - //alert(null==geometry); + var layers = getFeatureLayers(); + for (var i in layers) { + try { + var layer = SGWorld.ProjectTree.GetObject(layers[i]); + var fs = layer.ExecuteSpatialQuery(geometry, 1); // 1-IT_INTERSECT, 2-IT_WITHIN + if (fs.Count == 0) continue; + + rs.count += fs.Count; + + if (layer.GeometryType == 1) { // LGT_POLYLINE + for (var j = 0; j < fs.Count; j++) { + var f = fs.Item(j); + rs.lineLen += f.Geometry.Length; + } + continue; + } + if (layer.GeometryType == 2) { // LGT_POLYGON + var flag = layerName == layer.TreeItem.Name; + for (var j = 0; j < fs.Count; j++) { + var f = fs.Item(j); + rs.polyArea += f.Geometry.Area; + + if (flag) { + var maxHeight = f.FeatureAttributes.GetFeatureAttribute("MaxHeight").Value; + var minHeight = f.FeatureAttributes.GetFeatureAttribute("MinHeight").Value; + var height = maxHeight - minHeight; + + rs.volume += f.Geometry.Area * height; + if (rs.maxHeight < height) rs.maxHeight = height; + if (!rs.minHeight || rs.minHeight > height) rs.minHeight = height; + } + } + } + } catch (e) { + layers.splice(i, 1); + } + } + + rs.format(); + rs.setVal(); } function ResetAsync(FirstTime, FromMouseInputMode) { @@ -167,7 +226,7 @@ <td class="s8b"> <label for="Mode" class="i18n">绾垮璞¢暱搴�</label> </td> - <td> <span id="lineLen">0</span> 鍗冪背 + <td> <span id="lineLen">0</span> 绫� </td> </tr> <tr> @@ -184,6 +243,13 @@ <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> diff --git a/TEWin/Resources/sample.fly b/TEWin/Resources/sample.fly index c19b3b2..5f45cd3 100644 --- a/TEWin/Resources/sample.fly +++ b/TEWin/Resources/sample.fly Binary files differ -- Gitblit v1.9.3