@abi-software/flatmap-viewer 2.6.0-a.1 → 2.6.0
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 +2 -2
- package/package.json +24 -10
- package/src/controls/annotation.js +27 -10
- package/src/flatmap-viewer.js +50 -2
- package/src/interactions.js +89 -116
- package/src/layers/filter.js +310 -0
- package/src/layers/index.js +132 -45
- package/src/layers/paths3d.js +60 -10
- package/src/main.js +1 -4
- package/src/layers/filter.ts +0 -187
package/README.rst
CHANGED
|
@@ -26,7 +26,7 @@ Running
|
|
|
26
26
|
|
|
27
27
|
::
|
|
28
28
|
|
|
29
|
-
$ npm
|
|
29
|
+
$ npm start
|
|
30
30
|
|
|
31
31
|
Maps can then be viewed at http://localhost:3000
|
|
32
32
|
|
|
@@ -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.
|
|
41
|
+
* ``npm install @abi-software/flatmap-viewer@2.6.0``
|
|
42
42
|
|
|
43
43
|
Documentation
|
|
44
44
|
-------------
|
package/package.json
CHANGED
|
@@ -1,30 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abi-software/flatmap-viewer",
|
|
3
|
-
"version": "2.6.0
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"description": "Flatmap viewer using Maplibre GL",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/AnatomicMaps/flatmap-viewer.git"
|
|
8
8
|
},
|
|
9
9
|
"main": "src/main.js",
|
|
10
|
-
"type": "module",
|
|
11
10
|
"files": [
|
|
12
11
|
"src",
|
|
13
12
|
"static"
|
|
14
13
|
],
|
|
15
14
|
"scripts": {
|
|
16
15
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
17
|
-
"
|
|
18
|
-
"build": "
|
|
19
|
-
"preview": "vite preview",
|
|
16
|
+
"start": "node app",
|
|
17
|
+
"build": "webpack --mode production",
|
|
20
18
|
"docs": "cd docs; poetry run make html"
|
|
21
19
|
},
|
|
22
20
|
"author": "David Brooks",
|
|
23
21
|
"license": "MIT",
|
|
24
22
|
"dependencies": {
|
|
25
|
-
"@
|
|
26
|
-
"@deck.gl/
|
|
27
|
-
"@deck.gl/
|
|
23
|
+
"@babel/runtime": "^7.10.4",
|
|
24
|
+
"@deck.gl/core": "^8.9.35",
|
|
25
|
+
"@deck.gl/layers": "^8.9.35",
|
|
26
|
+
"@deck.gl/mapbox": "^8.9.35",
|
|
28
27
|
"@mapbox/mapbox-gl-draw": "^1.4.3",
|
|
29
28
|
"@turf/area": "^6.5.0",
|
|
30
29
|
"@turf/bbox": "^6.5.0",
|
|
@@ -32,6 +31,7 @@
|
|
|
32
31
|
"@turf/projection": "^6.5.0",
|
|
33
32
|
"bezier-js": "^6.1.0",
|
|
34
33
|
"colord": "^2.9.3",
|
|
34
|
+
"core-js-pure": "^3.36.1",
|
|
35
35
|
"html-es6cape": "^2.0.2",
|
|
36
36
|
"maplibre-gl": ">=3.6.0",
|
|
37
37
|
"mathjax-full": "^3.2.2",
|
|
@@ -39,8 +39,22 @@
|
|
|
39
39
|
"polylabel": "^1.1.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
+
"@babel/core": "^7.5.5",
|
|
43
|
+
"@babel/plugin-transform-runtime": "^7.5.5",
|
|
44
|
+
"@babel/preset-env": "^7.10.4",
|
|
45
|
+
"babel-loader": "^8.1.0",
|
|
46
|
+
"browser-sync": "^2.26.7",
|
|
47
|
+
"bs-fullscreen-message": "^1.1.0",
|
|
48
|
+
"clean-webpack-plugin": "^3.0.0",
|
|
49
|
+
"css-loader": "^6.7.3",
|
|
42
50
|
"eslint": "^8.7.0",
|
|
43
|
-
"
|
|
44
|
-
"
|
|
51
|
+
"express": "^4.17.1",
|
|
52
|
+
"html-webpack-plugin": "^4.5.2",
|
|
53
|
+
"strip-ansi": "^7.0.1",
|
|
54
|
+
"style-loader": "^3.3.2",
|
|
55
|
+
"webpack": "^5.16.0",
|
|
56
|
+
"webpack-cli": "^4.4.0",
|
|
57
|
+
"webpack-dev-middleware": "^4.1.0",
|
|
58
|
+
"webpack-node-externals": "^1.7.2"
|
|
45
59
|
}
|
|
46
60
|
}
|
|
@@ -41,9 +41,10 @@ limitations under the License.
|
|
|
41
41
|
|
|
42
42
|
//==============================================================================
|
|
43
43
|
|
|
44
|
-
import MapboxDraw from "@mapbox/mapbox-gl-draw
|
|
44
|
+
import MapboxDraw from "@mapbox/mapbox-gl-draw"
|
|
45
45
|
import '@mapbox/mapbox-gl-draw/dist/mapbox-gl-draw.css'
|
|
46
46
|
|
|
47
|
+
|
|
47
48
|
//==============================================================================
|
|
48
49
|
|
|
49
50
|
const drawStyleIds = MapboxDraw.lib.theme.map(s => s.id)
|
|
@@ -100,6 +101,7 @@ export class AnnotationDrawControl
|
|
|
100
101
|
map.on('draw.create', this.createdFeature.bind(this))
|
|
101
102
|
map.on('draw.delete', this.deletedFeature.bind(this))
|
|
102
103
|
map.on('draw.update', this.updatedFeature.bind(this))
|
|
104
|
+
map.on('draw.selectionchange', this.selectionChangedEvent.bind(this))
|
|
103
105
|
this.show(this.__visible)
|
|
104
106
|
return this.__container
|
|
105
107
|
}
|
|
@@ -189,6 +191,8 @@ export class AnnotationDrawControl
|
|
|
189
191
|
{
|
|
190
192
|
const feature = this.#cleanFeature(event)
|
|
191
193
|
if (feature) {
|
|
194
|
+
// specify updated callback type, either `move` or `change_coordinates`
|
|
195
|
+
feature.action = event.action
|
|
192
196
|
if (this.__uncommittedFeatureIds.has(feature.id)) {
|
|
193
197
|
// Ignore updates on an uncommitted create or update
|
|
194
198
|
} else {
|
|
@@ -205,6 +209,13 @@ export class AnnotationDrawControl
|
|
|
205
209
|
this.#sendEvent('modeChanged', event)
|
|
206
210
|
}
|
|
207
211
|
|
|
212
|
+
selectionChangedEvent(event)
|
|
213
|
+
//==========================
|
|
214
|
+
{
|
|
215
|
+
// Used to indicate a feature is selected or deselected
|
|
216
|
+
this.#sendEvent('selectionChanged', event)
|
|
217
|
+
}
|
|
218
|
+
|
|
208
219
|
inDrawingMode()
|
|
209
220
|
//=============
|
|
210
221
|
{
|
|
@@ -221,8 +232,6 @@ export class AnnotationDrawControl
|
|
|
221
232
|
this.__committedFeatures.set(feature.id, feature)
|
|
222
233
|
}
|
|
223
234
|
this.__uncommittedFeatureIds.delete(feature.id)
|
|
224
|
-
this.__flatmap.showPopup(feature.id, '<div>committed</div>')
|
|
225
|
-
|
|
226
235
|
}
|
|
227
236
|
|
|
228
237
|
abortEvent(event)
|
|
@@ -255,12 +264,18 @@ this.__flatmap.showPopup(feature.id, '<div>committed</div>')
|
|
|
255
264
|
}
|
|
256
265
|
}
|
|
257
266
|
|
|
258
|
-
|
|
259
|
-
|
|
267
|
+
clearFeatures()
|
|
268
|
+
//=============
|
|
260
269
|
{
|
|
261
270
|
this.__draw.deleteAll()
|
|
262
271
|
}
|
|
263
272
|
|
|
273
|
+
removeFeature()
|
|
274
|
+
//=============
|
|
275
|
+
{
|
|
276
|
+
this.__draw.trash()
|
|
277
|
+
}
|
|
278
|
+
|
|
264
279
|
addFeature(feature)
|
|
265
280
|
//=================
|
|
266
281
|
{
|
|
@@ -270,15 +285,17 @@ this.__flatmap.showPopup(feature.id, '<div>committed</div>')
|
|
|
270
285
|
this.__uncommittedFeatureIds.delete(ids[0])
|
|
271
286
|
}
|
|
272
287
|
|
|
273
|
-
|
|
274
|
-
|
|
288
|
+
refreshGeometry(feature)
|
|
289
|
+
//======================
|
|
275
290
|
{
|
|
276
|
-
return this.__draw.get(
|
|
291
|
+
return this.__draw.get(feature.id) || null
|
|
277
292
|
}
|
|
278
293
|
|
|
279
|
-
|
|
280
|
-
|
|
294
|
+
changeMode(type)
|
|
295
|
+
//===============
|
|
281
296
|
{
|
|
297
|
+
// Change the mode directly without listening to modes callback
|
|
298
|
+
this.__draw.changeMode(type.mode, type.options)
|
|
282
299
|
}
|
|
283
300
|
}
|
|
284
301
|
|
package/src/flatmap-viewer.js
CHANGED
|
@@ -436,6 +436,21 @@ class FlatMap
|
|
|
436
436
|
return this.__uuid;
|
|
437
437
|
}
|
|
438
438
|
|
|
439
|
+
/**
|
|
440
|
+
* The map's URL on the map server.
|
|
441
|
+
*
|
|
442
|
+
* @type string
|
|
443
|
+
*/
|
|
444
|
+
get url()
|
|
445
|
+
//========
|
|
446
|
+
{
|
|
447
|
+
let url = this.makeServerUrl('')
|
|
448
|
+
if (url.endsWith('/')) {
|
|
449
|
+
return url.substring(0, url.length - 1)
|
|
450
|
+
}
|
|
451
|
+
return url
|
|
452
|
+
}
|
|
453
|
+
|
|
439
454
|
/**
|
|
440
455
|
* The map's ``index.json`` as returned from the map server.
|
|
441
456
|
*
|
|
@@ -1025,7 +1040,11 @@ class FlatMap
|
|
|
1025
1040
|
'models',
|
|
1026
1041
|
'source',
|
|
1027
1042
|
'taxons',
|
|
1028
|
-
'hyperlinks'
|
|
1043
|
+
'hyperlinks',
|
|
1044
|
+
'completeness',
|
|
1045
|
+
'missing-nodes',
|
|
1046
|
+
'alert',
|
|
1047
|
+
'biological-sex'
|
|
1029
1048
|
];
|
|
1030
1049
|
const jsonProperties = [
|
|
1031
1050
|
'hyperlinks'
|
|
@@ -1118,7 +1137,18 @@ class FlatMap
|
|
|
1118
1137
|
//======================
|
|
1119
1138
|
{
|
|
1120
1139
|
if (this._userInteractions) {
|
|
1121
|
-
this._userInteractions.
|
|
1140
|
+
this._userInteractions.clearAnnotationFeatures()
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
/**
|
|
1145
|
+
* Delete the selected drawn feature
|
|
1146
|
+
*/
|
|
1147
|
+
removeAnnotationFeature()
|
|
1148
|
+
//=======================
|
|
1149
|
+
{
|
|
1150
|
+
if (this._userInteractions) {
|
|
1151
|
+
this._userInteractions.removeAnnotationFeature()
|
|
1122
1152
|
}
|
|
1123
1153
|
}
|
|
1124
1154
|
|
|
@@ -1155,6 +1185,24 @@ class FlatMap
|
|
|
1155
1185
|
}
|
|
1156
1186
|
}
|
|
1157
1187
|
|
|
1188
|
+
/**
|
|
1189
|
+
* Changes draw to another mode. The mode argument must be one of the following:
|
|
1190
|
+
* `simple_select`, `direct_select`, `draw_line_string`,
|
|
1191
|
+
* `draw_polygon` or `draw_point`. Options is accepted in first three modes.
|
|
1192
|
+
* More details in mapbox-gl-draw github repository.
|
|
1193
|
+
*
|
|
1194
|
+
* @param type {Object} The object
|
|
1195
|
+
* @param type.mode {string} Either ``simple_select``, ``direct_select``, etc
|
|
1196
|
+
* @param type.options {Object} Feature id(s) object.
|
|
1197
|
+
*/
|
|
1198
|
+
changeAnnotationDrawMode(type)
|
|
1199
|
+
//============================
|
|
1200
|
+
{
|
|
1201
|
+
if (this._userInteractions) {
|
|
1202
|
+
this._userInteractions.changeAnnotationDrawMode(type)
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1158
1206
|
/**
|
|
1159
1207
|
* Generate a callback as a result of some event with a flatmap feature.
|
|
1160
1208
|
*
|