@abi-software/flatmap-viewer 2.2.1-alpha.1 → 2.2.1-beta.3

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/README.rst CHANGED
@@ -2,7 +2,7 @@
2
2
  Flatmap Viewer
3
3
  ==============
4
4
 
5
- A viewer for anatomical flatmaps generated by `flatmap-maker <https://github.com/dbrnz/flatmap-maker>`_. The viewer is intended to be a component of a larger Javascript web application, although may be used standalone for local flatmap development and testing. Flatmap content is obtained from a `flatmap-server <https://github.com/dbrnz/flatmap-server>`_.
5
+ A viewer for anatomical flatmaps generated by `flatmap-maker <https://github.com/AnatomicMaps/flatmap-maker>`_. The viewer is intended to be a component of a larger Javascript web application, although may be used standalone for local flatmap development and testing. Flatmap content is obtained from a `flatmap-server <https://github.com/AnatomicMaps/flatmap-server>`_.
6
6
 
7
7
 
8
8
  Standalone Use
@@ -38,7 +38,7 @@ The map server endpoint is specified as ``MAP_ENDPOINT`` in ``src/main.js``. It
38
38
  Package Installation
39
39
  ====================
40
40
 
41
- * ``npm install @abi-software/flatmap-viewer``
41
+ * ``npm install @abi-software/flatmap-viewer@2.2.1-beta.3``
42
42
 
43
43
  Documentation
44
44
  -------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/flatmap-viewer",
3
- "version": "2.2.1-alpha.1",
3
+ "version": "2.2.1-beta.3",
4
4
  "description": "Flatmap viewer using Maplibre GL",
5
5
  "repository": "https://github.com/AnatomicMaps/flatmap-viewer.git",
6
6
  "main": "src/main.js",
@@ -45,6 +45,10 @@ import * as utils from './utils.js';
45
45
 
46
46
  //==============================================================================
47
47
 
48
+ const MAP_MAKER_SEPARATE_LAYERS_VERSION = 1.4;
49
+
50
+ //==============================================================================
51
+
48
52
  /**
49
53
  * Maps are not created directly but instead are created and loaded by
50
54
  * :meth:`LoadMap` of :class:`MapManager`.
@@ -1001,9 +1005,15 @@ export class MapManager
1001
1005
  {
1002
1006
  return await this._initialisingMutex.dispatch(async () => {
1003
1007
  if (!this._initialised) {
1004
- this._mapList = await this._mapServer.loadJSON('');
1008
+ this._mapList = [];
1009
+ const maps = await this._mapServer.loadJSON('');
1005
1010
  // Check map schema version (set by mapmaker) and
1006
1011
  // remove maps we can't view (giving a console warning...)
1012
+ for (const map of maps) {
1013
+ // Are features in separate vector tile source layers?
1014
+ map.separateLayers = ('version' in map && map.version >= MAP_MAKER_SEPARATE_LAYERS_VERSION);
1015
+ this._mapList.push(map);
1016
+ }
1007
1017
  this._initialised = true;
1008
1018
  }
1009
1019
  });
@@ -1157,7 +1167,7 @@ export class MapManager
1157
1167
  try {
1158
1168
  const map = await this.findMap_(identifier);
1159
1169
  if (map === null) {
1160
- reject(`Unknown map for ${JSON.stringify(identifier)}`);
1170
+ reject(`Unknown map: ${JSON.stringify(identifier)}`);
1161
1171
  };
1162
1172
 
1163
1173
  // Load the maps index file
@@ -1249,7 +1259,17 @@ export class MapManager
1249
1259
  outline: true
1250
1260
  };
1251
1261
  }
1252
- mapOptions.layerOptions.authoring = ('authoring' in mapIndex && mapIndex.authoring);
1262
+ if ('authoring' in mapIndex) {
1263
+ mapOptions.layerOptions.style == 'authoring'
1264
+ } else if ('style' in mapIndex) {
1265
+ mapOptions.layerOptions.style = mapIndex.style;
1266
+ } else {
1267
+ mapOptions.layerOptions.style = 'flatmap';
1268
+ }
1269
+
1270
+ // Are features in separate vector tile source layers?
1271
+
1272
+ mapOptions.separateLayers = map.separateLayers;
1253
1273
 
1254
1274
  // Display the map
1255
1275
 
@@ -162,34 +162,6 @@ export class UserInteractions
162
162
 
163
163
  this._layerManager = new LayerManager(flatmap);
164
164
 
165
- // Add the map's layers
166
-
167
- // Layers have an id, either layer-N or an assigned name
168
- // Some layers might have a description. These are the selectable layers,
169
- // unless they are flagged as `no-select`
170
- // Selectable layers have opacity 0 unless active, in which case they have opacity 1.
171
- // `no-select` layers have opacity 0.5
172
- // Background layer has opacity 0.2
173
-
174
- const layersById = new Map();
175
- const layerBackgroundIds = [];
176
- for (const layer of flatmap.layers) {
177
- layer.backgroundLayers = [];
178
- layersById.set(layer.id, layer);
179
- }
180
- for (const layer of flatmap.layers) {
181
- if (layer.background_for) {
182
- const l = layersById.get(layer.background_for);
183
- l.backgroundLayers.push(layer);
184
- layerBackgroundIds.push(layer.id);
185
- }
186
- }
187
- for (const layer of flatmap.layers) {
188
- if (layerBackgroundIds.indexOf(layer.id) < 0) {
189
- this._layerManager.addLayer(layer, flatmap.options.layerOptions);
190
- }
191
- }
192
-
193
165
  // Flag features that have annotations
194
166
  // Also flag those features that are models of something
195
167
 
@@ -285,7 +257,9 @@ export class UserInteractions
285
257
  return {
286
258
  id: featureId,
287
259
  source: VECTOR_TILES_SOURCE,
288
- sourceLayer: ann['tile-layer']
260
+ sourceLayer: this._flatmap.options.separateLayers
261
+ ? `${ann['layer']}_${ann['tile-layer']}`
262
+ : ann['tile-layer']
289
263
  };
290
264
  }
291
265
 
@@ -873,6 +847,7 @@ export class UserInteractions
873
847
  const feature = this._activeFeatures[0]
874
848
  this.selectionEvent_(event.originalEvent, feature);
875
849
  if (feature !== undefined) {
850
+ this.__lastClickLngLat = event.lngLat;
876
851
  this.__featureEvent('click', feature);
877
852
  }
878
853
  }
@@ -930,7 +905,9 @@ export class UserInteractions
930
905
  }
931
906
  let position = annotation.centroid;
932
907
  const features = this._map.querySourceFeatures(VECTOR_TILES_SOURCE, {
933
- 'sourceLayer': annotation['tile-layer'],
908
+ 'sourceLayer': this._flatmap.options.separateLayers
909
+ ? `${annotation['layer']}_${annotation['tile-layer']}`
910
+ : annotation['tile-layer'],
934
911
  'filter': [
935
912
  'all',
936
913
  [ '==', ['id'], parseInt(featureId) ],
package/src/layers.js CHANGED
@@ -27,41 +27,58 @@ import {PATHWAYS_LAYER} from './pathways.js';
27
27
  import * as style from './styling.js';
28
28
  import * as utils from './utils.js';
29
29
 
30
+ const FEATURES_LAYER = 'features'
31
+
30
32
  //==============================================================================
31
33
 
32
34
  class MapFeatureLayer
33
35
  {
34
- constructor(flatmap, layer, options)
36
+ constructor(flatmap, layer, background_layers=true)
35
37
  {
36
38
  this.__map = flatmap.map;
39
+ this.__separateLayers = flatmap.options.separateLayers;
37
40
  this.__id = layer.id;
38
41
  this.__rasterLayers = [];
39
42
  this.__styleLayers = [];
40
43
 
41
- const haveVectorLayers = (typeof this.__map.getSource('vector-tiles') !== 'undefined');
42
- if (haveVectorLayers) {
43
- this.__addStyleLayer(style.BodyLayer, options);
44
- }
45
- if (flatmap.details['image_layer']) {
46
- for (const raster_layer_id of layer['image-layers']) {
47
- const layerId = this.__addRasterLayer(raster_layer_id, options);
44
+ const layerOptions = flatmap.options.layerOptions;
45
+ const vectorTileSource = this.__map.getSource('vector-tiles');
46
+ const haveVectorLayers = (typeof vectorTileSource !== 'undefined');
47
+ const featuresVectorLayerId = this.__separateLayers
48
+ ? `${this.__id}_${FEATURES_LAYER}`
49
+ : FEATURES_LAYER;
50
+ const vectorFeatures = haveVectorLayers
51
+ && vectorTileSource.vectorLayerIds.indexOf(featuresVectorLayerId) >= 0;
52
+ if (background_layers) {
53
+ if (vectorFeatures) {
54
+ this.__addStyleLayer(style.BodyLayer, layerOptions);
55
+ }
56
+ if (flatmap.details['image_layer']) {
57
+ for (const raster_layer_id of layer['image-layers']) {
58
+ this.__addRasterLayer(raster_layer_id, layerOptions);
59
+ }
48
60
  }
49
61
  }
50
62
  // if no image layers then make feature borders (and lines?) more visible...??
51
63
  if (haveVectorLayers) {
52
- this.__addStyleLayer(style.FeatureFillLayer, options);
53
- this.__addStyleLayer(style.FeatureLineLayer, options);
54
- this.__addStyleLayer(style.FeatureBorderLayer, options);
55
- this.__addPathwayStyleLayers(options);
56
- this.__addStyleLayer(style.FeatureLargeSymbolLayer, options);
57
- if (!flatmap.options.tooltips) {
58
- this.__addStyleLayer(style.FeatureSmallSymbolLayer, options);
64
+ if (vectorFeatures) {
65
+ this.__addStyleLayer(style.FeatureFillLayer, layerOptions);
66
+ this.__addStyleLayer(style.FeatureDashLineLayer, layerOptions);
67
+ this.__addStyleLayer(style.FeatureLineLayer, layerOptions);
68
+ this.__addStyleLayer(style.FeatureBorderLayer, layerOptions);
69
+ }
70
+ this.__addPathwayStyleLayers(layerOptions);
71
+ if (vectorFeatures) {
72
+ this.__addStyleLayer(style.FeatureLargeSymbolLayer, layerOptions);
73
+ if (!flatmap.options.tooltips) {
74
+ this.__addStyleLayer(style.FeatureSmallSymbolLayer, layerOptions);
75
+ }
59
76
  }
60
77
  }
61
78
 
62
- // Make sure our colpur options are set properly, in particular raster layer visibility
79
+ // Make sure our colour options are set properly, in particular raster layer visibility
63
80
 
64
- this.setColour(options);
81
+ this.setColour(layerOptions);
65
82
  }
66
83
 
67
84
  get id()
@@ -81,9 +98,12 @@ class MapFeatureLayer
81
98
  __addPathwayStyleLayers(options)
82
99
  //==============================
83
100
  {
101
+ const pathwaysVectorLayerId = this.__separateLayers
102
+ ? `${this.__id}_${PATHWAYS_LAYER}`
103
+ : PATHWAYS_LAYER;
84
104
  if (this.__map.getSource('vector-tiles')
85
105
  .vectorLayerIds
86
- .indexOf(PATHWAYS_LAYER) >= 0) {
106
+ .indexOf(pathwaysVectorLayerId) >= 0) {
87
107
  this.__addStyleLayer(style.PathLineLayer, options, PATHWAYS_LAYER);
88
108
  this.__addStyleLayer(style.PathDashlineLayer, options, PATHWAYS_LAYER);
89
109
  this.__addStyleLayer(style.NervePolygonBorder, options, PATHWAYS_LAYER);
@@ -92,10 +112,12 @@ class MapFeatureLayer
92
112
  }
93
113
  }
94
114
 
95
- __addStyleLayer(styleClass, options, sourceLayer='features')
96
- //==========================================================
115
+ __addStyleLayer(styleClass, options, sourceLayer=FEATURES_LAYER)
116
+ //==============================================================
97
117
  {
98
- const styleLayer = new styleClass(this.__id, sourceLayer);
118
+ const layerId = `${this.__id}_${sourceLayer}`;
119
+ const source = this.__separateLayers ? layerId : sourceLayer;
120
+ const styleLayer = new styleClass(layerId, source);
99
121
  this.__map.addLayer(styleLayer.style(options));
100
122
  this.__styleLayers.push(styleLayer);
101
123
  }
@@ -129,12 +151,28 @@ export class LayerManager
129
151
  this.__mapLayers = new Map;
130
152
  this.__activeLayers = [];
131
153
  this.__activeLayerNames = [];
154
+ this.__rasterLayers = [];
132
155
  const backgroundLayer = new style.BackgroundLayer();
133
156
  if ('background' in flatmap.options) {
134
157
  this.__map.addLayer(backgroundLayer.style(flatmap.options.background));
135
158
  } else {
136
159
  this.__map.addLayer(backgroundLayer.style('white'));
137
160
  }
161
+ // Add the map's layers
162
+ const layerOptions = flatmap.options.layerOptions;
163
+ const fcDiagram = ('style' in layerOptions && layerOptions.style == 'fcdiagram');
164
+ if (fcDiagram && flatmap.details['image_layer']) {
165
+ for (const layer of flatmap.layers) {
166
+ for (const raster_layer_id of layer['image-layers']) {
167
+ const rasterLayer = new style.RasterLayer(raster_layer_id);
168
+ this.__map.addLayer(rasterLayer.style(layerOptions));
169
+ this.__rasterLayers.push(rasterLayer);
170
+ }
171
+ }
172
+ }
173
+ for (const layer of flatmap.layers) {
174
+ this.addLayer(layer, !fcDiagram);
175
+ }
138
176
  }
139
177
 
140
178
  get activeLayerNames()
@@ -143,12 +181,12 @@ export class LayerManager
143
181
  return this.__activeLayerNames;
144
182
  }
145
183
 
146
- addLayer(layer, options)
147
- //======================
184
+ addLayer(layer, background_layers=true)
185
+ //=====================================
148
186
  {
149
187
  this.__mapLayers.set(layer.id, layer);
150
188
 
151
- const layers = new MapFeatureLayer(this.__flatmap, layer, options);
189
+ const layers = new MapFeatureLayer(this.__flatmap, layer, background_layers);
152
190
  const layerId = this.__flatmap.mapLayerId(layer.id);
153
191
  this.__layers.set(layerId, layers);
154
192
  }
package/src/styling.js CHANGED
@@ -28,9 +28,9 @@ export const VECTOR_TILES_SOURCE = 'vector-tiles';
28
28
 
29
29
  class VectorStyleLayer
30
30
  {
31
- constructor(mapLayerId, sourceLayer, idPrefix)
31
+ constructor(id, suffix, sourceLayer)
32
32
  {
33
- this.__id = `${mapLayerId}_${sourceLayer}_${idPrefix}`;
33
+ this.__id = `${id}_${suffix}`;
34
34
  this.__sourceLayer = sourceLayer;
35
35
  this.__lastPaintStyle = {};
36
36
  }
@@ -78,9 +78,9 @@ class VectorStyleLayer
78
78
 
79
79
  export class BodyLayer extends VectorStyleLayer
80
80
  {
81
- constructor(mapLayerId, sourceLayer)
81
+ constructor(id, sourceLayer)
82
82
  {
83
- super(mapLayerId, sourceLayer, 'body');
83
+ super(id, 'body', sourceLayer);
84
84
  }
85
85
 
86
86
  style(options)
@@ -105,9 +105,9 @@ export class BodyLayer extends VectorStyleLayer
105
105
 
106
106
  export class FeatureFillLayer extends VectorStyleLayer
107
107
  {
108
- constructor(mapLayerId, sourceLayer)
108
+ constructor(id, sourceLayer)
109
109
  {
110
- super(mapLayerId, sourceLayer, 'fill');
110
+ super(id, 'fill', sourceLayer);
111
111
  }
112
112
 
113
113
  paintStyle(options, changes=false)
@@ -117,12 +117,12 @@ export class FeatureFillLayer extends VectorStyleLayer
117
117
  const paintStyle = {
118
118
  'fill-color': [
119
119
  'case',
120
+ ['has', 'colour'], ['get', 'colour'],
120
121
  ['boolean', ['feature-state', 'active'], false], coloured ? '#D88' : '#CCC',
121
122
  ['boolean', ['feature-state', 'selected'], false], '#0F0',
122
123
  ['any',
123
124
  ['==', ['get', 'kind'], 'scaffold']
124
125
  ], 'white',
125
- ['has', 'colour'], ['get', 'colour'],
126
126
  ['has', 'node'], '#AFA202',
127
127
  'white' // background colour? body colour ??
128
128
  ],
@@ -133,10 +133,10 @@ export class FeatureFillLayer extends VectorStyleLayer
133
133
  ['==', ['get', 'kind'], 'tissue'],
134
134
  ['==', ['get', 'kind'], 'cell-type'],
135
135
  ], 0.1,
136
- ['has', 'colour'], 0.008,
137
136
  ['has', 'node'], 0.3,
138
137
  ['boolean', ['feature-state', 'selected'], false], 1.0,
139
138
  ['boolean', ['feature-state', 'active'], false], 0.8,
139
+ ['has', 'colour'], 0.008,
140
140
  (coloured && !dimmed) ? 0.01 : 0.5
141
141
  ]
142
142
  };
@@ -165,9 +165,9 @@ export class FeatureFillLayer extends VectorStyleLayer
165
165
 
166
166
  export class FeatureBorderLayer extends VectorStyleLayer
167
167
  {
168
- constructor(mapLayerId, sourceLayer)
168
+ constructor(id, sourceLayer)
169
169
  {
170
- super(mapLayerId, sourceLayer, 'border');
170
+ super(id, 'border', sourceLayer);
171
171
  }
172
172
 
173
173
  paintStyle(options, changes=false)
@@ -236,68 +236,102 @@ export class FeatureBorderLayer extends VectorStyleLayer
236
236
 
237
237
  export class FeatureLineLayer extends VectorStyleLayer
238
238
  {
239
- constructor(mapLayerId, sourceLayer)
239
+ constructor(id, sourceLayer, dashed=false)
240
240
  {
241
- super(mapLayerId, sourceLayer, 'divider-line');
241
+ const filterType = dashed ? 'line-dash' : 'line';
242
+ super(id, `divider-${filterType}`, sourceLayer);
243
+ this.__filter = dashed ?
244
+ [
245
+ 'any',
246
+ ['==', 'type', `line-dash`]
247
+ ]
248
+ :
249
+ [
250
+ 'any',
251
+ ['==', 'type', 'bezier'],
252
+ ['==', 'type', `line`]
253
+ ];
254
+ this.__dashed = dashed;
242
255
  }
243
256
 
244
- style(options)
257
+ paintStyle(options)
245
258
  {
246
259
  const coloured = !('colour' in options) || options.colour;
260
+ const paintStyle = {
261
+ 'line-color': [
262
+ 'case',
263
+ ['has', 'colour'], ['get', 'colour'],
264
+ ['boolean', ['feature-state', 'active'], false], coloured ? '#D88' : '#CCC',
265
+ ['boolean', ['feature-state', 'selected'], false], '#0F0',
266
+ ['==', ['get', 'type'], 'network'], '#AFA202',
267
+ ['has', 'centreline'], '#888',
268
+ ('style' in options && options.style === 'authoring') ? '#C44' : '#444'
269
+ ],
270
+ 'line-opacity': [
271
+ 'case',
272
+ ['boolean', ['feature-state', 'active'], false], 1.0,
273
+ 0.3
274
+ ],
275
+ 'line-width': [
276
+ 'let',
277
+ 'width', [
278
+ 'case',
279
+ ['has', 'centreline'], 1.2,
280
+ ['==', ['get', 'type'], 'network'], 1.2,
281
+ ['boolean', ['feature-state', 'active'], false], 1.2,
282
+ ('style' in options && options.style === 'authoring') ? 0.7 : 0.5
283
+ ], [
284
+ 'interpolate',
285
+ ['exponential', 2],
286
+ ['zoom'],
287
+ 2, ["*", ['var', 'width'], ["^", 2, -0.5]],
288
+ 7, ["*", ['var', 'width'], ["^", 2, 2.5]],
289
+ 9, ["*", ['var', 'width'], ["^", 2, 4.0]]
290
+ ]
291
+ ]
292
+ // Need to vary width based on zoom??
293
+ // Or opacity??
294
+ };
295
+ if (this.__dashed) {
296
+ paintStyle['line-dasharray'] = [3, 2];
297
+ }
298
+ return paintStyle;
299
+ }
300
+
301
+ style(options)
302
+ {
247
303
  return {
248
304
  ...super.style(),
249
305
  'type': 'line',
250
306
  'filter': [
251
- 'all',
252
- ['==', '$type', 'LineString']
307
+ 'all',
308
+ ['==', '$type', 'LineString'],
309
+ this.__filter
253
310
  // not for paths...
254
311
  ],
255
- 'paint': {
256
- 'line-color': [
257
- 'case',
258
- ['boolean', ['feature-state', 'active'], false], coloured ? '#D88' : '#CCC',
259
- ['boolean', ['feature-state', 'selected'], false], '#0F0',
260
- ['==', ['get', 'type'], 'network'], '#AFA202',
261
- ['has', 'centreline'], '#888',
262
- ('authoring' in options && options.authoring) ? '#C44' : '#444'
263
- ],
264
- 'line-opacity': [
265
- 'case',
266
- ['boolean', ['feature-state', 'active'], false], 1.0,
267
- 0.3
268
- ],
269
- 'line-width': [
270
- 'let',
271
- 'width', [
272
- 'case',
273
- ['has', 'centreline'], 1.2,
274
- ['==', ['get', 'type'], 'network'], 1.2,
275
- ['boolean', ['feature-state', 'active'], false], 1.2,
276
- ('authoring' in options && options.authoring) ? 0.7 : 0.1
277
- ], [
278
- 'interpolate',
279
- ['exponential', 2],
280
- ['zoom'],
281
- 2, ["*", ['var', 'width'], ["^", 2, -0.5]],
282
- 7, ["*", ['var', 'width'], ["^", 2, 2.5]],
283
- 9, ["*", ['var', 'width'], ["^", 2, 4.0]]
284
- ]
285
- ]
286
- // Need to vary width based on zoom??
287
- // Or opacity??
288
- }
312
+ 'paint': this.paintStyle(options)
289
313
  };
290
314
  }
291
315
  }
292
316
 
293
317
  //==============================================================================
294
318
 
319
+ export class FeatureDashLineLayer extends FeatureLineLayer
320
+ {
321
+ constructor(id, sourceLayer)
322
+ {
323
+ super(id, sourceLayer, true);
324
+ }
325
+ }
326
+
327
+ //==============================================================================
328
+
295
329
  export class PathLineLayer extends VectorStyleLayer
296
330
  {
297
- constructor(mapLayerId, sourceLayer, dashed=false)
331
+ constructor(id, sourceLayer, dashed=false)
298
332
  {
299
333
  const filterType = dashed ? 'line-dash' : 'line';
300
- super(mapLayerId, sourceLayer, filterType);
334
+ super(id, filterType, sourceLayer);
301
335
  this.__filter = dashed ?
302
336
  [
303
337
  'any',
@@ -386,9 +420,9 @@ export class PathLineLayer extends VectorStyleLayer
386
420
 
387
421
  export class PathDashlineLayer extends PathLineLayer
388
422
  {
389
- constructor(mapLayerId, sourceLayer)
423
+ constructor(id, sourceLayer)
390
424
  {
391
- super(mapLayerId, sourceLayer, true);
425
+ super(id, sourceLayer, true);
392
426
  }
393
427
  }
394
428
 
@@ -396,9 +430,9 @@ export class PathDashlineLayer extends PathLineLayer
396
430
 
397
431
  export class FeatureNerveLayer extends VectorStyleLayer
398
432
  {
399
- constructor(mapLayerId, sourceLayer)
433
+ constructor(id, sourceLayer)
400
434
  {
401
- super(mapLayerId, sourceLayer, 'nerve-path');
435
+ super(id, 'nerve-path', sourceLayer);
402
436
  }
403
437
 
404
438
  style(options)
@@ -449,9 +483,9 @@ export class FeatureNerveLayer extends VectorStyleLayer
449
483
 
450
484
  export class NervePolygonBorder extends VectorStyleLayer
451
485
  {
452
- constructor(mapLayerId, sourceLayer)
486
+ constructor(id, sourceLayer)
453
487
  {
454
- super(mapLayerId, sourceLayer, 'nerve-border');
488
+ super(id, 'nerve-border', sourceLayer);
455
489
  }
456
490
 
457
491
  style(options)
@@ -493,9 +527,9 @@ export class NervePolygonBorder extends VectorStyleLayer
493
527
 
494
528
  export class NervePolygonFill extends VectorStyleLayer
495
529
  {
496
- constructor(mapLayerId, sourceLayer)
530
+ constructor(id, sourceLayer)
497
531
  {
498
- super(mapLayerId, sourceLayer, 'nerve-fill');
532
+ super(id, 'nerve-fill', sourceLayer);
499
533
  }
500
534
 
501
535
  style(options)
@@ -543,9 +577,9 @@ export class NervePolygonFill extends VectorStyleLayer
543
577
 
544
578
  export class FeatureLargeSymbolLayer extends VectorStyleLayer
545
579
  {
546
- constructor(mapLayerId, sourceLayer)
580
+ constructor(id, sourceLayer)
547
581
  {
548
- super(mapLayerId, sourceLayer, 'large-symbol');
582
+ super(id, 'large-symbol', sourceLayer);
549
583
  }
550
584
 
551
585
  style(options)
@@ -587,9 +621,9 @@ export class FeatureLargeSymbolLayer extends VectorStyleLayer
587
621
 
588
622
  export class FeatureSmallSymbolLayer extends VectorStyleLayer
589
623
  {
590
- constructor(mapLayerId, sourceLayer)
624
+ constructor(id, sourceLayer)
591
625
  {
592
- super(mapLayerId, sourceLayer, 'small-symbol');
626
+ super(id, 'small-symbol', sourceLayer);
593
627
  }
594
628
 
595
629
  style(options)
@@ -630,7 +664,7 @@ export class FeatureSmallSymbolLayer extends VectorStyleLayer
630
664
 
631
665
  export class BackgroundLayer
632
666
  {
633
- constructor(rasterLayerId)
667
+ constructor()
634
668
  {
635
669
  this.__id = 'background';
636
670
  }
@@ -643,7 +677,7 @@ export class BackgroundLayer
643
677
  style(backgroundColour)
644
678
  {
645
679
  return {
646
- 'id': 'background',
680
+ 'id': this.__id,
647
681
  'type': 'background',
648
682
  'paint': {
649
683
  'background-color': backgroundColour,
@@ -657,9 +691,9 @@ export class BackgroundLayer
657
691
 
658
692
  export class RasterLayer
659
693
  {
660
- constructor(rasterLayerId)
694
+ constructor(id)
661
695
  {
662
- this.__id = rasterLayerId;
696
+ this.__id = id;
663
697
  }
664
698
 
665
699
  get id()