From b637dca4802288affff11d528bfb0a6328a8ce79 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期五, 27 九月 2024 11:24:59 +0800 Subject: [PATCH] 1 --- TEWin/Resources/SpaceStatistics/SpaceStatistics.html | 70 +++++++++++++++++++++++++++------- 1 files changed, 55 insertions(+), 15 deletions(-) diff --git a/TEWin/Resources/SpaceStatistics/SpaceStatistics.html b/TEWin/Resources/SpaceStatistics/SpaceStatistics.html index 77bdd0d..03857ca 100644 --- a/TEWin/Resources/SpaceStatistics/SpaceStatistics.html +++ b/TEWin/Resources/SpaceStatistics/SpaceStatistics.html @@ -24,7 +24,7 @@ var gAsync = true; var gDebug = false; var groupName = "绌洪棿缁熻"; - var layerName = "JMD_1002"; + //var layerName = "JMD_1002"; var rs = { count: 0, // 瑕佺礌鎬讳釜鏁� @@ -39,17 +39,31 @@ maxHeight: 0, // 涓夌淮浣撴渶楂橀珮搴� + data: [], + reset: function () { + //SGWorld.ProjectTree.EnableRedraw(0); + var layers = getFeatureLayers(); + for (var i in layers) { + try { + SGWorld.ProjectTree.GetObject(layers[i]).Refresh(); + } catch (e) { + console.log(e); + } + } + //SGWorld.ProjectTree.EnableRedraw(1); + this.count = 0; this.lineLen = 0; this.polyArea = 0; this.volume = 0; this.minHeight = 0; this.maxHeight = 0; + this.data = []; return this; }, - + format: function () { this.lineLen = parseFloat(this.lineLen.toFixed(2)); this.polyArea = parseFloat(this.polyArea.toFixed(2)); @@ -67,6 +81,20 @@ $("#volume").html("" + this.volume); $("#minHeight").html("" + this.minHeight); $("#maxHeight").html("" + this.maxHeight); + $("#cc").html(this.getHtmlByData()); + }, + + getHtmlByData: function () { + if (!this.data || !this.data.length) return ""; + + var html = "<table class='PropertiesSheet' cellspacing='0' cellpadding='2' style='max-height: 256px; overflow: auto'>"; + html += "<tr><td>搴忓彿</td><td>鍥惧眰鍚�</td><td>闈㈢Н</td><td>楂樺害</td><td>浣撶Н</td></tr>"; + for (var i = 0, c = this.data.length; i < c; i++) { + html += "<tr><td>" + (i + 1) + "</td><td>" + this.data[i].name + "</td><td>" + this.data[i].area + "</td><td>" + this.data[i].height + "</td><td>" + this.data[i].vol + "</td></tr>"; + } + html += "</table>"; + + return html; } }; @@ -90,9 +118,7 @@ var gid = SGWorld.ProjectTree.FindItem(groupName); if (gid) SGWorld.ProjectTree.DeleteItem(gid); } - catch (e) { - console.log(e); - } + catch (e) { } } function getFeatureLayers() { @@ -139,33 +165,37 @@ 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; + var hField = $.trim($("#hField").val()), fName = 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; + try { + var height = parseFloat(f.FeatureAttributes.GetFeatureAttribute(hField).Value); rs.volume += f.Geometry.Area * height; if (rs.maxHeight < height) rs.maxHeight = height; if (!rs.minHeight || rs.minHeight > height) rs.minHeight = height; + + rs.data.push({ "name": fName, "area": f.Geometry.Area.toFixed(2), "height": height.toFixed(2), "vol": (f.Geometry.Area * height).toFixed(2) }); + } catch (ex) { + console.log(ex); } } } + for (var j = 0; j < fs.Count; j++) { + fs.Item(j).Tint.abgrColor = 0xff800080; + } } catch (e) { - layers.splice(i, 1); + console.log(e); + //layers.splice(i, 1); } } @@ -231,14 +261,14 @@ </tr> <tr> <td class="s8b"> - <label for="Mode" class="i18n">澶氳竟褰㈤潰绉�</label> + <label for="Mode" class="i18n">澶氳竟褰㈡�婚潰绉�</label> </td> <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> <span id="volume">0</span> 绔嬫柟绫� </td> @@ -250,10 +280,20 @@ <td> 鏈�浣� <span id="minHeight">0</span> 绫筹紝鏈�楂� <span id="maxHeight">0</span> 绫� </td> </tr> + <tr> + <td class="s8b"> + <label for="Mode" class="i18n">楂樺害瀛楁</label> + </td> + <td> <input id="hField" type="text" value="GD" /> + </td> + </tr> </table> </td> </tr> <tr class="s8"> + <td id="cc"></td> + </tr> + <tr class="s8"> <td align="center" class="ToolButtonsArea"> <div id="SurfaceDiv"> <button id="clipboardButton" class="MenuButton" onclick="clear(this);" style="cursor: pointer;"> -- Gitblit v1.9.3