| | |
| | | > |
| | | <mapol></mapol> |
| | | </div> |
| | | <add-online-map ref="addOnlineMap" /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | |
| | | import mapsdk from "./mapsdk" |
| | | import mapol from "./mapol" |
| | | import { transform } from "ol/proj" |
| | | import ol from "ol" |
| | | import $ from "jquery" |
| | | import AddOnlineMap from '../views/Tools/AddOnlineMap.vue' |
| | | export default { |
| | | name: "", |
| | | |
| | | components: { |
| | | mapsdk, |
| | | mapol, |
| | | AddOnlineMap |
| | | }, |
| | | data() { |
| | | return { |
| | |
| | | } |
| | | return this.levelArray[this.levelArray.length - 1] |
| | | }, |
| | | showBaseMapLayer() { |
| | | this.$refs && this.$refs.addOnlineMap && this.$refs.addOnlineMap.open("å°ä¸æ¨¡å¼", null); |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.$bus.$on("setChangeBaseMapLayer", (res) => { |
| | | this.showBaseMapLayer() |
| | | |
| | | |
| | | }) |
| | | // |
| | | this.$bus.$on("changemap", e => { |
| | | if (this.isSplitFlag == 1) { |
| | | this.changeMap(3) |
| | |
| | | methods: { |
| | | |
| | | init2DMap() { |
| | | var vectorLayer = new TileLayer({ |
| | | source: new XYZ({ |
| | | url: "http://wprd0{1-4}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&style=7&x={x}&y={y}&z={z}", |
| | | }), |
| | | }) |
| | | var imageLayer = new TileLayer({ |
| | | source: new XYZ({ |
| | | url: "http://wprd0{1-4}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&style=6&x={x}&y={y}&z={z}", |
| | | }), |
| | | }) |
| | | // var vectorLayer = new TileLayer({ |
| | | // source: new XYZ({ |
| | | // url: "http://wprd0{1-4}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&style=7&x={x}&y={y}&z={z}", |
| | | // }), |
| | | // }) |
| | | // var imageLayer = new TileLayer({ |
| | | // source: new XYZ({ |
| | | // url: "http://wprd0{1-4}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&style=6&x={x}&y={y}&z={z}", |
| | | // }), |
| | | // }) |
| | | window.map = new Map({ |
| | | target: "mapol", |
| | | layers: [imageLayer, vectorLayer], |
| | | layers: [], |
| | | view: new View({ |
| | | center: [105.02, 34.9], |
| | | zoom: 4, |
| | | projection: "EPSG:4326", |
| | | minZoom: 4, |
| | | minZoom: 5, |
| | | }), |
| | | controls: defaultControls().extend([ |
| | | new FullScreen(), |
| | |
| | | ]), |
| | | interactions: defaultInteractions().extend([new DragRotateAndZoom()]), |
| | | }) |
| | | |
| | | window.olBaseMapLayer = new TileLayer({ |
| | | title: "é«å¾·å°å¾", |
| | | source: new XYZ({ |
| | | url: gaoDeBaseUrl[1].url, |
| | | wrapX: false |
| | | }) |
| | | }); |
| | | window.map.addLayer(window.olBaseMapLayer); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // var scaleLine = new ScaleLine({ |
| | | // units: "metric" |
| | | // }); |
| | |
| | | }, |
| | | |
| | | changeMenulayer() { |
| | | this.isActive = !this.isActive |
| | | this.isMenuLayer = !this.isMenuLayer |
| | | this.setLayerVisible() |
| | | this.$bus.$emit("setChangeBaseMapLayer", true) |
| | | // this.isActive = !this.isActive |
| | | // this.isMenuLayer = !this.isMenuLayer |
| | | // this.setLayerVisible() |
| | | }, |
| | | setLayerVisible() { |
| | | if (this.isActive == true) { |
| | |
| | | <!-- v-bind:class="{ active: isActive, menuLayer: isMenuLayer }"--> |
| | | <!-- ></div>--> |
| | | <!-- </div>--> |
| | | |
| | | </div> |
| | | </div> |
| | | </template> |
| | |
| | | import $ from "jquery"; |
| | | import mapMenuTop from "./MapView/mapMenuTop.vue"; |
| | | import mapSpaceTop from "./MapView/mapSpaceTop.vue"; |
| | | |
| | | import { |
| | | select_Comprehensive_ByPageAndCount, |
| | | select_Comprehensive_SelectWktById, |
| | |
| | | components: { |
| | | mapMenuTop, |
| | | mapSpaceTop, |
| | | |
| | | }, |
| | | data() { |
| | | var validatePosition = (rule, value, callback) => { |
| | |
| | | Viewer.camera.flyTo({ |
| | | destination: Cesium.Cartesian3.fromDegrees(110, 33, 8000000), |
| | | }); |
| | | this.layer1 = Viewer.imageryLayers.addImageryProvider( |
| | | new Cesium.UrlTemplateImageryProvider({ |
| | | url: gaoDeBaseUrl[0].url, |
| | | }) |
| | | ); |
| | | |
| | | this.layer2 = Viewer.imageryLayers.addImageryProvider( |
| | | window.BaseMapLayer = Viewer.imageryLayers.addImageryProvider( |
| | | new Cesium.UrlTemplateImageryProvider({ |
| | | url: gaoDeBaseUrl[1].url, |
| | | }) |
| | | ); |
| | | // this.layer3 = Viewer.imageryLayers.addImageryProvider( |
| | | // new Cesium.UrlTemplateImageryProvider({ |
| | | // url: gaoDeBaseUrl[2].url, |
| | | // }) |
| | | // ); |
| | | |
| | | // window.ImageLayer3 = this.layer3; |
| | | |
| | | // for (var i in gaoDeBaseUrl) { |
| | | // sgworld.Creator.createUrlTemplateImageryProvider( |
| | | // gaoDeBaseUrl[i].label, |
| | | // gaoDeBaseUrl[i].url, |
| | | // '0', |
| | | // undefined, |
| | | // true, |
| | | // '' |
| | | // ); |
| | | // } |
| | | |
| | | Viewer._enableInfoOrSelection = false; |
| | | //æ¾ç¤ºfps |
| | |
| | | //å¼å¯æ·±åº¦æ£æµ |
| | | // sgworld.Analysis.depthTestAgainstTerrain(true) |
| | | Viewer.scene.globe.depthTestAgainstTerrain = true; |
| | | //å½±å对æ¯è®¾ç½® |
| | | // var base = { |
| | | // url: 'https://a.tile.openstreetmap.org/', |
| | | // }; |
| | | // window.openStreetMap = sgworld.Creator.createImageryProvider( |
| | | // 'OpenStreetMap', |
| | | // 'OpenStreetMap', |
| | | // base, |
| | | // '0', |
| | | // undefined, |
| | | // true, |
| | | // '' |
| | | // ); |
| | | // openStreetMap.item.show = false; |
| | | |
| | | // Viewer.terrainProvider = new Cesium.CesiumTerrainProvider({ |
| | | // url: demLayer, |
| | | // }) |
| | | var option = { |
| | | url: window.sceneConfig.SGUrl, |
| | | layerName: window.sceneConfig.mptName, |
| | |
| | | window.elevationTool = new SmartEarth.ElevationTool(window.sgworld); |
| | | elevationTool.setContourColor("#F1D487"); |
| | | |
| | | // var helper = new Cesium.EventHelper(); |
| | | // helper.add(Viewer.scene.globe.tileLoadProgressEvent, function (e) { |
| | | |
| | | // if (e == 0) { |
| | | // console.log("è¿ä¸ªæ¯å è½½æåä¸ä¸ªç¢éåççåè°"); |
| | | // } |
| | | // helper.removeAll(); |
| | | // helper = undefined; |
| | | // }); |
| | | }, |
| | | |
| | | changeMenulayer() { |
| | | this.isActive = !this.isActive; |
| | | this.isMenuLayer = !this.isMenuLayer; |
| | | this.setLayerVisible(); |
| | | this.$bus.$emit("setChangeBaseMapLayer", true) |
| | | // this.$refs && this.$refs.addOnlineMap && this.$refs.addOnlineMap.open("å°ä¸æ¨¡å¼", null,); |
| | | // this.isActive = !this.isActive; |
| | | // this.isMenuLayer = !this.isMenuLayer; |
| | | // this.setLayerVisible(); |
| | | }, |
| | | setLayerVisible() { |
| | | if (this.isActive == true) { |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <Popup |
| | | ref="pop" |
| | | :title="title" |
| | | @close="close(true)" |
| | | width="400px" |
| | | @yes="addData" |
| | | @cancel="close(false)" |
| | | > |
| | | |
| | | <div |
| | | id="archTopBox" |
| | | class="archTopBox" |
| | | > |
| | | |
| | | <div |
| | | class="boxCard" |
| | | v-for="(item,index) in mapList" |
| | | > |
| | | <el-card class="box-card"> |
| | | <div |
| | | slot="header" |
| | | class="clearfix" |
| | | > |
| | | <span style="font-size:14px">{{item.name}}</span> |
| | | <div style="float: right; padding: 3px 0"> |
| | | <i |
| | | v-show="!item.isShow" |
| | | style="margin-left:10px" |
| | | class="el-icon-arrow-up" |
| | | :title="$t('archiveObj.fold')" |
| | | @click="setCardChange(item)" |
| | | ></i> |
| | | <i |
| | | v-show="item.isShow" |
| | | style="margin-left:10px" |
| | | class="el-icon-arrow-down" |
| | | :title="$t('archiveObj.develop')" |
| | | @click="setCardChange(item)" |
| | | ></i> |
| | | </div> |
| | | </div> |
| | | <div |
| | | :id="item.id" |
| | | style="margin:5px 1px" |
| | | v-show="!item.isShow" |
| | | > |
| | | <div style="margin:10px;width:380px"> |
| | | <div |
| | | class="map" |
| | | v-for="(map, mapIndex) in item.list" |
| | | @click="addImageLayer(map, item)" |
| | | > |
| | | <img |
| | | style="width: 60px; height: 60px" |
| | | :src="map.image" |
| | | ></img> |
| | | <div> <el-link :underline="false"> |
| | | {{ map.name }} |
| | | </el-link></div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </el-card> |
| | | |
| | | </div> |
| | | |
| | | <!-- <el-collapse :value="activeNames"> |
| | | <el-collapse-item |
| | | v-for="(mapCollection, index) in mapList" |
| | | :title="mapCollection.name" |
| | | :name="mapCollection.name" |
| | | :key="index" |
| | | > |
| | | <div |
| | | class="map" |
| | | v-for="(map, mapIndex) in mapCollection.list" |
| | | :key="mapIndex" |
| | | @click="addImageLayer(map, mapCollection)" |
| | | > |
| | | <el-image |
| | | style="width: 60px; height: 60px" |
| | | :src="require(`@assets/imageLayer/${map.image}`)" |
| | | fit="fill" |
| | | ></el-image> |
| | | <span>{{ map.name }}</span> |
| | | </div> |
| | | </el-collapse-item> |
| | | </el-collapse> --> |
| | | </div> |
| | | </el-form> |
| | | </Popup> |
| | | </template> |
| | | |
| | | <script> |
| | | import Popup from "./Popup"; |
| | | import TileLayer from "ol/layer/Tile" |
| | | import XYZ from "ol/source/XYZ" |
| | | // å½±åå¾å± |
| | | |
| | | export default { |
| | | name: "AddOnlineMap", |
| | | components: { |
| | | Popup, |
| | | }, |
| | | mixins: [], |
| | | data() { |
| | | return { |
| | | title: "å¨çº¿å°å¾", |
| | | left: undefined, |
| | | tokne: "", |
| | | data: { |
| | | id: "", |
| | | sourceType: "", |
| | | name: "", |
| | | urls: "", |
| | | layer: "", |
| | | alpha: 1, |
| | | maximumLevel: 26, |
| | | zIndex: undefined, |
| | | }, |
| | | mapCollection: undefined, |
| | | mapList: [ |
| | | { |
| | | name: "天å°å¾", |
| | | sourceType: "tdmap", |
| | | tokne: "94a34772eb88317fcbf8428e10448561", |
| | | maximumLevel: 18, |
| | | id: 1, |
| | | isShow: true, |
| | | list: [ |
| | | { |
| | | name: "天å°å¾å°å¾", |
| | | image: require("../../assets/img/imageLayer/tdmap_map.jpg"), |
| | | urls: "http://t0.tianditu.com/vec_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=vec&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk=", |
| | | olUrls: 'http://t0.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=' |
| | | }, |
| | | { |
| | | name: "天å°å¾å½±å", |
| | | image: require("../../assets/img/imageLayer/tdmap_image.jpg"), |
| | | urls: "http://t0.tianditu.com/img_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=img&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk=", |
| | | olUrls: 'http://t0.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=' |
| | | }, |
| | | { |
| | | name: "天å°å¾å°å½¢", |
| | | image: require("../../assets/img/imageLayer/tdmap_label.jpg"), |
| | | urls: "http://t0.tianditu.com/ter_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=ter&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk=", |
| | | olUrls: 'http://t0.tianditu.gov.cn/DataServer?T=ter_w&x={x}&y={y}&l={z}&tk=' |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | name: "é«å¾·å°å¾", |
| | | sourceType: "gdmap", |
| | | maximumLevel: 18, |
| | | id: 2, |
| | | isShow: true, |
| | | list: [ |
| | | { |
| | | name: "é«å¾·å°å¾", |
| | | image: require("../../assets/img/imageLayer/gdmap_map.jpg"), |
| | | urls: "https://webst02.is.autonavi.com/appmaptile?style=7&x={x}&y={y}&z={z}", |
| | | }, |
| | | { |
| | | name: "é«å¾·å½±å", |
| | | image: require("../../assets/img/imageLayer/gdmap_image.jpg"), |
| | | urls: "https://webst02.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}", |
| | | }, |
| | | |
| | | ], |
| | | }, |
| | | |
| | | ], |
| | | }; |
| | | }, |
| | | computed: { |
| | | activeNames() { |
| | | return this.mapList.map((item) => { |
| | | return item.name; |
| | | }); |
| | | }, |
| | | }, |
| | | methods: { |
| | | setCardChange(res) { |
| | | res.isShow = !res.isShow |
| | | }, |
| | | // å
³éå¼¹çª |
| | | close(isCloseBtn, removeLayer = true) { |
| | | // removeLayer && this.removeImageLayer(); |
| | | |
| | | // éç½®dataå¼ |
| | | Object.assign(this.$data, this.$options.data()); |
| | | !isCloseBtn && this.$refs.pop.close(); |
| | | }, |
| | | // æå¼å¼¹çª |
| | | open() { |
| | | this.close(true); |
| | | this.$refs.pop.open(); |
| | | }, |
| | | changeToken(token) { |
| | | this.mapCollection.tokne = token; |
| | | }, |
| | | removeImageLayer() { |
| | | // window.BaseMapLayer && window.BaseMapLayer.deleteObject(); |
| | | // window.BaseMapLayer = undefined; |
| | | window.Viewer.imageryLayers.remove( |
| | | window.BaseMapLayer |
| | | ); |
| | | window.map.removeLayer(window.olBaseMapLayer); |
| | | }, |
| | | addImageLayer(map, mapCollection) { |
| | | |
| | | if ( |
| | | this.data.name === map.name && |
| | | (this.data.urls === map.urls || this.data.urls === mapCollection.urls) |
| | | ) { |
| | | return; |
| | | } |
| | | |
| | | this.removeImageLayer(); |
| | | |
| | | this.mapCollection = mapCollection; |
| | | |
| | | if (mapCollection.sourceType === "tdmap") { |
| | | var tokne = mapCollection.tokne; |
| | | //æ·»å 天å°å¾å½±å |
| | | |
| | | window.BaseMapLayer = Viewer.imageryLayers.addImageryProvider(new Cesium.WebMapTileServiceImageryProvider({ |
| | | url: map.urls + tokne, |
| | | layer: "tdtImgLayer", |
| | | style: "default", |
| | | format: "image/jpeg", |
| | | tileMatrixSetID: "GoogleMapsCompatible", |
| | | })) |
| | | window.olBaseMapLayer = new TileLayer({ |
| | | title: "é«å¾·å°å¾", |
| | | source: new XYZ({ |
| | | url: map.olUrls + tokne |
| | | |
| | | }), |
| | | zIndex: -1 |
| | | }); |
| | | window.map.addLayer(window.olBaseMapLayer); |
| | | } else if (mapCollection.sourceType === "gdmap") { |
| | | |
| | | window.BaseMapLayer = Viewer.imageryLayers.addImageryProvider( |
| | | new Cesium.UrlTemplateImageryProvider({ |
| | | url: map.urls, |
| | | maximumLevel: this.data.maximumLevel, |
| | | }) |
| | | ); |
| | | |
| | | window.olBaseMapLayer = new TileLayer({ |
| | | title: "é«å¾·å°å¾", |
| | | source: new XYZ({ |
| | | url: map.urls, |
| | | wrapX: false |
| | | }), |
| | | zIndex: -1 |
| | | }); |
| | | window.map.addLayer(window.olBaseMapLayer); |
| | | } |
| | | Viewer.imageryLayers.lowerToBottom(window.BaseMapLayer);//å°å¾å±ç§»å°æåºå± |
| | | |
| | | Viewer.imageryLayers.raise(window.BaseMapLayer);//å°å¾å±ä¸ç§»ä¸å± |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | }, |
| | | // æ·»å æ°æ® |
| | | addData() { |
| | | if (this.data.urls && this.data.sourceType) { |
| | | let data = { |
| | | id: window.sgworld.Core.getuid(), |
| | | ...this.data, |
| | | Level: [0, 26], |
| | | }; |
| | | if (data.sourceType === "tdmap") { |
| | | data.urls += "&tk=" + this.tokne; |
| | | } else if (data.sourceType === "bdmap") { |
| | | data.style = this.mapCollection.style; |
| | | } |
| | | if (this.mapCollection.GCJ02) { |
| | | data.GCJ02 = true; |
| | | } |
| | | |
| | | data.item = window.BaseMapLayer; |
| | | window.BaseMapLayer = undefined; |
| | | |
| | | this.$emit("success", data); |
| | | this.close(false, false); |
| | | } else { |
| | | this.$message("è¯·éæ©å°å¾"); |
| | | } |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped lang="less"> |
| | | /deep/.el-card__body { |
| | | padding: 0px !important; |
| | | } |
| | | .map { |
| | | display: inline-block; |
| | | cursor: pointer; |
| | | margin: 5px; |
| | | text-align: center; |
| | | |
| | | .el-image { |
| | | border: 2px solid #fff; |
| | | border-radius: 4px; |
| | | } |
| | | } |
| | | .boxCard { |
| | | margin-bottom: 5px; |
| | | } |
| | | </style> |