| | |
| | | } |
| | | |
| | | /// <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) |
| | |
| | | <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" /> |
| | |
| | | |
| | | 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; |
| | | } |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | meta.ismeta = idx == -1 ? 1 : args.models[idx]; |
| | | } |
| | | } |
| | | |
| | | [DllImport("ReadLas.dll")] |
| | | public extern static int get_las_cs(string file_name); |
| | | } |
| | | } |
| | |
| | | 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> |
| | |
| | | <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> |
| | |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | return fail(ex, -1); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | return success(rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | return success(count, rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | return success(entity); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | return fail(ex, -1); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | return fail(ex, -1); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | return fail(ex, -1); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | return fail(ex, -1); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | return fail(ex, -1); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | return fail(ex, -1); |
| | | } |
| | | } |
| | | } |