管道基础大数据平台系统开发-【CS】-ExportMap
1
13693261870
2023-03-14 e243ecf8d43eb00b2a0461230076ada26d2d11c1
1
已重命名2个文件
已添加4个文件
已修改4个文件
已删除1个文件
291 ■■■■ 文件已修改
ExportMap/Controllers/ConvertController.cs 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/ExportMap.csproj 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/Models/SysMeta.cs 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/Models/XYZArgs.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/cs/CacheUtils.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/cs/ConvertUtils.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/cs/SGUtils.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/cs/Tool.cs 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/cs/XYZUtil.cs 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/cs/XYZUtils.cs 89 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/export.html 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/Controllers/ConvertController.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,37 @@
using ExportMap.cs;
using ExportMap.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
namespace ExportMap.Controllers
{
    public class ConvertController : ApiController
    {
        [HttpPost]
        public ResponseMsg<int> ToTileset([FromBody]ExportArgs args)
        {
            try
            {
                return ResponseMsg<int>.success("成功", 1);
            }
            catch (Exception ex)
            {
                LogOut.Error(ex.StackTrace);
                return ResponseMsg<int>.fail(ex.Message);
            }
        }
        [HttpGet]
        public ResponseMsg<string> Test()
        {
            return ResponseMsg<string>.success("成功", "");
        }
    }
}
ExportMap/ExportMap.csproj
@@ -129,17 +129,19 @@
  </ItemGroup>
  <ItemGroup>
    <Compile Include="App_Start\WebApiConfig.cs" />
    <Compile Include="Controllers\ConvertController.cs" />
    <Compile Include="Controllers\ExportController.cs" />
    <Compile Include="Controllers\FloatServerController.cs" />
    <Compile Include="Controllers\licenseEncryptionController.cs" />
    <Compile Include="cs\CacheUtil.cs" />
    <Compile Include="cs\CacheUtils.cs" />
    <Compile Include="cs\ConvertUtils.cs" />
    <Compile Include="cs\CustomMultipartFormDataStreamProvider.cs" />
    <Compile Include="cs\ExportUtil.cs" />
    <Compile Include="cs\LogOut.cs" />
    <Compile Include="cs\NoBufferPolicySelector.cs" />
    <Compile Include="cs\SGUtil.cs" />
    <Compile Include="cs\SGUtils.cs" />
    <Compile Include="cs\Tool.cs" />
    <Compile Include="cs\XYZUtil.cs" />
    <Compile Include="cs\XYZUtils.cs" />
    <Compile Include="db\ModelHandler.cs" />
    <Compile Include="db\PostgreHelper.cs" />
    <Compile Include="db\SQLiteHelper.cs" />
@@ -150,6 +152,7 @@
    <Compile Include="Models\ExportArgs.cs" />
    <Compile Include="Models\ResponseMsg.cs" />
    <Compile Include="Models\Secret.cs" />
    <Compile Include="Models\SysMeta.cs" />
    <Compile Include="Models\XYZArgs.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
ExportMap/Models/SysMeta.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace ExportMap.Models
{
    public class SysMeta
    {
        public int id { set; get; }
        public string eventid { set; get; }
        public int metaid { set; get; }
        public int ismeta { set; get; }
        public string depcode { set; get; }
        public string dircode { set; get; }
        public int verid { set; get; }
        public string name { set; get; }
        public string type { set; get; }
        public string guid { set; get; }
        public string path { set; get; }
        public double sizes { set; get; }
        public string tab { set; get; }
        public string layer { set; get; }
        public int rows { set; get; }
        public int create_user { set; get; }
        public DateTime create_time { set; get; }
        public int update_user { set; get; }
        public DateTime update_time { set; get; }
        public string bak { set; get; }
    }
}
ExportMap/Models/XYZArgs.cs
@@ -31,9 +31,9 @@
        public int max { set; get; }
        /// <summary>
        /// æ•°æ®ç›®å½•ID
        /// æ•°æ®ç›®å½•编码
        /// </summary>
        public string dirid { set; get; }
        public string dircode { set; get; }
        /// <summary>
        /// å…ƒæ•°æ®ID集合
ExportMap/cs/CacheUtils.cs
ÎļþÃû´Ó ExportMap/cs/CacheUtil.cs ÐÞ¸Ä
@@ -11,11 +11,11 @@
    /// <summary>
    /// ç¼“存常用操作
    /// </summary>
    public class CacheUtil
    public class CacheUtils
    {
        public static CacheItemRemovedReason reason;
        public CacheUtil()
        public CacheUtils()
        {
        }
ExportMap/cs/ConvertUtils.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace ExportMap.cs
{
    public class ConvertUtils
    {
    }
}
ExportMap/cs/SGUtils.cs
ÎļþÃû´Ó ExportMap/cs/SGUtil.cs ÐÞ¸Ä
@@ -6,7 +6,7 @@
namespace ExportMap.cs
{
    public class SGUtil
    public class SGUtils
    {
        /// <summary>
        /// Mpt目录
ExportMap/cs/Tool.cs
@@ -1,4 +1,5 @@
using Npgsql;
using ExportMap.db;
using Npgsql;
using System;
using System.Collections.Generic;
using System.Configuration;
@@ -21,6 +22,24 @@
        /// åŸºç¡€ç›®å½•
        /// </summary>
        public static readonly string BaseDir = AppDomain.CurrentDomain.BaseDirectory;
        private static PostgreHelper _dbHelper;
        /// <summary>
        /// DB帮助类
        /// </summary>
        public static PostgreHelper DBHelper
        {
            get
            {
                if (null == _dbHelper)
                {
                    _dbHelper = new PostgreHelper(DbEnum.langfang);
                }
                return _dbHelper;
            }
        }
        /// <summary>
        /// å­—节格式化
@@ -166,7 +185,6 @@
            }
            return str;
        }
    }
}
ExportMap/cs/XYZUtil.cs
ÎļþÒÑɾ³ý
ExportMap/cs/XYZUtils.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,89 @@
using ExportMap.db;
using ExportMap.Models;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Web;
namespace ExportMap.cs
{
    public class XYZUtils
    {
        private static string pyFile;
        /// <summary>
        /// èŽ·å–Python文件
        /// </summary>
        public static string PyFile
        {
            get
            {
                if (string.IsNullOrWhiteSpace(pyFile))
                {
                    pyFile = Path.Combine(ExportUtil.SourcesPath, "xyz.py");
                }
                return pyFile;
            }
        }
        /// <summary>
        /// QGIS工程
        /// </summary>
        public static string Qgz
        {
            get
            {
                return "xyz.qgz";
            }
        }
        /// <summary>
        /// ç”Ÿæˆ
        /// </summary>
        /// <param name="args">XYZ参数</param>
        /// <param name="err">错误信息</param>
        /// <returns>数据发布ID</returns>
        public static int Generate(XYZArgs args, ref string err)
        {
            string tifFile = Path.Combine(ExportUtil.SourcesPath, ExportUtil.DateStr + ".txt");
            string xyzPath = Path.Combine(SGUtils.LFData, "2d\\tiles", args.id.ToString());
            if (!Directory.Exists(xyzPath)) Directory.CreateDirectory(xyzPath);
            string cmd = string.Format("python {0} -qgz {1} -file {2} -out {3} -min {4} -max {5}", PyFile, Qgz, tifFile, xyzPath, args.min, args.max);
            err = Tool.ExecPython(cmd);
            return args.id;
        }
        /// <summary>
        /// æŸ¥è¯¢å…ƒæ•°æ®
        /// </summary>
        private static List<SysMeta> selectMetas(string dircode)
        {
            string sql = string.Format("select * from lf.sys_meta where dircode like '{0}%'", dircode);
            DataTable dt = Tool.DBHelper.GetDataTable(sql);
            List<SysMeta> list = ModelHandler.FillModel<SysMeta>(dt);
            return list;
        }
        /// <summary>
        /// æŸ¥è¯¢å…ƒæ•°æ®
        /// </summary>
        private static List<SysMeta> selectMetas(List<int> ids)
        {
            string sql = string.Format("select * from lf.sys_meta where id in ({0})", string.Join(",", ids));
            DataTable dt = Tool.DBHelper.GetDataTable(sql);
            List<SysMeta> list = ModelHandler.FillModel<SysMeta>(dt);
            return list;
        }
    }
}
ExportMap/export.html
@@ -84,5 +84,8 @@
  </select>
  <input type="button" value="出图-1" onclick="exportMap1()" />
  <input type="button" value="出图-2" onclick="exportMap2()" />
  <br /><br />
  <a href="Convert/Test" >测试rvt</a>
</body>
</html>