From a43f84f7a44558805f65bc04f69d0f0d04902937 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期一, 26 六月 2023 19:01:50 +0800
Subject: [PATCH] 1

---
 ExportMap/UE.html |  276 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 274 insertions(+), 2 deletions(-)

diff --git a/ExportMap/UE.html b/ExportMap/UE.html
index 7f05e53..6827214 100644
--- a/ExportMap/UE.html
+++ b/ExportMap/UE.html
@@ -27,21 +27,293 @@
       height: 100%;
       position: absolute;
     }
+
+    #container {
+      position: absolute;
+      top: 10px;
+      left: 10px;
+      padding: 5px;
+      border-radius: 4px;
+      border: 1px solid rgba(128, 128, 128, 0.5);
+      color: #ffffff;
+    }
+
+    button {
+      background: transparent;
+      border: 1px solid #d0ffb8;
+      color: white;
+      border-radius: 2px;
+      margin: 3px;
+      cursor: pointer;
+    }
   </style>
   <script>
     $(function () {
       window.map = new TUMap({
         id: 'map', // div鐨刬d
-        //url: 'http://192.168.20.39:91', // UE鏈嶅姟鍦板潃
-        url: 'http://103.85.165.99:91',
+        url: 'http://192.168.20.39:91', // UE鏈嶅姟鍦板潃
+        //url: 'http://103.85.165.99:91',
         onInit: function () { // 鍒濆鍖栧畬鎴愪簨浠�
           console.log("鍒濆鍖栧畬鎴�");
         }
       })
     });
+
+    // 杞负WGS84鍧愭爣
+    function toWGS84() {
+      var trans = new TUTransForm({ x: 117.038112825, y: 39.382696649 });
+      trans.transformWGS84ToLocal();
+      trans.transformLocalToWGS84();
+    }
+
+    // 杞负UE鍧愭爣
+    function toUECoord() {
+
+    }
+
+    // 鑾峰彇闀滃ご淇℃伅
+    function getCamera() {
+      var location = map.camera.location; // 浣嶇疆淇℃伅
+      var rotation = map.camera.rotation; // 瑙掑害淇℃伅
+      var distance = map.camera.distance; // 璺濈淇℃伅
+      console.log(location, rotation, distance);
+    }
+
+    // 椋炶
+    function flyTo() {
+      map.flyTo(x, y, z, roll, pitch, yaw, distance, callBack, time);
+    }
+
+    // 鍒囨崲闀滃ご
+    function setView() {
+      map.setView(x, y, z, roll, pitch, yaw, distance);
+    }
+
+    // 澶╂皵鐗规晥锛歴un-鏅村ぉ ,rain-闆ㄥぉ,snow-闆ぉ
+    function setWeather() {
+      map.setWeather("snow");
+    }
+
+    // 鏃堕棿鐗规晥锛歮orning-鏃╂櫒,noon-涓崍,evening-鍌嶆櫄,night-澶滄櫄,darkWorld-鏆楄壊鍦烘櫙
+    function setTime() {
+      map.setTime("night");
+    }
+
+    // 鏂囧瓧鏍囩
+    function createLabel() {
+      var options = {
+        id: 1, //鍞竴鏍囪瘑锛屼笉鍙噸澶� 鍙笉濉�
+        x: 1000, //x杞磚e4鍧愭爣
+        y: 1000, //y杞磚e4鍧愭爣
+        z: 0,//z杞磚e4鍧愭爣
+        vectorType: "WGS84",//鍧愭爣绫诲瀷 2.1.5鐗堟湰鍚庡彲璁剧疆
+        size: { width: 480, height: 180 },//label鐨勫ぇ灏�
+        text: '娴嬭瘯鏂囧瓧',//鏄剧ず鐨勬枃瀛�
+        scale: 1,//缂╂斁
+        type: 'Type1',//绫诲瀷 Default,Type1,Type2
+        backgroundColor: "#ffffff",//鑳屾櫙鑹� 鏀寔rgba TUColor
+        fillColor: "#00ff00",//鏂囧瓧棰滆壊 
+        visibility: true//榛樿鏄惁鏄剧ず
+      };
+
+      var lbl = map.createLabel(options);
+      lbl.show(true); // 鏄剧ず
+
+      // lbl.show(false); // 闅愯棌
+      // lbl.removeFromMap(); //  绉婚櫎
+      // map.removeLabel(lbl.id); //  绉婚櫎
+    }
+
+    // POI鐐�
+    function createBillboard() {
+      var param = {
+        x: 1000, // x杞磚e4鍧愭爣
+        y: 1000, // y杞磚e4鍧愭爣
+        z: 0, // z杞磚e4鍧愭爣
+        image: "http://www.terra-it.cn/images/tubiao/indexLogo.png", // 鍥剧墖鍦板潃
+        scale: 0.5,//缂╂斁
+        clickedScale: 0.7,
+        visibility: true, // 榛樿鏄惁鏄剧ず
+        alertWindow: { // 鍙�夛紝鐐瑰嚮寮圭獥
+          url: "http://localhost/testAlertWindow.html", // 寮圭獥鍦板潃
+          size: new Vector2(180, 90), // 寮圭獥澶у皬
+          offset: new Vector2(50, -100) // 寮圭獥浣嶇疆锛屽彸锛歺姝o紝涓嬶細y姝�
+        }
+      }
+
+      var poi = map.createBillboard(param);
+      poi.show(true); // 鏄剧ず
+
+      var enable = true; // 鏄�/鍚﹀紑鍚洖璋�
+      poi.EnableBillboardCallBack(enable, function (data) {
+        console.info(data);
+      });
+
+      // poi.show(false); // 闅愯棌
+      // poi.removeFromMap(); //  绉婚櫎
+    }
+
+    // 3DPOI鐐�
+    function create3DBillboard() {
+      var param = {
+        x: 1000, // x杞磚e4鍧愭爣
+        y: 1000, // y杞磚e4鍧愭爣
+        z: 0, // z杞磚e4鍧愭爣
+        image: "http://www.terra-it.cn/images/tubiao/indexLogo.png", // 鍥剧墖鍦板潃
+        scale: 0.5,//缂╂斁
+        clickedScale: 0.7,
+        visibility: true, // 榛樿鏄惁鏄剧ず
+        alertWindow: {//鍙�夛紝鐐瑰嚮寮圭獥
+          url: "http://localhost/testAlertWindow.html", // 寮圭獥鍦板潃
+          size: new Vector2(180, 90), // 寮圭獥澶у皬
+          offset: new Vector2(50, -100) // 寮圭獥浣嶇疆锛屽彸锛歺姝o紝涓嬶細y姝�
+        }
+      }
+
+      var poi = map.create3DBillboard(param);
+      poi.show(true); // 鏄剧ず
+
+      var enable = true; // 鏄�/鍚﹀紑鍚洖璋�
+      poi.Enable3DBillboardCallBack(enable, function (data) {
+        console.info(data);
+      });
+
+      // poi.show(false); // 闅愯棌
+      // poi.removeFromMap(); //  绉婚櫎
+    }
+
+    // 娣诲姞绾胯矾
+    function createPolyline() {
+      var obj = map.createPolyline({
+        pathWidth: 1000, // 璺緞瀹藉害 
+        pathColor: "#00FF00", // 璺緞棰滆壊
+        type: 1, // 绾胯矾绫诲瀷: 0楂樹寒 1涓夎 2绠ご
+        data: [ // 璺緞鐐逛綅鏁扮粍锛寀e4鍧愭爣
+            new TUVector3(-129.99, -7.41, 0),
+            new TUVector3(-131.00, -134.96, 0),
+            new TUVector3(113.83, -128.26, 0),
+            new TUVector3(123.84, -550.99, 0)
+        ]
+      });
+    }
+
+    // 娣诲姞鍖哄煙
+    function createAreaData() {
+      var obj = map.createAreaData({
+        id: "fdfdfdfdfd",
+        data: [
+          new TUVector3(0, 0, 0),
+          new TUVector3(10000, 0, 0),
+          new TUVector3(10000, 10000, 0),
+          new TUVector3(0, 10000, 0)
+        ]
+      });
+    }
+
+    // 鍏夊湀
+    function createCircleArea() {
+      var param = {
+        location: new TUVector3(0, 0, 0), // 涓績鐐�
+        radius: 15000,
+        type: 2, //0涓婃诞妯牸锛�1瀹炶壊锛�2绠ご锛�3涓夎
+        color: "#ff0000",
+        height: 15000,  //榛樿5000
+        brightness: 10 //榛樿10
+      }
+      var circle = map.createCircleArea(param);
+      // circle.removeFromMap(); // 绉婚櫎
+    }
+
+    // 鍥存爮
+    function createAreaBoundary() {
+      var param = {
+        type: 0, // 0涓婃诞妯牸锛�1瀹炶壊锛�2绠ご锛�3涓夎
+        height: 5000, // 榛樿5000
+        color: "#ff0000", // 榛樿鐧借壊
+        brightness: 10, // 榛樿10
+        data: [ // 鍥存爮鐐逛綅鏁扮粍 
+            new TUVector3(-129.99, -7.41, 0),
+            new TUVector3(-131.00, -134.96, 0),
+            new TUVector3(113.83, -128.26, 0),
+            new TUVector3(123.84, -550.99, 0)
+        ]
+      }
+      var bound = map.createAreaBoundary(param);
+      // bound.removeFromMap(); // 绉婚櫎
+    }
+
+    // 楂樺害閲忔祴
+    function getMeasureHeight() {
+      var obj = map.getMeasureHeight(function (e) { // 鍥炶皟
+        alert(JSON.stringify(e));
+        obj.deleteObject(); // 绉婚櫎
+      });
+    }
+
+    // 鎶樼嚎璺濈閲忔祴
+    function getDistanceHorizontal() {
+      var obj = map.getDistanceHorizontal(function (e) { // 鍥炶皟
+        alert(JSON.stringify(e));
+        obj.deleteObject(); // 绉婚櫎
+      });
+    }
+
+    // 骞抽潰闈㈢Н閲忔祴
+    function getPlaneArea() {
+      var obj = map.getPlaneArea(function (e) { // 鍥炶皟
+        alert(JSON.stringify(e));
+        obj.deleteObject(); // 绉婚櫎
+      });
+    }
+
+    // 鎷惧彇鍧愭爣
+    function pickPosition() {
+      map.pickPosition(function (e) {
+        alert(JSON.stringify(e)); // e.objectName-鍐呴儴缂栧彿锛宔.location-鐐逛綅鐨剈e4鍧愭爣
+        map.endPick(); // 鍙栨秷鎷惧彇
+      });
+    }
+
+    // 鎷惧彇瀵硅薄
+    function pickObject() {
+      map.execute("factory", "callEvent", { eventName: "ClickObjectCallBack", param: "1" }, function (e) {
+        console.log(e);
+        map.execute("factory", "callEvent", { eventName: "ClickObjectCallBack", param: "0" }, null); // 鍙栨秷鎷惧彇
+      });
+    }
+
+    // 娓呴櫎
+    function clear() {
+      map.resetWeather(); // 绉婚櫎澶╂皵鐗规晥
+      map.resetTime(); // 绉婚櫎鏃堕棿鐗规晥
+      map.clearAllCovering(); // 娓呴櫎鎵�鏈夎鐩栫墿
+    }
   </script>
 </head>
 <body>
   <div id="map"></div>
+
+  <div id="container">
+    <button onclick="toWGS84();">杞负WGS84鍧愭爣</button>
+    <button onclick="toUECoord();">杞负UE鍧愭爣</button>
+    <button onclick="getCamera();">鑾峰彇闀滃ご淇℃伅</button>
+    <button onclick="flyTo();">椋炶</button>
+    <button onclick="setView();">鍒囨崲闀滃ご</button>
+    <button onclick="setWeather();">澶╂皵鐗规晥</button>
+    <button onclick="setTime();">鏃堕棿鐗规晥</button>
+    <button onclick="createLabel();">鏂囧瓧鏍囩</button>
+    <button onclick="createBillboard();">POI鐐�</button>
+    <button onclick="create3DBillboard();">3DPOI鐐�</button>
+    <button onclick="createPolyline();">娣诲姞绾胯矾</button>
+    <button onclick="createAreaData();">娣诲姞鍖哄煙</button>
+    <button onclick="createCircleArea();">鍏夊湀</button>
+    <button onclick="createAreaBoundary();">鍥存爮</button>
+    <button onclick="getMeasureHeight();">楂樺害閲忔祴</button>
+    <button onclick="getDistanceHorizontal();">鎶樼嚎璺濈閲忔祴</button>
+    <button onclick="getPlaneArea();">骞抽潰闈㈢Н閲忔祴</button>
+    <button onclick="pickPosition();">鎷惧彇鍧愭爣</button>
+    <button onclick="pickObject();">鎷惧彇瀵硅薄</button>
+    <button onclick="clear();">娓呴櫎</button>
+  </div>
 </body>
 </html>

--
Gitblit v1.9.3