@abi-software/flatmap-viewer 2.2.11-devel.1 → 2.2.12-b.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.
- package/README.rst +1 -1
- package/package.json +2 -2
- package/src/controls.js +101 -37
- package/src/flatmap-viewer.js +79 -49
- package/src/info.js +5 -5
- package/src/interactions.js +129 -134
- package/src/layers.js +105 -53
- package/src/main.js +1 -7
- package/src/minimap.js +1 -1
- package/src/pathways.js +21 -8
- package/src/search.js +0 -1
- package/src/styling.js +239 -44
- package/static/flatmap-viewer.css +3 -30
- package/src/editor.js +0 -198
- package/src/newcontrols.js +0 -617
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.
|
|
41
|
+
* ``npm install @abi-software/flatmap-viewer@2.2.12-b.1``
|
|
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.
|
|
3
|
+
"version": "2.2.12-b.1",
|
|
4
4
|
"description": "Flatmap viewer using Maplibre GL",
|
|
5
5
|
"repository": "https://github.com/AnatomicMaps/flatmap-viewer.git",
|
|
6
6
|
"main": "src/main.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@turf/helpers": "^6.1.4",
|
|
24
24
|
"@turf/projection": "^6.5.0",
|
|
25
25
|
"bezier-js": "^6.1.0",
|
|
26
|
-
"maplibre-gl": ">=
|
|
26
|
+
"maplibre-gl": ">=2.4.0",
|
|
27
27
|
"minisearch": "^2.2.1",
|
|
28
28
|
"polylabel": "^1.1.0"
|
|
29
29
|
},
|
package/src/controls.js
CHANGED
|
@@ -22,8 +22,6 @@ limitations under the License.
|
|
|
22
22
|
|
|
23
23
|
//==============================================================================
|
|
24
24
|
|
|
25
|
-
// Needed for Webpack
|
|
26
|
-
import zoomInButton from '../static/images/zoom-in-button.png'
|
|
27
25
|
|
|
28
26
|
//==============================================================================
|
|
29
27
|
|
|
@@ -119,15 +117,20 @@ export class PathControl
|
|
|
119
117
|
|
|
120
118
|
const innerHTML = [];
|
|
121
119
|
innerHTML.push(`<label for="path-all-paths">ALL PATHS:</label><div class="nerve-line"></div><input id="path-all-paths" type="checkbox" checked/>`);
|
|
120
|
+
this.__checkedCount = 0;
|
|
122
121
|
for (const path of this.__pathTypes) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
122
|
+
const checked = !('enabled' in path) || path.enabled ? 'checked' : '';
|
|
123
|
+
if (checked != '') {
|
|
124
|
+
this.__checkedCount += 1;
|
|
125
|
+
}
|
|
126
|
+
const colour = path.colour || '#440';
|
|
127
|
+
const style = path.dashed ? `background: repeating-linear-gradient(to right,${colour} 0,${colour} 6px,transparent 6px,transparent 9px);`
|
|
128
|
+
: `background: ${colour};`;
|
|
129
|
+
|
|
130
|
+
innerHTML.push(`<label for="path-${path.type}">${path.label}</label><div class="nerve-line" style="${style}"></div><input id="path-${path.type}" type="checkbox" ${checked}/>`);
|
|
127
131
|
}
|
|
128
132
|
this._legend.innerHTML = innerHTML.join('\n');
|
|
129
|
-
this.
|
|
130
|
-
this.__halfCount = Math.trunc(this.__checkedCount/2);
|
|
133
|
+
this.__halfCount = Math.trunc(this.__pathTypes.length/2);
|
|
131
134
|
|
|
132
135
|
this._button = document.createElement('button');
|
|
133
136
|
this._button.id = 'nerve-key-button';
|
|
@@ -157,6 +160,9 @@ export class PathControl
|
|
|
157
160
|
if (this._button.getAttribute('control-visible') === 'false') {
|
|
158
161
|
this._container.appendChild(this._legend);
|
|
159
162
|
this._button.setAttribute('control-visible', 'true');
|
|
163
|
+
const allPathsCheckbox = document.getElementById('path-all-paths');
|
|
164
|
+
allPathsCheckbox.indeterminate = this.__checkedCount < this.__pathTypes.length
|
|
165
|
+
&& this.__checkedCount > 0;
|
|
160
166
|
this._legend.focus();
|
|
161
167
|
} else {
|
|
162
168
|
this._legend = this._container.removeChild(this._legend);
|
|
@@ -211,7 +217,7 @@ export class LayerControl
|
|
|
211
217
|
constructor(flatmap, layerManager)
|
|
212
218
|
{
|
|
213
219
|
this.__flatmap = flatmap;
|
|
214
|
-
this.
|
|
220
|
+
this.__layers = layerManager.layers;
|
|
215
221
|
this.__map = undefined;
|
|
216
222
|
}
|
|
217
223
|
|
|
@@ -226,21 +232,18 @@ export class LayerControl
|
|
|
226
232
|
{
|
|
227
233
|
this.__map = map;
|
|
228
234
|
this.__container = document.createElement('div');
|
|
229
|
-
this.__container.className = 'maplibregl-ctrl';
|
|
230
|
-
this.
|
|
231
|
-
|
|
232
|
-
this.__layers = document.createElement('div');
|
|
233
|
-
this.__layers.id = 'layer-control-text';
|
|
234
|
-
this.__layers.className = 'flatmap-layer-grid';
|
|
235
|
+
this.__container.className = 'maplibregl-ctrl flatmap-control';
|
|
236
|
+
this.__layersControl = document.createElement('div');
|
|
237
|
+
this.__layersControl.className = 'flatmap-control-grid';
|
|
235
238
|
|
|
236
239
|
const innerHTML = [];
|
|
237
240
|
innerHTML.push(`<label for="layer-all-layers">ALL LAYERS:</label><input id="layer-all-layers" type="checkbox" checked/>`);
|
|
238
|
-
for (const layer of this.
|
|
241
|
+
for (const layer of this.__layers) {
|
|
239
242
|
innerHTML.push(`<label for="layer-${layer.id}">${layer.description}</label><input id="layer-${layer.id}" type="checkbox" checked/>`);
|
|
240
243
|
}
|
|
241
|
-
this.
|
|
244
|
+
this.__layersControl.innerHTML = innerHTML.join('\n');
|
|
242
245
|
|
|
243
|
-
this.__layersCount = this.
|
|
246
|
+
this.__layersCount = this.__layers;
|
|
244
247
|
this.__checkedCount = this.__layersCount;
|
|
245
248
|
this.__halfCount = Math.trunc(this.__checkedCount/2);
|
|
246
249
|
|
|
@@ -270,11 +273,11 @@ export class LayerControl
|
|
|
270
273
|
{
|
|
271
274
|
if (event.target.id === 'map-layers-button') {
|
|
272
275
|
if (this.__button.getAttribute('control-visible') === 'false') {
|
|
273
|
-
this.__container.appendChild(this.
|
|
276
|
+
this.__container.appendChild(this.__layersControl);
|
|
274
277
|
this.__button.setAttribute('control-visible', 'true');
|
|
275
|
-
this.
|
|
278
|
+
this.__layersControl.focus();
|
|
276
279
|
} else {
|
|
277
|
-
this.
|
|
280
|
+
this.__layersControl = this.__container.removeChild(this.__layersControl);
|
|
278
281
|
this.__button.setAttribute('control-visible', 'false');
|
|
279
282
|
}
|
|
280
283
|
} else if (event.target.tagName === 'INPUT') {
|
|
@@ -288,16 +291,16 @@ export class LayerControl
|
|
|
288
291
|
} else {
|
|
289
292
|
this.__checkedCount = 0;
|
|
290
293
|
}
|
|
291
|
-
for (const layer of this.
|
|
294
|
+
for (const layer of this.__layers) {
|
|
292
295
|
const layerCheckbox = document.getElementById(`layer-${layer.id}`);
|
|
293
296
|
if (layerCheckbox) {
|
|
294
297
|
layerCheckbox.checked = event.target.checked;
|
|
295
|
-
this.
|
|
298
|
+
this.__flatmap.enableLayer(layer.id, event.target.checked);
|
|
296
299
|
}
|
|
297
300
|
}
|
|
298
301
|
} else if (event.target.id.startsWith('layer-')) {
|
|
299
302
|
const layerId = event.target.id.substring(6);
|
|
300
|
-
this.
|
|
303
|
+
this.__flatmap.enableLayer(layerId, event.target.checked);
|
|
301
304
|
if (event.target.checked) {
|
|
302
305
|
this.__checkedCount += 1;
|
|
303
306
|
} else {
|
|
@@ -321,7 +324,6 @@ export class LayerControl
|
|
|
321
324
|
|
|
322
325
|
//==============================================================================
|
|
323
326
|
|
|
324
|
-
|
|
325
327
|
const SCKAN_STATES = [
|
|
326
328
|
{
|
|
327
329
|
'id': 'VALID',
|
|
@@ -336,10 +338,11 @@ const SCKAN_STATES = [
|
|
|
336
338
|
|
|
337
339
|
export class SCKANControl
|
|
338
340
|
{
|
|
339
|
-
constructor(flatmap)
|
|
341
|
+
constructor(flatmap, options={sckan: 'valid'})
|
|
340
342
|
{
|
|
341
343
|
this.__flatmap = flatmap;
|
|
342
344
|
this.__map = undefined;
|
|
345
|
+
this.__initialState = options.sckan || 'valid';
|
|
343
346
|
}
|
|
344
347
|
|
|
345
348
|
getDefaultPosition()
|
|
@@ -353,23 +356,24 @@ export class SCKANControl
|
|
|
353
356
|
{
|
|
354
357
|
this.__map = map;
|
|
355
358
|
this.__container = document.createElement('div');
|
|
356
|
-
this.__container.className = 'maplibregl-ctrl';
|
|
357
|
-
this.__container.id = 'flatmap-layer-control';
|
|
358
|
-
|
|
359
|
+
this.__container.className = 'maplibregl-ctrl flatmap-control';
|
|
359
360
|
this.__sckan = document.createElement('div');
|
|
360
|
-
this.__sckan.
|
|
361
|
-
this.__sckan.className = 'flatmap-layer-grid';
|
|
361
|
+
this.__sckan.className = 'flatmap-control-grid';
|
|
362
362
|
|
|
363
363
|
const innerHTML = [];
|
|
364
|
-
|
|
364
|
+
let checked = (this.__initialState === 'all') ? 'checked' : '';
|
|
365
|
+
innerHTML.push(`<label for="sckan-all-paths">ALL PATHS:</label><input id="sckan-all-paths" type="checkbox" ${checked}/>`);
|
|
365
366
|
for (const state of SCKAN_STATES) {
|
|
366
|
-
|
|
367
|
+
checked = (this.__initialState.toUpperCase() === state.id) ? 'checked' : '';
|
|
368
|
+
innerHTML.push(`<label for="sckan-${state.id}">${state.description}</label><input id="sckan-${state.id}" type="checkbox" ${checked}/>`);
|
|
367
369
|
}
|
|
368
370
|
this.__sckan.innerHTML = innerHTML.join('\n');
|
|
369
371
|
|
|
370
372
|
this.__sckanCount = SCKAN_STATES.length;
|
|
371
|
-
this.__checkedCount = this.__sckanCount
|
|
372
|
-
|
|
373
|
+
this.__checkedCount = (this.__initialState === 'all') ? this.__sckanCount
|
|
374
|
+
: (this.__initialState === 'none') ? 0
|
|
375
|
+
: 1;
|
|
376
|
+
this.__halfCount = Math.trunc(this.__sckanCount/2);
|
|
373
377
|
|
|
374
378
|
this.__button = document.createElement('button');
|
|
375
379
|
this.__button.id = 'map-sckan-button';
|
|
@@ -399,6 +403,9 @@ export class SCKANControl
|
|
|
399
403
|
if (this.__button.getAttribute('control-visible') === 'false') {
|
|
400
404
|
this.__container.appendChild(this.__sckan);
|
|
401
405
|
this.__button.setAttribute('control-visible', 'true');
|
|
406
|
+
const allLayersCheckbox = document.getElementById('sckan-all-paths');
|
|
407
|
+
allLayersCheckbox.indeterminate = (this.__checkedCount > 0)
|
|
408
|
+
&& (this.__checkedCount < this.__sckanCount);
|
|
402
409
|
this.__sckan.focus();
|
|
403
410
|
} else {
|
|
404
411
|
this.__sckan = this.__container.removeChild(this.__sckan);
|
|
@@ -411,20 +418,22 @@ export class SCKANControl
|
|
|
411
418
|
event.target.indeterminate = false;
|
|
412
419
|
}
|
|
413
420
|
if (event.target.checked) {
|
|
421
|
+
this.__state = 'all';
|
|
414
422
|
this.__checkedCount = this.__sckanCount;
|
|
415
423
|
} else {
|
|
424
|
+
this.__state = 'none';
|
|
416
425
|
this.__checkedCount = 0;
|
|
417
426
|
}
|
|
418
427
|
for (const state of SCKAN_STATES) {
|
|
419
428
|
const sckanCheckbox = document.getElementById(`sckan-${state.id}`);
|
|
420
429
|
if (sckanCheckbox) {
|
|
421
430
|
sckanCheckbox.checked = event.target.checked;
|
|
422
|
-
this.__flatmap.
|
|
431
|
+
this.__flatmap.enableSckanPath(state.id, event.target.checked);
|
|
423
432
|
}
|
|
424
433
|
}
|
|
425
434
|
} else if (event.target.id.startsWith('sckan-')) {
|
|
426
435
|
const sckanId = event.target.id.substring(6);
|
|
427
|
-
this.__flatmap.
|
|
436
|
+
this.__flatmap.enableSckanPath(sckanId, event.target.checked);
|
|
428
437
|
if (event.target.checked) {
|
|
429
438
|
this.__checkedCount += 1;
|
|
430
439
|
} else {
|
|
@@ -448,6 +457,61 @@ export class SCKANControl
|
|
|
448
457
|
|
|
449
458
|
//==============================================================================
|
|
450
459
|
|
|
460
|
+
export class NerveControl
|
|
461
|
+
{
|
|
462
|
+
constructor(flatmap, options={showCentrelines: false})
|
|
463
|
+
{
|
|
464
|
+
this.__flatmap = flatmap;
|
|
465
|
+
this.__map = undefined;
|
|
466
|
+
this.__visible = options.showCentrelines || false;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
getDefaultPosition()
|
|
470
|
+
//==================
|
|
471
|
+
{
|
|
472
|
+
return 'top-right';
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
onAdd(map)
|
|
476
|
+
//========
|
|
477
|
+
{
|
|
478
|
+
this.__map = map;
|
|
479
|
+
this.__container = document.createElement('div');
|
|
480
|
+
this.__container.className = 'maplibregl-ctrl';
|
|
481
|
+
|
|
482
|
+
this.__button = document.createElement('button');
|
|
483
|
+
this.__button.id = 'map-nerve-button';
|
|
484
|
+
this.__button.className = 'control-button text-button';
|
|
485
|
+
this.__button.setAttribute('type', 'button');
|
|
486
|
+
this.__button.setAttribute('aria-label', 'Show/hide nerve centrelines');
|
|
487
|
+
this.__button.textContent = 'NERVES';
|
|
488
|
+
this.__button.title = 'Show/hide nerve centrelines';
|
|
489
|
+
this.__container.appendChild(this.__button);
|
|
490
|
+
|
|
491
|
+
this.__container.addEventListener('click', this.onClick_.bind(this));
|
|
492
|
+
return this.__container;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
onRemove()
|
|
496
|
+
//========
|
|
497
|
+
{
|
|
498
|
+
this.__container.parentNode.removeChild(this.__container);
|
|
499
|
+
this.__map = undefined;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
onClick_(event)
|
|
503
|
+
//=============
|
|
504
|
+
{
|
|
505
|
+
if (event.target.id === 'map-nerve-button') {
|
|
506
|
+
this.__visible = !this.__visible;
|
|
507
|
+
this.__flatmap.enableCentrelines(this.__visible);
|
|
508
|
+
}
|
|
509
|
+
event.stopPropagation();
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
//==============================================================================
|
|
514
|
+
|
|
451
515
|
export class BackgroundControl
|
|
452
516
|
{
|
|
453
517
|
constructor(flatmap)
|
package/src/flatmap-viewer.js
CHANGED
|
@@ -192,8 +192,7 @@ class FlatMap
|
|
|
192
192
|
this._initialState = this.getState();
|
|
193
193
|
|
|
194
194
|
// Add a minimap if option set
|
|
195
|
-
|
|
196
|
-
// ==> add all controls here (via interactions.js...)
|
|
195
|
+
|
|
197
196
|
if (this.options.minimap) {
|
|
198
197
|
this._minimap = new MinimapControl(this, this.options.minimap);
|
|
199
198
|
this._map.addControl(this._minimap);
|
|
@@ -276,21 +275,24 @@ class FlatMap
|
|
|
276
275
|
}
|
|
277
276
|
|
|
278
277
|
/**
|
|
279
|
-
* @returns {Array.<{type: string, label: string, colour: string}>} an array of objects giving path types
|
|
280
|
-
*
|
|
278
|
+
* @returns {Array.<{type: string, label: string, colour: string}>} an array of objects giving the path types
|
|
279
|
+
* present in the map along with their
|
|
280
|
+
* descriptions and colours
|
|
281
281
|
*/
|
|
282
282
|
pathTypes()
|
|
283
283
|
//=========
|
|
284
284
|
{
|
|
285
|
-
|
|
285
|
+
if (this._userInteractions !== null) {
|
|
286
|
+
return this._userInteractions.pathways.pathTypes();
|
|
287
|
+
}
|
|
286
288
|
}
|
|
287
289
|
|
|
288
290
|
/**
|
|
289
291
|
* Hide or show paths of a given type.
|
|
290
292
|
*
|
|
291
|
-
* @param
|
|
292
|
-
* @param
|
|
293
|
-
*
|
|
293
|
+
* @param {string} pathType The path type
|
|
294
|
+
* @param {boolean} enable Show or hide paths of that type. Defaults to
|
|
295
|
+
* ``true`` (show)
|
|
294
296
|
*/
|
|
295
297
|
enablePath(pathType, enable=true)
|
|
296
298
|
//===============================
|
|
@@ -301,32 +303,31 @@ class FlatMap
|
|
|
301
303
|
}
|
|
302
304
|
|
|
303
305
|
/**
|
|
304
|
-
* Hide or show all paths
|
|
306
|
+
* Hide or show all paths valid in SCKAN.
|
|
305
307
|
*
|
|
306
|
-
* @param
|
|
307
|
-
* @param
|
|
308
|
-
*
|
|
308
|
+
* @param {string} sckanState Either ``valid`` or ``invalid``
|
|
309
|
+
* @param {boolean} enable Show or hide paths with that SCKAN state.
|
|
310
|
+
* Defaults to ``true`` (show)
|
|
309
311
|
*/
|
|
310
|
-
|
|
311
|
-
|
|
312
|
+
enableSckanPath(sckanState, enable=true)
|
|
313
|
+
//======================================
|
|
312
314
|
{
|
|
313
315
|
if (this._userInteractions !== null) {
|
|
314
|
-
this._userInteractions.
|
|
316
|
+
this._userInteractions.enableSckanPath(sckanState, enable);
|
|
315
317
|
}
|
|
316
318
|
}
|
|
317
319
|
|
|
318
320
|
/**
|
|
319
|
-
* Hide or show
|
|
321
|
+
* Hide or show centrelines and nodes.
|
|
320
322
|
*
|
|
321
|
-
* @param
|
|
322
|
-
*
|
|
323
|
-
* of the type(s) otherwise only hide the paths
|
|
323
|
+
* @param {boolean} enable Show or centrelines and associated nodes.
|
|
324
|
+
* Defaults to ``true`` (show)
|
|
324
325
|
*/
|
|
325
|
-
|
|
326
|
-
|
|
326
|
+
enableCentrelines(enable=true)
|
|
327
|
+
//============================
|
|
327
328
|
{
|
|
328
329
|
if (this._userInteractions !== null) {
|
|
329
|
-
this._userInteractions.
|
|
330
|
+
this._userInteractions.enableCentrelines(enable);
|
|
330
331
|
}
|
|
331
332
|
}
|
|
332
333
|
|
|
@@ -444,12 +445,6 @@ class FlatMap
|
|
|
444
445
|
return `${this.__uuid}-${this._mapNumber}`;
|
|
445
446
|
}
|
|
446
447
|
|
|
447
|
-
get activeLayerNames()
|
|
448
|
-
//====================
|
|
449
|
-
{
|
|
450
|
-
return this._userInteractions.activeLayerNames;
|
|
451
|
-
}
|
|
452
|
-
|
|
453
448
|
get annotations()
|
|
454
449
|
//===============
|
|
455
450
|
{
|
|
@@ -671,18 +666,25 @@ class FlatMap
|
|
|
671
666
|
}
|
|
672
667
|
}
|
|
673
668
|
|
|
674
|
-
|
|
675
|
-
|
|
669
|
+
setPaint(options=null)
|
|
670
|
+
//====================
|
|
676
671
|
{
|
|
677
672
|
options = utils.setDefaults(options, {
|
|
678
673
|
colour: true,
|
|
679
674
|
outline: true
|
|
680
675
|
});
|
|
681
676
|
if (this._userInteractions !== null) {
|
|
682
|
-
this._userInteractions.
|
|
677
|
+
this._userInteractions.setPaint(options);
|
|
683
678
|
}
|
|
684
679
|
}
|
|
685
680
|
|
|
681
|
+
setColour(options=null)
|
|
682
|
+
//=====================
|
|
683
|
+
{
|
|
684
|
+
console.log('`setColour()` is deprecated; please use `setPaint()` instead.')
|
|
685
|
+
this.setPaint(options);
|
|
686
|
+
}
|
|
687
|
+
|
|
686
688
|
//==========================================================================
|
|
687
689
|
|
|
688
690
|
/**
|
|
@@ -755,22 +757,50 @@ class FlatMap
|
|
|
755
757
|
|
|
756
758
|
//==========================================================================
|
|
757
759
|
|
|
760
|
+
/**
|
|
761
|
+
* Get a list of the flatmap's layers.
|
|
762
|
+
*
|
|
763
|
+
* @return {Array.Object.<{id: string, description: string, enabled: boolean}>} An array with layer details
|
|
764
|
+
*/
|
|
765
|
+
getLayers()
|
|
766
|
+
//=========
|
|
767
|
+
{
|
|
768
|
+
if (this._userInteractions !== null) {
|
|
769
|
+
return this._userInteractions.getLayers();
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
/**
|
|
774
|
+
* @param {string} layerId The layer identifier to enable
|
|
775
|
+
* @param {boolean} enable Show or hide the layer. Defaults to ``true`` (show)
|
|
776
|
+
*
|
|
777
|
+
*/
|
|
778
|
+
enableLayer(layerId, enable=true)
|
|
779
|
+
//===============================
|
|
780
|
+
{
|
|
781
|
+
if (this._userInteractions !== null) {
|
|
782
|
+
return this._userInteractions.enableLayer(layerId, enable);
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
//==========================================================================
|
|
787
|
+
|
|
758
788
|
/**
|
|
759
789
|
* Add a marker to the map.
|
|
760
790
|
*
|
|
761
791
|
* @param {string} anatomicalId The anatomical identifier of the feature on which
|
|
762
792
|
* to place the marker
|
|
763
|
-
* @param {string} [
|
|
764
|
-
*
|
|
765
|
-
*
|
|
793
|
+
* @param {string} [htmlElement=null] An optional parameter giving the DOM element to
|
|
794
|
+
* use as a marker. The default is a light blue,
|
|
795
|
+
* droplet-shaped SVG marker.
|
|
766
796
|
* @return {integer} The identifier for the resulting marker. -1 is returned if the
|
|
767
797
|
* map doesn't contain a feature with the given anatomical identifier
|
|
768
798
|
*/
|
|
769
|
-
addMarker(anatomicalId,
|
|
770
|
-
|
|
799
|
+
addMarker(anatomicalId, htmlElement=null)
|
|
800
|
+
//========================================
|
|
771
801
|
{
|
|
772
802
|
if (this._userInteractions !== null) {
|
|
773
|
-
return this._userInteractions.addMarker(anatomicalId,
|
|
803
|
+
return this._userInteractions.addMarker(anatomicalId, htmlElement);
|
|
774
804
|
}
|
|
775
805
|
return -1;
|
|
776
806
|
}
|
|
@@ -850,7 +880,6 @@ class FlatMap
|
|
|
850
880
|
'dataset',
|
|
851
881
|
'kind',
|
|
852
882
|
'label',
|
|
853
|
-
'markup',
|
|
854
883
|
'models',
|
|
855
884
|
'nodeId',
|
|
856
885
|
'source',
|
|
@@ -1142,7 +1171,6 @@ export class MapManager
|
|
|
1142
1171
|
let latestMap = null;
|
|
1143
1172
|
let lastCreatedTime = '';
|
|
1144
1173
|
for (const map of this._mapList) {
|
|
1145
|
-
// We can break/return if we have a UUID match...
|
|
1146
1174
|
if (('uuid' in map && mapDescribes === map.uuid
|
|
1147
1175
|
|| mapDescribes === map.id
|
|
1148
1176
|
|| 'taxon' in map && mapDescribes === map.taxon
|
|
@@ -1194,13 +1222,12 @@ export class MapManager
|
|
|
1194
1222
|
* @arg options {Object} Configurable options for the map.
|
|
1195
1223
|
* @arg options.background {string} Background colour of flatmap. Defaults to ``white``.
|
|
1196
1224
|
* @arg options.debug {boolean} Enable debugging mode.
|
|
1197
|
-
* @arg options.featureInfo {boolean} Show information about features as a tooltip. The tooltip is active
|
|
1198
|
-
* on selected features and, for non-selected features, when the
|
|
1199
|
-
* ``info`` control is enabled. More details are shown in debug mode.
|
|
1200
1225
|
* @arg options.fullscreenControl {boolean} Add a ``Show full screen`` button to the map.
|
|
1201
1226
|
* @arg options.layerOptions {Object} Options to control colour and outlines of features
|
|
1202
1227
|
* @arg options.layerOptions.colour {boolean} Use colour fill (if available) for features. Defaults to ``true``.
|
|
1203
1228
|
* @arg options.layerOptions.outline {boolean} Show the border of features. Defaults to ``true``.
|
|
1229
|
+
* @arg options.layerOptions.sckan {string} Show neuron paths known to SCKAN: values are ``valid`` (default),
|
|
1230
|
+
* ``invalid``, ``all`` or ``none``.
|
|
1204
1231
|
* @arg options.minimap {boolean|Object} Display a MiniMap of the flatmap. Defaults to ``false``.
|
|
1205
1232
|
* @arg options.minimap.position {string} The minimap's position: ``bottom-left`` (default), ``bottom-right``,
|
|
1206
1233
|
* ``top-left`` or ``top-right``.
|
|
@@ -1211,9 +1238,9 @@ export class MapManager
|
|
|
1211
1238
|
* @arg options.maxZoom {number} The maximum zoom level of the map.
|
|
1212
1239
|
* @arg options.minZoom {number} The minimum zoom level of the map.
|
|
1213
1240
|
* @arg options.navigationControl {boolean} Add navigation controls (zoom buttons) to the map.
|
|
1214
|
-
* @arg options.pathControl {boolean} Add buttons to control pathways including via a color-coded legend.
|
|
1215
|
-
* @arg options.searchable {boolean} Add a control to search for features on a map.
|
|
1216
1241
|
* @arg options.showPosition {boolean} Show ``position`` of tooltip.
|
|
1242
|
+
* @arg options.standalone {boolean} Viewer is running ``standalone``, as opposed to integrated into
|
|
1243
|
+
* another application so show a number of controls. Defaults to ``false``.
|
|
1217
1244
|
* @example
|
|
1218
1245
|
* const humanMap1 = mapManager.loadMap('humanV1', 'div-1');
|
|
1219
1246
|
*
|
|
@@ -1251,6 +1278,14 @@ export class MapManager
|
|
|
1251
1278
|
mapOptions['bounds'] = mapIndex['bounds'];
|
|
1252
1279
|
}
|
|
1253
1280
|
|
|
1281
|
+
// Note the kind of map
|
|
1282
|
+
|
|
1283
|
+
if ('style' in mapIndex) {
|
|
1284
|
+
mapOptions.style = mapIndex.style; // Currently ``anatomical`` or ``functional``
|
|
1285
|
+
} else {
|
|
1286
|
+
mapOptions.style = 'flatmap'; // Default is a generic ``flatmap``
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1254
1289
|
// Mapmaker has changed the name of the field to indicate that indicates if
|
|
1255
1290
|
// there are raster layers
|
|
1256
1291
|
if (!('image-layers' in mapIndex) && ('image_layer' in mapIndex)) {
|
|
@@ -1326,11 +1361,6 @@ export class MapManager
|
|
|
1326
1361
|
};
|
|
1327
1362
|
}
|
|
1328
1363
|
mapOptions.layerOptions.authoring = ('authoring' in mapIndex) ? mapIndex.authoring : false;
|
|
1329
|
-
if ('style' in mapIndex) {
|
|
1330
|
-
mapOptions.layerOptions.style = mapIndex.style;
|
|
1331
|
-
} else {
|
|
1332
|
-
mapOptions.layerOptions.style = 'flatmap';
|
|
1333
|
-
}
|
|
1334
1364
|
|
|
1335
1365
|
// Are features in separate vector tile source layers?
|
|
1336
1366
|
|
package/src/info.js
CHANGED
|
@@ -29,10 +29,6 @@ import { indexedProperties } from './search.js';
|
|
|
29
29
|
export const displayedProperties = [
|
|
30
30
|
'id',
|
|
31
31
|
'class',
|
|
32
|
-
'featureId',
|
|
33
|
-
'tile-layer',
|
|
34
|
-
'layer',
|
|
35
|
-
'kind',
|
|
36
32
|
...indexedProperties
|
|
37
33
|
];
|
|
38
34
|
|
|
@@ -242,7 +238,11 @@ export class InfoControl
|
|
|
242
238
|
if (prop in feature.properties) {
|
|
243
239
|
const value = feature.properties[prop];
|
|
244
240
|
if (value !== undefined) {
|
|
245
|
-
|
|
241
|
+
if (prop === 'label') {
|
|
242
|
+
values[prop] = value.replaceAll("\n", "<br/>");
|
|
243
|
+
} else {
|
|
244
|
+
values[prop] = value;
|
|
245
|
+
}
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
});
|