import RealDrpLayer from "./realdrplayer"; import RealHDLayer from "./realhdlayer"; import RealSkLayer from "./realsklayer"; import sources from "./sources"; import base from "./base"; import DcpjLayer from "./dcpjlayer"; import ContourLayer from "./contourlayer"; import WataLayer from "./watalayer"; import HighlightLayer from "./highlightlayer"; import AdcdLayer from "./adcdlayer"; import FzdxLayer from "./fzdxlayer"; import TerrainLayer from "./terrainlayer"; import PlaneAreaLayer from "./planarealayer"; import RoadLayer from "./roadlayer"; import RivlLayer from "./rivllayer"; import DcpjDikeLayer from "./dikelayer"; import YuwaiLayer from "./yuwailayer"; import PicStLayer from "./picstlayer"; import PumpLayer from "./tmp/pumplayer"; import BxSkLayer from "./tmp/bxsk"; class LayerMgr { constructor() { this.layerMap = {}; this.sublayerMap = {}; this.layers = []; } init(layerSettings) { layerSettings = layerSettings || {}; this.layerMap = {}; this.sublayerMap = {}; this.layers = []; this.layers.push(new RealDrpLayer()); this.layers.push(new RealHDLayer()); this.layers.push(new RealSkLayer()); this.layers.push(new BxSkLayer()); this.layers.push(new YuwaiLayer()); this.layers.push(new PicStLayer()); this.layers.push(new DcpjLayer('bridge')); this.layers.push(new DcpjLayer('culvert')); this.layers.push(new DcpjLayer('sluice')); this.layers.push(new DcpjLayer('daminfo')); this.layers.push(new DcpjLayer('srstinfo')); this.layers.push(new DcpjLayer('swstinfo')); this.layers.push(new DcpjLayer('stinfo')); this.layers.push(new DcpjLayer('wbrinfo')); this.layers.push(new DcpjDikeLayer()); this.layers.push(new DcpjLayer('danad')); this.layers.push(new DcpjLayer('placement')); this.layers.push(new DcpjLayer('transfer')); this.layers.push(new DcpjLayer('flrvvlg')); this.layers.push(new DcpjLayer('bsnssinfo')); this.layers.push(new WataLayer()); this.layers.push(new ContourLayer()); this.layers.push(new PlaneAreaLayer()); this.layers.push(new HighlightLayer()); this.layers.push(new AdcdLayer()); this.layers.push(new FzdxLayer()); this.layers.push(new TerrainLayer()); this.layers.push(new RoadLayer()); this.layers.push(new RivlLayer()); this.layers.push(new PumpLayer()); for (const layer of this.layers) { layer.init(layerSettings); this.layerMap[layer.getName()] = layer; layer.getSubLayers().forEach(s => { this.sublayerMap[s] = layer; }) } } getMapStyle() { return { version: 8, name: "fxkh", metadata: {}, sprite: `${window.location.origin}/mapbox/sprite`, glyphs: `${window.location.origin}/mapbox/{fontstack}/{range}.pbf`, sources, terrain: this.layerMap.TerrainLayer.getTerrain(), layers: [ base.background, this.layerMap.TerrainLayer.getStyle(0), this.layerMap.TerrainLayer.getStyle(1), this.layerMap.RivlLayer.getStyle('water'), this.layerMap.RivlLayer.getStyle('rivl'), sources.绿色区域 && base.plantZone, base.xzj.shape, base.xj.shape, this.layerMap.RoadLayer.getStyle('铁路case'), this.layerMap.RoadLayer.getStyle('高速case'), this.layerMap.RoadLayer.getStyle('国道case'), this.layerMap.RoadLayer.getStyle('高速引路'), this.layerMap.RoadLayer.getStyle('县道'), this.layerMap.RoadLayer.getStyle('省道'), this.layerMap.RoadLayer.getStyle('国道'), this.layerMap.RoadLayer.getStyle('铁路'), this.layerMap.RoadLayer.getStyle('高速'), this.layerMap.WataLayer.getStyle(0), this.layerMap.WataLayer.getStyle(1), this.layerMap.ContourLayer.getStyle(0), this.layerMap.ContourLayer.getStyle(1), this.layerMap.PlaneAreaLayer.getStyle(), this.layerMap.Dcpj_bridgeLayer.getStyle(), this.layerMap.Dcpj_culvertLayer.getStyle(), this.layerMap.Dcpj_sluiceLayer.getStyle(), this.layerMap.Dcpj_daminfoLayer.getStyle(), this.layerMap.Dcpj_srstinfoLayer.getStyle(), this.layerMap.Dcpj_swstinfoLayer.getStyle(), this.layerMap.Dcpj_wbrinfoLayer.getStyle(), this.layerMap.Dcpj_stinfoLayer.getStyle(), this.layerMap.Dcpj_dikeLayer.getStyle('line'), this.layerMap.Dcpj_dikeLayer.getStyle('paling'), this.layerMap.Dcpj_danadLayer.getStyle(), this.layerMap.Dcpj_placementLayer.getStyle(), this.layerMap.Dcpj_transferLayer.getStyle(), this.layerMap.Dcpj_flrvvlgLayer.getStyle(), this.layerMap.Dcpj_bsnssinfoLayer.getStyle(), this.layerMap.PumpLayer.getStyle(), this.layerMap.RealSkLayer.getStyle(), this.layerMap.BxSkLayer.getStyle(), this.layerMap.RealHDLayer.getStyle(), this.layerMap.RealDrpLayer.getStyle(0), this.layerMap.RealDrpLayer.getStyle(1), this.layerMap.YuwaiLayer.getStyle(0), this.layerMap.YuwaiLayer.getStyle(1), this.layerMap.PicStLayer.getStyle(), this.layerMap.AdcdLayer.getStyle(3), this.layerMap.AdcdLayer.getStyle(2), this.layerMap.AdcdLayer.getStyle(1), this.layerMap.AdcdLayer.getStyle(0), this.layerMap.FzdxLayer.getStyle(), this.layerMap.RivlLayer.getStyle('rivlLabel'), this.layerMap.RoadLayer.getStyle('国道label'), this.layerMap.RoadLayer.getStyle('高速label'), this.layerMap.RoadLayer.getStyle('省道label'), this.layerMap.RoadLayer.getStyle('县道label'), this.layerMap.Dcpj_dikeLayer.getStyle('label'), this.layerMap.HighlightLayer.getStyle(2), this.layerMap.HighlightLayer.getStyle(1), this.layerMap.HighlightLayer.getStyle(0), base.xj.shape2, ].filter(Boolean), created: 0, modified: 0, owner: 'pixii', id: 'dcpj', draft: false } } getLayers() { return this.layers; } getLayer(layerName) { return this.layerMap[layerName]; } getLayerBySublater(layerId) { return this.sublayerMap[layerId]; } setLayerSettings(mapCtrl, settings) { for (const layer of this.layers) { layer.setLayerSettings(mapCtrl, settings); } } } export default LayerMgr;