mcfxkh-Web/src/views/Home/MapCtrl/mapstyle/layermgr.js

275 lines
8.9 KiB
JavaScript

import RealDrpLayer from "./realdrplayer";
import RealHDLayer from "./realhdlayer";
import RealHDLayerQ2 from "./realhdlayerQ2";
import RealSkLayer from "./realsklayer";
import RealSkLayerQ2 from "./realsklayerQ2";
import ShyjLayer from "./shyjLayer"
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";
import BxjcLayer from "./bxjclayer"
import SyjcLayer from "./syjclayer"
import SljcLayer from "./sljclayer"
import ByjcLayer from "./byjclayer"
import ShuiZhaLayer from "./shuizhalayer"
import BzLayer from "./bzlayer"
import SbLayer from "./sblayer"
import QdLayer from "./qdlayer"
import ShuizhiLayer from "./shuizhilayer"
import TrsqLayer from "./trsqlayer"
import ShuichangLayer from "./shuichangLayer"
import ShuichangQLayer from "./shuichangQLayer"
import ShuiyuandiLayer from "./shuiyuandiLayer"
import ShuiyuandiQLayer from "./shuiyuandiQLayer"
import ShuikuLayer from "./shuikuLayer"
import RainDrpLayer from "./rainDrpLayer"
import XunchaLayer from "./xunchalayer"
class LayerMgr {
constructor() {
this.layerMap = {};
this.sublayerMap = {};
this.layers = [];
}
init(layerSettings) {
layerSettings = layerSettings || {};
this.layerMap = {};
this.sublayerMap = {};
this.layers = [];
this.layers.push(new BxjcLayer());
this.layers.push(new SyjcLayer());
this.layers.push(new SljcLayer());
this.layers.push(new ByjcLayer());
this.layers.push(new ShuiZhaLayer());
this.layers.push(new BzLayer());
this.layers.push(new SbLayer());
this.layers.push(new QdLayer());
this.layers.push(new ShuizhiLayer());
this.layers.push(new TrsqLayer());
this.layers.push(new ShuichangLayer());
this.layers.push(new ShuichangQLayer());
this.layers.push(new ShuiyuandiLayer());
this.layers.push(new ShuiyuandiQLayer());
this.layers.push(new ShuikuLayer());
this.layers.push(new RainDrpLayer());
this.layers.push(new XunchaLayer());
this.layers.push(new ShyjLayer());
//
this.layers.push(new RealDrpLayer());
this.layers.push(new RealHDLayer());
this.layers.push(new RealHDLayerQ2());
this.layers.push(new RealSkLayer());
this.layers.push(new RealSkLayerQ2());
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,
base.zhenGround,
base.heatmap,
base.gwmap,
base.gqmap,
this.layerMap.TerrainLayer.getStyle(0),
this.layerMap.TerrainLayer.getStyle(1),
this.layerMap.RivlLayer.getStyle('water'),
this.layerMap.RivlLayer.getStyle('rivl'),
sources.绿色区域 && base.plantZone,
base.浮桥河流域,
base.浮桥河,
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.RealSkLayerQ2.getStyle(),
this.layerMap.BxSkLayer.getStyle(),
this.layerMap.RealHDLayer.getStyle(),
this.layerMap.RealHDLayerQ2.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.BxjcLayer.getStyle(),
this.layerMap.SyjcLayer.getStyle(),
this.layerMap.SljcLayer.getStyle(),
this.layerMap.ByjcLayer.getStyle(),
this.layerMap.ShuiZhaLayer.getStyle(),
this.layerMap.BzLayer.getStyle(),
this.layerMap.SbLayer.getStyle(),
this.layerMap.QdLayer.getStyle(),
this.layerMap.ShuizhiLayer.getStyle(),
this.layerMap.TrsqLayer.getStyle(),
this.layerMap.ShuichangLayer.getStyle(),
this.layerMap.ShuichangQLayer.getStyle(),
this.layerMap.ShuiyuandiLayer.getStyle(),
this.layerMap.ShuiyuandiQLayer.getStyle(),
this.layerMap.ShuikuLayer.getStyle(),
this.layerMap.RainDrpLayer.getStyle(),
this.layerMap.XunchaLayer.getStyle(),
this.layerMap.ShyjLayer.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;