@abi-software/flatmap-viewer 2.7.2 → 2.7.3-a.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/index.css +1 -0
- package/dist/index.js +80577 -0
- package/dist/lib/index.d.ts +4 -0
- package/package.json +10 -7
- package/lib/index.ts +0 -10
- package/src/contextmenu.js +0 -97
- package/src/controls/annotation.js +0 -302
- package/src/controls/controls.js +0 -645
- package/src/controls/flightpaths.js +0 -95
- package/src/controls/info.js +0 -291
- package/src/controls/minimap.js +0 -442
- package/src/controls/paths.js +0 -143
- package/src/controls/search.js +0 -113
- package/src/controls/systems.js +0 -75
- package/src/controls/taxons.js +0 -73
- package/src/flatmap-viewer.js +0 -1789
- package/src/images.js +0 -66
- package/src/interactions.js +0 -1569
- package/src/layers/cluster.js +0 -177
- package/src/layers/filter.js +0 -310
- package/src/layers/flightpaths.js +0 -383
- package/src/layers/index.js +0 -478
- package/src/layers/styling.js +0 -1077
- package/src/main.js +0 -272
- package/src/mapserver.js +0 -64
- package/src/mathjax.js +0 -100
- package/src/pathways.js +0 -427
- package/src/search.js +0 -137
- package/src/systems.js +0 -146
- package/src/utils.js +0 -152
- package/static/css/flatmap-viewer.css +0 -238
- package/static/icons/favicon.ico +0 -0
- package/static/images/active.png +0 -0
- package/static/images/inactive.png +0 -0
- package/static/images/reset-map-active.png +0 -0
- package/static/images/reset-map-button.png +0 -0
- package/static/images/rounded-background.png +0 -0
- package/static/images/zoom-in-active.png +0 -0
- package/static/images/zoom-in-button.png +0 -0
- package/static/images/zoom-out-active.png +0 -0
- package/static/images/zoom-out-button.png +0 -0
- package/thirdParty/maplibre-gl-svg/CHANGELOG.md +0 -13
- package/thirdParty/maplibre-gl-svg/LICENSE +0 -21
- package/thirdParty/maplibre-gl-svg/LICENSE.md +0 -21
- package/thirdParty/maplibre-gl-svg/README.md +0 -24
- package/thirdParty/maplibre-gl-svg/assets/Add custom SVG template to template manager.jpg +0 -0
- package/thirdParty/maplibre-gl-svg/assets/All built-in SVG templates as HTML markers.jpg +0 -0
- package/thirdParty/maplibre-gl-svg/assets/All built-in SVG templates as symbols.jpg +0 -0
- package/thirdParty/maplibre-gl-svg/assets/Fill polygon with built-in SVG template.jpg +0 -0
- package/thirdParty/maplibre-gl-svg/assets/HTML Marker with Custom SVG Template.jpg +0 -0
- package/thirdParty/maplibre-gl-svg/assets/HTML Marker with built-in SVG template.jpg +0 -0
- package/thirdParty/maplibre-gl-svg/assets/Line layer with built-in SVG template.jpg +0 -0
- package/thirdParty/maplibre-gl-svg/assets/Load SVG from URL.jpg +0 -0
- package/thirdParty/maplibre-gl-svg/assets/SVG template options.jpg +0 -0
- package/thirdParty/maplibre-gl-svg/assets/Smiley_face_changed.svg +0 -37
- package/thirdParty/maplibre-gl-svg/assets/Symbol layer with built-in SVG template.jpg +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/arrow-up-thin.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/arrow-up.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/car.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/checker-rotated.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/checker.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/circles-spaced.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/circles.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/diagonal-lines-down.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/diagonal-lines-up.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/diagonal-stripes-down.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/diagonal-stripes-up.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/dots.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/flag-triangle.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/flag.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/grid-lines.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/hexagon-rounded-thick.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/hexagon-rounded.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/hexagon-thick.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/hexagon.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/marker-arrow.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/marker-ball-pin.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/marker-circle.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/marker-flat.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/marker-square-cluster.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/marker-square-rounded-cluster.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/marker-square-rounded.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/marker-square.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/marker-thick.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/marker.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/pin-round.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/pin.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/rotated-grid-lines.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/rotated-grid-stripes.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/rounded-square-thick.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/rounded-square.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/triangle-arrow-left.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/triangle-arrow-up.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/triangle-thick.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/triangle.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/x-fill.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/zig-zag-vertical.png +0 -0
- package/thirdParty/maplibre-gl-svg/assets/image-templates/zig-zag.png +0 -0
- package/thirdParty/maplibre-gl-svg/build/build.js +0 -210
- package/thirdParty/maplibre-gl-svg/dist/maplibre-gl-svg.js +0 -339
- package/thirdParty/maplibre-gl-svg/dist/maplibre-gl-svg.min.js +0 -4
- package/thirdParty/maplibre-gl-svg/docs/docs.md +0 -375
- package/thirdParty/maplibre-gl-svg/examples/Add custom SVG template to template manager.html +0 -101
- package/thirdParty/maplibre-gl-svg/examples/All built-in SVG templates as HTML markers.html +0 -82
- package/thirdParty/maplibre-gl-svg/examples/All built-in SVG templates as symbols.html +0 -124
- package/thirdParty/maplibre-gl-svg/examples/Fill polygon with built-in SVG template.html +0 -94
- package/thirdParty/maplibre-gl-svg/examples/HTML Marker with Custom SVG Template.html +0 -86
- package/thirdParty/maplibre-gl-svg/examples/HTML Marker with built-in SVG template.html +0 -83
- package/thirdParty/maplibre-gl-svg/examples/Line layer with built-in SVG template.html +0 -129
- package/thirdParty/maplibre-gl-svg/examples/Load SVG from URL.html +0 -96
- package/thirdParty/maplibre-gl-svg/examples/SVG template options.html +0 -264
- package/thirdParty/maplibre-gl-svg/examples/Symbol layer with built-in SVG template.html +0 -93
- package/thirdParty/maplibre-gl-svg/index.html +0 -151
- package/thirdParty/maplibre-gl-svg/package-lock.json +0 -5882
- package/thirdParty/maplibre-gl-svg/package.json +0 -49
- package/thirdParty/maplibre-gl-svg/src/SvgManager.ts +0 -186
- package/thirdParty/maplibre-gl-svg/src/SvgTemplateManager.ts +0 -144
- package/thirdParty/maplibre-gl-svg/src/index.ts +0 -4
- package/thirdParty/maplibre-gl-svg/tsconfig.json +0 -31
- package/thirdParty/maplibre-gl-svg/typings/index.d.ts +0 -111
package/src/layers/index.js
DELETED
|
@@ -1,478 +0,0 @@
|
|
|
1
|
-
/******************************************************************************
|
|
2
|
-
|
|
3
|
-
Flatmap viewer and annotation tool
|
|
4
|
-
|
|
5
|
-
Copyright (c) 2019 David Brooks
|
|
6
|
-
|
|
7
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
-
you may not use this file except in compliance with the License.
|
|
9
|
-
You may obtain a copy of the License at
|
|
10
|
-
|
|
11
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
|
|
13
|
-
Unless required by applicable law or agreed to in writing, software
|
|
14
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
-
See the License for the specific language governing permissions and
|
|
17
|
-
limitations under the License.
|
|
18
|
-
|
|
19
|
-
******************************************************************************/
|
|
20
|
-
|
|
21
|
-
'use strict';
|
|
22
|
-
|
|
23
|
-
//==============================================================================
|
|
24
|
-
|
|
25
|
-
import {PATHWAYS_LAYER} from '../pathways.js';
|
|
26
|
-
import * as utils from '../utils.js';
|
|
27
|
-
|
|
28
|
-
import {ClusteredMarkerLayer} from './cluster'
|
|
29
|
-
import * as style from './styling.js';
|
|
30
|
-
|
|
31
|
-
import {FlightPathLayer} from './flightpaths'
|
|
32
|
-
import {PropertiesFilter} from './filter'
|
|
33
|
-
|
|
34
|
-
const FEATURES_LAYER = 'features';
|
|
35
|
-
const RASTER_LAYERS_NAME = 'Background image layer';
|
|
36
|
-
const RASTER_LAYERS_ID = 'background-image-layer';
|
|
37
|
-
|
|
38
|
-
//==============================================================================
|
|
39
|
-
|
|
40
|
-
class MapStylingLayers
|
|
41
|
-
{
|
|
42
|
-
constructor(flatmap, layer, options)
|
|
43
|
-
{
|
|
44
|
-
this.__map = flatmap.map;
|
|
45
|
-
this.__id = layer.id;
|
|
46
|
-
this.__description = layer.description;
|
|
47
|
-
this.__active = true;
|
|
48
|
-
this.__layers = [];
|
|
49
|
-
this.__layerOptions = options;
|
|
50
|
-
this.__separateLayers = flatmap.options.separateLayers;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
get id()
|
|
54
|
-
//======
|
|
55
|
-
{
|
|
56
|
-
return this.__id;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
get description()
|
|
60
|
-
//===============
|
|
61
|
-
{
|
|
62
|
-
return this.__description;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
get active()
|
|
66
|
-
//==========
|
|
67
|
-
{
|
|
68
|
-
return this.__active;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
get map()
|
|
72
|
-
//=======
|
|
73
|
-
{
|
|
74
|
-
return this.__map
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
addLayer(styleLayer, options)
|
|
78
|
-
//===========================
|
|
79
|
-
{
|
|
80
|
-
this.__map.addLayer(styleLayer.style(options));
|
|
81
|
-
this.__layers.push(styleLayer);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
__showLayer(layer, visible=true)
|
|
85
|
-
//===============================
|
|
86
|
-
{
|
|
87
|
-
this.__map.setLayoutProperty(layer.id, 'visibility', visible ? 'visible' : 'none');
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
activate(enable=true)
|
|
91
|
-
//===================
|
|
92
|
-
{
|
|
93
|
-
for (const layer of this.__layers) {
|
|
94
|
-
this.__showLayer(layer, enable);
|
|
95
|
-
}
|
|
96
|
-
this.__active = enable;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
vectorSourceId(sourceLayer)
|
|
100
|
-
//=========================
|
|
101
|
-
{
|
|
102
|
-
return (this.__separateLayers ? `${this.__id}_${sourceLayer}`
|
|
103
|
-
: sourceLayer).replaceAll('/', '_');
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
setPaint(options)
|
|
107
|
-
{
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
setFilter(options)
|
|
111
|
-
{
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
//==============================================================================
|
|
116
|
-
|
|
117
|
-
class MapFeatureLayers extends MapStylingLayers
|
|
118
|
-
{
|
|
119
|
-
#pathLayers = []
|
|
120
|
-
|
|
121
|
-
constructor(flatmap, layer, options)
|
|
122
|
-
{
|
|
123
|
-
super(flatmap, layer, options);
|
|
124
|
-
const vectorTileSource = this.__map.getSource('vector-tiles');
|
|
125
|
-
const haveVectorLayers = (typeof vectorTileSource !== 'undefined');
|
|
126
|
-
|
|
127
|
-
// if no image layers then make feature borders (and lines?) more visible...??
|
|
128
|
-
if (haveVectorLayers) {
|
|
129
|
-
const featuresVectorSource = this.vectorSourceId(FEATURES_LAYER);
|
|
130
|
-
const vectorFeatures = vectorTileSource.vectorLayerIds.includes(featuresVectorSource);
|
|
131
|
-
if (vectorFeatures) {
|
|
132
|
-
this.__addStyleLayer(style.FeatureFillLayer);
|
|
133
|
-
this.__addStyleLayer(style.FeatureDashLineLayer);
|
|
134
|
-
this.__addStyleLayer(style.FeatureLineLayer);
|
|
135
|
-
this.__addStyleLayer(style.FeatureBorderLayer);
|
|
136
|
-
this.__addStyleLayer(style.CentrelineNodeFillLayer);
|
|
137
|
-
}
|
|
138
|
-
this.__addPathwayStyleLayers();
|
|
139
|
-
if (vectorFeatures) {
|
|
140
|
-
this.__addStyleLayer(style.FeatureLargeSymbolLayer);
|
|
141
|
-
if (!flatmap.options.tooltips) {
|
|
142
|
-
this.__addStyleLayer(style.FeatureSmallSymbolLayer);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
// Make sure our paint options are set properly, in particular raster layer visibility
|
|
148
|
-
|
|
149
|
-
this.setPaint(this.__layerOptions);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
__addStyleLayer(styleClass, sourceLayer=FEATURES_LAYER, path2dLayer=false)
|
|
153
|
-
//========================================================================
|
|
154
|
-
{
|
|
155
|
-
const styleLayer = new styleClass(`${this.__id}_${sourceLayer}`,
|
|
156
|
-
this.vectorSourceId(sourceLayer))
|
|
157
|
-
this.addLayer(styleLayer, this.__layerOptions)
|
|
158
|
-
if (path2dLayer) {
|
|
159
|
-
this.#pathLayers.push(styleLayer)
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
__addPathwayStyleLayers()
|
|
164
|
-
//=======================
|
|
165
|
-
{
|
|
166
|
-
const pathwaysVectorSource = this.vectorSourceId(PATHWAYS_LAYER)
|
|
167
|
-
if (this.__map.getSource('vector-tiles')
|
|
168
|
-
.vectorLayerIds
|
|
169
|
-
.includes(pathwaysVectorSource)) {
|
|
170
|
-
this.__addStyleLayer(style.AnnotatedPathLayer, PATHWAYS_LAYER, true)
|
|
171
|
-
|
|
172
|
-
this.__addStyleLayer(style.CentrelineEdgeLayer, PATHWAYS_LAYER)
|
|
173
|
-
this.__addStyleLayer(style.CentrelineTrackLayer, PATHWAYS_LAYER)
|
|
174
|
-
|
|
175
|
-
this.__addStyleLayer(style.PathLineLayer, PATHWAYS_LAYER, true)
|
|
176
|
-
this.__addStyleLayer(style.PathDashlineLayer, PATHWAYS_LAYER, true)
|
|
177
|
-
|
|
178
|
-
this.__addStyleLayer(style.NervePolygonBorder, PATHWAYS_LAYER, true)
|
|
179
|
-
this.__addStyleLayer(style.NervePolygonFill, PATHWAYS_LAYER, true)
|
|
180
|
-
this.__addStyleLayer(style.FeatureNerveLayer, PATHWAYS_LAYER, true)
|
|
181
|
-
|
|
182
|
-
this.__addStyleLayer(style.PathHighlightLayer, PATHWAYS_LAYER, true)
|
|
183
|
-
this.__addStyleLayer(style.PathDashHighlightLayer, PATHWAYS_LAYER, true)
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
setFlatPathMode(visible)
|
|
188
|
-
//======================
|
|
189
|
-
{
|
|
190
|
-
for (const layer of this.#pathLayers) {
|
|
191
|
-
this.map.setLayoutProperty(layer.id, 'visibility', visible ? 'visible' : 'none')
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
setPaint(options)
|
|
196
|
-
//===============
|
|
197
|
-
{
|
|
198
|
-
for (const layer of this.__layers) {
|
|
199
|
-
const paintStyle = layer.paintStyle(options, true);
|
|
200
|
-
for (const [property, value] of Object.entries(paintStyle)) {
|
|
201
|
-
this.__map.setPaintProperty(layer.id, property, value, {validate: false});
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
setFilter(options)
|
|
207
|
-
//================
|
|
208
|
-
{
|
|
209
|
-
for (const layer of this.__layers) {
|
|
210
|
-
const filter = layer.makeFilter(options);
|
|
211
|
-
if (filter !== null) {
|
|
212
|
-
this.__map.setFilter(layer.id, filter, {validate: true});
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
//==============================================================================
|
|
219
|
-
|
|
220
|
-
class MapRasterLayers extends MapStylingLayers
|
|
221
|
-
{
|
|
222
|
-
constructor(flatmap, options, bodyLayerId=null)
|
|
223
|
-
{
|
|
224
|
-
const rasterLayer = {
|
|
225
|
-
id: RASTER_LAYERS_ID,
|
|
226
|
-
description: RASTER_LAYERS_NAME
|
|
227
|
-
};
|
|
228
|
-
super(flatmap, rasterLayer, options);
|
|
229
|
-
if (bodyLayerId !== null) {
|
|
230
|
-
const layerId = `${bodyLayerId}_${FEATURES_LAYER}`;
|
|
231
|
-
const source = flatmap.options.separateLayers ? layerId : FEATURES_LAYER;
|
|
232
|
-
const styleLayer = new style.BodyLayer(layerId, source);
|
|
233
|
-
this.__map.addLayer(styleLayer.style(this.__layerOptions));
|
|
234
|
-
this.__layers.push(styleLayer);
|
|
235
|
-
}
|
|
236
|
-
// Make sure our paint options are set properly, in particular raster layer visibility
|
|
237
|
-
this.setPaint(this.__layerOptions);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
addLayer(layer)
|
|
241
|
-
//=============
|
|
242
|
-
{
|
|
243
|
-
for (const layer_id of layer['image-layers']) {
|
|
244
|
-
const rasterLayer = new style.RasterLayer(layer_id);
|
|
245
|
-
this.__map.addLayer(rasterLayer.style(this.__layerOptions));
|
|
246
|
-
this.__layers.push(rasterLayer);
|
|
247
|
-
}
|
|
248
|
-
// Make sure our paint options are set properly, in particular raster layer visibility
|
|
249
|
-
this.setPaint(this.__layerOptions);
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
setPaint(options)
|
|
253
|
-
//===============
|
|
254
|
-
{
|
|
255
|
-
const coloured = !('colour' in options) || options.colour;
|
|
256
|
-
for (const layer of this.__layers) {
|
|
257
|
-
// Check active status when resetting to visible....
|
|
258
|
-
this.__map.setLayoutProperty(layer.id, 'visibility',
|
|
259
|
-
(coloured && this.active) ? 'visible' : 'none',
|
|
260
|
-
{validate: false});
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
//==============================================================================
|
|
266
|
-
|
|
267
|
-
export class LayerManager
|
|
268
|
-
{
|
|
269
|
-
#featureLayers = new Map()
|
|
270
|
-
#markerLayer = null
|
|
271
|
-
#flightPathLayer = null
|
|
272
|
-
#rasterLayer = null
|
|
273
|
-
|
|
274
|
-
constructor(flatmap, ui)
|
|
275
|
-
{
|
|
276
|
-
this.__flatmap = flatmap;
|
|
277
|
-
this.__map = flatmap.map;
|
|
278
|
-
this.__layerOptions = utils.setDefaults(flatmap.options.layerOptions, {
|
|
279
|
-
colour: true,
|
|
280
|
-
outline: true,
|
|
281
|
-
sckan: 'valid'
|
|
282
|
-
});
|
|
283
|
-
const backgroundLayer = new style.BackgroundLayer();
|
|
284
|
-
if ('background' in flatmap.options) {
|
|
285
|
-
this.__map.addLayer(backgroundLayer.style(flatmap.options.background));
|
|
286
|
-
} else {
|
|
287
|
-
this.__map.addLayer(backgroundLayer.style('white'));
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
// Add the map's layers
|
|
291
|
-
if (flatmap.details['image-layers']) {
|
|
292
|
-
this.__layerOptions.activeRasterLayer = true;
|
|
293
|
-
|
|
294
|
-
// Image layers are below all feature layers
|
|
295
|
-
const bodyLayer = flatmap.layers[0];
|
|
296
|
-
this.#rasterLayer = new MapRasterLayers(this.__flatmap,
|
|
297
|
-
this.__layerOptions,
|
|
298
|
-
bodyLayer.id); // body layer if not FC??
|
|
299
|
-
for (const layer of flatmap.layers) {
|
|
300
|
-
this.#rasterLayer.addLayer(layer);
|
|
301
|
-
}
|
|
302
|
-
} else {
|
|
303
|
-
this.__layerOptions.activeRasterLayer = false;
|
|
304
|
-
}
|
|
305
|
-
for (const layer of flatmap.layers) {
|
|
306
|
-
this.#featureLayers.set(layer.id, new MapFeatureLayers(this.__flatmap,
|
|
307
|
-
layer,
|
|
308
|
-
this.__layerOptions));
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
// Support flight path view
|
|
312
|
-
this.#flightPathLayer = new FlightPathLayer(flatmap, ui)
|
|
313
|
-
|
|
314
|
-
// Show clustered markers in a layer
|
|
315
|
-
this.#markerLayer = new ClusteredMarkerLayer(flatmap, ui)
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
get layers()
|
|
319
|
-
//==========
|
|
320
|
-
{
|
|
321
|
-
const layers = []
|
|
322
|
-
if (this.#rasterLayer) {
|
|
323
|
-
layers.push({
|
|
324
|
-
id: this.#rasterLayer.id,
|
|
325
|
-
description: this.#rasterLayer.description,
|
|
326
|
-
enabled: this.#rasterLayer.active
|
|
327
|
-
})
|
|
328
|
-
}
|
|
329
|
-
for (const mapLayer of this.#featureLayers.values()) {
|
|
330
|
-
layers.push({
|
|
331
|
-
id: mapLayer.id,
|
|
332
|
-
description: mapLayer.description,
|
|
333
|
-
enabled: mapLayer.active
|
|
334
|
-
});
|
|
335
|
-
}
|
|
336
|
-
return layers;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
get sckanState()
|
|
340
|
-
//==============
|
|
341
|
-
{
|
|
342
|
-
return this.__layerOptions.sckan;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
activate(layerId, enable=true)
|
|
346
|
-
//============================
|
|
347
|
-
{
|
|
348
|
-
if (layerId === RASTER_LAYERS_ID) {
|
|
349
|
-
if (this.#rasterLayer) {
|
|
350
|
-
this.#rasterLayer.activate(enable)
|
|
351
|
-
this.__layerOptions.activeRasterLayer = enable
|
|
352
|
-
for (const mapLayer of this.#featureLayers.values()) {
|
|
353
|
-
mapLayer.setPaint(this.__layerOptions)
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
} else {
|
|
357
|
-
const layer = this.#featureLayers.get(layerId)
|
|
358
|
-
if (layer) {
|
|
359
|
-
layer.activate(enable)
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
addMarker(id, position, properties={})
|
|
365
|
-
//====================================
|
|
366
|
-
{
|
|
367
|
-
this.#markerLayer.addMarker(id, position, properties)
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
clearMarkers()
|
|
371
|
-
//============
|
|
372
|
-
{
|
|
373
|
-
this.#markerLayer.clearMarkers()
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
featuresAtPoint(point)
|
|
377
|
-
//====================
|
|
378
|
-
{
|
|
379
|
-
let features = []
|
|
380
|
-
if (this.#flightPathLayer) {
|
|
381
|
-
features = this.#flightPathLayer.queryFeaturesAtPoint(point)
|
|
382
|
-
}
|
|
383
|
-
if (features.length === 0) {
|
|
384
|
-
features = this.__map.queryRenderedFeatures(point)
|
|
385
|
-
}
|
|
386
|
-
return features
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
removeFeatureState(feature, key)
|
|
390
|
-
//==============================
|
|
391
|
-
{
|
|
392
|
-
if (this.#flightPathLayer) {
|
|
393
|
-
this.#flightPathLayer.removeFeatureState(feature.id, key)
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
setFeatureState(feature, state)
|
|
398
|
-
//=============================
|
|
399
|
-
{
|
|
400
|
-
if (this.#flightPathLayer) {
|
|
401
|
-
this.#flightPathLayer.setFeatureState(feature.id, state)
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
setPaint(options={})
|
|
406
|
-
//==================
|
|
407
|
-
{
|
|
408
|
-
this.__layerOptions = utils.setDefaults(options, this.__layerOptions)
|
|
409
|
-
if (this.#rasterLayer) {
|
|
410
|
-
this.#rasterLayer.setPaint(this.__layerOptions)
|
|
411
|
-
}
|
|
412
|
-
for (const mapLayer of this.#featureLayers.values()) {
|
|
413
|
-
mapLayer.setPaint(this.__layerOptions)
|
|
414
|
-
}
|
|
415
|
-
if (this.#flightPathLayer) {
|
|
416
|
-
this.#flightPathLayer.setPaint(options)
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
setFilter(options={})
|
|
421
|
-
//===================
|
|
422
|
-
{
|
|
423
|
-
this.__layerOptions = utils.setDefaults(options, this.__layerOptions);
|
|
424
|
-
for (const mapLayer of this.#featureLayers.values()) {
|
|
425
|
-
mapLayer.setFilter(this.__layerOptions);
|
|
426
|
-
}
|
|
427
|
-
if (this.#flightPathLayer) {
|
|
428
|
-
const sckanState = options.sckan || 'valid'
|
|
429
|
-
const sckanFilter = (sckanState == 'none') ? {NOT: {HAS: 'sckan'}} :
|
|
430
|
-
(sckanState == 'valid') ? {sckan: true} :
|
|
431
|
-
(sckanState == 'invalid') ? {NOT: {sckan: true}} :
|
|
432
|
-
true
|
|
433
|
-
const featureFilter = new PropertiesFilter(sckanFilter)
|
|
434
|
-
if ('taxons' in options) {
|
|
435
|
-
featureFilter.narrow({taxons: options.taxons})
|
|
436
|
-
}
|
|
437
|
-
this.#flightPathLayer.setFilter(featureFilter)
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
setFlightPathMode(enable=true)
|
|
442
|
-
//============================
|
|
443
|
-
{
|
|
444
|
-
if (this.#flightPathLayer) {
|
|
445
|
-
this.#flightPathLayer.enable(enable)
|
|
446
|
-
for (const mapLayer of this.#featureLayers.values()) {
|
|
447
|
-
mapLayer.setFlatPathMode(!enable)
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
enableSckanPaths(sckanState, enable=true)
|
|
453
|
-
//=======================================
|
|
454
|
-
{
|
|
455
|
-
const currentState = this.__layerOptions.sckan;
|
|
456
|
-
const validEnabled = ['valid', 'all'].includes(currentState);
|
|
457
|
-
const invalidEnabled = ['invalid', 'all'].includes(currentState);
|
|
458
|
-
let newState = sckanState.toLowerCase();
|
|
459
|
-
if (newState === 'valid') {
|
|
460
|
-
if (enable && !validEnabled) {
|
|
461
|
-
newState = invalidEnabled ? 'all' : 'valid';
|
|
462
|
-
} else if (!enable && validEnabled) {
|
|
463
|
-
newState = invalidEnabled ? 'invalid' : 'none';
|
|
464
|
-
}
|
|
465
|
-
} else if (newState === 'invalid') {
|
|
466
|
-
if (enable && !invalidEnabled) {
|
|
467
|
-
newState = validEnabled ? 'all' : 'invalid';
|
|
468
|
-
} else if (!enable && invalidEnabled) {
|
|
469
|
-
newState = validEnabled ? 'valid' : 'none';
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
if (newState !== this.__layerOptions.sckan) {
|
|
473
|
-
this.setFilter({sckan: newState});
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
//==============================================================================
|