@abi-software/flatmap-viewer 2.2.12-b.1 → 2.2.12-b.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/README.rst CHANGED
@@ -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@2.2.12-b.1``
41
+ * ``npm install @abi-software/flatmap-viewer@2.2.12-b.2``
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.12-b.1",
3
+ "version": "2.2.12-b.2",
4
4
  "description": "Flatmap viewer using Maplibre GL",
5
5
  "repository": "https://github.com/AnatomicMaps/flatmap-viewer.git",
6
6
  "main": "src/main.js",
@@ -785,6 +785,20 @@ class FlatMap
785
785
 
786
786
  //==========================================================================
787
787
 
788
+ /**
789
+ * Get a list of a FC flatmap's systems.
790
+ *
791
+ * @return {Array.Object.<{name: string, colour: string}>} An array with system details
792
+ */
793
+ getSystems()
794
+ //==========
795
+ {
796
+ if (this._userInteractions !== null) {
797
+ return this._userInteractions.getSystems();
798
+ }
799
+ }
800
+ //==========================================================================
801
+
788
802
  /**
789
803
  * Add a marker to the map.
790
804
  *
@@ -173,14 +173,24 @@ export class UserInteractions
173
173
  }
174
174
  }
175
175
 
176
- // Flag features that have annotations
177
- // Also flag those features that are models of something
176
+ // Flag features that have annotations and not which are FC systems
178
177
 
178
+ this.__systems = [];
179
+ const seenSystems = [];
179
180
  for (const [id, ann] of flatmap.annotations) {
180
181
  const feature = this.mapFeature_(id);
181
182
  if (feature !== undefined) {
182
183
  this._map.setFeatureState(feature, { 'annotated': true });
183
184
  }
185
+ if (ann['fc-class'] === 'FC_CLASS.SYSTEM') {
186
+ if (seenSystems.indexOf(ann['name']) < 0) {
187
+ seenSystems.push(ann['name']);
188
+ this.__systems.push({
189
+ name: ann['name'],
190
+ colour: ann['colour']
191
+ });
192
+ }
193
+ }
184
194
  }
185
195
 
186
196
  // Display a context menu on right-click
@@ -271,6 +281,12 @@ export class UserInteractions
271
281
  this._layerManager.activate(layerId, enable);
272
282
  }
273
283
 
284
+ getSystems()
285
+ //==========
286
+ {
287
+ return this.__systems;
288
+ }
289
+
274
290
  mapFeature_(featureId)
275
291
  //====================
276
292
  {