From 5206e7a4f4c5b71c9ddeccdbbe5e7fba5b3eeb9b Mon Sep 17 00:00:00 2001 From: lixuliang <lixuliang_hd@126.com> Date: 星期五, 22 三月 2024 01:05:38 +0800 Subject: [PATCH] YOUHAU --- src/components/rightMenu/bottom2.vue | 4 ++++ src/components/leftMenu/sousuo2.vue | 9 ++------- src/utils/tool.js | 3 ++- src/utils/map2.js | 25 +++++++++++++++++++++---- src/components/leftMenu/bottom2.vue | 1 + src/components/sideMenu/layerTreePanel/layerTreePanel2.vue | 11 +++++------ 6 files changed, 35 insertions(+), 18 deletions(-) diff --git a/src/components/leftMenu/bottom2.vue b/src/components/leftMenu/bottom2.vue index 3083ef7..3f69312 100644 --- a/src/components/leftMenu/bottom2.vue +++ b/src/components/leftMenu/bottom2.vue @@ -171,6 +171,7 @@ window.mapapi.getView().animate({ // 鍙缃渶瑕佺殑灞炴�у嵆鍙� center: [116.52217697339846, 39.75979421847914], // 涓績鐐� + projection: "EPSG:3857", zoom: 12, // 缂╂斁绾у埆 rotation: undefined, // 缂╂斁瀹屾垚view瑙嗗浘鏃嬭浆寮у害 duration: 1000, // 缂╂斁鎸佺画鏃堕棿锛岄粯璁や笉闇�瑕佽缃� diff --git a/src/components/leftMenu/sousuo2.vue b/src/components/leftMenu/sousuo2.vue index 27dd400..a657f92 100644 --- a/src/components/leftMenu/sousuo2.vue +++ b/src/components/leftMenu/sousuo2.vue @@ -429,18 +429,13 @@ ); }) .forEach((val) => { - let poiarr = val.location.split(","); - let poi = { - lon: parseFloat(poiarr[0]), - lat: parseFloat(poiarr[1]), - }; let obj = { address: val.address, adname: val.area, cityname: val.city, id: val.uid, - lat: val.location.lat, - lng: val.location.lng, + lat: parseFloat(val.location.lat), + lng: parseFloat(val.location.lng), name: val.name, pname: val.province, }; diff --git a/src/components/rightMenu/bottom2.vue b/src/components/rightMenu/bottom2.vue index b513f7a..e716acf 100644 --- a/src/components/rightMenu/bottom2.vue +++ b/src/components/rightMenu/bottom2.vue @@ -105,6 +105,7 @@ window.mapapi.getView().animate({ // 鍙缃渶瑕佺殑灞炴�у嵆鍙� center: window.mapapi.getView().getCenter(), // 涓績鐐� + projection: "EPSG:3857", zoom: zoom + 1, // 缂╂斁绾у埆 rotation: undefined, // 缂╂斁瀹屾垚view瑙嗗浘鏃嬭浆寮у害 duration: 1000, // 缂╂斁鎸佺画鏃堕棿锛岄粯璁や笉闇�瑕佽缃� @@ -116,6 +117,7 @@ window.mapapi.getView().animate({ // 鍙缃渶瑕佺殑灞炴�у嵆鍙� center: window.mapapi.getView().getCenter(), // 涓績鐐� + projection: "EPSG:3857", zoom: zoom - 1, // 缂╂斁绾у埆 rotation: undefined, // 缂╂斁瀹屾垚view瑙嗗浘鏃嬭浆寮у害 duration: 1000, // 缂╂斁鎸佺画鏃堕棿锛岄粯璁や笉闇�瑕佽缃� @@ -125,6 +127,7 @@ window.mapapi.getView().animate({ // 鍙缃渶瑕佺殑灞炴�у嵆鍙� center: ol.proj.fromLonLat([116.52217697339846, 39.75979421847914]), // 涓績鐐� + projection: "EPSG:3857", zoom: 12, // 缂╂斁绾у埆 rotation: undefined, // 缂╂斁瀹屾垚view瑙嗗浘鏃嬭浆寮у害 duration: 1000, // 缂╂斁鎸佺画鏃堕棿锛岄粯璁や笉闇�瑕佽缃� @@ -134,6 +137,7 @@ window.mapapi.getView().animate({ // 鍙缃渶瑕佺殑灞炴�у嵆鍙� center: window.personalPoi, // 涓績鐐� + projection: "EPSG:3857", zoom: 17, // 缂╂斁绾у埆 rotation: undefined, // 缂╂斁瀹屾垚view瑙嗗浘鏃嬭浆寮у害 duration: 1500, // 缂╂斁鎸佺画鏃堕棿锛岄粯璁や笉闇�瑕佽缃� diff --git a/src/components/sideMenu/layerTreePanel/layerTreePanel2.vue b/src/components/sideMenu/layerTreePanel/layerTreePanel2.vue index 37f4ab1..0d2eb1b 100644 --- a/src/components/sideMenu/layerTreePanel/layerTreePanel2.vue +++ b/src/components/sideMenu/layerTreePanel/layerTreePanel2.vue @@ -2005,8 +2005,6 @@ window.mapapi.getView().getZoom() == window.mapapi.getView().getMaxZoom() ) { - console.log("max"); - clusterSource.setDistance(0); } else { clusterSource.setDistance(40); @@ -2106,8 +2104,6 @@ window.mapapi.getView().getZoom() == window.mapapi.getView().getMaxZoom() ) { - console.log("max"); - clusterSource.setDistance(0); } else { clusterSource.setDistance(40); @@ -2381,16 +2377,19 @@ window.mapapi.removeLayer(window.jkspclusterLayer); window.mapapi.addLayer(window.qiyeclusterLayer); loading.close(); + //鐩戝惉鏈�澶у眰绾� 鑱氬悎璺濈涓�0 鍙栨秷鑱氬悎 window.mapapi.getView().on("change:resolution", function (event) { if ( window.mapapi.getView().getZoom() == window.mapapi.getView().getMaxZoom() ) { clusterSource.setDistance(0); + // clusterSource.getSource().clear() + // console.log("浼佷笟"); } else { clusterSource.setDistance(40); } - }); + }); // 鐩戝惉鍦板浘鍗曞嚮浜嬩欢 // window.mapapi.on("singleclick", function (e) { // var pixel = window.mapapi.getEventPixel(e.originalEvent); @@ -2507,7 +2506,7 @@ // cluster.billboard.height = 40; // } // }); - }, + }, testSDKcluster() { let clusterLayer1 = new SmartEarth.ClusterLayer(Viewer, { diff --git a/src/utils/map2.js b/src/utils/map2.js index f701baf..9c152c7 100644 --- a/src/utils/map2.js +++ b/src/utils/map2.js @@ -2376,6 +2376,7 @@ window.mapapi.forEachFeatureAtPixel(e.pixel, function (feature) { console.log(feature.getProperties(), 'aaa'); + //鎼滅储鐨勭偣浣� if (window.pointArr.length > 0) { let obj = feature.getProperties().desc @@ -2391,7 +2392,7 @@ for (const propertyNames in properties) { if (propertyNames.indexOf("鐩戞帶鍚�") !== -1) { const infoM = Message({ - message: '璇ョ偣浣嶈棰戠洃鎺ф煡璇腑锛岃绋嶅悗', + message: '璇ョ偣浣嶈棰戠洃鎺у姞杞戒腑锛岃绋嶅悗', type: 'info', offset: 75, center: true, @@ -2402,7 +2403,10 @@ // 璇锋眰鍦ㄧ嚎鐘舵�� window.gisBaseUrl + "BEApi/getCameraDetails?cameraIndexCode=" + properties["JK鍐呯爜"] - ).then(res => { + , { + timeout: 6000 + }) + .then(res => { if (res.data.data.status == 1) { infoM.close(); Message({ @@ -2432,14 +2436,25 @@ } else { infoM.close(); Message({ - message: '璇ョ偣浣嶈棰戠洃鎺х绾夸腑', - type: 'errer', + message: '璇ヨ棰戠洃鎺х绾夸腑', + type: 'error', offset: 75, center: true, duration: 2000, }); return } + }) + .catch(err => { + infoM.close(); + Message({ + message: '璇ヨ棰戠洃鎺ц姹傝秴鏃�', + type: 'error', + offset: 75, + center: true, + duration: 2000, + }); + return }) return } else if (propertyNames.indexOf("閮ㄤ欢鍚嶇О") !== -1) { @@ -2498,6 +2513,7 @@ export function flyToPoint(posisitons) { window.mapapi.getView().animate({ center: ol.proj.fromLonLat(posisitons), + projection: "EPSG:3857", zoom: 18, duration: 1500 }) @@ -2513,6 +2529,7 @@ if (len === 2) { window.mapapi.getView().animate({ center: window.mapapi.getView().getCenter(), + projection: "EPSG:3857", zoom: window.mapapi.getView().getZoom() - 1, duration: 1000, }); diff --git a/src/utils/tool.js b/src/utils/tool.js index 736d888..2de79ff 100644 --- a/src/utils/tool.js +++ b/src/utils/tool.js @@ -132,7 +132,8 @@ url: `https://skyzt.bda.gov.cn/yzAdapter/Vector/?request=1&year=${layerName}&type=Sate&level={z}&x={x}&y={y}`, }) }); - window.mapapi.addLayer(_GLOBAL.historyLayer); + // window.mapapi.addLayer(_GLOBAL.historyLayer); + layersArray.insertAt(1, _GLOBAL.historyLayer); } var topResolution = 896.0859375; var resolutions = []; -- Gitblit v1.9.3