| | |
| | | try |
| | | { |
| | | ResponseMsg<string> msg = checkArgs(args); |
| | | if (null != args) return msg; |
| | | if (null != msg) return msg; |
| | | |
| | | List<int> rs = ConvertUtils.Convert(args); |
| | | if (null == rs || rs.Count == 0) |
| | |
| | | try |
| | | { |
| | | ResponseMsg<string> msg = checkArgs(args, true); |
| | | if (null != args) return msg; |
| | | if (null != msg) return msg; |
| | | |
| | | checkMinMax(args, true); |
| | | |
| | |
| | | try |
| | | { |
| | | ResponseMsg<string> msg = checkArgs(args); |
| | | if (null != args) return msg; |
| | | if (null != msg) return msg; |
| | | |
| | | string err = null; |
| | | SGUtils utils = new SGUtils(); |
| | |
| | | try |
| | | { |
| | | ResponseMsg<string> msg = checkArgs(args, true); |
| | | if (null != args) return msg; |
| | | if (null != msg) return msg; |
| | | |
| | | checkMinMax(args); |
| | | |
| | |
| | | try |
| | | { |
| | | ResponseMsg<string> msg = checkArgs(args); |
| | | if (null != args) return msg; |
| | | if (null != msg) return msg; |
| | | |
| | | string err = null; |
| | | List<int> rs = LasUtils.Generate(args, ref err); |
| | |
| | | try |
| | | { |
| | | ResponseMsg<string> msg = checkArgs(args); |
| | | if (null != args) return msg; |
| | | if (null != msg) return msg; |
| | | |
| | | string err = null; |
| | | List<int> rs = OsgbUtils.Generate(args, ref err); |
| | |
| | | { |
| | | ids = new List<int>(); |
| | | isNew = true; |
| | | srid = 4326; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// 是/否全新发布 |
| | | /// </summary> |
| | | public bool isNew { set; get; } |
| | | |
| | | /// <summary> |
| | | /// 坐标系ID |
| | | /// </summary> |
| | | public int srid { set; get; } |
| | | |
| | | /// <summary> |
| | | /// 高度偏移量 |
| | | /// </summary> |
| | | public double z { set; get; } |
| | | } |
| | | } |
| | |
| | | <add key="sgDB" value="E:\soft\SGConfig\catalog.db"/> |
| | | <!-- cesium-terrain-builder路径 --> |
| | | <add key="ctbPath" value="E:\WebSite\Cesium\Tool\ctb_0.41" /> |
| | | <!-- 3dtiles路径 --> |
| | | <add key="d3tilesPath" value="E:\WebSite\Cesium\Tool\3dtiles" /> |
| | | <!-- gocesiumtiler路径 --> |
| | | <add key="tilerPath" value="E:\WebSite\Cesium\Tool\gocesiumtiler-1.2.3" /> |
| | | <!-- PG连接 --> |
| | | <!--<add key="pgConn" value="Server=127.0.0.1;Port=5433;Database=langfang;User Id=postgres;Password=postgres;"/>--> |
| | | <add key="pgConn" value="Server=192.168.20.205;Port=5433;Database=langfang;User Id=postgres;Password=Postgres!_14_Lf;"/> |
| | | <add key="pgConn" value="Server=127.0.0.1;Port=5433;Database=langfang;User Id=postgres;Password=postgres;"/> |
| | | <!--<add key="pgConn" value="Server=192.168.20.205;Port=5433;Database=langfang;User Id=postgres;Password=Postgres!_14_Lf;"/>--> |
| | | <!--<add key="pgConn" value="Server=103.85.165.99;Port=5433;Database=langfang;User Id=postgres;Password=Postgres!_14_Lf;"/>--> |
| | | <add key="webpages:Version" value="3.0.0.0"/> |
| | | <add key="webpages:Enabled" value="false"/> |
| | |
| | | using ExportMap.Models; |
| | | using ExportMap.db; |
| | | using ExportMap.Models; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.IO; |
| | | using System.Linq; |
| | | using System.Web; |
| | | |
| | |
| | | public class LasUtils |
| | | { |
| | | /// <summary> |
| | | /// 获取路径 |
| | | /// </summary> |
| | | public static string GetPath(int id) |
| | | { |
| | | return Path.Combine(SGUtils.LFData, "3d\\3dtiles\\las", id.ToString()); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取发布地址 |
| | | /// </summary> |
| | | public static string GetReleaseUrl(SysMeta meta) |
| | | { |
| | | return "http://{host}/LFData/3d/3dtiles/las/" + meta.id + "/tileset.json"; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 生成 |
| | | /// </summary> |
| | | /// <param name="args">XYZ参数</param> |
| | |
| | | /// <returns>数据发布ID集合</returns> |
| | | public static List<int> Generate(XYZArgs args, ref string err) |
| | | { |
| | | try |
| | | { |
| | | List<SysMeta> list = XYZUtils.SelectMetas(args.ids, "and type in ('las', 'laz')"); |
| | | if (null == list || list.Count == 0) return null; |
| | | |
| | | string tilerPath = Tools.GetSetting("tilerPath"); |
| | | string uploadFolder = Tools.GetSetting("uploadFolder"); |
| | | |
| | | return null; |
| | | List<int> ids = new List<int>(); |
| | | foreach (SysMeta meta in list) |
| | | { |
| | | string osgbPath = Path.Combine(uploadFolder, meta.path); |
| | | if (!Directory.Exists(osgbPath)) continue; |
| | | |
| | | meta.ismeta = 0; // 0-倾斜摄影数据 |
| | | string outPath = GetPath(meta.id); |
| | | string jsonFile = Path.Combine(outPath, "tileset.json"); |
| | | |
| | | if (args.isNew && Directory.Exists(outPath)) Tools.DelPath(outPath); |
| | | if (!Directory.Exists(outPath)) Directory.CreateDirectory(outPath); |
| | | if (File.Exists(jsonFile)) File.Delete(jsonFile); |
| | | |
| | | string cmd = string.Format("{0}\\gocesiumtiler.exe -i \"{1}\" -o \"{2}\" -e {3} -z {4} -g -s", tilerPath, osgbPath, outPath, args.srid, args.z); |
| | | err = Tools.ExecCmd(cmd, false, false); |
| | | |
| | | if (File.Exists(jsonFile)) |
| | | { |
| | | string path = jsonFile.Replace(Tools.GetSetting("lfData") + "\\", ""); |
| | | int pubid = InsertToDB(meta, args, path); |
| | | if (pubid > 0) ids.Add(pubid); |
| | | } |
| | | } |
| | | |
| | | return ids; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogOut.Error(ex.Message + "\r\n" + ex.StackTrace); |
| | | err = ex.Message; |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 插入数据库 |
| | | /// </summary> |
| | | private static int InsertToDB(SysMeta meta, XYZArgs args, string path) |
| | | { |
| | | if (PubDBHelper.IsPublish(meta.id)) return 0; |
| | | |
| | | SysPublish sys = Tools.NewPublish(meta, args, GetReleaseUrl(meta), path); |
| | | |
| | | int pubid = PubDBHelper.InsertPublish(sys); |
| | | if (pubid > 0) |
| | | { |
| | | sys.id = pubid; |
| | | PubDBHelper.InsertLayer(sys, meta); |
| | | PubDBHelper.InsertMetaPub(meta.id, pubid, args.userId); |
| | | } |
| | | |
| | | return pubid; |
| | | } |
| | | } |
| | | } |
| | |
| | | using ExportMap.Models; |
| | | using ExportMap.db; |
| | | using ExportMap.Models; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.IO; |
| | | using System.Linq; |
| | | using System.Web; |
| | | |
| | |
| | | public class OsgbUtils |
| | | { |
| | | /// <summary> |
| | | /// 获取路径 |
| | | /// </summary> |
| | | public static string GetPath(int id) |
| | | { |
| | | return Path.Combine(SGUtils.LFData, "3d\\3dtiles\\osgb", id.ToString()); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取发布地址 |
| | | /// </summary> |
| | | public static string GetReleaseUrl(SysMeta meta) |
| | | { |
| | | return "http://{host}/LFData/3d/3dtiles/osgb/" + meta.id + "/tileset.json"; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 生成 |
| | | /// </summary> |
| | | /// <param name="args">XYZ参数</param> |
| | |
| | | /// <returns>数据发布ID集合</returns> |
| | | public static List<int> Generate(XYZArgs args, ref string err) |
| | | { |
| | | // |
| | | try |
| | | { |
| | | List<SysMeta> list = XYZUtils.SelectMetas(args.ids, "and type = 'osgb'"); |
| | | if (null == list || list.Count == 0) return null; |
| | | |
| | | return null; |
| | | string d3tilesPath = Tools.GetSetting("d3tilesPath"); |
| | | string uploadFolder = Tools.GetSetting("uploadFolder"); |
| | | |
| | | List<int> ids = new List<int>(); |
| | | foreach (SysMeta meta in list) |
| | | { |
| | | string osgbPath = Path.Combine(uploadFolder, meta.path); |
| | | if (!Directory.Exists(osgbPath)) continue; |
| | | |
| | | meta.ismeta = 0; // 0-倾斜摄影数据 |
| | | string outPath = GetPath(meta.id); |
| | | string jsonFile = Path.Combine(outPath, "tileset.json"); |
| | | |
| | | if (args.isNew && Directory.Exists(outPath)) Tools.DelPath(outPath); |
| | | if (!Directory.Exists(outPath)) Directory.CreateDirectory(outPath); |
| | | if (File.Exists(jsonFile)) File.Delete(jsonFile); |
| | | |
| | | string cmd = string.Format("{0}\\3dtile.exe -f osgb -i \"{1}\" -o \"{2}\"", d3tilesPath, osgbPath, outPath); |
| | | err = Tools.ExecCmd(cmd, false, false); |
| | | |
| | | if (File.Exists(jsonFile)) |
| | | { |
| | | string path = jsonFile.Replace(Tools.GetSetting("lfData") + "\\", ""); |
| | | int pubid = InsertToDB(meta, args, path); |
| | | if (pubid > 0) ids.Add(pubid); |
| | | } |
| | | } |
| | | |
| | | return ids; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogOut.Error(ex.Message + "\r\n" + ex.StackTrace); |
| | | err = ex.Message; |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 插入数据库 |
| | | /// </summary> |
| | | private static int InsertToDB(SysMeta meta, XYZArgs args, string path) |
| | | { |
| | | if (PubDBHelper.IsPublish(meta.id)) return 0; |
| | | |
| | | SysPublish sys = Tools.NewPublish(meta, args, GetReleaseUrl(meta), path); |
| | | |
| | | int pubid = PubDBHelper.InsertPublish(sys); |
| | | if (pubid > 0) |
| | | { |
| | | sys.id = pubid; |
| | | PubDBHelper.InsertLayer(sys, meta); |
| | | PubDBHelper.InsertMetaPub(meta.id, pubid, args.userId); |
| | | } |
| | | |
| | | return pubid; |
| | | } |
| | | } |
| | | } |
| | |
| | | /// </summary> |
| | | /// <param name="cmd">命令行</param> |
| | | /// <returns>执行结果或出错信息</returns> |
| | | public static String ExecCmd(string cmd, bool isPy = false, bool isOut = false) |
| | | public static string ExecCmd(string cmd, bool isPy = false, bool isOut = false) |
| | | { |
| | | List<string> list = new List<string>(); |
| | | if (isPy) |
| | |
| | | <title></title> |
| | | <script src="js/jquery.1.12.4.js"></script> |
| | | <script> |
| | | var token = "94baeb78-d4cc-43db-b9b5-8ff9584c587d"; |
| | | var token = "74fca142-b0cd-4ecb-965b-6b51b8866ec4"; |
| | | |
| | | // Ajax |
| | | function ajax(url, type, data, dataType, contentType, fn) { |
| | |
| | | console.log(rs); |
| | | }); |
| | | } |
| | | |
| | | // 测试OSGB |
| | | function toOsgb() { |
| | | var data = { token: token, ids: [7187], depcode: "00", dircode: "0C", userId: 1, name: "3-1倾斜模型-中卫站" }; |
| | | ajax("Convert/ToOsgb", "POST", JSON.stringify(data), null, null, function (rs) { |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | console.log(rs); |
| | | }); |
| | | } |
| | | </script> |
| | | </head> |
| | | <body> |
| | |
| | | <input type="button" value="测试Ifc" onclick="convert3();" /> |
| | | <input type="button" value="测试SG" onclick="toSG();" /> |
| | | <input type="button" value="测试Terra" onclick="toTerra();" /> |
| | | <input type="button" value="测试OSGB" onclick="toOsgb();" /> |
| | | </body> |
| | | </html> |