wuxiang hace 2 años
padre
commit
06a24cf372
Se han modificado 2 ficheros con 19 adiciones y 23 borrados
  1. 11 15
      src/views/situation/index.vue
  2. 8 8
      vue.config.js

+ 11 - 15
src/views/situation/index.vue

@@ -184,7 +184,7 @@ export default ({
         navigationHelpButton: false,
         selectionIndicator: false,
         imageryProvider:  new this.Cesium.WebMapServiceImageryProvider({
-          url: 'http://localhost:8080/geoserver/map/wms',
+          url: '/geoserver/map/wms',
             // 这里是自定义的图层名称
             layers: 'map',
             parameters: {
@@ -194,20 +194,16 @@ export default ({
             }
         }),
 
+      imageryProvider:  new this.Cesium.WebMapTileServiceImageryProvider({
+          url: "http://localhost:8080/geoserver/gwc/service/wmts/rest/map:map/{style}/{TileMatrixSet}/{TileMatrixSet}:{TileMatrix}/{TileRow}/{TileCol}?format=image/png",
+          layer: 'map:map',
+          style: 'raster',
+          format: 'image/png',
+          tileMatrixSetID: 'EPSG:900913',      //一般使用EPSG:3857坐标系
+        
+        }),
+
       });
-      // imageryProvider:  new this.Cesium.WebMapTileServiceImageryProvider({
-      //     url: "http://localhost:8080/geoserver/gwc/service/wmts/rest/map:map/{style}/{TileMatrixSet}/{TileMatrixSet}:13/{TileRow}/{TileCol}?format=image/png",
-      //     layer: 'map:map',
-      //     style: 'raster',
-      //     format: 'image/png',
-      //     tileMatrixSetID: 'EPSG:900913',      //一般使用EPSG:3857坐标系
-      //     tileMatrixLabels: ['13'],
-      //     tilingScheme: new this.Cesium.WebMercatorTilingScheme(),
-      //     maximumLevel: 13,
-      //     rectangle: new this.Cesium.Rectangle.fromDegrees(106.43, 17.47, 132.97, 35.56)
-      //   }),
-
-      // });
       this.viewer._cesiumWidget._creditContainer.style.display = "none";
       this.viewer.camera.setView({
         destination: new this.Cesium.Cartesian3.fromDegrees(117.918977,25.0,1500000),
@@ -217,7 +213,7 @@ export default ({
         //   pitch: this.Cesium.Math.toRadians(-45) ,//设置俯仰角度为-45度
         // }
       })
-      this.viewer.scene.screenSpaceCameraController.maximumZoomDistance = 1500000;  //相机高度的最大值
+      // this.viewer.scene.screenSpaceCameraController.maximumZoomDistance = 1500000;  //相机高度的最大值
     },
     removeAllModel(){
       this.viewer.entities.removeAll(); // 移除全部模型

+ 8 - 8
vue.config.js

@@ -57,15 +57,15 @@ module.exports = {
           target: 'http://192.168.1.6:1234',
           ws: true,
           changeOrigin: true
+        },
+        '/geoserver': {
+          target: 'http://localhost:8080',
+          ws: true,
+          changeOrigin: true,
+          // pathRewrite:{
+          //   "^/geoserver":""
+          // } 
         }
-        // '/geoserver': {
-        //   target: 'http://localhost:8080',
-        //   ws: true,
-        //   changeOrigin: true,
-        //   // pathRewrite:{
-        //   //   "^/geoserver":""
-        //   // } 
-        // }
           
       }
     },