| | |
| | | var gAsync = true; |
| | | var gDebug = false; |
| | | var groupName = "空间统计"; |
| | | var layerName = "JMD_1002"; |
| | | |
| | | var rs = { |
| | | count: 0, // 要素总个数 |
| | |
| | | |
| | | 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); |
| | | } |
| | | }; |
| | | |
| | |
| | | } |
| | | |
| | | function getFeatureLayers() { |
| | | var layers = [], index = 0; |
| | | var layers = []; |
| | | BuildObjectsList(SGWorld.ProjectTree.RootID, layers, 36); |
| | | |
| | | return layers; |
| | |
| | | } |
| | | |
| | | function startQuery(e) { |
| | | delGroup(); |
| | | this.clear(); |
| | | if (drawing.drawingEditMode != -1) { |
| | | drawing.abort(); |
| | | return; |
| | |
| | | } |
| | | |
| | | 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) { |
| | |
| | | <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> |
| | |
| | | <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> |