mork 1 сар өмнө
parent
commit
a12c463583

+ 2 - 1
public/static/config/config.js

@@ -19,7 +19,8 @@ let systemConfig = {
     /* 以下为各模块定义各自全局变量的位置,包括 example 示例 */
     example: {
         scriptArr: [
-            "/static/plugins/skyscenery/plugins/CGCS2000ArcGisMapServerImageryProvider.js"
+            "/static/plugins/skyscenery/plugins/CGCS2000ArcGisMapServerImageryProvider.js",
+            "/static/plugins/skyscenery/plugins/3DTiles/add3DTiles.js"
         ]
     },
     skszk: {},

+ 111 - 61
src/views/wgn/sksj/index.vue

@@ -6,6 +6,7 @@
                 v-model="typeValue"
                 placeholder="Select"
                 style="width: 150px"
+                @change="changType"
                 >
                 <el-option
                     v-for="item in options"
@@ -14,8 +15,8 @@
                     :value="item.value"
                 />
                 </el-select>
-                <el-input v-if="typeValue != 5" v-model="inputAddress" style="width: 200px;height: 32px;padding: 0px 10px;" placeholder="输入URL地址……" />
-                <div style="padding: 0px 10px;" v-if="typeValue == 5">
+                <el-input v-if="typeValue != 6" v-model="inputAddress" style="width: 200px;height: 32px;padding: 0px 10px;" placeholder="输入URL地址……" />
+                <div style="padding: 0px 10px;" v-if="typeValue == 6">
                     <el-upload
                         ref="uploadRef"
                         action=""
@@ -67,7 +68,7 @@ export default {
             nowPoint: null,
             nowPointInfo:null,
             typeValue:'1',
-            inputAddress:'',
+            inputAddress:'http://121.43.55.7:8889/geoserver/kdyjs/wms',
             options:[
                 {
                     value: '1',
@@ -82,10 +83,14 @@ export default {
                 },
                 {
                     value: '4',
-                    label: '矢量服务',
+                    label: '3dtiles数据',
                 },
+                // {
+                //     value: '5',
+                //     label: '矢量数据',
+                // },
                 {
-                    value: '5',
+                    value: '6',
                     label: '矢量文件',
                 }
             ]
@@ -275,36 +280,17 @@ export default {
                 // debugger
             }
         },
-        changBaseWMTS(){
-            let params = {layers: "WMTS-sksj",name:'WMTS-sksj',url:systemConfig.GEOSERVER_URL_WFS};
-            if(this.wmslayer[params.name]){
-                viewer.imageryLayers.remove(toRaw(this.wmslayer[params.name]))
-                 delete this.wmslayer[params.name];
-
-            }else{
-                let layer = viewer.imageryLayers.addImageryProvider(
-                    new SkyScenery.WebMapServiceImageryProvider({
-                        url: params.url,
-                        layers: params.layers,
-                        parameters: {
-                        TRANSPARENT: true,
-                        format: "image/png"
-                        }
-                    })
-                )
-                this.wmslayer[params.name] = layer;
-            }
-        },
-        addWMTSLayer(type) {
+        addWMTSLayer(param) {
             let matrixIds = [];
             for (let i = 0; i < 19; i++) {
                 matrixIds[i] = i + 1;
             }
-            console.log('[ WMTS ] >'+param)
-           viewer.imageryLayers.addImageryProvider(
+            // this.removeMapLayer();
+            // console.log('[ WMTS ] >'+param)
+            let layer = viewer.imageryLayers.addImageryProvider(
                 new SkyScenery.WebMapTileServiceImageryProvider({
-                    url: systemConfig.TDT_URL + type + "_w/wmts?tk=f74e6c0cc247c42af05f7053e0b5fb9b",
-                    layer: type,
+                    url: param.url,
+                    layer: param.layers, // 固定的 cia  img  vec  cva 四种类型
                     style: "default",
                     format: "tiles",
                     // format:"image/png",
@@ -316,66 +302,130 @@ export default {
                     tilingScheme: new SkyScenery.WebMercatorTilingScheme()
                 })
             );
+            this.wmslayer.mapItemLayer = layer;
         },
         addWMSLayer(param) {
-            console.log('[ WMS ] >'+param)
-            let url = param.url;
-            let layers = param.layers;
-            viewer.imageryLayers.addImageryProvider(
+            // console.log('[ WMS ] >'+param)
+            let layer =  viewer.imageryLayers.addImageryProvider(
                 new SkyScenery.WebMapServiceImageryProvider({
-                    url: url,
-                    layers: layers,
+                    url: param.url,
+                    layers: param.layers, //固定的已发布的类型
                     parameters: {
                         TRANSPARENT: true,
                         format: "image/png"
                     }
                 })
             );
-
-            // if (judge) {
-            //     let layer = viewer.imageryLayers.addImageryProvider(
-            //     new SkyScenery.WebMapServiceImageryProvider({
-            //         url: this.layerRoot,
-            //         layers: params.layers,
-            //         parameters: {
-            //         TRANSPARENT: true,
-            //         format: "image/png"
-            //         }
-            //     })
-            //     )
-            //     this.wmslayer[params.name] = layer;
-            // } else {
-            //     viewer.imageryLayers.remove(toRaw(this.wmslayer[params.name]))
-            //     delete this.wmslayer[params.name];
-            // }
-
-            
+            this.wmslayer.mapItemLayer = layer;
         },
         addARCGISLayer(param){
-            console.log('[ ArcGisMapServer ] >'+param)
+            // console.log('[ ArcGisMapServer ] >'+param)
+            // this.removeMapLayer();
             // 添加地图服务
-            viewer.imageryLayers.addImageryProvider(
+            let layer =  viewer.imageryLayers.addImageryProvider(
                 // 此处使用的地图服务地址也可存放在配置文件中
                 new SkyScenery.ArcGisMapServerImageryProvider({
                     url: param.url
                 })
             );
+            this.wmslayer.mapItemLayer = layer;
+        },
+        removeMapLayer(){
+            // console.log('[ eee ] >')
+            if(this.wmslayer.mapItemLayer){
+                viewer.imageryLayers.remove(toRaw(this.wmslayer.mapItemLayer))
+                delete this.wmslayer.mapItemLayer;
+            }
+            
+        },
+        getVectorData(param){
+            let that = this;
+            fetch(param.url, {
+                method: 'GET',
+            }).then(response => response.json()) // 假设服务器返回 JSON 数据
+                .then(data => {
+                    console.log('[ eee ] >')
+                    that.dataJson = data.result;
+                    that.closeWin()
+                    that.dwanMap()
+                })
+        },
+        add3dtilesData(param){
+            console.log('[ add3dtilesData ] >'+param)
+            let tile1 = new SkyScenery.add3DTilesData(param.url, viewer)
+            tile1.readyPromise.then(function (tileset) {
+                viewer.zoomTo(tile1)
+            });
+        },
+        changType(){
+            let that = this;
+            // this.inputAddress = '';
+            if(that.typeValue == 1){
+                let curUrl = 'http://121.43.55.7:8889/geoserver/kdyjs/wms';
+                that.inputAddress = curUrl;
+            }else if(that.typeValue == 2){
+                let type = "vec"; //cia  img  vec  cva
+                let curUrl = "https://{s}.tianditu.gov.cn/"+type+"_w/wmts?tk=f74e6c0cc247c42af05f7053e0b5fb9b";
+                that.inputAddress = curUrl;
+             
+            }else if(that.typeValue == 3){
+                let curUrl = 'https://service-api.onemap.sh.gov.cn/data-service-manage-service/MapProxyApi/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHBsaWNhdGlvbl9pZCI6NjEsImFwcGxpY2F0aW9uX25hbWUiOiLpnZLmtabkuozkuInnu7TmnI3liqHns7vnu58iLCJleHAiOjIwNDY2Nzg0MDN9.IKUMdjUX4U1jncIUNren-iotL7duXI90aLECMjpvUX8/shmap_normal_web/MapServer';
+                that.inputAddress = curUrl;
+            }else if(that.typeValue == 4){
+                let curUrl = "http://121.43.55.7:65456/shzx/tileset.json";
+                that.inputAddress = curUrl;
+            }else if(that.typeValue == 5){
+                let curUrl = "http://121.43.55.7:10018/kdyjs/shop/recommend?type=1&size=20&banned=1,2,3";
+                that.inputAddress = curUrl;
+            }else if(that.typeValue == 6){
+                that.inputAddress = "";
+            }
         },
         parse(){
+            let that = this;
+            if( that.typeValue != 6 && that.inputAddress == ''){
+                return ElMessage({
+                    type: 'error',
+                    message: `输入地址不能为空!请输入地址后进行解析`,
+                })
+            }
             console.log('[ eee ] >')
             //  typeValue:'1',
             // inputAddress:'',
-            let that = this;
+            
             if(that.typeValue == 1){
-                
+                // let curUrl = that.inputAddress;
+                let curUrl = 'http://121.43.55.7:8889/geoserver/kdyjs/wms';
+                that.inputAddress = curUrl;
+                let param = {url:curUrl,layers:'kdyjs:CourtyardFace'}
+                that.addWMSLayer(param)
+
             }else if(that.typeValue == 2){
+                let type = "vec"; //cia  img  vec  cva
+                let curUrl = "https://{s}.tianditu.gov.cn/"+type+"_w/wmts?tk=f74e6c0cc247c42af05f7053e0b5fb9b";
+                that.inputAddress = curUrl;
+                let param = {url:curUrl,layers:type}
+                that.addWMTSLayer(param)
              
             }else if(that.typeValue == 3){
-                let param = {url:'https://service-api.onemap.sh.gov.cn/data-service-manage-service/MapProxyApi/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHBsaWNhdGlvbl9pZCI6NjEsImFwcGxpY2F0aW9uX25hbWUiOiLpnZLmtabkuozkuInnu7TmnI3liqHns7vnu58iLCJleHAiOjIwNDY2Nzg0MDN9.IKUMdjUX4U1jncIUNren-iotL7duXI90aLECMjpvUX8/shmap_normal_web/MapServer'}
+                // let curUrl = that.inputAddress;
+                let curUrl = 'https://service-api.onemap.sh.gov.cn/data-service-manage-service/MapProxyApi/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHBsaWNhdGlvbl9pZCI6NjEsImFwcGxpY2F0aW9uX25hbWUiOiLpnZLmtabkuozkuInnu7TmnI3liqHns7vnu58iLCJleHAiOjIwNDY2Nzg0MDN9.IKUMdjUX4U1jncIUNren-iotL7duXI90aLECMjpvUX8/shmap_normal_web/MapServer';
+                that.inputAddress = curUrl;
+                let param = {url:curUrl,layers:'arcgisLayer'}
                 that.addARCGISLayer(param)
             }else if(that.typeValue == 4){
-             
+                // let curUrl = that.inputAddress;
+                let curUrl = "http://121.43.55.7:65456/shzx/tileset.json";
+                that.inputAddress = curUrl;
+                let param = {url:curUrl}
+                that.add3dtilesData(param);
             }else if(that.typeValue == 5){
+                // let curUrl = that.inputAddress;
+                let curUrl = "https://kdyjs-proxy.metamaker.cn/proxy_map/static/json/%E6%A5%BC%E5%AE%87%E6%95%B0%E6%8D%AE-20250820.geojson";
+                that.inputAddress = curUrl;
+                let param = {url:curUrl}
+                that.getVectorData(param);
+            }else if(that.typeValue == 6){
                 //上传GeoJson文件解析数据并上图
                 if(this.mapHandle){
                     toRaw(this.mapHandle).destroy();