@abi-software/flatmap-viewer 2.7.1 → 2.7.3-a.1

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.
Files changed (122) hide show
  1. package/README.rst +1 -1
  2. package/dist/flatmapviewer.es.js +80577 -0
  3. package/dist/flatmapviewer.umd.js +1687 -0
  4. package/dist/lib/index.d.ts +4 -0
  5. package/dist/style.css +1 -0
  6. package/package.json +10 -8
  7. package/lib/index.ts +0 -10
  8. package/src/contextmenu.js +0 -97
  9. package/src/controls/annotation.js +0 -302
  10. package/src/controls/controls.js +0 -645
  11. package/src/controls/flightpaths.js +0 -95
  12. package/src/controls/info.js +0 -291
  13. package/src/controls/minimap.js +0 -442
  14. package/src/controls/paths.js +0 -143
  15. package/src/controls/search.js +0 -113
  16. package/src/controls/systems.js +0 -75
  17. package/src/controls/taxons.js +0 -73
  18. package/src/flatmap-viewer.js +0 -1789
  19. package/src/images.js +0 -66
  20. package/src/interactions.js +0 -1569
  21. package/src/layers/cluster.js +0 -178
  22. package/src/layers/filter.js +0 -310
  23. package/src/layers/flightpaths.js +0 -383
  24. package/src/layers/index.js +0 -478
  25. package/src/layers/styling.js +0 -1077
  26. package/src/main.js +0 -272
  27. package/src/mapserver.js +0 -64
  28. package/src/mathjax.js +0 -100
  29. package/src/pathways.js +0 -427
  30. package/src/search.js +0 -137
  31. package/src/systems.js +0 -146
  32. package/src/utils.js +0 -152
  33. package/static/css/flatmap-viewer.css +0 -238
  34. package/static/icons/favicon.ico +0 -0
  35. package/static/images/active.png +0 -0
  36. package/static/images/inactive.png +0 -0
  37. package/static/images/reset-map-active.png +0 -0
  38. package/static/images/reset-map-button.png +0 -0
  39. package/static/images/rounded-background.png +0 -0
  40. package/static/images/zoom-in-active.png +0 -0
  41. package/static/images/zoom-in-button.png +0 -0
  42. package/static/images/zoom-out-active.png +0 -0
  43. package/static/images/zoom-out-button.png +0 -0
  44. package/thirdParty/maplibre-gl-svg/CHANGELOG.md +0 -13
  45. package/thirdParty/maplibre-gl-svg/LICENSE +0 -21
  46. package/thirdParty/maplibre-gl-svg/LICENSE.md +0 -21
  47. package/thirdParty/maplibre-gl-svg/README.md +0 -24
  48. package/thirdParty/maplibre-gl-svg/assets/Add custom SVG template to template manager.jpg +0 -0
  49. package/thirdParty/maplibre-gl-svg/assets/All built-in SVG templates as HTML markers.jpg +0 -0
  50. package/thirdParty/maplibre-gl-svg/assets/All built-in SVG templates as symbols.jpg +0 -0
  51. package/thirdParty/maplibre-gl-svg/assets/Fill polygon with built-in SVG template.jpg +0 -0
  52. package/thirdParty/maplibre-gl-svg/assets/HTML Marker with Custom SVG Template.jpg +0 -0
  53. package/thirdParty/maplibre-gl-svg/assets/HTML Marker with built-in SVG template.jpg +0 -0
  54. package/thirdParty/maplibre-gl-svg/assets/Line layer with built-in SVG template.jpg +0 -0
  55. package/thirdParty/maplibre-gl-svg/assets/Load SVG from URL.jpg +0 -0
  56. package/thirdParty/maplibre-gl-svg/assets/SVG template options.jpg +0 -0
  57. package/thirdParty/maplibre-gl-svg/assets/Smiley_face_changed.svg +0 -37
  58. package/thirdParty/maplibre-gl-svg/assets/Symbol layer with built-in SVG template.jpg +0 -0
  59. package/thirdParty/maplibre-gl-svg/assets/image-templates/arrow-up-thin.png +0 -0
  60. package/thirdParty/maplibre-gl-svg/assets/image-templates/arrow-up.png +0 -0
  61. package/thirdParty/maplibre-gl-svg/assets/image-templates/car.png +0 -0
  62. package/thirdParty/maplibre-gl-svg/assets/image-templates/checker-rotated.png +0 -0
  63. package/thirdParty/maplibre-gl-svg/assets/image-templates/checker.png +0 -0
  64. package/thirdParty/maplibre-gl-svg/assets/image-templates/circles-spaced.png +0 -0
  65. package/thirdParty/maplibre-gl-svg/assets/image-templates/circles.png +0 -0
  66. package/thirdParty/maplibre-gl-svg/assets/image-templates/diagonal-lines-down.png +0 -0
  67. package/thirdParty/maplibre-gl-svg/assets/image-templates/diagonal-lines-up.png +0 -0
  68. package/thirdParty/maplibre-gl-svg/assets/image-templates/diagonal-stripes-down.png +0 -0
  69. package/thirdParty/maplibre-gl-svg/assets/image-templates/diagonal-stripes-up.png +0 -0
  70. package/thirdParty/maplibre-gl-svg/assets/image-templates/dots.png +0 -0
  71. package/thirdParty/maplibre-gl-svg/assets/image-templates/flag-triangle.png +0 -0
  72. package/thirdParty/maplibre-gl-svg/assets/image-templates/flag.png +0 -0
  73. package/thirdParty/maplibre-gl-svg/assets/image-templates/grid-lines.png +0 -0
  74. package/thirdParty/maplibre-gl-svg/assets/image-templates/hexagon-rounded-thick.png +0 -0
  75. package/thirdParty/maplibre-gl-svg/assets/image-templates/hexagon-rounded.png +0 -0
  76. package/thirdParty/maplibre-gl-svg/assets/image-templates/hexagon-thick.png +0 -0
  77. package/thirdParty/maplibre-gl-svg/assets/image-templates/hexagon.png +0 -0
  78. package/thirdParty/maplibre-gl-svg/assets/image-templates/marker-arrow.png +0 -0
  79. package/thirdParty/maplibre-gl-svg/assets/image-templates/marker-ball-pin.png +0 -0
  80. package/thirdParty/maplibre-gl-svg/assets/image-templates/marker-circle.png +0 -0
  81. package/thirdParty/maplibre-gl-svg/assets/image-templates/marker-flat.png +0 -0
  82. package/thirdParty/maplibre-gl-svg/assets/image-templates/marker-square-cluster.png +0 -0
  83. package/thirdParty/maplibre-gl-svg/assets/image-templates/marker-square-rounded-cluster.png +0 -0
  84. package/thirdParty/maplibre-gl-svg/assets/image-templates/marker-square-rounded.png +0 -0
  85. package/thirdParty/maplibre-gl-svg/assets/image-templates/marker-square.png +0 -0
  86. package/thirdParty/maplibre-gl-svg/assets/image-templates/marker-thick.png +0 -0
  87. package/thirdParty/maplibre-gl-svg/assets/image-templates/marker.png +0 -0
  88. package/thirdParty/maplibre-gl-svg/assets/image-templates/pin-round.png +0 -0
  89. package/thirdParty/maplibre-gl-svg/assets/image-templates/pin.png +0 -0
  90. package/thirdParty/maplibre-gl-svg/assets/image-templates/rotated-grid-lines.png +0 -0
  91. package/thirdParty/maplibre-gl-svg/assets/image-templates/rotated-grid-stripes.png +0 -0
  92. package/thirdParty/maplibre-gl-svg/assets/image-templates/rounded-square-thick.png +0 -0
  93. package/thirdParty/maplibre-gl-svg/assets/image-templates/rounded-square.png +0 -0
  94. package/thirdParty/maplibre-gl-svg/assets/image-templates/triangle-arrow-left.png +0 -0
  95. package/thirdParty/maplibre-gl-svg/assets/image-templates/triangle-arrow-up.png +0 -0
  96. package/thirdParty/maplibre-gl-svg/assets/image-templates/triangle-thick.png +0 -0
  97. package/thirdParty/maplibre-gl-svg/assets/image-templates/triangle.png +0 -0
  98. package/thirdParty/maplibre-gl-svg/assets/image-templates/x-fill.png +0 -0
  99. package/thirdParty/maplibre-gl-svg/assets/image-templates/zig-zag-vertical.png +0 -0
  100. package/thirdParty/maplibre-gl-svg/assets/image-templates/zig-zag.png +0 -0
  101. package/thirdParty/maplibre-gl-svg/build/build.js +0 -210
  102. package/thirdParty/maplibre-gl-svg/dist/maplibre-gl-svg.js +0 -339
  103. package/thirdParty/maplibre-gl-svg/dist/maplibre-gl-svg.min.js +0 -4
  104. package/thirdParty/maplibre-gl-svg/docs/docs.md +0 -375
  105. package/thirdParty/maplibre-gl-svg/examples/Add custom SVG template to template manager.html +0 -101
  106. package/thirdParty/maplibre-gl-svg/examples/All built-in SVG templates as HTML markers.html +0 -82
  107. package/thirdParty/maplibre-gl-svg/examples/All built-in SVG templates as symbols.html +0 -124
  108. package/thirdParty/maplibre-gl-svg/examples/Fill polygon with built-in SVG template.html +0 -94
  109. package/thirdParty/maplibre-gl-svg/examples/HTML Marker with Custom SVG Template.html +0 -86
  110. package/thirdParty/maplibre-gl-svg/examples/HTML Marker with built-in SVG template.html +0 -83
  111. package/thirdParty/maplibre-gl-svg/examples/Line layer with built-in SVG template.html +0 -129
  112. package/thirdParty/maplibre-gl-svg/examples/Load SVG from URL.html +0 -96
  113. package/thirdParty/maplibre-gl-svg/examples/SVG template options.html +0 -264
  114. package/thirdParty/maplibre-gl-svg/examples/Symbol layer with built-in SVG template.html +0 -93
  115. package/thirdParty/maplibre-gl-svg/index.html +0 -151
  116. package/thirdParty/maplibre-gl-svg/package-lock.json +0 -5882
  117. package/thirdParty/maplibre-gl-svg/package.json +0 -49
  118. package/thirdParty/maplibre-gl-svg/src/SvgManager.ts +0 -186
  119. package/thirdParty/maplibre-gl-svg/src/SvgTemplateManager.ts +0 -144
  120. package/thirdParty/maplibre-gl-svg/src/index.ts +0 -4
  121. package/thirdParty/maplibre-gl-svg/tsconfig.json +0 -31
  122. package/thirdParty/maplibre-gl-svg/typings/index.d.ts +0 -111
@@ -1,383 +0,0 @@
1
- /******************************************************************************
2
-
3
- Flatmap viewer and annotation tool
4
-
5
- Copyright (c) 2019 - 2024 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
- import {ArcLayer} from '@deck.gl/layers'
22
- import {MapboxOverlay as DeckOverlay} from '@deck.gl/mapbox'
23
- import {Model, Geometry} from '@luma.gl/core'
24
- import GL from '@luma.gl/constants'
25
-
26
- //==============================================================================
27
-
28
- import {pathColourArray} from '../pathways'
29
- import {PropertiesFilter} from './filter'
30
-
31
- //==============================================================================
32
-
33
- const transparencyCheck = '|| length(vColor) == 0.0'
34
-
35
- class ArcMapLayer extends ArcLayer
36
- {
37
- static layerName = 'ArcMapLayer'
38
-
39
- #dirty = false
40
- #pathData
41
-
42
- constructor(...args)
43
- {
44
- super(...args)
45
- this.#pathData = new Map([...this.props.data].map(ann => [+ann.featureId, ann]))
46
- this.#pathData.forEach(ann => delete ann['hidden'])
47
- }
48
-
49
- get featureIds()
50
- //==============
51
- {
52
- return [...this.#pathData.keys()]
53
- }
54
-
55
- getShaders()
56
- //==========
57
- {
58
- const shaders = super.getShaders()
59
- shaders.fs = `#version 300 es\n${shaders.fs}`
60
- .replace('isValid == 0.0', `isValid == 0.0 ${transparencyCheck}`)
61
- shaders.vs = `#version 300 es\n${shaders.vs}`
62
- return shaders
63
- }
64
-
65
- setDataProperty(featureId, key, enabled)
66
- //======================================
67
- {
68
- const properties = this.#pathData.get(+featureId)
69
- if (properties) {
70
- if (!(key in properties) || properties[key] !== enabled) {
71
- properties[key] = enabled
72
- this.#dirty = true
73
- }
74
- }
75
- }
76
-
77
- redraw(force=false)
78
- //=================
79
- {
80
- if (force || this.#dirty) {
81
- this.internalState.changeFlags.dataChanged = true
82
- this.setNeedsUpdate()
83
- this.#dirty = false
84
- }
85
- }
86
- }
87
-
88
- //==============================================================================
89
-
90
- const makeDashedTriangles = ` float alpha = floor(fract(float(gl_VertexID)/12.0)+0.5);
91
- if (vColor.a != 0.0) vColor.a *= alpha;
92
- `
93
-
94
- class ArcDashedLayer extends ArcMapLayer
95
- {
96
- static layerName = 'ArcDashedLayer'
97
-
98
- constructor(...args)
99
- {
100
- super(...args)
101
- }
102
-
103
- getShaders()
104
- //==========
105
- {
106
- const shaders = super.getShaders()
107
- shaders.vs = shaders.vs.replace('DECKGL_FILTER_COLOR(', `${makeDashedTriangles}\n DECKGL_FILTER_COLOR(`)
108
- return shaders
109
- }
110
-
111
- _getModel(gl)
112
- //===========
113
- {
114
- const {numSegments} = this.props
115
- let positions = []
116
- for (let i = 0; i < numSegments; i++) {
117
- positions = positions.concat([i, 1, 0, i, -1, 0, i+1, 1, 0,
118
- i, -1, 0, i+1, 1, 0, i+1, -1, 0])
119
- }
120
- const model = new Model(gl, {
121
- ...this.getShaders(),
122
- id: this.props.id,
123
- geometry: new Geometry({
124
- drawMode: GL.TRIANGLES,
125
- attributes: {
126
- positions: new Float32Array(positions)
127
- }
128
- }),
129
- isInstanced: true,
130
- })
131
- model.setUniforms({numSegments: numSegments})
132
- return model
133
- }
134
- }
135
-
136
- //==============================================================================
137
-
138
- export class FlightPathLayer
139
- {
140
- #arcLayers = new Map()
141
- #deckOverlay = null
142
- #dimmed = false
143
- #enabled = false
144
- #featureFilter = new PropertiesFilter()
145
- #featureToLayer = new Map()
146
- #knownTypes = []
147
- #map
148
- #pathData
149
- #pathFilters
150
- #pathManager
151
- #pathStyles
152
- #ui
153
-
154
- constructor(flatmap, ui)
155
- {
156
- this.#ui = ui
157
- this.#map = flatmap.map
158
- this.#pathManager = ui.pathManager
159
- this.#pathManager.addWatcher(this.#pathStateChanged.bind(this))
160
- this.#pathData = new Map([...flatmap.annotations.values()]
161
- .filter(ann => ann['tile-layer'] === 'pathways'
162
- && ann['geometry'] === 'LineString'
163
- && 'type' in ann && ann['type'].startsWith('line')
164
- && 'kind' in ann
165
- && 'pathStartPosition' in ann
166
- && 'pathEndPosition' in ann)
167
- .map(ann => [ann.featureId, ann]))
168
- this.#pathStyles = new Map(this.#pathManager.pathStyles().map(s => [s.type, s]))
169
- const knownTypes = [...this.#pathStyles.keys()].filter(t => t !== 'other')
170
- this.#pathFilters = new Map(
171
- [...this.#pathStyles.keys()]
172
- .map(pathType => [pathType, new PropertiesFilter({
173
- OR: [{
174
- AND: [
175
- {kind: knownTypes},
176
- {kind: pathType}
177
- ],
178
- },
179
- {
180
- AND: [
181
- {
182
- NOT: {kind: knownTypes}
183
- },
184
- (pathType === 'other')
185
- ]
186
- }]
187
- })
188
- ])
189
- )
190
- }
191
-
192
- enable(enable=true)
193
- //=================
194
- {
195
- if (enable && !this.#enabled) {
196
- this.#setupDeckOverlay()
197
- this.#map.addControl(this.#deckOverlay)
198
- } else if (!enable && this.#enabled) {
199
- if (this.#deckOverlay) {
200
- this.#map.removeControl(this.#deckOverlay)
201
- this.#deckOverlay.finalize()
202
- this.#deckOverlay = null
203
- }
204
- this.#featureToLayer = new Map()
205
- }
206
- this.#enabled = enable
207
- }
208
-
209
- queryFeaturesAtPoint(point)
210
- //=========================
211
- {
212
- if (this.#deckOverlay) {
213
- return this.#deckOverlay
214
- .pickMultipleObjects(point)
215
- .map(o => this.#makeMapFeature(o.object))
216
- }
217
- return []
218
- }
219
-
220
- redraw(force=false)
221
- //=================
222
- {
223
- for (const layer of this.#arcLayers.values()) {
224
- layer.redraw(force)
225
- }
226
- }
227
-
228
- removeFeatureState(featureId, key)
229
- //================================
230
- {
231
- const layer = this.#featureToLayer.get(+featureId)
232
- if (layer) {
233
- layer.setDataProperty(featureId, key, false)
234
- layer.redraw()
235
- }
236
- }
237
-
238
- setFeatureState(featureId, state)
239
- //===============================
240
- {
241
- const layer = this.#featureToLayer.get(+featureId)
242
- if (layer) {
243
- for (const [key, value] of Object.entries(state)) {
244
- layer.setDataProperty(featureId, key, value)
245
- }
246
- layer.redraw()
247
- }
248
- }
249
-
250
- setFilter(featureFilter)
251
- //======================
252
- {
253
- this.#featureFilter = featureFilter
254
- if (this.#deckOverlay) {
255
- const updatedLayers = new Map()
256
- for (const [pathType, layer] of this.#arcLayers.entries()) {
257
- layer.featureIds.forEach(id => this.#featureToLayer.delete(+id))
258
- const pathStyle = this.#pathStyles.get(pathType)
259
- if (pathStyle) {
260
- const updatedLayer = pathStyle.dashed
261
- ? new ArcDashedLayer(this.#layerOptions(pathType))
262
- : new ArcMapLayer(this.#layerOptions(pathType))
263
- updatedLayer.featureIds.forEach(id => this.#featureToLayer.set(+id, layer))
264
- updatedLayers.set(pathType, updatedLayer)
265
- }
266
- }
267
- this.#arcLayers = updatedLayers
268
- this.#deckOverlay.setProps({
269
- layers: [...this.#arcLayers.values()]
270
- })
271
- }
272
- }
273
-
274
- setPaint(options)
275
- //===============
276
- {
277
- const dimmed = options.dimmed || false
278
- if (this.#dimmed !== dimmed) {
279
- this.#dimmed = dimmed
280
- this.redraw(true)
281
- }
282
- }
283
-
284
- #addArcLayer(pathType)
285
- //====================
286
- {
287
- const pathStyle = this.#pathStyles.get(pathType)
288
- if (pathStyle) {
289
- const layer = pathStyle.dashed
290
- ? new ArcDashedLayer(this.#layerOptions(pathType))
291
- : new ArcMapLayer(this.#layerOptions(pathType))
292
- layer.featureIds.forEach(id => this.#featureToLayer.set(+id, layer))
293
- this.#arcLayers.set(pathType, layer)
294
- }
295
- }
296
-
297
- #removeArcLayer(pathType)
298
- //=======================
299
- {
300
- const layer = this.#arcLayers.get(pathType)
301
- if (layer) {
302
- layer.featureIds.forEach(id => this.#featureToLayer.delete(+id))
303
- this.#arcLayers.delete(pathType)
304
- }
305
- }
306
-
307
- #pathColour(properties)
308
- //=====================
309
- {
310
- if (properties.hidden) {
311
- return [0, 0, 0, 0]
312
- }
313
- return pathColourArray(properties.kind,
314
- properties.active || properties.selected ? 255
315
- : this.#dimmed ? 20 : 160)
316
- }
317
-
318
- #pathStateChanged(changes={})
319
- //===========================
320
- {
321
- if (this.#deckOverlay) {
322
- if ('pathType' in changes) {
323
- const pathType = changes.pathType
324
- const enabled = this.#pathManager.pathTypeEnabled(pathType)
325
- if (enabled && !this.#arcLayers.has(pathType)) {
326
- this.#addArcLayer(pathType)
327
- } else if (!enabled && this.#arcLayers.has(pathType)) {
328
- this.#removeArcLayer(pathType)
329
- }
330
- this.#deckOverlay.setProps({
331
- layers: [...this.#arcLayers.values()]
332
- })
333
- }
334
- }
335
- }
336
-
337
- #layerOptions(pathType)
338
- //=====================
339
- {
340
- const filter = this.#pathFilters.get(pathType)
341
- const pathData = (filter ? [...this.#pathData.values()].filter(ann => filter.match(ann))
342
- : []).filter(ann => this.#featureFilter.match(ann))
343
- return {
344
- id: `arc-${pathType}`,
345
- data: pathData,
346
- pickable: true,
347
- numSegments: 400,
348
- // Styles
349
- getSourcePosition: f => f.pathStartPosition,
350
- getTargetPosition: f => f.pathEndPosition,
351
- getSourceColor: this.#pathColour.bind(this),
352
- getTargetColor: this.#pathColour.bind(this),
353
- opacity: 1.0,
354
- getWidth: 3,
355
- }
356
- }
357
-
358
- #makeMapFeature(pickedObject)
359
- //===========================
360
- {
361
- // Mock up a map vector feature
362
- return {
363
- id: pickedObject.featureId,
364
- source: 'vector-tiles',
365
- sourceLayer: `${pickedObject.layer}_${pickedObject['tile-layer']}`,
366
- properties: pickedObject,
367
- flightPath: true
368
- }
369
- }
370
-
371
- #setupDeckOverlay()
372
- //=================
373
- {
374
- // One overlay layer for each path style
375
- [...this.#pathStyles.values()].filter(style => this.#pathManager.pathTypeEnabled(style.type))
376
- .forEach(style => this.#addArcLayer(style.type))
377
- this.#deckOverlay = new DeckOverlay({
378
- layers: [...this.#arcLayers.values()],
379
- })
380
- }
381
- }
382
-
383
- //==============================================================================