管道基础大数据平台系统开发-【CS】-ExportMap
1
13693261870
2023-07-15 ae436e2cb0980af757511377215a454c17a35308
1
已添加1个文件
已修改6个文件
98 ■■■■ 文件已修改
ExportMap/Controllers/ConvertController.cs 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/DLL/ReadLas.dll 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/ExportMap.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/cs/LasUtils.cs 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/cs/Tools.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/export.html 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JavaCode/SysTemplate/Controller.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/Controllers/ConvertController.cs
@@ -187,6 +187,33 @@
        }
        /// <summary>
        /// 读取Las坐标系
        /// </summary>
        [HttpPost]
        public ResponseMsg<string> ReadLasCs([FromBody]XYZArgs args)
        {
            try
            {
                ResponseMsg<string> msg = checkArgs(args, true);
                if (null != msg) return msg;
                string err = null;
                List<int> rs = LasUtils.ReadLasCs(args, ref err);
                if (null == rs || rs.Count == 0)
                {
                    return ResponseMsg<string>.fail(null == err ? "失败" : err);
                }
                return ResponseMsg<string>.success("成功", string.Join(",", rs), rs.Count);
            }
            catch (Exception ex)
            {
                LogOut.Error(ex.Message + "\r\n" + ex.StackTrace);
                return ResponseMsg<string>.fail(ex.Message);
            }
        }
        /// <summary>
        /// 检查参数
        /// </summary>
        private ResponseMsg<string> checkArgs(XYZArgs args, bool checkDir = false)
ExportMap/DLL/ReadLas.dll
Binary files differ
ExportMap/ExportMap.csproj
@@ -109,6 +109,7 @@
    <Content Include="DLL\Mono.Security.dll" />
    <Content Include="DLL\Npgsql.dll" />
    <Content Include="DLL\NPOI.dll" />
    <Content Include="DLL\ReadLas.dll" />
    <Content Include="DLL\System.Data.SQLite.dll" />
    <Content Include="fme.html" />
    <Content Include="Global.asax" />
ExportMap/cs/LasUtils.cs
@@ -143,5 +143,37 @@
            return pubid;
        }
        /// <summary>
        /// 读取Las坐标系
        /// </summary>
        public static List<int> ReadLasCs(XYZArgs args, ref string err)
        {
            List<SysMeta> list = XYZUtils.SelectMetas(args.ids, "and type in ('las', 'laz')");
            if (null == list || list.Count == 0) return null;
            string uploadFolder = Tools.GetSetting("uploadFolder");
            List<int> ids = new List<int>();
            foreach (SysMeta meta in list)
            {
                string lasPath = Path.Combine(uploadFolder, meta.path);
                if (!File.Exists(lasPath)) continue;
                int epsg = 0;
                try
                {
                    epsg = Tools.get_las_cs(lasPath.Replace("\\", "/"));
                }
                catch (Exception ex)
                {
                    LogOut.Error(ex.Message + "\r\n" + ex.StackTrace);
                    epsg = -1;
                }
                ids.Add(epsg);
            }
            return ids;
        }
    }
}
ExportMap/cs/Tools.cs
@@ -9,6 +9,7 @@
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Security.AccessControl;
@@ -286,5 +287,8 @@
                meta.ismeta = idx == -1 ? 1 : args.models[idx];
            }
        }
        [DllImport("ReadLas.dll")]
        public extern static int get_las_cs(string file_name);
    }
}
ExportMap/export.html
@@ -168,6 +168,15 @@
        console.log(rs);
      });
    }
    // 读取Las坐标系
    function ReadLasCs() {
      var data = { token: token, ids: [10285, 10481, 10456, 10483], dircode: "00" };
      ajax("Convert/ReadLasCs", "POST", JSON.stringify(data), null, null, function (rs) {
        alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result);
        console.log(rs);
      });
    }
  </script>
</head>
<body>
@@ -193,5 +202,8 @@
  <input type="button" value="测试Las" onclick="toLas();" />
  <input type="button" value="测试Laz" onclick="toLaz();" />
  <input type="button" value="生成Mpt" onclick="createMpt();" />
  <br /><br />
  <input type="button" value="读取Las坐标系" onclick="ReadLasCs();" />
</body>
</html>
JavaCode/SysTemplate/Controller.java
@@ -43,7 +43,7 @@
            return success(count);
        } catch (Exception ex) {
            return fail(ex.getMessage(), -1);
            return fail(ex, -1);
        }
    }
@@ -65,7 +65,7 @@
            return success(rs);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
            return fail(ex, null);
        }
    }
@@ -92,7 +92,7 @@
            return success(count, rs);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
            return fail(ex, null);
        }
    }
@@ -105,7 +105,7 @@
            return success(list);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
            return fail(ex, null);
        }
    }
@@ -121,7 +121,7 @@
            return success(entity);
        } catch (Exception ex) {
            return fail(ex.getMessage(), null);
            return fail(ex, null);
        }
    }
@@ -142,7 +142,7 @@
            return success(count);
        } catch (Exception ex) {
            return fail(ex.getMessage(), -1);
            return fail(ex, -1);
        }
    }
@@ -165,7 +165,7 @@
            return success(count);
        } catch (Exception ex) {
            return fail(ex.getMessage(), -1);
            return fail(ex, -1);
        }
    }
@@ -181,7 +181,7 @@
            return success(count);
        } catch (Exception ex) {
            return fail(ex.getMessage(), -1);
            return fail(ex, -1);
        }
    }
@@ -201,7 +201,7 @@
            return success(count);
        } catch (Exception ex) {
            return fail(ex.getMessage(), -1);
            return fail(ex, -1);
        }
    }
@@ -223,7 +223,7 @@
            return success(count);
        } catch (Exception ex) {
            return fail(ex.getMessage(), -1);
            return fail(ex, -1);
        }
    }
@@ -247,7 +247,7 @@
            return success(count);
        } catch (Exception ex) {
            return fail(ex.getMessage(), -1);
            return fail(ex, -1);
        }
    }
}