From d3da54b15bd7d658d5fcb778bdd3a3e6c4fcf2af Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期二, 27 六月 2023 18:26:18 +0800 Subject: [PATCH] 1 --- ExportMap/UE2.html | 330 +++++++++++++++++++++++++++++++++++++++++++++++ ExportMap/UE.html | 63 --------- 2 files changed, 330 insertions(+), 63 deletions(-) diff --git a/ExportMap/UE.html b/ExportMap/UE.html index 0d26ffd..1f04708 100644 --- a/ExportMap/UE.html +++ b/ExportMap/UE.html @@ -95,12 +95,6 @@ map.setView(x, y, z, roll, pitch, yaw, distance); } - // 澶╂皵鐗规晥 - function setWeather() { - // sun-鏅村ぉ ,rain-闆ㄥぉ,snow-闆ぉ - map.setWeather('rain') // 鏅村ぉ - } - // 鏃堕棿鐗规晥 function setTime() { // morning-鏃╂櫒,noon-涓崍,evening-鍌嶆櫄,night-澶滄櫄,darkWorld-鏆楄壊鍦烘櫙 @@ -182,34 +176,6 @@ }); } - // 娣诲姞绾胯矾 - function createPolyline() { - 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), - ]; - - //缁樺埗璺緞 - var 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); - } - // 娣诲姞鍖哄煙 function createAreaData() { var obj = map.createAreaData({ @@ -256,30 +222,6 @@ // 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() { var obj = map.transformLocalToWGS84(map.camera.location.x, map.camera.location.y); @@ -309,18 +251,13 @@ <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="objclear();">娓呴櫎</button> diff --git a/ExportMap/UE2.html b/ExportMap/UE2.html new file mode 100644 index 0000000..0d26ffd --- /dev/null +++ b/ExportMap/UE2.html @@ -0,0 +1,330 @@ +锘�<!DOCTYPE html> +<html xmlns="http://www.w3.org/1999/xhtml"> + +<head> + <title>UE鎺ュ彛娴嬭瘯</title> + <meta http-equiv="Expires" content="0" /> + <meta http-equiv="Cache" content="no-cache" /> + <meta http-equiv="Pragma" content="no-cache" /> + <meta http-equiv="Cache-control" content="no-cache" /> + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <script src="js/tumap.js"></script> + <style> + html, + body { + width: 100%; + height: 100%; + padding: 0; + margin: 0; + overflow: hidden; + font-size: 13px; + font-family: 寰蒋闆呴粦; + } + + #map { + width: 100%; + 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> + window.onload = function () { + window.map = new TUMap({ + id: 'map', // div鐨刬d + url: 'http://192.168.20.39:91', // UE鏈嶅姟鍦板潃 + //url: 'http://103.85.165.99:91', + onInit: function () { // 鍒濆鍖栧畬鎴愪簨浠� + console.log("鍒濆鍖栧畬鎴�"); + } + }) + } + + // 鍧愭爣杞寲 + function transform() { + 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) + } + + // 鑾峰彇闀滃ご淇℃伅 + function getCamera() { + var location = map.camera.location; // 浣嶇疆淇℃伅 + var rotation = map.camera.rotation; // 瑙掑害淇℃伅 + var distance = map.camera.distance; // 璺濈淇℃伅 + console.log(location, rotation, distance); + } + + // 椋炶 + function flyTo() { + var x = 117.038112825, y = 39.382696649, z = 5000; + var roll = 0, pitch = 0, yaw = 0, distance = 1000; + var callBack = function () { console.log("flyTo"); } + var time = 3; // 3s + + map.flyTo(x, y, z, roll, pitch, yaw, distance, callBack, time); + } + + // 鍒囨崲闀滃ご + function setView() { + var x = 117.038112825, y = 39.382696649, z = 5000; + var roll = 0, pitch = 0, yaw = 0, distance = 1000; + + map.setView(x, y, z, roll, pitch, yaw, distance); + } + + // 澶╂皵鐗规晥 + function setWeather() { + // sun-鏅村ぉ ,rain-闆ㄥぉ,snow-闆ぉ + map.setWeather('rain') // 鏅村ぉ + } + + // 鏃堕棿鐗规晥 + function setTime() { + // morning-鏃╂櫒,noon-涓崍,evening-鍌嶆櫄,night-澶滄櫄,darkWorld-鏆楄壊鍦烘櫙 + map.setTime("evening"); + } + + // 鏂囧瓧鏍囩 + function createLabel() { + var options = { + id: 1, // 鍞竴鏍囪瘑锛屼笉鍙噸澶嶏紝鍙笉濉� + x: 1000, // x杞磚e4鍧愭爣 + y: 1000, // y杞磚e4鍧愭爣 + z: 0, // z杞磚e4鍧愭爣 + size: { width: 480, height: 180 }, // label鐨勫ぇ灏� + text: '娴嬭瘯鏂囧瓧', // 鏄剧ず鐨勬枃瀛� + scale: 1, // 缂╂斁 + type: 'Type1', // 绫诲瀷 Default,Type1,Type2 + backgroundColor: "#ffffff", // 鑳屾櫙鑹叉敮鎸乺gba + fillColor: "#00ff00", // 鏂囧瓧棰滆壊 + visibility: true // 榛樿鏄惁鏄剧ず + }; + + var lbl = map.createLabel(options); + // lbl.show(true); // 鏄剧ず + } + + // 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://192.168.20.89:12306/popupThree.html", // 寮圭獥鍦板潃 + size: new TUVector2(180, 90), // 寮圭獥澶у皬 + offset: new TUVector2(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 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 pois = map.create3DBillboard(points); + pois.forEach(function (poi) { + poi.show(true); + // poi.show(false); // 闅愯棌 + // poi.removeFromMap(); // 绉婚櫎 + }); + } + + // 娣诲姞绾胯矾 + function createPolyline() { + 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), + ]; + + //缁樺埗璺緞 + var 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); + } + + // 娣诲姞鍖哄煙 + 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) + ] + }); + // obj.removeFromMap(); // 绉婚櫎 + } + + // 鍏夊湀 + 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() { + var obj = map.transformLocalToWGS84(map.camera.location.x, map.camera.location.y); + alert(JSON.stringify(obj)); + } + + // 鎷惧彇瀵硅薄 + function pickObject() { + map.pickPosition(function (e) { + alert(JSON.stringify(e)) + }); + } + + // 娓呴櫎 + function objclear() { + map.clearAllCovering(); + } + + </script> +</head> + +<body> + <div id="map"></div> + + <div id="container"> + <button onclick="transform();">鍧愭爣杞崲</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="objclear();">娓呴櫎</button> + </div> +</body> + +</html> \ No newline at end of file -- Gitblit v1.9.3