From ae436e2cb0980af757511377215a454c17a35308 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期六, 15 七月 2023 15:18:49 +0800 Subject: [PATCH] 1 --- ExportMap/DLL/ReadLas.dll | 0 ExportMap/cs/Tools.cs | 4 ++ JavaCode/SysTemplate/Controller.java | 22 +++++----- ExportMap/Controllers/ConvertController.cs | 27 +++++++++++++ ExportMap/ExportMap.csproj | 1 ExportMap/export.html | 12 ++++++ ExportMap/cs/LasUtils.cs | 32 ++++++++++++++++ 7 files changed, 87 insertions(+), 11 deletions(-) diff --git a/ExportMap/Controllers/ConvertController.cs b/ExportMap/Controllers/ConvertController.cs index 16b151b..7b0fd4e 100644 --- a/ExportMap/Controllers/ConvertController.cs +++ b/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) diff --git a/ExportMap/DLL/ReadLas.dll b/ExportMap/DLL/ReadLas.dll new file mode 100644 index 0000000..533ae6e --- /dev/null +++ b/ExportMap/DLL/ReadLas.dll Binary files differ diff --git a/ExportMap/ExportMap.csproj b/ExportMap/ExportMap.csproj index 842fd9b..7959cc6 100644 --- a/ExportMap/ExportMap.csproj +++ b/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" /> diff --git a/ExportMap/cs/LasUtils.cs b/ExportMap/cs/LasUtils.cs index a63b76f..431c67b 100644 --- a/ExportMap/cs/LasUtils.cs +++ b/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; + } } } diff --git a/ExportMap/cs/Tools.cs b/ExportMap/cs/Tools.cs index a098aad..000724c 100644 --- a/ExportMap/cs/Tools.cs +++ b/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); } } diff --git a/ExportMap/export.html b/ExportMap/export.html index 2b83814..b113565 100644 --- a/ExportMap/export.html +++ b/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> diff --git a/JavaCode/SysTemplate/Controller.java b/JavaCode/SysTemplate/Controller.java index dabec4f..e4acb0e 100644 --- a/JavaCode/SysTemplate/Controller.java +++ b/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); } } } -- Gitblit v1.9.3