@abi-software/flatmap-viewer 2.3.0-a.1 → 2.3.0-a.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 +1 -1
- package/package.json +6 -3
- package/src/annotation.js +487 -0
- package/src/controls.js +503 -11
- package/src/editor.js +198 -0
- package/src/flatmap-viewer.js +176 -64
- package/src/info.js +5 -1
- package/src/interactions.js +299 -232
- package/src/layers.js +242 -151
- package/src/main.js +22 -17
- package/src/newcontrols.js +617 -0
- package/src/pathways.js +47 -21
- package/src/search.js +4 -1
- package/src/styling.js +275 -95
- package/src/systems.js +76 -0
- package/src/utils.js +1 -1
- package/static/{flatmap-viewer.css → css/flatmap-viewer.css} +153 -30
- /package/static/{favicon.ico → icons/favicon.ico} +0 -0
package/src/styling.js
CHANGED
|
@@ -26,6 +26,10 @@ export const VECTOR_TILES_SOURCE = 'vector-tiles';
|
|
|
26
26
|
|
|
27
27
|
//==============================================================================
|
|
28
28
|
|
|
29
|
+
import {PATH_STYLE_RULES} from './pathways.js';
|
|
30
|
+
|
|
31
|
+
//==============================================================================
|
|
32
|
+
|
|
29
33
|
class VectorStyleLayer
|
|
30
34
|
{
|
|
31
35
|
constructor(id, suffix, sourceLayer)
|
|
@@ -40,6 +44,11 @@ class VectorStyleLayer
|
|
|
40
44
|
return this.__id;
|
|
41
45
|
}
|
|
42
46
|
|
|
47
|
+
makeFilter(options)
|
|
48
|
+
{
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
|
|
43
52
|
paintStyle(options, changes=false)
|
|
44
53
|
{
|
|
45
54
|
return {};
|
|
@@ -120,23 +129,15 @@ export class FeatureFillLayer extends VectorStyleLayer
|
|
|
120
129
|
['boolean', ['feature-state', 'selected'], false], '#0F0',
|
|
121
130
|
['has', 'colour'], ['get', 'colour'],
|
|
122
131
|
['boolean', ['feature-state', 'active'], false], coloured ? '#D88' : '#CCC',
|
|
123
|
-
['any',
|
|
124
|
-
['==', ['get', 'kind'], 'scaffold']
|
|
125
|
-
], 'white',
|
|
126
|
-
['has', 'node'], '#AFA202',
|
|
127
132
|
'white' // background colour? body colour ??
|
|
128
133
|
],
|
|
129
134
|
'fill-opacity': [
|
|
130
135
|
'case',
|
|
131
|
-
['
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
], 0.
|
|
136
|
-
['has', 'node'], 0.3,
|
|
137
|
-
['boolean', ['feature-state', 'active'], false], 0.8,
|
|
138
|
-
['boolean', ['feature-state', 'selected'], false], 0.01,
|
|
139
|
-
['has', 'colour'], 0.008,
|
|
136
|
+
['boolean', ['feature-state', 'hidden'], false], 0.01,
|
|
137
|
+
['boolean', ['feature-state', 'selected'], false], 0.7,
|
|
138
|
+
['has', 'opacity'], ['get', 'opacity'],
|
|
139
|
+
['has', 'colour'], 1.0,
|
|
140
|
+
['boolean', ['feature-state', 'active'], false], 0.7,
|
|
140
141
|
(coloured && !dimmed) ? 0.01 : 0.1
|
|
141
142
|
]
|
|
142
143
|
};
|
|
@@ -151,7 +152,8 @@ export class FeatureFillLayer extends VectorStyleLayer
|
|
|
151
152
|
'filter': [
|
|
152
153
|
'all',
|
|
153
154
|
['==', '$type', 'Polygon'],
|
|
154
|
-
['!=', 'models', 'UBERON:0013702']
|
|
155
|
+
['!=', 'models', 'UBERON:0013702'],
|
|
156
|
+
['!has', 'node']
|
|
155
157
|
],
|
|
156
158
|
'layout': {
|
|
157
159
|
'fill-sort-key': ['get', 'scale']
|
|
@@ -175,22 +177,21 @@ export class FeatureBorderLayer extends VectorStyleLayer
|
|
|
175
177
|
const coloured = !('colour' in options) || options.colour;
|
|
176
178
|
const outlined = !('outline' in options) || options.outline;
|
|
177
179
|
const dimmed = 'dimmed' in options && options.dimmed;
|
|
180
|
+
const activeRasterLayer = 'activeRasterLayer' in options && options.activeRasterLayer;
|
|
178
181
|
const lineColour = [ 'case' ];
|
|
179
182
|
lineColour.push(['boolean', ['feature-state', 'selected'], false]);
|
|
180
|
-
lineColour.push('
|
|
183
|
+
lineColour.push('black');
|
|
181
184
|
if (coloured && outlined) {
|
|
182
185
|
lineColour.push(['boolean', ['feature-state', 'active'], false]);
|
|
183
186
|
lineColour.push('blue');
|
|
184
187
|
}
|
|
185
188
|
lineColour.push(['has', 'colour']);
|
|
186
189
|
lineColour.push(['get', 'colour']);
|
|
187
|
-
lineColour.push(['has', 'node']);
|
|
188
|
-
lineColour.push('#AFA202');
|
|
189
190
|
lineColour.push('#444');
|
|
190
191
|
|
|
191
192
|
const lineOpacity = [
|
|
192
193
|
'case',
|
|
193
|
-
['boolean', ['
|
|
194
|
+
['boolean', ['feature-state', 'hidden'], false], 0.05,
|
|
194
195
|
];
|
|
195
196
|
if (coloured && outlined) {
|
|
196
197
|
lineOpacity.push(['boolean', ['feature-state', 'active'], false]);
|
|
@@ -198,7 +199,11 @@ export class FeatureBorderLayer extends VectorStyleLayer
|
|
|
198
199
|
}
|
|
199
200
|
lineOpacity.push(['boolean', ['feature-state', 'selected'], false]);
|
|
200
201
|
lineOpacity.push(0.9);
|
|
201
|
-
|
|
202
|
+
if (activeRasterLayer) {
|
|
203
|
+
lineOpacity.push((outlined && !dimmed) ? 0.3 : 0.1);
|
|
204
|
+
} else {
|
|
205
|
+
lineOpacity.push(0.5);
|
|
206
|
+
}
|
|
202
207
|
|
|
203
208
|
const lineWidth = [
|
|
204
209
|
'case',
|
|
@@ -208,8 +213,10 @@ export class FeatureBorderLayer extends VectorStyleLayer
|
|
|
208
213
|
lineWidth.push(2.5);
|
|
209
214
|
if (coloured && outlined) {
|
|
210
215
|
lineWidth.push(['boolean', ['feature-state', 'active'], false]);
|
|
211
|
-
lineWidth.push(1);
|
|
216
|
+
lineWidth.push(1.5);
|
|
212
217
|
}
|
|
218
|
+
lineWidth.push(['has', 'colour']);
|
|
219
|
+
lineWidth.push(0.7);
|
|
213
220
|
lineWidth.push((coloured && outlined) ? 0.5 : 0.1);
|
|
214
221
|
|
|
215
222
|
return super.changedPaintStyle({
|
|
@@ -227,7 +234,7 @@ export class FeatureBorderLayer extends VectorStyleLayer
|
|
|
227
234
|
'filter': [
|
|
228
235
|
'all',
|
|
229
236
|
['==', '$type', 'Polygon'],
|
|
230
|
-
['has', '
|
|
237
|
+
['!has', 'node']
|
|
231
238
|
],
|
|
232
239
|
'paint': this.paintStyle(options)
|
|
233
240
|
};
|
|
@@ -238,53 +245,58 @@ export class FeatureBorderLayer extends VectorStyleLayer
|
|
|
238
245
|
|
|
239
246
|
export class FeatureLineLayer extends VectorStyleLayer
|
|
240
247
|
{
|
|
241
|
-
constructor(id, sourceLayer,
|
|
248
|
+
constructor(id, sourceLayer, options={})
|
|
242
249
|
{
|
|
250
|
+
const dashed = ('dashed' in options && options.dashed);
|
|
243
251
|
const filterType = dashed ? 'line-dash' : 'line';
|
|
244
252
|
super(id, `feature-${filterType}`, sourceLayer);
|
|
245
|
-
this.
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
253
|
+
this.__dashed = dashed;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
makeFilter(options={})
|
|
257
|
+
{
|
|
258
|
+
return this.__dashed ? [
|
|
259
|
+
'all',
|
|
260
|
+
['==', '$type', 'LineString'],
|
|
261
|
+
['==', 'type', `line-dash`]
|
|
262
|
+
] : [
|
|
263
|
+
'all',
|
|
264
|
+
['==', '$type', 'LineString'],
|
|
251
265
|
[
|
|
252
266
|
'any',
|
|
253
|
-
['has', 'centreline'],
|
|
254
267
|
['==', 'type', 'bezier'],
|
|
255
268
|
['==', 'type', `line`]
|
|
256
|
-
]
|
|
257
|
-
|
|
269
|
+
]
|
|
270
|
+
];
|
|
258
271
|
}
|
|
259
272
|
|
|
260
|
-
paintStyle(options)
|
|
273
|
+
paintStyle(options, changes=false)
|
|
261
274
|
{
|
|
262
275
|
const coloured = !('colour' in options) || options.colour;
|
|
263
276
|
const paintStyle = {
|
|
264
277
|
'line-color': [
|
|
265
278
|
'case',
|
|
266
279
|
['boolean', ['feature-state', 'selected'], false], '#0F0',
|
|
267
|
-
['has', 'colour'], ['get', 'colour'],
|
|
268
280
|
['boolean', ['feature-state', 'active'], false], coloured ? '#888' : '#CCC',
|
|
281
|
+
['has', 'colour'], ['get', 'colour'],
|
|
269
282
|
['==', ['get', 'type'], 'network'], '#AFA202',
|
|
270
|
-
|
|
271
|
-
('style' in options && options.style === 'authoring') ? '#C44' : '#444'
|
|
283
|
+
options.authoring ? '#C44' : '#444'
|
|
272
284
|
],
|
|
273
285
|
'line-opacity': [
|
|
274
286
|
'case',
|
|
275
|
-
|
|
276
|
-
|
|
287
|
+
['boolean', ['feature-state', 'selected'], false], 1.0,
|
|
288
|
+
['has', 'colour'], 1.0,
|
|
289
|
+
['boolean', ['feature-state', 'active'], false], 1.0,
|
|
277
290
|
0.3
|
|
278
291
|
],
|
|
279
292
|
'line-width': [
|
|
280
293
|
'let',
|
|
281
294
|
'width', [
|
|
282
295
|
'case',
|
|
283
|
-
['has', 'centreline'], 1.2,
|
|
284
296
|
['==', ['get', 'type'], 'network'], 1.2,
|
|
285
297
|
['boolean', ['feature-state', 'selected'], false], 1.2,
|
|
286
298
|
['boolean', ['feature-state', 'active'], false], 1.2,
|
|
287
|
-
|
|
299
|
+
options.authoring ? 0.7 : 0.5
|
|
288
300
|
], [
|
|
289
301
|
'interpolate',
|
|
290
302
|
['exponential', 2],
|
|
@@ -300,7 +312,7 @@ export class FeatureLineLayer extends VectorStyleLayer
|
|
|
300
312
|
if (this.__dashed) {
|
|
301
313
|
paintStyle['line-dasharray'] = [3, 2];
|
|
302
314
|
}
|
|
303
|
-
return paintStyle;
|
|
315
|
+
return super.changedPaintStyle(paintStyle, changes);
|
|
304
316
|
}
|
|
305
317
|
|
|
306
318
|
style(options)
|
|
@@ -308,12 +320,7 @@ export class FeatureLineLayer extends VectorStyleLayer
|
|
|
308
320
|
return {
|
|
309
321
|
...super.style(),
|
|
310
322
|
'type': 'line',
|
|
311
|
-
'filter':
|
|
312
|
-
'all',
|
|
313
|
-
['==', '$type', 'LineString'],
|
|
314
|
-
this.__filter
|
|
315
|
-
// not for paths...
|
|
316
|
-
],
|
|
323
|
+
'filter': this.makeFilter(options),
|
|
317
324
|
'paint': this.paintStyle(options)
|
|
318
325
|
};
|
|
319
326
|
}
|
|
@@ -325,7 +332,7 @@ export class FeatureDashLineLayer extends FeatureLineLayer
|
|
|
325
332
|
{
|
|
326
333
|
constructor(id, sourceLayer)
|
|
327
334
|
{
|
|
328
|
-
super(id, sourceLayer, true);
|
|
335
|
+
super(id, sourceLayer, {dashed: true});
|
|
329
336
|
}
|
|
330
337
|
}
|
|
331
338
|
|
|
@@ -333,70 +340,99 @@ export class FeatureDashLineLayer extends FeatureLineLayer
|
|
|
333
340
|
|
|
334
341
|
export class PathLineLayer extends VectorStyleLayer
|
|
335
342
|
{
|
|
336
|
-
constructor(id, sourceLayer,
|
|
343
|
+
constructor(id, sourceLayer, options={})
|
|
337
344
|
{
|
|
345
|
+
const dashed = ('dashed' in options && options.dashed);
|
|
338
346
|
const filterType = dashed ? 'line-dash' : 'line';
|
|
339
347
|
super(id, `path-${filterType}`, sourceLayer);
|
|
340
|
-
this.
|
|
341
|
-
|
|
348
|
+
this.__dashed = dashed;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
makeFilter(options={})
|
|
352
|
+
{
|
|
353
|
+
const sckanState = !'sckan' in options ? 'all'
|
|
354
|
+
: options.sckan.toLowerCase();
|
|
355
|
+
const sckan_filter =
|
|
356
|
+
sckanState == 'none' ? [
|
|
357
|
+
['!has', 'sckan']
|
|
358
|
+
] :
|
|
359
|
+
sckanState == 'valid' ? [[
|
|
342
360
|
'any',
|
|
343
|
-
['
|
|
344
|
-
|
|
345
|
-
|
|
361
|
+
['!has', 'sckan'],
|
|
362
|
+
[
|
|
363
|
+
'all',
|
|
364
|
+
['has', 'sckan'],
|
|
365
|
+
['==', 'sckan', true]
|
|
366
|
+
]
|
|
367
|
+
]] :
|
|
368
|
+
sckanState == 'invalid' ? [[
|
|
369
|
+
'any',
|
|
370
|
+
['!has', 'sckan'],
|
|
371
|
+
[
|
|
372
|
+
'all',
|
|
373
|
+
['has', 'sckan'],
|
|
374
|
+
['!=', 'sckan', true]
|
|
375
|
+
]
|
|
376
|
+
]] :
|
|
377
|
+
[ ];
|
|
378
|
+
|
|
379
|
+
return this.__dashed ? [
|
|
380
|
+
'all',
|
|
381
|
+
['==', '$type', 'LineString'],
|
|
382
|
+
['==', 'type', `line-dash`],
|
|
383
|
+
...sckan_filter
|
|
384
|
+
] : [
|
|
385
|
+
'all',
|
|
386
|
+
['==', '$type', 'LineString'],
|
|
346
387
|
[
|
|
347
388
|
'any',
|
|
348
389
|
['==', 'type', 'bezier'],
|
|
349
|
-
[
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
390
|
+
[
|
|
391
|
+
'all',
|
|
392
|
+
['==', 'type', `line`],
|
|
393
|
+
...sckan_filter
|
|
394
|
+
]
|
|
395
|
+
]
|
|
396
|
+
];
|
|
353
397
|
}
|
|
354
398
|
|
|
355
|
-
paintStyle(options, changes=false)
|
|
399
|
+
paintStyle(options={}, changes=false)
|
|
356
400
|
{
|
|
357
401
|
const dimmed = 'dimmed' in options && options.dimmed;
|
|
358
402
|
const paintStyle = {
|
|
359
403
|
'line-color': [
|
|
360
404
|
'case',
|
|
405
|
+
['boolean', ['feature-state', 'selected'], false], '#0F0',
|
|
361
406
|
['boolean', ['feature-state', 'hidden'], false], '#CCC',
|
|
362
407
|
['==', ['get', 'type'], 'bezier'], 'red',
|
|
363
|
-
['==', ['get', 'kind'], '
|
|
364
|
-
|
|
365
|
-
['==', ['get', 'kind'], 'cns'], '#9B1FC1',
|
|
366
|
-
['==', ['get', 'kind'], 'lcn'], '#F19E38',
|
|
367
|
-
['==', ['get', 'kind'], 'para-post'], '#3F8F4A',
|
|
368
|
-
['==', ['get', 'kind'], 'para-pre'], '#3F8F4A',
|
|
369
|
-
['==', ['get', 'kind'], 'somatic'], '#98561D',
|
|
370
|
-
['==', ['get', 'kind'], 'sensory'], '#2A62F6',
|
|
371
|
-
['==', ['get', 'kind'], 'symp-post'], '#EA3423',
|
|
372
|
-
['==', ['get', 'kind'], 'symp-pre'], '#EA3423',
|
|
373
|
-
['==', ['get', 'kind'], 'centreline'], '#CC0',
|
|
408
|
+
['==', ['get', 'kind'], 'unknown'], '#888',
|
|
409
|
+
...PATH_STYLE_RULES,
|
|
374
410
|
'#888'
|
|
375
411
|
],
|
|
376
412
|
'line-opacity': [
|
|
377
413
|
'case',
|
|
378
|
-
['boolean', ['feature-state', 'hidden'], false], 0.
|
|
414
|
+
['boolean', ['feature-state', 'hidden'], false], 0.05,
|
|
379
415
|
['==', ['get', 'type'], 'bezier'], 1.0,
|
|
416
|
+
['==', ['get', 'kind'], 'error'], 1.0,
|
|
380
417
|
['boolean', ['get', 'invisible'], false], 0.001,
|
|
381
418
|
['boolean', ['feature-state', 'selected'], false], 1.0,
|
|
382
|
-
['boolean', ['feature-state', 'active'], false], 0
|
|
383
|
-
|
|
384
|
-
dimmed ? 0.1 : 0.5
|
|
419
|
+
['boolean', ['feature-state', 'active'], false], 1.0,
|
|
420
|
+
dimmed ? 0.1 : 0.8
|
|
385
421
|
],
|
|
386
422
|
'line-width': [
|
|
387
423
|
'let',
|
|
388
|
-
'width', [
|
|
424
|
+
'width', ["*", [
|
|
389
425
|
'case',
|
|
390
426
|
['==', ['get', 'type'], 'bezier'], 0.1,
|
|
391
|
-
['==', ['get', 'kind'], 'centreline'], 2,
|
|
392
427
|
['==', ['get', 'kind'], 'error'], 1,
|
|
393
428
|
['==', ['get', 'kind'], 'unknown'], 1,
|
|
394
429
|
['boolean', ['get', 'invisible'], false], 0.1,
|
|
395
|
-
['boolean', ['feature-state', 'selected'], false],
|
|
430
|
+
['boolean', ['feature-state', 'selected'], false], 0.6,
|
|
396
431
|
['boolean', ['feature-state', 'active'], false], 0.9,
|
|
397
|
-
0.
|
|
398
|
-
],
|
|
399
|
-
'
|
|
432
|
+
0.6
|
|
433
|
+
],
|
|
434
|
+
['case', ['has', 'stroke-width'], ['get', 'stroke-width'], 1.0]],
|
|
435
|
+
['interpolate',
|
|
400
436
|
['exponential', 2],
|
|
401
437
|
['zoom'],
|
|
402
438
|
2, ["*", ['var', 'width'], ["^", 2, -0.5]],
|
|
@@ -406,11 +442,81 @@ export class PathLineLayer extends VectorStyleLayer
|
|
|
406
442
|
]
|
|
407
443
|
};
|
|
408
444
|
if (this.__dashed) {
|
|
409
|
-
paintStyle['line-dasharray'] = [
|
|
445
|
+
paintStyle['line-dasharray'] = [1, 1];
|
|
410
446
|
}
|
|
411
447
|
return super.changedPaintStyle(paintStyle, changes);
|
|
412
448
|
}
|
|
413
449
|
|
|
450
|
+
style(options={})
|
|
451
|
+
{
|
|
452
|
+
return {
|
|
453
|
+
...super.style(),
|
|
454
|
+
'type': 'line',
|
|
455
|
+
'filter': this.makeFilter(options),
|
|
456
|
+
'layout': {
|
|
457
|
+
'line-cap': 'butt'
|
|
458
|
+
},
|
|
459
|
+
'paint': this.paintStyle(options)
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
//==============================================================================
|
|
465
|
+
|
|
466
|
+
export class PathDashlineLayer extends PathLineLayer
|
|
467
|
+
{
|
|
468
|
+
constructor(id, sourceLayer)
|
|
469
|
+
{
|
|
470
|
+
super(id, sourceLayer, {dashed: true});
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
//==============================================================================
|
|
475
|
+
|
|
476
|
+
class CentrelineLayer extends VectorStyleLayer
|
|
477
|
+
{
|
|
478
|
+
constructor(id, type, sourceLayer)
|
|
479
|
+
{
|
|
480
|
+
super(id, `centreline-${type}`, sourceLayer);
|
|
481
|
+
this.__type = type;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
paintStyle(options, changes=false)
|
|
485
|
+
{
|
|
486
|
+
const coloured = !('colour' in options) || options.colour;
|
|
487
|
+
const paintStyle = {
|
|
488
|
+
'line-color': (this.__type == 'edge') ? '#000' : [
|
|
489
|
+
'case',
|
|
490
|
+
['boolean', ['feature-state', 'selected'], false], '#0F0',
|
|
491
|
+
['boolean', ['feature-state', 'active'], false], '#444',
|
|
492
|
+
'#CCC'
|
|
493
|
+
],
|
|
494
|
+
'line-opacity': [
|
|
495
|
+
'case',
|
|
496
|
+
['boolean', ['feature-state', 'hidden'], false], 0.01,
|
|
497
|
+
['boolean', ['feature-state', 'selected'], false], 1.0,
|
|
498
|
+
['boolean', ['feature-state', 'active'], false], 1.0,
|
|
499
|
+
0.8
|
|
500
|
+
],
|
|
501
|
+
'line-width': [
|
|
502
|
+
'let',
|
|
503
|
+
'width',
|
|
504
|
+
(this.__type == 'edge') ? 1.6 : 1.2,
|
|
505
|
+
[
|
|
506
|
+
'interpolate',
|
|
507
|
+
['exponential', 2],
|
|
508
|
+
['zoom'],
|
|
509
|
+
2, ["*", ['var', 'width'], ["^", 2, -0.5]],
|
|
510
|
+
7, ["*", ['var', 'width'], ["^", 2, 2.5]],
|
|
511
|
+
9, ["*", ['var', 'width'], ["^", 2, 4.0]]
|
|
512
|
+
]
|
|
513
|
+
]
|
|
514
|
+
// Need to vary width based on zoom??
|
|
515
|
+
// Or opacity??
|
|
516
|
+
};
|
|
517
|
+
return super.changedPaintStyle(paintStyle, changes);
|
|
518
|
+
}
|
|
519
|
+
|
|
414
520
|
style(options)
|
|
415
521
|
{
|
|
416
522
|
return {
|
|
@@ -419,23 +525,104 @@ export class PathLineLayer extends VectorStyleLayer
|
|
|
419
525
|
'filter': [
|
|
420
526
|
'all',
|
|
421
527
|
['==', '$type', 'LineString'],
|
|
422
|
-
|
|
528
|
+
['==', 'kind', 'centreline']
|
|
423
529
|
],
|
|
530
|
+
'paint': this.paintStyle(options),
|
|
424
531
|
'layout': {
|
|
425
|
-
'line-cap': '
|
|
426
|
-
|
|
427
|
-
|
|
532
|
+
'line-cap': 'square',
|
|
533
|
+
'line-join': 'bevel'
|
|
534
|
+
}
|
|
428
535
|
};
|
|
429
536
|
}
|
|
430
537
|
}
|
|
431
538
|
|
|
539
|
+
|
|
540
|
+
export class CentrelineEdgeLayer extends CentrelineLayer
|
|
541
|
+
{
|
|
542
|
+
constructor(id, sourceLayer)
|
|
543
|
+
{
|
|
544
|
+
super(id, 'edge', sourceLayer);
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
export class CentrelineTrackLayer extends CentrelineLayer
|
|
550
|
+
{
|
|
551
|
+
constructor(id, sourceLayer)
|
|
552
|
+
{
|
|
553
|
+
super(id, 'track', sourceLayer);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
|
|
557
|
+
}
|
|
558
|
+
|
|
432
559
|
//==============================================================================
|
|
433
560
|
|
|
434
|
-
export class
|
|
561
|
+
export class CentrelineNodeFillLayer extends VectorStyleLayer
|
|
435
562
|
{
|
|
436
563
|
constructor(id, sourceLayer)
|
|
437
564
|
{
|
|
438
|
-
super(id,
|
|
565
|
+
super(id, 'node-fill', sourceLayer);
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
paintStyle(options={}, changes=false)
|
|
569
|
+
{
|
|
570
|
+
const showNodes = options.showCentrelines || false;
|
|
571
|
+
const paintStyle = {
|
|
572
|
+
'fill-color': '#AFA202',
|
|
573
|
+
'fill-opacity': showNodes ? 0.7 : 0.01
|
|
574
|
+
}
|
|
575
|
+
return super.changedPaintStyle(paintStyle, changes);
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
style(options)
|
|
579
|
+
{
|
|
580
|
+
return {
|
|
581
|
+
...super.style(),
|
|
582
|
+
'type': 'fill',
|
|
583
|
+
'filter': [
|
|
584
|
+
'all',
|
|
585
|
+
['==', '$type', 'Polygon'],
|
|
586
|
+
['has', 'node']
|
|
587
|
+
],
|
|
588
|
+
'layout': {
|
|
589
|
+
'fill-sort-key': ['get', 'scale']
|
|
590
|
+
},
|
|
591
|
+
'paint': this.paintStyle(options)
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
export class CentrelineNodeBorderLayer extends VectorStyleLayer
|
|
597
|
+
{
|
|
598
|
+
constructor(id, sourceLayer)
|
|
599
|
+
{
|
|
600
|
+
super(id, 'node-border', sourceLayer);
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
paintStyle(options={}, changes=false)
|
|
604
|
+
{
|
|
605
|
+
const showNodes = options.showCentrelines || false;
|
|
606
|
+
const paintStyle = {
|
|
607
|
+
'line-color': '#AFA202',
|
|
608
|
+
'line-opacity': showNodes ? 0.7 : 0.01,
|
|
609
|
+
'line-width': 0.5
|
|
610
|
+
}
|
|
611
|
+
return super.changedPaintStyle(paintStyle, changes);
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
style(options)
|
|
615
|
+
{
|
|
616
|
+
return {
|
|
617
|
+
...super.style(),
|
|
618
|
+
'type': 'line',
|
|
619
|
+
'filter': [
|
|
620
|
+
'all',
|
|
621
|
+
['==', '$type', 'Polygon'],
|
|
622
|
+
['has', 'node']
|
|
623
|
+
],
|
|
624
|
+
'paint': this.paintStyle(options)
|
|
625
|
+
};
|
|
439
626
|
}
|
|
440
627
|
}
|
|
441
628
|
|
|
@@ -566,14 +753,7 @@ export class NervePolygonFill extends VectorStyleLayer
|
|
|
566
753
|
'case',
|
|
567
754
|
['==', ['get', 'kind'], 'bezier-end'], 'red',
|
|
568
755
|
['==', ['get', 'kind'], 'bezier-control'], 'green',
|
|
569
|
-
|
|
570
|
-
['==', ['get', 'kind'], 'lcn'], '#F19E38',
|
|
571
|
-
['==', ['get', 'kind'], 'para-post'], '#3F8F4A',
|
|
572
|
-
['==', ['get', 'kind'], 'para-pre'], '#3F8F4A',
|
|
573
|
-
['==', ['get', 'kind'], 'somatic'], '#98561D',
|
|
574
|
-
['==', ['get', 'kind'], 'sensory'], '#2A62F6',
|
|
575
|
-
['==', ['get', 'kind'], 'symp-post'], '#EA3423',
|
|
576
|
-
['==', ['get', 'kind'], 'symp-pre'], '#EA3423',
|
|
756
|
+
...PATH_STYLE_RULES,
|
|
577
757
|
'white'
|
|
578
758
|
],
|
|
579
759
|
'fill-opacity': [
|
|
@@ -688,7 +868,7 @@ export class BackgroundLayer
|
|
|
688
868
|
return this.__id;
|
|
689
869
|
}
|
|
690
870
|
|
|
691
|
-
style(backgroundColour, opacity=0
|
|
871
|
+
style(backgroundColour, opacity=1.0)
|
|
692
872
|
{
|
|
693
873
|
return {
|
|
694
874
|
'id': this.__id,
|
package/src/systems.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
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
|
+
|
|
22
|
+
import { Control } from './controls';
|
|
23
|
+
|
|
24
|
+
//==============================================================================
|
|
25
|
+
|
|
26
|
+
export class SystemsManager
|
|
27
|
+
{
|
|
28
|
+
constructor()
|
|
29
|
+
{
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
//==============================================================================
|
|
35
|
+
|
|
36
|
+
export class SystemsControl extends Control
|
|
37
|
+
{
|
|
38
|
+
constructor(flatmap, systems)
|
|
39
|
+
{
|
|
40
|
+
super(flatmap, 'system', 'systems');
|
|
41
|
+
this.__systems = systems;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
__innerLinesHTML()
|
|
45
|
+
//================
|
|
46
|
+
{
|
|
47
|
+
const html = [];
|
|
48
|
+
for (const [name, system] of this.__systems.entries()) {
|
|
49
|
+
html.push(`<label for="${this.__prefix}${system.id}" style="background: ${system.colour};">${name}</label><input id="${this.__prefix}${system.id}" type="checkbox" checked/>`);
|
|
50
|
+
}
|
|
51
|
+
return html;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
__enableAll(enable)
|
|
55
|
+
//=================
|
|
56
|
+
{
|
|
57
|
+
for (const [name, system] of this.__systems.entries()) {
|
|
58
|
+
const checkbox = document.getElementById(`${this.__prefix}${system.id}`);
|
|
59
|
+
if (checkbox) {
|
|
60
|
+
checkbox.checked = enable;
|
|
61
|
+
this.__flatmap.enableSystem(name, enable);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
__enableControl(id, enable)
|
|
67
|
+
//=========================
|
|
68
|
+
{
|
|
69
|
+
for (const [name, system] of this.__systems.entries()) {
|
|
70
|
+
if (id === system.id) {
|
|
71
|
+
this.__flatmap.enableSystem(name, enable);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
}
|
package/src/utils.js
CHANGED
|
@@ -110,7 +110,7 @@ export function normaliseId(id)
|
|
|
110
110
|
|
|
111
111
|
//==============================================================================
|
|
112
112
|
|
|
113
|
-
export function
|
|
113
|
+
export function setDefaults(options, defaultOptions)
|
|
114
114
|
{
|
|
115
115
|
if (options === undefined || options === null) {
|
|
116
116
|
return defaultOptions;
|