管道基础大数据平台系统开发-【CS】-ExportMap
13693261870
2024-01-22 c7d2ead2a09345cdf83a7036418b96f90a11fa86
集成osgblab
已添加1个文件
已修改3个文件
322 ■■■■■ 文件已修改
JiangSu/App_Data/js.db 补丁 | 查看 | 原始文档 | blame | 历史
TEWin/FrmWin.cs 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
TEWin/Resources/SpatialQuery/SpaceStatistics.html 286 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
TEWin/app.config 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiangSu/App_Data/js.db
Binary files differ
TEWin/FrmWin.cs
@@ -24,21 +24,21 @@
        FrmTool tool;
        string mainUrl;
        bool isAngle;
        int angleCount;
        double angleSize;
        public SGWorld71 SG;
        private bool isAngle;
        ITerrainLabel71 angleLabel;
        private int angleCount;
        ITerrainPolyline71 angleLine;
        private double angleSize;
        string angleGroupName = "角量算";
        private ITerrainLabel71 angleLabel;
        private ITerrainPolyline71 angleLine;
        private string angleGroupName = "角量算";
        string mainUrl = Application.StartupPath;
        public FrmWin()
        {
@@ -52,10 +52,8 @@
            try
            {
                LogOut.Info("开始运行..");
                mainUrl = Application.StartupPath;
                bool isTest = "1" == ConfigurationManager.AppSettings["isTest"];
                //this.fly = isTest ? ConfigurationManager.AppSettings["testFly"] : Path.Combine(Application.StartupPath, "Resources\\sample.fly");
                this.fly = ConfigurationManager.AppSettings["fly"] ?? ConfigurationManager.AppSettings["testFly"];
                if (!this.fly.Contains(":\\")) this.fly = Path.Combine(Application.StartupPath, this.fly);
                if (!File.Exists(this.fly))
@@ -286,7 +284,7 @@
            return str;
        }
        #region è§’量算+空间统计+空间分析+osgblab
        #region è§’量算
        private void AngleMeasurement()
        {
            if (isAngle)
@@ -470,6 +468,14 @@
            return true;
        }
        #endregion
        private string GetAbsolutePath(string key)
        {
            string str = ConfigurationManager.AppSettings[key];
            return str.Contains(":\\") ? str : Path.Combine(Application.StartupPath, str);
        }
        private void SpaceStatistics()
        {
@@ -484,8 +490,7 @@
        private void InvokeOsgbLab()
        {
            ExecCmd(new List<string> { "taskkill /f /t /im OSGBLab.exe" });
            RunExe(ConfigurationManager.AppSettings["osgblabPath"], null, false);
            RunExe(GetAbsolutePath("osgblabPath"), null, false);
        }
        #endregion
    }
}
TEWin/Resources/SpatialQuery/SpaceStatistics.html
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,286 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>空间统计</title>
  <meta http-equiv="Expires" content="0" />
  <meta http-equiv="Cache" content="no-cache" />
  <meta http-equiv="Pragma" content="no-cache" />
  <meta http-equiv="Cache-control" content="no-cache" />
  <!--<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />-->
  <meta http-equiv="X-UA-Compatible" content="IE=9" />
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <script src="../Jquery/jquery.min.js"></script>
  <script src="../ToolsCommon71.js"></script>
  <link href="../Style.css" rel="StyleSheet" type="text/css" />
  <style>
    html, body {
      margin: 0;
      padding: 0;
      height: 100%;
      width: 100%;
    }
  </style>
  <script>
    var gAsync = true;
    var gDebug = false;
    var groupName = "空间统计";
    var layerName = "JMD_1002";
    var rs = {
      count: 0, // è¦ç´ æ€»ä¸ªæ•°
      lineLen: 0, // çº¿å¯¹è±¡é•¿åº¦
      polyArea: 0, // å¤šè¾¹å½¢é¢ç§¯
      volume: 0, // ä¸‰ç»´ä½“体积
      minHeight: 0, // ä¸‰ç»´ä½“最低高度
      maxHeight: 0, // ä¸‰ç»´ä½“最高高度
      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;
        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);
        $("#lineLen").html("" + this.lineLen);
        $("#polyArea").html("" + this.polyArea);
        $("#volume").html("" + this.volume);
        $("#minHeight").html("" + this.minHeight);
        $("#maxHeight").html("" + this.maxHeight);
      }
    };
    $(function () {
      init();
    });
    function init() {
      window.ondragstart = function () { return false; }
    }
    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) { }
    }
    function getFeatureLayers() {
      var layers = [];
      BuildObjectsList(SGWorld.ProjectTree.RootID, layers, 36);
      return layers;
    }
    function clear(e) {
      rs.reset();
      rs.setVal();
      delGroup();
    }
    function startQuery(e) {
      this.clear();
      if (drawing.drawingEditMode != -1) {
        drawing.abort();
        return;
      }
      SGWorld.Window.ShowMessageBarText("按 Esc é”®é€€å‡º");
      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) {
      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;
            }
          }
          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;
              }
            }
          }
          for (var j = 0; j < fs.Count; j++) {
            fs.Item(j).Tint.abgrColor = 0xff800080;
          }
        } catch (e) {
          console.log(e);
          //layers.splice(i, 1);
        }
      }
      rs.format();
      rs.setVal();
    }
    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>
<body class="hideUntillTranslated">
  <table style="width: 100%; border: 0;" cellspacing="0" cellpadding="2">
    <tr>
      <td class="ToolTopArea" id="TopAreaTD" width="100%" valign="middle">
        <table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td width="55px">
              <img style="margin-left: 5px;" src="img/ToolIcon.png" alt="" /></td>
            <td id="TitleTD" align="center" class="s12w i18n">空间统计</td>
            <td align="right" id="CloseHelpTd">
              <img style="margin-right: 5px; cursor: pointer;" alt="" src="../CommonImg/help.png" border="0" class="i18n" alt="help" title="帮助" onclick="DisplayHelpPopup6(SGLang.i18nFile('help.html'),SGLang.i18n('help'))" /></td>
          </tr>
        </table>
      </td>
    </tr>
    <tr>
      <td class="ToolTopSeperator"></td>
    </tr>
    <tr class="s8">
      <td>
        <table class="PropertiesSheet" cellspacing="0" cellpadding="2">
          <tr class='TableOtherLine'>
            <td class="s8b">
              <label for="Mode" class="i18n">要素总个数</label>
            </td>
            <td>&nbsp;<span id="totalNum">0</span> ä¸ª
            </td>
          </tr>
          <tr>
            <td class="s8b">
              <label for="Mode" class="i18n">线对象长度</label>
            </td>
            <td>&nbsp;<span id="lineLen">0</span> ç±³
            </td>
          </tr>
          <tr>
            <td class="s8b">
              <label for="Mode" class="i18n">多边形面积</label>
            </td>
            <td>&nbsp;<span id="polyArea">0</span> å¹³æ–¹ç±³
            </td>
          </tr>
          <tr>
            <td class="s8b">
              <label for="Mode" class="i18n">三维体体积</label>
            </td>
            <td>&nbsp;<span id="volume">0</span> ç«‹æ–¹ç±³
            </td>
          </tr>
          <tr>
            <td class="s8b">
              <label for="Mode" class="i18n">三维体高度</label>
            </td>
            <td>&nbsp;最低 <span id="minHeight">0</span> ç±³ï¼Œæœ€é«˜ <span id="maxHeight">0</span> ç±³
            </td>
          </tr>
        </table>
      </td>
    </tr>
    <tr class="s8">
      <td align="center" class="ToolButtonsArea">
        <div id="SurfaceDiv">
          <button id="clipboardButton" class="MenuButton" onclick="clear(this);" style="cursor: pointer;">
            <img src="img/delete.png" /><br />
            <span class="i18n">清 é™¤</span></button>
          <button id="DrawPlaneBtn" class="MenuButton MenuButtonLast" onclick="startQuery(this);" style="cursor: pointer;">
            <img src="../commonImg/polygon.png" /><br />
            <span class="i18n">开始统计</span></button>
        </div>
      </td>
    </tr>
    <tr>
      <td>
        <object id="SGWorld" style="display:none" classid="CLSID:3a4f9199-65a8-11d5-85c1-0001023952c1"></object>
      </td>
    </tr>
  </table>
</body>
</html>
TEWin/app.config
@@ -6,7 +6,8 @@
    <add key="testFly" value="E:\data\opting\2022.fly"/>
    <!--<add key="tePath" value="C:\Program Files\Skyline\TerraExplorer Pro"/>-->
    <add key="tePath" value="C:\Program Files\SmartEarth\TerraExplorer Pro"/>
    <add key="osgblabPath" value="C:\Program Files\OSGBLab\Trial\OSGBLab.exe"/>
    <!--<add key="osgblabPath" value="C:\Program Files\OSGBLab\Trial\OSGBLab.exe"/>-->
    <add key="osgblabPath" value="OSGBLab\Trial\OSGBLab.exe"/>
  </appSettings>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>