MCPcopy Index your code
hub / github.com/SuperMap/iClient-JavaScript / createMapClassExtending

Function createMapClassExtending

src/common/mapping/MapBase.js:1–91  ·  view source on GitHub ↗
(SuperClass = class {})

Source from the content-addressed store, hash-verified

1export function createMapClassExtending(SuperClass = class {}) {
2 return class MapBase extends SuperClass {
3 constructor() {
4 super();
5 this._sourceListModel = null;
6 this._legendList = [];
7 }
8
9 initializeMap() {
10 throw new Error('initializeMap is not implemented');
11 }
12
13 clean() {
14 throw new Error('clean is not implemented');
15 }
16
17 getLayerCatalog() {
18 return (this._sourceListModel && this._sourceListModel.getLayerCatalog()) || [];
19 }
20
21 getLayers() {
22 return (this._sourceListModel && this._sourceListModel.getLayers()) || [];
23 }
24
25 getLegends() {
26 return this._legendList;
27 }
28
29 getSelfAppreciableLayers() {
30 return (this._sourceListModel && this._sourceListModel.getSelfLayers(...arguments)) || [];
31 }
32
33 setLayersVisible() {
34 this._sourceListModel && this._sourceListModel.setLayersVisible(...arguments);
35 }
36
37 toggleLayerVisible() {
38 this._sourceListModel && this._sourceListModel.toggleLayerVisible(...arguments);
39 }
40
41 rectifyLayersOrder(appreciableLayers, topLayerBeforeId) {
42 const renderLayers = appreciableLayers
43 .filter((item) => !item.reused)
44 .reduce((layers, layer) => {
45 return layers.concat(layer.renderLayers);
46 }, []);
47 const exsitLayers = renderLayers.filter((layerId) => !!this.map.getLayer(layerId));
48 for (let index = exsitLayers.length - 1; index > -1; index--) {
49 const targetlayerId = exsitLayers[index];
50 const afterLayers = exsitLayers.slice(index + 1);
51 let beforLayerId = afterLayers.find((id) => this.map.style._layers[id]);
52 if (!afterLayers.length) {
53 beforLayerId = topLayerBeforeId;
54 }
55 this.map.moveLayer(targetlayerId, beforLayerId);
56 }
57 return exsitLayers;
58 }
59
60 changeBaseLayer() {

Callers 4

WebMapV3Spec.jsFile · 0.90
WebMapV3Spec.jsFile · 0.90
_createWebMapFactoryMethod · 0.90
_createWebMapFactoryMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected