From 22b4c946cc51180ee68e2bea82a86b912fcfa744 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期四, 16 三月 2023 18:54:31 +0800 Subject: [PATCH] 1 --- ExportMap/cs/SGUtils.cs | 35 +++++++++++++++++ ExportMap/db/SQLiteHelper.cs | 2 ExportMap/ExportMap.csproj | 1 ExportMap/Models/SpatialItem.cs | 27 +++++++++++++ ExportMap/export.html | 10 +++++ 5 files changed, 73 insertions(+), 2 deletions(-) diff --git a/ExportMap/ExportMap.csproj b/ExportMap/ExportMap.csproj index 4feb5e5..4369faa 100644 --- a/ExportMap/ExportMap.csproj +++ b/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" /> diff --git a/ExportMap/Models/SpatialItem.cs b/ExportMap/Models/SpatialItem.cs new file mode 100644 index 0000000..024c626 --- /dev/null +++ b/ExportMap/Models/SpatialItem.cs @@ -0,0 +1,27 @@ +锘縰sing 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; } + } +} \ No newline at end of file diff --git a/ExportMap/cs/SGUtils.cs b/ExportMap/cs/SGUtils.cs index cd91cb2..c3fe028 100644 --- a/ExportMap/cs/SGUtils.cs +++ b/ExportMap/cs/SGUtils.cs @@ -1,7 +1,9 @@ -锘縰sing ExportMap.Models; +锘縰sing 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> + /// 鑾峰彇鏈�澶D鍊� + /// </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">鏈�澶D鍊�</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; + } } } diff --git a/ExportMap/db/SQLiteHelper.cs b/ExportMap/db/SQLiteHelper.cs index 2f43b25..4e0fae4 100644 --- a/ExportMap/db/SQLiteHelper.cs +++ b/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> diff --git a/ExportMap/export.html b/ExportMap/export.html index 08d1838..cd6a725 100644 --- a/ExportMap/export.html +++ b/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> -- Gitblit v1.9.3