From f99c96adfe3ec59712cdadf88d54416c7742cc21 Mon Sep 17 00:00:00 2001 From: Surpriseplus <845948745@qq.com> Date: 星期日, 08 十月 2023 11:15:11 +0800 Subject: [PATCH] 代码更新 --- static/SmartEarthSDK/Workers/image/1.png | 0 index.html | 1 src/assets/js/rpc.js | 35 +++++++++++ src/components/map/viewer.vue | 2 static/Polyline.js | 82 +++++++++++++++++++++++++++ src/assets/js/mapMsg.js | 51 ++++++++-------- 6 files changed, 144 insertions(+), 27 deletions(-) diff --git a/index.html b/index.html index bcec9a2..fe9734f 100644 --- a/index.html +++ b/index.html @@ -15,6 +15,7 @@ <script src="./static/SmartEarthSDK/Workers/jquery-2.0.3.js"></script> <script src="./static/SmartEarthSDK/SmartEarth.min.js"></script> <script src="./static/SmartEarthSDK/Workers/layui/layui.all.js"></script> + <script src="./static/Polyline.js"></script> </head> <body oncontextmenu="return false;" ondragstart="return false;" onselectstart="return false;"> diff --git a/src/assets/js/mapMsg.js b/src/assets/js/mapMsg.js index 98eb4eb..8430e25 100644 --- a/src/assets/js/mapMsg.js +++ b/src/assets/js/mapMsg.js @@ -1,15 +1,17 @@ import mapData from "../../../static/mapData"; import rpc from "./rpc"; -import vueEvents from '@/utils/vueEvent.js' +import vueEvents from "@/utils/vueEvent.js"; window.mapMsg = { setTimeInterval: null, testMsg(res) { this.setMsgMatching({ message: res, baidu_keys: { - results: [{ - word: res - }] + results: [ + { + word: res + } + ] } }); }, @@ -19,67 +21,66 @@ if (this.setTimeInterval) { clearInterval(this.setTimeInterval); this.setTimeInterval = null; - } if (res.data.status === "ok") { that.setMsgMatching(res.data.params); } - this.setTimeInterval = setTimeout((res) => { + this.setTimeInterval = setTimeout(res => { vueEvents.$emit("queryData", false); rpc.setClearAllMsg(); - rpc.setLineRoaming() + rpc.setLineRoaming(); clearInterval(this.setTimeInterval); this.setTimeInterval = null; - }, 70000) - + }, 70000); }); + + }, + //娑堟伅鍖归厤 setMsgMatching(result) { var param = result.message; var rest = mapData.msgMach.rest; var rom = mapData.msgMach.lineRoam; var closeRomData = mapData.msgMach.closeRoam; - var valRest = rest.filter((rs) => { + var valRest = rest.filter(rs => { if (param.indexOf(rs) > -1) { return rs; } - }) + }); // 鍦板浘澶嶄綅 if (valRest.length > 0) { - vueEvents.$emit("queryData", false); rpc.setClearAllMsg(); rpc.setMapRest(); - return + return; } //婕父 - var valRom = rom.filter((rs) => { + var valRom = rom.filter(rs => { if (param.indexOf(rs) > -1) { return rs; } - }) + }); if (valRom.length > 0) { - vueEvents.$emit("queryData", false); rpc.setClearAllMsg(); - rpc.setLineRoaming() - return + rpc.setLineRoaming(); + return; } // 鍋滄婕父 - var closeRom = closeRomData.filter((rs) => { + var closeRom = closeRomData.filter(rs => { if (param.indexOf(rs) > -1) { - return rs + return rs; } }); if (closeRom.length > 0) { rpc.setCloseLineRomaing(); - return + return; } - rpc.getFuzzyQuery(result) - - }, + rpc.getFuzzyQuery(result); + } }; -export default mapMsg \ No newline at end of file +export default mapMsg; + diff --git a/src/assets/js/rpc.js b/src/assets/js/rpc.js index ffbf4d7..f8da644 100644 --- a/src/assets/js/rpc.js +++ b/src/assets/js/rpc.js @@ -208,6 +208,39 @@ ); } }); + + // var positions = [ + // 108.95846, + // 34.22104, + // 108.96039, + // 34.22104, + // 108.96046, + // 34.21804, + // 108.95843, + // 34.21804, + // 108.95846, + // 34.22104 + // ]; + // var wall = Viewer.entities.add({ + // name: "绔嬩綋澧欐晥鏋�", + // wall: { + // positions: Cesium.Cartesian3.fromDegreesArray(positions), + + + // material: new Cesium.DynamicWallMaterialProperty({ + // color: Cesium.Color.RED, + // duration: 4000 + // }), + // // 璁剧疆楂樺害 + // maximumHeights: [20, 20, 20, 20, 20], + // minimumHeights: [0, 0, 0, 0, 0], + // } + // }) + + // setTimeout(() => { + // Viewer.flyTo(wall) + // }, 20000); + }, // 鏄剧ず鍥尯鑼冨洿 getPark(res) { @@ -671,7 +704,7 @@ }); setTimeout(() => { this.setClearPointFly(); - }, 5000); + }, 8000); }, changeCameraHeading(res) { var nextIndex = this.marksIndex + 1; diff --git a/src/components/map/viewer.vue b/src/components/map/viewer.vue index 0a975b3..4c281cf 100644 --- a/src/components/map/viewer.vue +++ b/src/components/map/viewer.vue @@ -60,7 +60,7 @@ let that = this; let option = { fullscreenButton: true, - licenseServer: "http://183.162.245.49:18080", + // licenseServer: "http://183.162.245.49:18080", minViewHeight: parseFloat(common.minviewheight), // url: SmartEarthRootUrl + "Workers/image/earth.jpg", //涓嶅惈鍗曞紶鍦板浘鍥剧墖url鍒欎娇鐢ㄥ湪绾垮湴鍥� contextOptions: { diff --git a/static/Polyline.js b/static/Polyline.js new file mode 100644 index 0000000..25226d9 --- /dev/null +++ b/static/Polyline.js @@ -0,0 +1,82 @@ + + + +//鍔ㄦ�佸鏉愯川 +function DynamicWallMaterialProperty(options) { + // 榛樿鍙傛暟璁剧疆 + this._definitionChanged = new Cesium.Event(); + this._color = undefined; + this._colorSubscription = undefined; + this.color = options.color; + this.duration = options.duration; + this.trailImage = options.trailImage; + this._time = (new Date()).getTime(); +} +Object.defineProperties(DynamicWallMaterialProperty.prototype, { + isConstant: { + get: function () { + return false; + } + }, + definitionChanged: { + get: function () { + return this._definitionChanged; + } + }, + color: Cesium.createPropertyDescriptor('color') +}); +DynamicWallMaterialProperty.prototype.getType = function (time) { + return 'DynamicWall'; +}; +DynamicWallMaterialProperty.prototype.getValue = function (time, result) { + if (!Cesium.defined(result)) { + result = {}; + } + result.color = Cesium.Property.getValueOrClonedDefault(this._color, time, Cesium.Color.WHITE, result.color); + if (this.trailImage) { + result.image = this.trailImage; + } else { + result.image = Cesium.Material.DynamicWallImage + } + + if (this.duration) { + result.time = (((new Date()).getTime() - this._time) % this.duration) / this.duration; + } + Viewer.scene.requestRender(); + return result; +}; +DynamicWallMaterialProperty.prototype.equals = function (other) { + return this === other || + (other instanceof DynamicWallMaterialProperty && + Cesium.Property.equals(this._color, other._color)) +}; +Cesium.DynamicWallMaterialProperty = DynamicWallMaterialProperty; +Cesium.Material.DynamicWallType = 'DynamicWall'; +Cesium.Material.DynamicWallImage = "/static/SmartEarthSDK/Workers/image/1.png"; +Cesium.Material.DynamicWallSource = "czm_material czm_getMaterial(czm_materialInput materialInput)\n\ + {\n\ + czm_material material = czm_getDefaultMaterial(materialInput);\n\ + vec2 st = materialInput.st;\n\ + vec4 colorImage = texture2D(image, vec2(fract(st.t - time), st.t));\n\ + vec4 fragColor;\n\ + fragColor.rgb = color.rgb / 1.0;\n\ + fragColor = czm_gammaCorrect(fragColor);\n\ + material.alpha = colorImage.a * color.a;\n\ + material.diffuse = color.rgb;\n\ + material.emission = fragColor.rgb;\n\ + return material;\n\ + }"; +Cesium.Material._materialCache.addMaterial(Cesium.Material.DynamicWallType, { + fabric: { + type: Cesium.Material.DynamicWallType, + uniforms: { + color: new Cesium.Color(1.0, 1.0, 1.0, 1), + image: Cesium.Material.DynamicWallImage, + time: 0 + }, + source: Cesium.Material.DynamicWallSource + }, + translucent: function (material) { + return true; + } +}); diff --git a/static/SmartEarthSDK/Workers/image/1.png b/static/SmartEarthSDK/Workers/image/1.png new file mode 100644 index 0000000..495c3ea --- /dev/null +++ b/static/SmartEarthSDK/Workers/image/1.png Binary files differ -- Gitblit v1.9.3