| | |
| | | var source = [] |
| | | const mapGeo = { |
| | | source1: null, |
| | | type: null, |
| | | init(res) { |
| | | if (this.type && this.type === res) { |
| | | return this.type = null |
| | | } |
| | | this.type = res; |
| | | switch (res.type) { |
| | | case "WangGe": |
| | | this.addWangGeGeoJson(res); |
| | |
| | | break; |
| | | case "zhaiHai": |
| | | this.addzhaiHaiGeoJson(res) |
| | | |
| | | break; |
| | | case "ZhongPo": |
| | | this.addZhongPoGeoJson(res) |
| | | break; |
| | | } |
| | | }, |
| | | |
| | | addZhongPoGeoJson(res) { |
| | | var url = layerData.config.Model_URL + res.urls; |
| | | var data = Cesium.GeoJsonDataSource.load(url, //要加载的 url、GeoJSON 对象或 TopoJSON 对象。 |
| | | { |
| | | stroke: Cesium.Color.ORANGE, //折线和多边形轮廓的默认颜色。 |
| | | fill: Cesium.Color.WHITE.withAlpha(0.2), //多边形内部的默认颜色。 |
| | | strokeWidth: 3, //折线和多边形轮廓的默认宽度。 |
| | | } |
| | | ) |
| | | data.then((dataSource) => { |
| | | dataSource.name = res.type |
| | | Viewer.dataSources.add( |
| | | dataSource |
| | | ); |
| | | }) |
| | | }, |
| | | delGeoSource(res) { |
| | | if (this.type && this.type == res) { |
| | | this.type = null |
| | | } |
| | | if (res.type == "zhaiHai") { |
| | | Viewer.dataSources.remove(Viewer.dataSources.getByName("zhaiHai2")[0]) |
| | | Viewer.dataSources.remove(Viewer.dataSources.getByName("zhaiHai1")[0]) |
| | |
| | | }) |
| | | }, |
| | | addZhuangHaoGeoJson(res) { |
| | | |
| | | |
| | | var url = layerData.config.Model_URL + res.urls; |
| | | var img = layerData.config.Model_URL + '/Data/img/img1.png'; |
| | | Cesium.GeoJsonDataSource.load(url).then((dataSource) => { |
| | | |
| | | Cesium.GeoJsonDataSource.load(url).then((dataSource) => { |
| | | |
| | | dataSource.name = res.type |
| | | Viewer.dataSources.add( |
| | | dataSource |