管道基础大数据平台系统开发-【CS】-ExportMap
13693261870
2024-01-03 b138834384e977cfc93cff1c66f70676cd4e7e18
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>ToolTitle</title>
  <meta http-equiv="X-UA-Compatible" content="IE=9" />
  <!--<meta http-equiv="Content-Type" content="text/html; charset=utf-8">-->
  <link rel="StyleSheet" href="../Style.css" type="text/css">
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" style="border: 0px; overflow: hidden;" id="Body" class="hideUntillTranslated ToolButtonsArea" onload="Init()" onunload="OnUnload()">
  <!--oncontextmenu="return false;">  onclick="bHide=true;HideOptionsNow()" > -->
  <table border="0" width="100%" class="s8w" cellspacing="0" cellpadding="0">
    <tr>
      <td>
        <table class="PropertiesSheet" cellspacing="0" cellpadding="0"></table>
      </td>
      <tr>
        <td colspan="2" align="left" class="ToolButtonsArea" style="border-bottom: 2px solid #ffffff;">
          <button id="deleteMeasure" class="MenuButton2" style="border: none;" onclick="OnDeleteMeasure();">
            <img src="./img/delete.png" /></button>
          <button id="deleteLastPoint" class="MenuButton2" style="border: none;" onclick="OnDeleteLastPoint()">
            <img src="./img/delete_last_point.png" /></button>
          <button id="snapping" class="MenuButton2" style="border-right: 2px solid #ffffff;" onclick="OnSnapping()">
            <img src="./img/snap.png" /><br />
          </button>
          <button id="horizontalSurface" class="MenuButton2" style="border: none;" onclick="OnHorizontalSurface()">
            <img src="./img/horizontal.png" /><br />
          </button>
          <button id="3dPlane" class="MenuButton2" style="border: none;" onclick="On3DPlane()">
            <img src="./img/3d_palne_area.png" /><br />
          </button>
          <button id="terrainSurface" class="MenuButton2" style="border-left: 2px solid #ffffff; border-right: none;" onclick="OnTerrainSurface()">
            <img src="./img/surface.png" /><br />
          </button>
        </td>
      </tr>
  </table>
  <table border="0" width="100%" class="s8w ToolButtonsArea" cellspacing="0" cellpadding="3pt">
    <tr id="createTRId" style="display: none;">
      <td>
        <span class="i18n s8w" style="vertical-align: top;">Text6</span>
        <input type="checkbox" align="bottom" id="createMeasurementObject" style="width: 25px;" onclick="CreateMeasurementObject();" />
      </td>
    </tr>
    <tr>
      <td class="textarea-container">
        <div class="textarea-size s8w"></div>
      </td>
    </tr>
    <!--<tr id="sampleIntervalTR">
        <td align="left">
            <span class="i18n s8w">Text5</span>
            <input type="text" id="sampleInterval" style="width:25px; height:13px;  background-color:#000000; color:#FFFFFF; padding:1px; margin-left: 2px;margin-right: 2px;" onkeypress="OnSampleInterval(event)" />
            <span class="i18n s8w">Text18</span>
        </td>
        </tr>-->
    <tr id="sampleIntervalTR">
      <td align="left">
        <span class="i18n s8w">Text5</span>
        <input type="text" id="sampleInterval" style="width: 25px; height: 13px; background-color: #000000; color: #FFFFFF; padding: 1px; margin-left: 2px; margin-right: 2px;" onkeypress="OnSampleInterval(event)" />
        <span class="i18n s8w">Text18</span>
      </td>
    </tr>
    <tr id="surfaceResultTR">
      <td class="textarea-container_surface">
        <div class="textarea-size_surface s8w"></div>
      </td>
    </tr>
    <tr id="unitTRId" style="display: none;">
      <!--<td  align="right" >-->
      <td>
        <u><a class="btn btn-primary" href="#" role="button" id="changeMeasurementUnits" onclick="OnChangeMeasurementUnits()"><span class="i18n s8w" style="padding-right: 5px;">Text17</span></a></u>
      </td>
    </tr>
  </table>
  <object id="SGWorld" style="display: none" classid="CLSID:3a4f919d-65a8-11d5-85c1-0001023952c1"></object>
  <script language="javascript" src="../jquery/jquery-3.1.1.min.js"></script>
  <script language="javascript" src="../ToolsCommon71.js"></script>
  <script language="JavaScript">
    var DISABLE = "gray";
    var gGeometry = null;
    var g_bCalculateTerrainArea;
    var _3D_PLANE_NAME = "plane";
    var _HORIZONTAL_NAME = "horizontal";
 
    function Init() {
      document.getElementById("changeMeasurementUnits").value = SGLang.i18n("Text17");
      document.getElementById("sampleInterval").value = 5;
 
      var isPM = GetParamValue("pm", "0"); // when opening this tool in PM we want to hide several options
      if (isPM == "1") {
        $("#unitTRId").hide();
        $("#createTRId").hide();
        $("#terrainSurface").hide();
        $("#sampleIntervalTR").hide();
        $("#surfaceResultTR").hide();
      }
 
      $("#deleteMeasure").attr('title', SGLang.i18n("Text19"));
      $("#deleteLastPoint").attr('title', SGLang.i18n("Text20"));
      $("#snapping").attr('title', SGLang.i18n("Text21"));
      $("#horizontalSurface").attr('title', SGLang.i18n("Text22"));
      $("#3dPlane").attr('title', SGLang.i18n("Text23"));
      $("#terrainSurface").attr('title', SGLang.i18n("Text24"));
 
      textContainer = document.querySelector('.textarea-container');
      textareaSize = textContainer.querySelector('.textarea-size');
      textareaSize.innerText = SGLang.i18n("Text25");
 
      textContainer = document.querySelector('.textarea-container_surface');
      textareaSize = textContainer.querySelector('.textarea-size_surface');
      textareaSize.innerText = SGLang.i18n("Text26");
 
      SGWorld.AttachEvent("OnMeasurementAreaResult", OnMeasurementResult);
      SGWorld.AttachEvent("OnInputModeChanged", OnInputModeChanged);
      SGWorld.AttachEvent("OnEndDrawMeasurement", OnEndDrawMeasurement);
 
      //var bCreateMeasurementObject = (isPM == "1") ? false : SGWorld.GetOptionParam("CreateMeasurementObjects");
      //document.getElementById("createMeasurementObject").checked = bCreateMeasurementObject;
      document.getElementById("createMeasurementObject").checked = true;
      CreateMeasurementObject();
 
      Reset(1, 0);
      if (SGWorld.GetOptionParam("AreaMeasurementDefaultMode") == _3D_PLANE_NAME)
        document.getElementById("3dPlane").click();
      else
        document.getElementById("horizontalSurface").click();
    }
 
    function setText(idx, val) {
      var txtId = SGWorld.ProjectTree.FindItem("定位点\\Text");
      if (txtId) {
        var obj = SGWorld.ProjectTree.GetObject(txtId);
        var strs = obj.Text.split(","); // 0,0,0,0,0,0,0
        strs[idx] = val;
        obj.Text = strs.join(",");
      }
    }
 
    //---------------------------------
    function Reset(FirstTime, FromMouseInputMode) {
      ResetButtons();
      SGWorld.Window.SetInputMode(0);
      gGeometry = null;
    }
 
    //---------------------------------
    function OnSampleInterval(evt) {
      var theEvent = evt || window.event;
 
      // Handle paste
      if (theEvent.type === 'paste') {
        key = event.clipboardData.getData('text/plain');
      }
      else {
        // Handle key press
        var key = theEvent.keyCode || theEvent.which;
        key = String.fromCharCode(key);
      }
 
      var regex = /[0-9]|\./;
      if (!regex.test(key) || document.getElementById("sampleInterval").style.color == DISABLE) {
        theEvent.returnValue = false;
        if (theEvent.preventDefault)
          theEvent.preventDefault();
      }
    }
 
    //---------------------------------
    function OnDeleteMeasure() {
      var is3dPlane = $("#3dPlane").hasClass("MenuButtonHighlight");
      var isHorizontalSurface = $("#horizontalSurface").hasClass("MenuButtonHighlight");
 
      Reset(0, 0);
 
      if (is3dPlane) {
        document.getElementById("3dPlane").click();
      }
      else
        if (isHorizontalSurface) {
          document.getElementById("horizontalSurface").click();
        }
 
      EnableDisableButtons();
    }
 
    //---------------------------------
    function OnUnload() {
      var measurementMode = SGWorld.GetParam(9916);
      if (measurementMode == 33351/*ID_MEASURE_TERRAIN_AREA*/ || measurementMode == 33350/*ID_MEASURE_AREA*/)
        SGWorld.Window.SetInputMode(0);
    }
 
    //---------------------------------
    function OnEndDrawMeasurement(geometry) {
      gGeometry = geometry;
      EnableDisableButtons();
    }
 
    //---------------------------------
    function OnInputModeChanged(mode) {
      if (mode == 0) {
        ResetButtons();
      }
    }
 
    //---------------------------------
    function OnMeasurementResult(rs, SounrceID) {
      rs = rs.replace("N/A", "不适用")
          .replace("Surface Area:", "表面积:")
          .replace("Area:", "面积:")
          .replace("Square Meter", "平方米")
          .replace("Square km", "平方千米")
          .replace("Perimeter: ", "周长:")
          .replace(/Km/g, " 千米")
          .replace(/m/g, " 米");
 
      window.strs = rs.replace(/\t/g, "").replace(/s+/g, "").split("\n");
      var area = strs[0].split(":")[1].replace("\r", "").trim().replace(" 平方米", "");
      setText(6, area);
 
      if (!g_bCalculateTerrainArea) {
        textContainer = document.querySelector('.textarea-container');
        textareaSize = textContainer.querySelector('.textarea-size');
        textareaSize.innerText = rs;
 
        textContainer = document.querySelector('.textarea-container_surface');
        textareaSize = textContainer.querySelector('.textarea-size_surface');
        textareaSize.innerText = SGLang.i18n("Text26");
      }
      else {
        textContainer = document.querySelector('.textarea-container_surface');
        textareaSize = textContainer.querySelector('.textarea-size_surface');
        textareaSize.innerText = rs;
      }
 
      EnableDisableButtons();
 
      return true;
    }
 
    //---------------------------------
    function OnChangeMeasurementUnits() {
      SGWorld.Command.Execute(1011, 3);
    }
 
    //---------------------------------
    function CreateMeasurementObject() {
      var bCreateMeasurementObject = document.getElementById("createMeasurementObject").checked == true;
      SGWorld.SetOptionParam("CreateMeasurementObjects", bCreateMeasurementObject);
    }
 
    //---------------------------------
    function EnableDisableButtons() {
      var bEnableTerrainSurface = $("#horizontalSurface").hasClass("MenuButtonHighlight") && gGeometry != null;
      if (!bEnableTerrainSurface)
        document.getElementById("sampleInterval").style.color = DISABLE;
      else
        document.getElementById("sampleInterval").style.color = "#FFFFFF";
 
      document.getElementById("terrainSurface").disabled = !bEnableTerrainSurface;
 
      if (bEnableTerrainSurface)
        document.getElementById("terrainSurface").style.opacity = 1;
      else
        document.getElementById("terrainSurface").style.opacity = 0.3;
 
      var numPoints = SGWorld.GetParam(9915);
      if (numPoints < 3) {
        gGeometry = null;
      }
 
      if (numPoints > 0) {
        document.getElementById("deleteMeasure").style.opacity = 1;
      }
      else {
        document.getElementById("deleteMeasure").style.opacity = 0.3;
      }
 
      if (numPoints > 2 && gGeometry == null) {
        document.getElementById("deleteLastPoint").style.opacity = 1;
      }
      else {
        document.getElementById("deleteLastPoint").style.opacity = 0.3;
      }
    }
 
    //---------------------------------
    function ResetButtons() {
      $("#horizontalSurface").removeClass("MenuButtonHighlight");
      $("#terrainSurface").removeClass("MenuButtonHighlight");
      $("#3dPlane").removeClass("MenuButtonHighlight");
      EnableDisableButtons();
    }
 
    //---------------------------------
    function SetSnapping() {
      if ($("#snapping").hasClass("MenuButtonHighlight"))
        SGWorld.SetParam(9912, 1);
      else
        SGWorld.SetParam(9912, 0);
    }
 
    //---------------------------------
    function OnSnapping() {
      //$("#snapping").removeClass("MenuButtonHighlight");
 
      if ($(event.srcElement).hasClass("MenuButtonHighlight")) {
        $("#snapping").removeClass("MenuButtonHighlight");
        SGWorld.SetParam(9912, 0);
      }
      else {
        SGWorld.SetParam(9912, 1);
        $(event.srcElement).addClass("MenuButtonHighlight");
      }
    }
 
    //---------------------------------
    function On3DPlane() {
      if ($(event.srcElement).hasClass("MenuButtonHighlight")) {
        Reset(0, 0);
        return;
      }
 
      Reset(0, 0);
      $(event.srcElement).addClass("MenuButtonHighlight");
      //SGWorld.Command.Execute(2358, 0);//__TEC_MEASURE_AREA
      SGWorld.Command.Execute(1037, 0);
 
      textContainer = document.querySelector('.textarea-container');
      textareaSize = textContainer.querySelector('.textarea-size');
      textareaSize.innerText = SGLang.i18n("Text25");
 
      SetSnapping();
 
      SGWorld.SetOptionParam("AreaMeasurementDefaultMode", _3D_PLANE_NAME);
 
      EnableDisableButtons();
    }
 
    //---------------------------------
    function OnTerrainSurface() {
      //Reset(0,0);
      g_bCalculateTerrainArea = true;
      if (document.getElementById("sampleInterval").value > 0.0)
        SGWorld.Command.Execute(1165/*__TEC_MEASURE_TERRAIN_AREA*/, document.getElementById("sampleInterval").value); // 2359
      g_bCalculateTerrainArea = false;
 
      SetSnapping();
    }
 
    //---------------------------------
    function OnHorizontalSurface() {
      if ($(event.srcElement).hasClass("MenuButtonHighlight")) {
        Reset(0, 0);
        return;
      }
 
      Reset(0, 0);
      $(event.srcElement).addClass("MenuButtonHighlight");
      SGWorld.Command.Execute(1165/*__TEC_MEASURE_TERRAIN_AREA*/, 0); // 2359
 
      textContainer = document.querySelector('.textarea-container');
      textareaSize = textContainer.querySelector('.textarea-size');
      textareaSize.innerText = SGLang.i18n("Text25");
 
      SetSnapping();
 
      //SGWorld.SetOptionParam("AreaMeasurementDefaultMode", _HORIZONTAL_NAME);
      EnableDisableButtons();
    }
 
    function OnDeleteLastPoint() {
      SGWorld.SetParam(9914, 0);
      EnableDisableButtons();
    }
  </script>
</body>
</html>
 
<!--Sig:00000040au6WjiNW.uqyaxQdPdCltSVnmGMYOWXEgBB9yrqQ.Kyq91MhWbUupggV5yi1GRel4nJZMYQa3tOFAX56jNS8XmJJ-->