- import blue_vector from './mapStyle.js';
- import white_vector from './whiteMapStyle.js';
- export default class changeMapStyle {
- //地图白色风格
- static mapSetWhiteStyle(newfiberMap) {
- let removedLayers = newfiberMap
- .getMap()
- .imageryLayers._layers.filter(
- layer =>
- layer.imageryProvider.newfiberId == 'blackMap' || (layer.imageryProvider.url && layer.imageryProvider.url.includes('style=6'))
- );
- let selectedLayer = newfiberMap.getMap().imageryLayers._layers.filter(layer => layer.imageryProvider.newfiberId == 'whiteMap');
- removedLayers.forEach(layer => {
- layer.show = false;
- });
- newfiberMap.getMap().scene.globe.baseColor = Cesium.Color.fromCssColorString('rgba(238,251,255,1)');
- selectedLayer[0].show = true;
- }
- //地图深色风格
- static mapSetBlueStyle(newfiberMap) {
- let removedLayers = newfiberMap
- .getMap()
- .imageryLayers._layers.filter(
- layer =>
- layer.imageryProvider.newfiberId == 'whiteMap' || (layer.imageryProvider.url && layer.imageryProvider.url.includes('webst0'))
- );
- let selectedLayer = newfiberMap.getMap().imageryLayers._layers.filter(layer => layer.imageryProvider.newfiberId == 'blackMap');
- removedLayers.forEach(layer => {
- layer.show = false;
- });
- if (!selectedLayer[0]) {
- var layer = new NewFiberMap.Layer.MVTImageryProvider({
- style: blue_vector,
- tileSize: 1024,
- });
- layer.newfiberId = 'blackMap';
- newfiberMap.getMap().scene.globe.baseColor = Cesium.Color.fromCssColorString('rgba(8,27,54,1)');
- newfiberMap.getMap().imageryLayers.addImageryProvider(layer);
- } else {
- newfiberMap.getMap().scene.globe.baseColor = Cesium.Color.fromCssColorString('rgba(8,27,54,1)');
- selectedLayer[0].show = true;
- }
- }
- //影像图
- static mapSetImageStyle(newfiberMap) {
- let removedLayers = newfiberMap
- .getMap()
- .imageryLayers._layers.filter(
- layer =>
- layer.imageryProvider.newfiberId == 'whiteMap' || (layer.imageryProvider.url && layer.imageryProvider.url.includes('style=7'))
- );
- let selectedLayer = newfiberMap
- .getMap()
- .imageryLayers._layers.filter(layer => layer.imageryProvider.url && layer.imageryProvider.url.includes('style=6'));
- removedLayers.forEach(layer => {
- layer.show = false;
- });
- if (!selectedLayer[0]) {
- newfiberMap.setBaseMapByEnum([NewFiberMap.Enum.BaseMap.AMAP_IMAGE]);
- } else {
- selectedLayer[0].show = true;
- }
- }
- }