forked from SuperMap/iClient-JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWebMap.js
More file actions
33 lines (32 loc) · 1.66 KB
/
WebMap.js
File metadata and controls
33 lines (32 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import mapboxgl from 'mapbox-gl';
import { createWebMapExtending } from '@supermapgis/iclient-common/mapping/WebMap';
import { createWebMapV2Extending } from '@supermapgis/iclient-common/mapping/WebMapV2';
import { createWebMapV3Extending } from '@supermapgis/iclient-common/mapping/WebMapV3';
import { createMapClassExtending } from '@supermapgis/iclient-common/mapping/MapBase';
import { createMapStyleExtending } from '@supermapgis/iclient-common/mapping/MapStyle';
import { createWebMapBaseExtending } from '@supermapgis/iclient-common/mapping/WebMapBase';
import { L7LayerUtil } from '@supermapgis/iclient-common/mapping/utils/L7LayerUtil';
import { featureFilter, expression } from '@mapbox/mapbox-gl-style-spec';
import spec from '@mapbox/mapbox-gl-style-spec/reference/v8';
import { L7Layer, L7 } from '../overlay/L7Layer';
import MapManager from './webmap/MapManager';
const l7LayerUtil = L7LayerUtil({ featureFilter, expression, spec, L7Layer, L7 });
export class WebMap extends createWebMapExtending(mapboxgl.Evented, { mapRepo: mapboxgl }) {
_createWebMapFactory(type) {
const commonFactoryOptions = { MapManager, mapRepo: mapboxgl, mapRepoName: 'mapbox-gl' };
switch (type) {
case 'MapStyle':
return createMapStyleExtending(createMapClassExtending(mapboxgl.Evented), commonFactoryOptions);
case 'WebMap3':
return createWebMapV3Extending(createMapClassExtending(mapboxgl.Evented), {
...commonFactoryOptions,
l7LayerUtil
});
default:
return createWebMapV2Extending(
createWebMapBaseExtending(createMapClassExtending(mapboxgl.Evented), 'fire'),
commonFactoryOptions
);
}
}
}