| | |
| | | <div class="mapMode"> |
| | | <div class="title" style="margin-top: 0px">地图模式</div> |
| | | <div class="container"> |
| | | <div class="layerItem" :key="value.id" v-for="(value, index) in eMapModeList" |
| | | @click.stop="handleEMapClick(value, index)"> |
| | | <img :src="value.src" :class="{ active: curEMapModelIndex == index }" /> |
| | | <div |
| | | class="layerItem" |
| | | :key="value.id" |
| | | v-for="(value, index) in eMapModeList" |
| | | @click.stop="handleEMapClick(value, index)" |
| | | > |
| | | <img |
| | | :src="value.src" |
| | | :class="{ active: curEMapModelIndex == index }" |
| | | /> |
| | | <span :class="{ spanActive: curEMapModelIndex == index }">{{ |
| | | value.name |
| | | }}</span> |
| | | </div> |
| | | <div class="layerItem" :key="value0.id" v-for="(value0, index0) in sMapModelList" |
| | | @click.stop="handleSMapClick(value0, index0)"> |
| | | <img :src="value0.src" :class="{ active: curSMapModelIndex == index0 }" /> |
| | | <div |
| | | class="layerItem" |
| | | :key="value0.id" |
| | | v-for="(value0, index0) in sMapModelList" |
| | | @click.stop="handleSMapClick(value0, index0)" |
| | | > |
| | | <img |
| | | :src="value0.src" |
| | | :class="{ active: curSMapModelIndex == index0 }" |
| | | /> |
| | | <span :class="{ spanActive: curSMapModelIndex == index0 }">{{ |
| | | value0.name |
| | | }}</span> |
| | |
| | | <div class="title"> |
| | | 专题应用 |
| | | <!-- 不显示更多图层 --> |
| | | <span class="more" v-show="false" @click.stop="showLayerTree">更多图层<i class="el-icon-arrow-right"></i></span> |
| | | <span class="more" v-show="false" @click.stop="showLayerTree" |
| | | >更多图层<i class="el-icon-arrow-right"></i |
| | | ></span> |
| | | </div> |
| | | <div class="container"> |
| | | <div class="layerItem" v-for="(ZTValue, ZTIndex) in zhuantiList" :key="ZTValue.id" |
| | | @click.stop="handleZTlick(ZTValue, ZTIndex)"> |
| | | <div |
| | | class="layerItem" |
| | | v-for="(ZTValue, ZTIndex) in zhuantiList" |
| | | :key="ZTValue.id" |
| | | @click.stop="handleZTlick(ZTValue, ZTIndex)" |
| | | > |
| | | <img :src="ZTValue.src" :class="{ active: curZTIndex == ZTIndex }" /> |
| | | <span :class="{ spanActive: curZTIndex == ZTIndex }">{{ |
| | | ZTValue.name |
| | |
| | | </div> |
| | | <div class="title2"></div> |
| | | <div class="container"> |
| | | <div class="layerItem" v-for="(funcValue, funcIndex) in FuncList" :key="funcValue.id" |
| | | @click.stop="handleFuncClick(funcIndex)"> |
| | | <img :src="funcValue.src" :class="{ active: curFuncIndex == funcIndex }" /> |
| | | <div |
| | | class="layerItem" |
| | | v-for="(funcValue, funcIndex) in FuncList" |
| | | :key="funcValue.id" |
| | | @click.stop="handleFuncClick(funcIndex)" |
| | | > |
| | | <img |
| | | :src="funcValue.src" |
| | | :class="{ active: curFuncIndex == funcIndex }" |
| | | /> |
| | | <span :class="{ spanActive: curFuncIndex == funcIndex }">{{ |
| | | funcValue.name |
| | | }}</span> |
| | |
| | | import store from "@/utils/store2.js"; |
| | | import ZTTitem from "@/utils/ztt2.js"; |
| | | import { layers } from "../../../../static/json/layer.js"; |
| | | |
| | | // import Tile from "ol/layer/Tile"; |
| | | // import XYZ from "ol/source/XYZ"; |
| | | // import { get as getProjection, getTransform } from "ol/proj"; |
| | | // import { createXYZ } from "ol/tilegrid"; |
| | | |
| | | import { |
| | | addImageLayer, |
| | | addAnnotationLayer, |
| | | addHxLayer, |
| | | addYzLayer, |
| | | loadBaseMap, |
| | | loadGeoMap, |
| | | clearAll, |
| | | } from "@/utils/tool"; |
| | | export default { |
| | | name: "LayerPanel", |
| | | data() { |
| | |
| | | }, |
| | | // 二维底图选择 |
| | | handleEMapClick(result, index) { |
| | | // 设置相机 |
| | | // if (result.name == "二维地图") { |
| | | // window.mapapi.getLayerByName("二维地图").setVisible(true); |
| | | // window.mapapi.getLayerByName("影像地图").setVisible(false); |
| | | // } else if (result.name == "影像地图") { |
| | | // window.mapapi.getLayerByName("影像地图").setVisible(true); |
| | | // window.mapapi.getLayerByName("二维地图").setVisible(false); |
| | | // } |
| | | |
| | | // 切换图层 |
| | | const val = layers.filter((res) => { |
| | | if (res.name == result.name) { |
| | | return res; |
| | | } |
| | | }); |
| | | const children = val[0].children; |
| | | // console.log(children, '111') |
| | | if (result.name == '影像地图') { |
| | | //加载航拍影像 |
| | | window.ImageLayer = new ol.layer.Tile({ |
| | | id: 'C0698021', |
| | | visible: true, |
| | | source: new ol.source.XYZ({ |
| | | wrapX: true, |
| | | url: `${'https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer'}/tile/{z}/{y}/{x}`, |
| | | }), |
| | | projection: new ol.proj.get('EPSG:4326') |
| | | }); |
| | | window.mapapi.addLayer(window.ImageLayer); |
| | | |
| | | //加载高德标注 |
| | | window.annotation = new ol.layer.Tile({ |
| | | id: '69EB42A8', |
| | | visible: true, |
| | | source: new ol.source.XYZ({ |
| | | wrapX: true, |
| | | url: `https://webst02.is.autonavi.com/appmaptile?style=8&x={x}&y={y}&z={z}`, |
| | | }), |
| | | projection: new ol.proj.get('EPSG:4326') |
| | | }); |
| | | window.mapapi.addLayer(window.annotation); |
| | | |
| | | |
| | | window.hexin = new ol.layer.Tile({ |
| | | source: new ol.source.TileWMS({ |
| | | ratio: 3, |
| | | url: 'https://skyzt.bda.gov.cn/gisserver/wmsserver/YZ_BJ60',//图层地址 |
| | | params: { |
| | | 'VERSION': '1.1.1', |
| | | 'SRS': 'EPSG:4326', |
| | | 'FORMAT': 'image/png', |
| | | 'TILED': true, |
| | | "LAYERS": '' |
| | | } |
| | | }) |
| | | }) |
| | | window.mapapi.addLayer(window.hexin) |
| | | |
| | | |
| | | //亦庄新城规划范围 |
| | | window.yizhuang = new ol.layer.Tile({ |
| | | source: new ol.source.TileWMS({ |
| | | ratio: 3, |
| | | url: 'https://skyzt.bda.gov.cn/gisserver/wmsserver/YZ_BJ',//图层地址 |
| | | params: { |
| | | 'VERSION': '1.1.1', |
| | | 'SRS': 'EPSG:4326', |
| | | 'FORMAT': 'image/png', |
| | | 'TILED': true, |
| | | "LAYERS": '' |
| | | } |
| | | }) |
| | | }) |
| | | window.mapapi.addLayer(window.yizhuang) |
| | | } else { |
| | | window.mapapi.removeLayer(window.ImageLayer); |
| | | window.mapapi.removeLayer(window.annotation) |
| | | window.mapapi.removeLayer(window.hexin); |
| | | window.mapapi.removeLayer(window.yizhuang); |
| | | } |
| | | |
| | | |
| | | |
| | | if (this.curEMapModelIndex == index) { |
| | | // 再次点击选中的item时取消选择 |
| | | // clearLayerByTypeId(result.id); |
| | | // this.curEMapModelIndex = -1; |
| | | } else { |
| | | this.curSMapModelIndex = -1; |
| | | this.curEMapModelIndex = index; |
| | | // clearLayerByTypeIdArr(["ewdt", "yxdt"]); |
| | | // clearLayerByTypeIdArr(["3Dcs", "swmx"]); |
| | | // _GLOBAL.layers[result.id] = []; |
| | | // children.forEach((item) => { |
| | | // let itemLayer = loadLayer(item); |
| | | // _GLOBAL.layers[result.id].push(itemLayer); |
| | | // // console.log(_GLOBAL.layers[result.id]); |
| | | // }); |
| | | if (this.curEMapModelIndex == index) return; |
| | | this.curEMapModelIndex = index; |
| | | clearAll(); |
| | | switch (result.name) { |
| | | case "二维地图": |
| | | loadGeoMap(); |
| | | loadBaseMap(); |
| | | addAnnotationLayer(); |
| | | addHxLayer(); |
| | | addYzLayer(); |
| | | window.mapapi.getView().setZoom(14); |
| | | break; |
| | | case "影像地图": |
| | | addImageLayer(); |
| | | addAnnotationLayer(); |
| | | addHxLayer(); |
| | | addYzLayer(); |
| | | break; |
| | | } |
| | | }, |
| | | // 三维模型选择 |
| | |
| | | window.tdgllayer = new ol.layer.Tile({ |
| | | source: new ol.source.TileWMS({ |
| | | ratio: 3, |
| | | url: 'https://skyzt.bda.gov.cn//gisserver/wmsserver/chengshiguihua_dikuaibianhao', |
| | | url: "https://skyzt.bda.gov.cn/gisserver/wmsserver/chengshiguihua_dikuaibianhao", |
| | | params: { |
| | | 'VERSION': '1.1.1', |
| | | 'SRS': 'EPSG:4326', |
| | | 'FORMAT': 'image/png', |
| | | 'TILED': true, |
| | | "LAYERS": '' |
| | | } |
| | | }) |
| | | }) |
| | | VERSION: "1.1.1", |
| | | SRS: "EPSG:4326", |
| | | FORMAT: "image/png", |
| | | TILED: true, |
| | | LAYERS: "", |
| | | }, |
| | | }), |
| | | }); |
| | | |
| | | // window.tdgllayer = new ol.layer.Tile({ |
| | | // source: new ol.source.XYZ({ |