| | |
| | | List<SysMeta> list = XYZUtils.selectMetas(args.ids, "and type in ('mpt', '3dml')"); |
| | | if (null == list || list.Count == 0) return 0; |
| | | |
| | | int maxId = GetMaxId(); maxId = 411576; // |
| | | int maxId = GetMaxId(); // maxId = 411576; |
| | | RomoveNoneFiles(list); |
| | | if (list.Count == 0) return 0; |
| | | |
| | |
| | | string viewFile = Path.Combine(xyzPath, "view.html"); |
| | | if (File.Exists(viewFile)) |
| | | { |
| | | string path = ""; |
| | | string path = "2d\\tiles" + "\\" + args.dircode; |
| | | InsertToDB(list, args, path); |
| | | return 1; |
| | | } |
| | |
| | | int pubid = PubDBHelper.InsertPublish(sys); |
| | | if (pubid > 0) |
| | | { |
| | | //PubDBHelper.InsertMetaPub(meta.id, pubid); |
| | | foreach (SysMeta meta in metas) |
| | | { |
| | | PubDBHelper.InsertMetaPub(meta.id, pubid, args.userId); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | sp.max = args.max; |
| | | sp.json = null; |
| | | sp.create_user = args.userId; |
| | | sp.geom = null; |
| | | sp.geom = GetPointZ(args); |
| | | sp.bak = null; |
| | | |
| | | return sp; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取中心点 |
| | | /// </summary> |
| | | private static string GetPointZ(XYZArgs args) |
| | | { |
| | | string viewFile = Path.Combine(SGUtils.LFData, "2d\\tiles", args.dircode, "view.html"); |
| | | if (!File.Exists(viewFile)) return null; |
| | | |
| | | string str = File.ReadAllText(viewFile); |
| | | int start = str.IndexOf(".setView([") + ".setView([".Length; |
| | | int end = str.IndexOf(");", start); |
| | | |
| | | string coords = str.Substring(start, end - start).Replace("]", "").Replace(" ", ""); |
| | | string[] strs = coords.Split(new char[] { ',' }); |
| | | |
| | | return string.Format("ST_GeomFromText('POINT Z ({0} {1} {2})')", strs[0], strs[1], strs[2]); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | public class PubDBHelper |
| | | { |
| | | private static string insertPublishSql = "insert into lf.sys_publish(name, url, path, type, status, dirid, depid, min, max, json, create_user, geom, bak) values (@name, @url, @path, @type, @status, @dirid, @depid, @min, @max, @json, @create_user, @geom, @bak) returning id"; |
| | | private static string insertPublishSql = "insert into lf.sys_publish(name, url, path, type, status, dirid, depid, min, max, json, create_user, geom, bak) values (@name, @url, @path, @type, @status, @dirid, @depid, @min, @max, @json, @create_user, {0}, @bak) returning id"; |
| | | |
| | | private static string insertMetaPubSql = "insert into lf.sys_meta_pub (metaid, pubid, create_user) select {0}, {1}, {2} from (select 1) temp where not exists (select 1 from lf.sys_meta_pub where metaid = {0} and pubid = {1})"; |
| | | |
| | |
| | | /// </summary> |
| | | public static bool IsPublish(string dirid) |
| | | { |
| | | string sql = "select count(*) from lf.sys_meta_pub a inner join lf.sys_publish b on a.pubid = b.id where b.dirid = @dirid"; |
| | | string sql = "select count(*) from lf.sys_meta_pub a inner join lf.sys_publish b on a.pubid = b.id where b.type = 'DOM' and b.dirid = @dirid"; |
| | | DbParameter dp = new NpgsqlParameter("@dirid", dirid); |
| | | |
| | | object obj = Tool.DBHelper.GetScalar(sql, dp); |
| | |
| | | public static int InsertPublish(SysPublish sys) |
| | | { |
| | | List<DbParameter> list = Tool.GetParams<SysPublish>(insertPublishSql, sys); |
| | | string sql = string.Format(insertPublishSql, sys.geom == null ? "null" : sys.geom); |
| | | |
| | | object obj = Tool.DBHelper.GetScalar(insertPublishSql, list.ToArray()); |
| | | object obj = Tool.DBHelper.GetScalar(sql, list.ToArray()); |
| | | |
| | | return obj == null ? 0 : Convert.ToInt32(obj); |
| | | } |