From 12075d0fa73d963ff5d6dbc4727fb95fb6084961 Mon Sep 17 00:00:00 2001
From: surprise <15810472099@163.com>
Date: 星期五, 01 三月 2024 09:32:40 +0800
Subject: [PATCH] 代码更新

---
 src/assets/js/Map/olMap.js |   26 ++++++++++++--------------
 1 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/src/assets/js/Map/olMap.js b/src/assets/js/Map/olMap.js
index 2b0a562..65f8492 100644
--- a/src/assets/js/Map/olMap.js
+++ b/src/assets/js/Map/olMap.js
@@ -180,12 +180,11 @@
 
   addWmts(res) {
     this.initMap();
-    console.log(res)
-    console.log(res.category)
     if (res.category == 4) {//鍒ゆ柇鏄惁涓篈rcgis鏈嶅姟
       addArcGisWmst(res);
     } else {
       addGeoWmst(res);
+      // addArcGisWmst(res)
     }
   },
 };
@@ -271,21 +270,22 @@
   }, 500);
 }
 function addArcGisWmst(res) {
-  console.log(res.url)
+ 
   olMap.initMap();
   var olMapDate = null;
-  if (res.url.indexOf('south') > -1) {//鍗楁瀬
+ 
+  if (res.cnName.indexOf('鍗楁瀬鎶曞奖') > -1) {//鍗楁瀬
     olMapDate = proDate.south;
-  } else if (res.url.indexOf('north') > -1) {//鍖楁瀬
+  } else if (res.cnName.indexOf('鍖楁瀬鎶曞奖') > -1) {//鍖楁瀬
     olMapDate = proDate.north;
-  } else if (res.url.indexOf('near') > -1) {//鍖楁瀬
+  } else if (res.cnName.indexOf('杩戝湴鎶曞奖') > -1) {//鍖楁瀬
     olMapDate = proDate.near;
-  } else if (res.url.indexOf('far') > -1) {//鍖楁瀬
+  } else if (res.cnName.indexOf('杩滃湴鎶曞奖') > -1) {//鍖楁瀬
     olMapDate = proDate.far;
-  } else if (res.url.indexOf('equid') > -1) {//鍖楁瀬
+  } else if (res.cnName.indexOf('绛夎窛绂�') > -1) {//鍖楁瀬
     olMapDate = proDate.equid;
   }
-  console.log(res.url)
+ 
   if(!olMapDate)return
   if(!olMapDate.extent)return;
   var extent = olMapDate.extent;
@@ -303,7 +303,8 @@
   };
   ol.proj.addProjection(proj);
   var ResolutionsAndMids = getResolutionsAndMids(12);
-  var arcUrl = res.url;
+  var arcUrl =olMap.getLayrUrl( res);
+ 
   var arcgisLayer = new ol.layer.Tile({
     source: new ol.source.XYZ({
 
@@ -325,16 +326,13 @@
   let mousePositionControl = new ol.control.MousePosition({
     coordinateFormat: (coordinate) => {
       var sourceProj = mapCode; 
-      console.log("yuanshi",mapCode)
+ 
       var destProj = "ESRI:104903"; // 鐩爣鍧愭爣绯讳负澧ㄥ崱鎵樻姇褰�
       var olLon = coordinate[0]
       var olLat = coordinate[1];
-      console.log(olLon, olLat)
       var destCoord = ol.proj.transform([olLon, olLat], sourceProj, destProj);
-
       store.state.olLon = destCoord[0].toFixed(6)
       store.state.olLat = destCoord[1].toFixed(6);
-
       if (olMap.map) {
         store.state.olZoom = parseInt(olMap.map.getView().getZoom())
       }

--
Gitblit v1.9.3