管道基础大数据平台系统开发-【CS】-ExportMap
1
13693261870
2023-05-10 e069dedd70855dbee4b987a2c09c21b6b2168ef9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title></title>
  <script src="js/jquery.1.12.4.js"></script>
  <script>
    var token = "d12b3854-17c1-46c1-8435-22b1c5892fe7";
 
    // Ajax
    function ajax(url, type, data, dataType, contentType, fn) {
      $.ajax({
        url: url,
        type: type,
        data: data,
        dataType: dataType || "json", // html、json、jsonp、script、text
        contentType: contentType || "application/json", // "application/x-www-form-urlencoded"
        success: function (data) {
          fn(data);
        },
        error: function (e) {
          console.error(e);
          fn();
        }
      });
    }
 
    // 出图-1
    function exportMap1() {
      var page = $("#selectPage").find("option:selected").text();
      var data = {
        token: token,
        title: "管道基础大数据平台(DW1-01)",
        pageSize: page,
        province: "河北省",
        scale: "1:5万",
        resolution: "5米",
        date: "2022.11.09",
        layers: "m_hydraulic_protection,m_marker,m_pipeline,m_sitepoint,m_valvehousepoint,m_crossing,高德矢量",
        rotation: 0,
        xmin: 103.394023,
        ymin: 30.690466,
        ymax: 37.871048,
        xmax: 112.534648
      };
 
      ajax("http://127.0.0.1/ExportMap/Export/Start", "POST", JSON.stringify(data), null, null, function (rs) {
        alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result);
        console.log(rs);
      });
    }
 
    // 出图-2
    function exportMap2() {
      var page = $("#selectPage").find("option:selected").text();
      var data = {
        token: token,
        title: "管道基础大数据平台(DW1-02)",
        pageSize: page,
        province: "山东省",
        scale: "1:1万",
        resolution: "2米",
        date: "2022.11.10",
        layers: "bs_project,th_strategic_channel,m_hydraulic_protection,m_marker,m_pipeline,m_sitepoint,m_valvehousepoint,m_crossing,高德影像",
        rotation: 0,
        xmin: 103.394023,
        ymin: 30.690466,
        ymax: 37.871048,
        xmax: 112.534648
      };
 
      ajax("Export/Start", "POST", JSON.stringify(data), null, null, function (rs) {
        alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result);
        console.log(rs);
      });
    }
 
    // 测试切图
    function convertXYZ() {
      var data = { token: token, ids: [2919, 2920], id: 1, min: 8, max: 18, depcode: "000305", dircode: "0102", userId: 1, name: "DOM_0.2m" };
      ajax("Convert/ToTiles", "POST", JSON.stringify(data), null, null, function (rs) {
        alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result);
        console.log(rs);
      });
    }
 
    // 测试Rvt
    function convert1() {
      var data = { token: token, ids: [1521], depcode: "000305", dircode: "0102", userId: 1 };
      ajax("Convert/ToTileset", "POST", JSON.stringify(data), null, null, function (rs) {
        alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result);
        console.log(rs);
      });
    }
 
    // 测试Fbx
    function convert2() {
      var data = { token: token, ids: [1522], depcode: "000305", dircode: "0102", userId: 1 };
      ajax("Convert/ToTileset", "POST", JSON.stringify(data), null, null, function (rs) {
        alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result);
        console.log(rs);
      });
    }
 
    // 测试Ifc
    function convert3() {
      var data = { token: token, ids: [6894], depcode: "000305", dircode: "0A040001010004", userId: 1 };
      ajax("Convert/ToTileset", "POST", JSON.stringify(data), null, null, function (rs) {
        alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result);
        console.log(rs);
      });
    }
 
    // 测试SG
    function toSG() {
      var data = { token: token, ids: [1523, 1525], depcode: "000305", dircode: "0102", userId: 1 };
      ajax("Convert/ToSG", "POST", JSON.stringify(data), null, null, function (rs) {
        alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result);
        console.log(rs);
      });
    }
    
    // 测试Terra
    function toTerra() {
      var data = { token: token, ids: [7088, 7089, 7090], min: 7, max: 7, depcode: "00", dircode: "0C00000003", userId: 1, name: "astgtm2" };
      ajax("Convert/ToTerra", "POST", JSON.stringify(data), null, null, function (rs) {
        alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result);
        console.log(rs);
      });
    }
  </script>
</head>
<body>
  <h2>出图测试</h2>
  <select id="selectPage">
    <option>A0</option>
    <option>A1</option>
    <option>A2</option>
    <option>A3</option>
    <option selected="selected">A4</option>
  </select>
  <input type="button" value="出图-1" onclick="exportMap1()" />
  <input type="button" value="出图-2" onclick="exportMap2()" />
  <br /><br />
  
  <input type="button" value="测试切图" onclick="convertXYZ();" />
  <input type="button" value="测试Rvt" onclick="convert1();" />
  <input type="button" value="测试Fbx" onclick="convert2();" />
  <input type="button" value="测试Ifc" onclick="convert3();" />
  <input type="button" value="测试SG" onclick="toSG();" />
  <input type="button" value="测试Terra" onclick="toTerra();" />
</body>
</html>