@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,95 +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
- export class FlightPathControl
22
- {
23
- #button
24
- #container
25
- #enabled = false
26
- #map = null
27
- #flatmap
28
-
29
- constructor(flatmap, enabled)
30
- {
31
- this.#flatmap = flatmap
32
- this.#enabled = !!enabled
33
- }
34
-
35
- getDefaultPosition()
36
- //==================
37
- {
38
- return 'top-right'
39
- }
40
-
41
- onAdd(map)
42
- //========
43
- {
44
- this.#map = map
45
- this.#container = document.createElement('div')
46
- this.#container.className = 'maplibregl-ctrl'
47
- this.#button = document.createElement('button')
48
- this.#button.className = 'control-button text-button'
49
- this.#button.setAttribute('type', 'button')
50
- this.#button.setAttribute('aria-label', 'Show flight paths')
51
- this.#button.textContent = '3D'
52
- this.#button.title = 'Show/hide flight paths'
53
- this.#container.appendChild(this.#button)
54
- this.#container.addEventListener('click', this.onClick.bind(this))
55
- if (this.#enabled) {
56
- this.#button.classList.add('control-active')
57
- this.__setBackground()
58
- }
59
- return this.#container
60
- }
61
-
62
- onRemove()
63
- //========
64
- {
65
- this.#container.parentNode.removeChild(this.#container)
66
- this.#map = undefined
67
- }
68
-
69
- __setBackground()
70
- //===============
71
- {
72
- if (this.#enabled) {
73
- this.#button.setAttribute('style', 'background: red');
74
- } else {
75
- this.#button.removeAttribute('style');
76
- }
77
- }
78
-
79
- onClick(_event)
80
- //=============
81
- {
82
- if (this.#button.classList.contains('control-active')) {
83
- this.#flatmap.enableFlightPaths(false)
84
- this.#button.classList.remove('control-active')
85
- this.#enabled = false
86
- } else {
87
- this.#flatmap.enableFlightPaths(true)
88
- this.#button.classList.add('control-active')
89
- this.#enabled = true
90
- }
91
- this.__setBackground()
92
- }
93
- }
94
-
95
- //==============================================================================
@@ -1,291 +0,0 @@
1
- /******************************************************************************
2
-
3
- Flatmap viewer and annotation tool
4
-
5
- Copyright (c) 2019 - 2023 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 { indexedProperties } from '../search.js';
22
-
23
- //==============================================================================
24
-
25
- export const displayedProperties = [
26
- 'id',
27
- 'class',
28
- 'cd-class',
29
- 'fc-class',
30
- 'fc-kind',
31
- 'name',
32
- ...indexedProperties,
33
- 'featureId'
34
- ];
35
-
36
- //==============================================================================
37
-
38
- class InfoDisplay
39
- {
40
- constructor()
41
- {
42
- this._map = undefined;
43
- this._container = undefined;
44
- }
45
-
46
- getDefaultPosition()
47
- //==================
48
- {
49
- return 'top-left';
50
- }
51
-
52
- onAdd(map)
53
- //========
54
- {
55
- this._map = map;
56
- this._container = document.createElement('div');
57
- this._container.className = 'maplibregl-ctrl info-display';
58
- return this._container;
59
- }
60
-
61
- onRemove()
62
- //========
63
- {
64
- if (this._container !== undefined) {
65
- this._container.parentNode.removeChild(this._container);
66
- }
67
- this._map = undefined;
68
- this._container = undefined;
69
- }
70
-
71
- show(html)
72
- //========
73
- {
74
- if (this._container) {
75
- this._container.innerHTML = html;
76
- }
77
-
78
- }
79
- }
80
-
81
- //==============================================================================
82
-
83
- export class InfoControl
84
- {
85
- constructor(flatmap)
86
- {
87
- this._flatmap = flatmap;
88
- this._map = undefined;
89
- this._active = false;
90
- this._infoDisplay = new InfoDisplay();
91
- }
92
-
93
- get active()
94
- //==========
95
- {
96
- return this._active;
97
- }
98
-
99
- getDefaultPosition()
100
- //==================
101
- {
102
- return 'top-right';
103
- }
104
-
105
- onAdd(map)
106
- //========
107
- {
108
- this._map = map;
109
- this._container = document.createElement('div');
110
- this._container.className = 'maplibregl-ctrl info-control';
111
- // https://iconmonstr.com/info-6-svg/
112
- this._container.innerHTML = `<button class="control-button" id="info-control-button"
113
- type="button" title="Show annotation" aria-label="Show annotation">
114
- <svg xmlns="http://www.w3.org/2000/svg" id="info-control-icon" viewBox="0 0 24 24">
115
- <path d="M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm-.001 5.75c.69 0 1.251.56 1.251 1.25s-.561 1.25-1.251 1.25-1.249-.56-1.249-1.25.559-1.25 1.249-1.25zm2.001 12.25h-4v-1c.484-.179 1-.201 1-.735v-4.467c0-.534-.516-.618-1-.797v-1h3v6.265c0 .535.517.558 1 .735v.999z"/>
116
- </svg>
117
- </button>`;
118
- this._container.onclick = this.onClick_.bind(this);
119
- this._map.addControl(this._infoDisplay);
120
- return this._container;
121
- }
122
-
123
- onRemove()
124
- //========
125
- {
126
- if (this._map !== undefined) {
127
- this._map.removeControl(this._infoDisplay);
128
- }
129
- this._container.parentNode.removeChild(this._container);
130
- this._map = undefined;
131
- }
132
-
133
- onClick_(e)
134
- //=========
135
- {
136
- const targetId = ('rangeTarget' in e) ? e.rangeTarget.id : e.target.id; // FF has rangeTarget
137
- if (['info-control-button', 'info-control-icon'].includes(targetId)) {
138
- const button = document.getElementById('info-control-button');
139
- if (!this._active) {
140
- this._active = true;
141
- button.classList.add('control-button-active');
142
- } else {
143
- this.reset();
144
- this._active = false;
145
- button.classList.remove('control-button-active');
146
- }
147
- }
148
- }
149
-
150
- featureInformation(features, location)
151
- //====================================
152
- {
153
- // Get all features if the control is active otherwise just the selected ones
154
-
155
- const featureList = (this._active || this._flatmap.options.debug) ? features
156
- : features.filter(feature => this._map.getFeatureState(feature)['selected']);
157
-
158
- if (featureList.length === 0) {
159
- return '';
160
- }
161
-
162
- let html = '';
163
- if (this._flatmap.options.debug) {
164
- // See example at https://maplibre.org/maplibre-gl-js-docs/example/queryrenderedfeatures/
165
-
166
- // Limit the number of properties we're displaying for
167
- // legibility and performance
168
- const displayProperties = [
169
- 'id',
170
- 'type',
171
- 'properties',
172
- // 'layer' //,
173
- //'source',
174
- //'sourceLayer',
175
- //'state'
176
- ];
177
-
178
- const propertiesProperties = [
179
- 'id',
180
- 'class',
181
- 'label',
182
- 'models',
183
- // 'area',
184
- // 'length',
185
- // 'group',
186
- 'neuron',
187
- 'type'
188
- ];
189
-
190
- const layerProperties = [
191
- 'id',
192
- 'type',
193
- 'filter'
194
- ];
195
-
196
- // Do we filter for smallest properties.area (except lines have area == 0)
197
- // with lines having precedence... ??
198
- const featureIds = [];
199
- const displayFeatures = [];
200
- for (const feat of featureList) {
201
- if (!featureIds.includes(feat.id)) {
202
- featureIds.push(feat.id);
203
- const displayFeat = {};
204
- displayProperties.forEach(prop => {
205
- if (prop === 'properties') {
206
- const properties = feat[prop];
207
- const propertiesProps = {};
208
- propertiesProperties.forEach(prop => {
209
- propertiesProps[prop] = properties[prop];
210
- });
211
- displayFeat[prop] = propertiesProps;
212
- } else if (prop === 'layer') {
213
- const layer = feat[prop];
214
- const layerProps = {};
215
- layerProperties.forEach(prop => {
216
- layerProps[prop] = layer[prop];
217
- });
218
- displayFeat[prop] = layerProps;
219
- } else {
220
- displayFeat[prop] = feat[prop];
221
- }
222
- });
223
- displayFeatures.push(displayFeat);
224
- }
225
- }
226
- const content = JSON.stringify(
227
- displayFeatures,
228
- null,
229
- 2
230
- );
231
- // Only if this._flatmap.options.showPosition ??
232
- // html = `<pre class="info-control-features">${JSON.stringify(location)}\n${content}</pre>`;
233
- html = `<pre class="info-control-features">${content}</pre>`;
234
- } else {
235
- const displayValues = new Map();
236
- for (const feature of featureList) {
237
- if (!displayValues.has(feature.id)) {
238
- const values = {};
239
- displayedProperties.forEach(prop => {
240
- if (prop in feature.properties) {
241
- const value = feature.properties[prop];
242
- if (value !== undefined) {
243
- if (prop === 'label') {
244
- values[prop] = value.replaceAll("\n", "<br/>");
245
- } else {
246
- values[prop] = value;
247
- }
248
- }
249
- }
250
- });
251
- if (Object.keys(values).length > 0) {
252
- displayValues.set(feature.id, values);
253
- }
254
- }
255
- }
256
-
257
- const htmlList = [];
258
- let lastId = null;
259
- for (const [id, values] of displayValues.entries()) {
260
- if (lastId !== null && lastId !== id) {
261
- htmlList.push(`<span><hr/></span><span></span>`);
262
- }
263
- for (const prop of displayedProperties) {
264
- if (prop in values) {
265
- htmlList.push(`<span class="info-name">${prop}:</span>`);
266
- htmlList.push(`<span class="info-value">${values[prop]}</span>`);
267
- }
268
- }
269
- lastId = id;
270
- }
271
- if (htmlList.length > 0) {
272
- html = `<div id="info-control-info">${htmlList.join('\n')}</div>`;
273
- }
274
- }
275
- return html;
276
- }
277
-
278
- reset()
279
- //=====
280
- {
281
- this._infoDisplay.show('');
282
- }
283
-
284
- show(html)
285
- //========
286
- {
287
- this._infoDisplay.show(html);
288
- }
289
- }
290
-
291
- //==============================================================================