管道基础大数据平台系统开发-【CS】-ExportMap
1
13693261870
2023-03-16 22b4c946cc51180ee68e2bea82a86b912fcfa744
1
已添加1个文件
已修改4个文件
75 ■■■■■ 文件已修改
ExportMap/ExportMap.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/Models/SpatialItem.cs 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/cs/SGUtils.cs 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/db/SQLiteHelper.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/export.html 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/ExportMap.csproj
@@ -152,6 +152,7 @@
    <Compile Include="Models\ExportArgs.cs" />
    <Compile Include="Models\ResponseMsg.cs" />
    <Compile Include="Models\Secret.cs" />
    <Compile Include="Models\SpatialItem.cs" />
    <Compile Include="Models\SysMeta.cs" />
    <Compile Include="Models\XYZArgs.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
ExportMap/Models/SpatialItem.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace ExportMap.Models
{
    /// <summary>
    /// SG的空间数据项
    /// </summary>
    public class SpatialItem
    {
        public SpatialItem() { }
        public int id { set; get; }
        public string Name { set; get; }
        public string RelativePath { set; get; }
        public string LayerName { set; get; }
        public int DataSourceId { set; get; }
        public string Description { set; get; }
    }
}
ExportMap/cs/SGUtils.cs
@@ -1,7 +1,9 @@
using ExportMap.Models;
using ExportMap.db;
using ExportMap.Models;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
@@ -60,9 +62,40 @@
        /// <returns>行数</returns>
        public static int Release(XYZArgs args)
        {
            List<SysMeta> list = XYZUtils.selectMetas(args.ids, "and type in ('mpt', '3dml')");
            if (null == list || list.Count == 0) return 0;
            int maxId = GetMaxId();
            List<SpatialItem> items = SelectItems(maxId);
            if (null == items || items.Count == 0) return 0;
            return 0;
        }
        /// <summary>
        /// èŽ·å–æœ€å¤§ID值
        /// </summary>
        public static int GetMaxId()
        {
            Object obj = SQLiteHelper.ExecuteScalar("select max(id) from SpatialItems");
            return null == obj ? 0 : Convert.ToInt32(obj);
        }
        /// <summary>
        /// æŸ¥è¯¢SG数据项
        /// </summary>
        /// <param name="maxId">最大ID值</param>
        /// <returns>SG数据项</returns>
        public static List<SpatialItem> SelectItems(int maxId)
        {
            string sql = string.Format("select id, Name, RelativePath, LayerName, DataSourceId, Description from SpatialItems where id > {0} order by id desc", maxId);
            DataTable dt = SQLiteHelper.GetDataTable(sql);
            List<SpatialItem> list = ModelHandler.FillModel<SpatialItem>(dt);
            return list;
        }
    }
}
ExportMap/db/SQLiteHelper.cs
@@ -19,7 +19,7 @@
        static SQLiteHelper()
        {
            //SQLiteHelper.DB = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources\\Community.db");
            DB = Tool.GetSetting("db");
            DB = Tool.GetSetting("sgDB");
        }
        /// <summary>
ExportMap/export.html
@@ -110,6 +110,15 @@
        console.log(rs);
      });
    }
    // æµ‹è¯•SG
    function toSG() {
      var data = { ids: [1523, 1525] };
      ajax("Convert/ToTileset", "POST", JSON.stringify(data), null, null, function (rs) {
        alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result);
        console.log(rs);
      });
    }
  </script>
</head>
<body>
@@ -129,5 +138,6 @@
  <input type="button" value="测试Rvt" onclick="convert1();" />
  <input type="button" value="测试Fbx" onclick="convert2();" />
  <input type="button" value="测试Ifc" onclick="convert3();" />
  <input type="button" value="测试SG" onclick="toSG();" />
</body>
</html>