From c80a20113b16f70a8bc5d33bc68e8739ac4d33d6 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期二, 27 六月 2023 16:32:28 +0800
Subject: [PATCH] 1

---
 ExportMap/UE.html |  170 +++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 105 insertions(+), 65 deletions(-)

diff --git a/ExportMap/UE.html b/ExportMap/UE.html
index e869342..b755618 100644
--- a/ExportMap/UE.html
+++ b/ExportMap/UE.html
@@ -1,5 +1,6 @@
 锘�<!DOCTYPE html>
 <html xmlns="http://www.w3.org/1999/xhtml">
+
 <head>
   <title>UE鎺ュ彛娴嬭瘯</title>
   <meta http-equiv="Expires" content="0" />
@@ -60,9 +61,11 @@
 
     // 鍧愭爣杞寲
     function transform() {
-      var trans = new TUTransForm({ x: 117.038112825, y: 39.382696649 });
-      trans.transformWGS84ToLocal();
-      trans.transformLocalToWGS84();
+      var coordinate = { x: 117.038112825, y: 39.382696649 }
+      var Wgs84ToLocal = map.transformWGS84ToLocal(coordinate.x, coordinate.y)
+      console.log('Wgs84ToLocal', Wgs84ToLocal)
+      var LocalToWGS84 = map.transformLocalToWGS84(Wgs84ToLocal.x, coordinate.y)
+      console.log('LocalToWGS84', LocalToWGS84)
     }
 
     // 鑾峰彇闀滃ご淇℃伅
@@ -94,13 +97,13 @@
     // 澶╂皵鐗规晥
     function setWeather() {
       // sun-鏅村ぉ ,rain-闆ㄥぉ,snow-闆ぉ
-      map.setWeather("snow");
+      map.setWeather('rain') // 鏅村ぉ
     }
 
     // 鏃堕棿鐗规晥
     function setTime() {
       // morning-鏃╂櫒,noon-涓崍,evening-鍌嶆櫄,night-澶滄櫄,darkWorld-鏆楄壊鍦烘櫙
-      map.setTime("night");
+      map.setTime("evening");
     }
 
     // 鏂囧瓧鏍囩
@@ -120,11 +123,8 @@
       };
 
       var lbl = map.createLabel(options);
-      lbl.show(true); // 鏄剧ず
+      // lbl.show(true); // 鏄剧ず
 
-      // lbl.show(false); // 闅愯棌
-      // lbl.removeFromMap(); //  绉婚櫎
-      // map.removeLabel(lbl.id); //  绉婚櫎
     }
 
     // POI鐐�
@@ -138,9 +138,9 @@
         clickedScale: 0.7, // 鐐瑰嚮鍚庢瘮渚�
         visibility: true, // 榛樿鏄惁鏄剧ず
         alertWindow: { // 鍙�夛紝鐐瑰嚮寮圭獥
-          url: "http://localhost/testAlertWindow.html", // 寮圭獥鍦板潃
-          size: new Vector2(180, 90), // 寮圭獥澶у皬
-          offset: new Vector2(50, -100) // 寮圭獥浣嶇疆锛屽彸锛歺姝o紝涓嬶細y姝�
+          url: "http://192.168.20.89:12306/popupThree.html", // 寮圭獥鍦板潃
+          size: new TUVector2(180, 90), // 寮圭獥澶у皬
+          offset: new TUVector2(50, -100) // 寮圭獥浣嶇疆锛屽彸锛歺姝o紝涓嬶細y姝�
         }
       }
 
@@ -158,46 +158,76 @@
 
     // 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 testPoints = [{ "x": 10000, "y": 10000, "z": 4000 }];
+      var points = []
+      testPoints.forEach(function (item) {
+        points.push({
+          x: item.x,
+          y: item.y,
+          z: item.z,
+          image: "http://www.terra-it.cn/images/tubiao/indexLogo.png",
+          text: "",
+          scale: 20,
+          clickedScale: 1,
+          flash: false,
+          canClick: true,
 
-      var poi = map.create3DBillboard(param);
-      poi.show(true); // 鏄剧ず
-
-      var enable = true; // 鏄�/鍚﹀紑鍚洖璋�
-      poi.Enable3DBillboardCallBack(enable, function (data) {
-        console.info(data);
+        });
       });
+      poi = map.create3DBillboard(points)
+      poi.forEach(function (b) {
+        b.show(true)
+      })
+      var enable = true; // 鏄�/鍚﹀紑鍚洖璋�
+      obj = obj.concat(poi);
 
       // poi.show(false); // 闅愯棌
       // poi.removeFromMap(); //  绉婚櫎
     }
-
+    function creat() {
+      map.Enable3DBillboardCallBack(true, function (e) {
+        console.log(e, "11111111111")
+      })
+    }
     // 娣诲姞绾胯矾
     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)
-        ]
+      // 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)
+      //   ]
+      // });
+      var testPoints = [
+        new TUVector3(77053.6953125, 150984.859375, 0),
+        new TUVector3(16167.91015625, 151470.453125, 0),
+        new TUVector3(14827.0908203125, 100942.328125, 0),
+        new TUVector3(71444.015625, 104834.4375, 0),
+        new TUVector3(67891.890625, 57269.85546875, 0),
+        new TUVector3(13084.04296875, 56401.7734375, 0),
+        new TUVector3(11550.640625, -13705.76953125, 0),
+        new TUVector3(7773.74560546875, -103738.140625, 0),
+      ];
+      testPointArray = []
+      //缁樺埗璺緞
+      pathObj = map.createPolyline({
+        data: testPoints,
+        pathWidth: 3000,
+        type: 0,//0楂樹寒绾� 1涓夎 2绠ご
+        pathColor: "cyan",
       });
+
+
+      var roll = 0, pitch = -45, yaw = 0, distance = 1000;
+      var callBack = function () { console.log("flyTo"); }
+      var time = 3; // 3s
+
+
+      map.flyTo(116.51446997, 39.772785555, 1000, roll, pitch, yaw, distance, callBack, time);
     }
 
     // 娣诲姞鍖哄煙
@@ -235,10 +265,10 @@
         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)
+          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);
@@ -271,29 +301,38 @@
 
     // 鎷惧彇鍧愭爣
     function pickPosition() {
-      map.pickPosition(function (e) {
-        alert(JSON.stringify(e)); // e.objectName-鍐呴儴缂栧彿锛宔.location-鐐逛綅鐨剈e4鍧愭爣
-        map.endPick(); // 鍙栨秷鎷惧彇
-      });
+      // map.pickPosition(function (e) {
+
+      //   alert(JSON.stringify(e)); // e.objectName-鍐呴儴缂栧彿锛宔.location-鐐逛綅鐨剈e4鍧愭爣
+      //   map.endPick(); // 鍙栨秷鎷惧彇
+      // });
+
+      var vla = map.transformLocalToWGS84(map.camera.location.x, map.camera.location.y);
+      alert(JSON.stringify(vla))
     }
 
     // 鎷惧彇瀵硅薄
     function pickObject() {
-      map.execute("factory", "callEvent", { eventName: "ClickObjectCallBack", param: "1" }, function (e) {
-        console.log(e);
-        map.execute("factory", "callEvent", { eventName: "ClickObjectCallBack", param: "0" }, null); // 鍙栨秷鎷惧彇
+      map.pickPosition(function (e) {
+        if (e) {
+          alert(JSON.stringify(e))
+        }
       });
+
+      // 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(); // 娓呴櫎鎵�鏈夎鐩栫墿
+    function objclear() {
+      map.clearAllCovering();
     }
 
   </script>
 </head>
+
 <body>
   <div id="map"></div>
 
@@ -302,21 +341,22 @@
     <button onclick="getCamera();">鑾峰彇闀滃ご淇℃伅</button>
     <button onclick="flyTo();">椋炶</button>
     <button onclick="setView();">鍒囨崲闀滃ご</button>
-    <button onclick="setWeather();">澶╂皵鐗规晥</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="createPolyline();">娣诲姞绾胯矾</button> -->
     <button onclick="createAreaData();">娣诲姞鍖哄煙</button>
     <button onclick="createCircleArea();">鍏夊湀</button>
     <button onclick="createAreaBoundary();">鍥存爮</button>
-    <button onclick="getMeasureHeight();">楂樺害閲忔祴</button>
+    <!-- <button onclick="getMeasureHeight();">楂樺害閲忔祴</button>
     <button onclick="getDistanceHorizontal();">鎶樼嚎璺濈閲忔祴</button>
-    <button onclick="getPlaneArea();">骞抽潰闈㈢Н閲忔祴</button>
-    <button onclick="pickPosition();">鎷惧彇鍧愭爣</button>
+    <button onclick="getPlaneArea();">骞抽潰闈㈢Н閲忔祴</button> -->
+    <button onclick="pickPosition();">鑾峰彇闀滃ご鍧愭爣</button>
     <button onclick="pickObject();">鎷惧彇瀵硅薄</button>
-    <button onclick="clear();">娓呴櫎</button>
+    <button onclick="objclear();">娓呴櫎</button>
   </div>
 </body>
-</html>
+
+</html>
\ No newline at end of file

--
Gitblit v1.9.3