@abi-software/flatmap-viewer 2.5.2 → 2.5.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
@@ -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.5.2``
41
+ * ``npm install @abi-software/flatmap-viewer@2.5.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.5.2",
3
+ "version": "2.5.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",
@@ -589,19 +589,32 @@ class FlatMap
589
589
  }
590
590
 
591
591
  /**
592
- * Get feature ids of all nodes of a path model.
592
+ * Get GeoJSON feature ids of all nodes of a path model.
593
593
  *
594
594
  * @param {string} pathId The path model identifier
595
- * @return {set<number>} Local (GeoJSON) identifiers of features on the path
595
+ * @return {Array<string>} GeoJSON identifiers of features on the path
596
596
  */
597
597
  pathModelNodes(modelId)
598
598
  //=====================
599
599
  {
600
600
  if (this._userInteractions !== null) {
601
- return this._userInteractions.pathModelNodes(modelId);
601
+ return new [...this._userInteractions.pathModelNodes(modelId)]
602
602
  }
603
603
  }
604
604
 
605
+ /**
606
+ * Get GeoJSON feature ids of all features identified with a taxon.
607
+ *
608
+ * @param {string} taxonId The taxon identifier
609
+ * @return {Array<string>} GeoJSON identifiers of features on the path
610
+ */
611
+ taxonFeatureIds(taxonId)
612
+ //======================
613
+ {
614
+ const featureIds = this.__taxonToFeatureIds.get(utils.normaliseId(taxonId))
615
+ return [...new Set(featureIds ? featureIds : [])]
616
+ }
617
+
605
618
  get layers()
606
619
  //==========
607
620
  {
@@ -1331,6 +1344,42 @@ class FlatMap
1331
1344
  this._userInteractions.zoomToFeatures(featureIds, options);
1332
1345
  }
1333
1346
  }
1347
+
1348
+ /**
1349
+ * Select features on the map.
1350
+ *
1351
+ * @param {string | Array.<string>} geojsonIds A single GeoJSON feature identifiers
1352
+ * or an array of identifiers.
1353
+ */
1354
+ selectGeoJSONFeatures(geojsonIds)
1355
+ //===============================
1356
+ {
1357
+ if (this._userInteractions !== null) {
1358
+ this._userInteractions.selectFeatures(geojsonIds)
1359
+ }
1360
+ }
1361
+
1362
+ /**
1363
+ * Select features and zoom the map to them.
1364
+ *
1365
+ * @param {string | Array.<string>} geojsonIds A single GeoJSON feature identifiers
1366
+ * or an array of identifiers.
1367
+ * @param {Object} [options]
1368
+ * @param {boolean} [options.noZoomIn=false] Don't zoom in (although zoom out as necessary)
1369
+ * @param {number} [options.padding=10] Padding in pixels around the composite bounding box
1370
+ */
1371
+ zoomToGeoJSONFeatures(geojsonIds, options=null)
1372
+ //=============================================
1373
+ {
1374
+ options = utils.setDefaults(options, {
1375
+ select: true,
1376
+ highlight: false,
1377
+ padding:100
1378
+ })
1379
+ if (this._userInteractions !== null) {
1380
+ this._userInteractions.zoomToFeatures(geojsonIds, options)
1381
+ }
1382
+ }
1334
1383
  }
1335
1384
 
1336
1385
  //==============================================================================