@abi-software/flatmap-viewer 2.2.8 → 2.3.0-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.
- package/package.json +1 -1
- package/src/controls.js +7 -7
- package/src/flatmap-viewer.js +3 -1
- package/src/interactions.js +7 -2
- package/src/pathways.js +24 -17
- package/src/styling.js +6 -1
- package/static/flatmap-viewer.css +3 -0
package/package.json
CHANGED
package/src/controls.js
CHANGED
|
@@ -22,7 +22,6 @@ limitations under the License.
|
|
|
22
22
|
|
|
23
23
|
//==============================================================================
|
|
24
24
|
|
|
25
|
-
import * as pathways from './pathways.js';
|
|
26
25
|
|
|
27
26
|
//==============================================================================
|
|
28
27
|
|
|
@@ -77,10 +76,11 @@ export class NavigationControl
|
|
|
77
76
|
|
|
78
77
|
export class PathControl
|
|
79
78
|
{
|
|
80
|
-
constructor(flatmap)
|
|
79
|
+
constructor(flatmap, pathways)
|
|
81
80
|
{
|
|
82
81
|
this._flatmap = flatmap;
|
|
83
82
|
this._map = undefined;
|
|
83
|
+
this.__pathTypes = pathways.pathTypes;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
getDefaultPosition()
|
|
@@ -103,11 +103,11 @@ export class PathControl
|
|
|
103
103
|
|
|
104
104
|
const innerHTML = [];
|
|
105
105
|
innerHTML.push(`<label for="path-all-paths">ALL PATHS:</label><input id="path-all-paths" type="checkbox" checked/><div class="nerve-line"></div>`);
|
|
106
|
-
for (const path of
|
|
106
|
+
for (const path of this.__pathTypes) {
|
|
107
107
|
innerHTML.push(`<label for="path-${path.type}">${path.label}</label><input id="path-${path.type}" type="checkbox" checked/><div class="nerve-line nerve-${path.type}"></div>`);
|
|
108
108
|
}
|
|
109
109
|
this._legend.innerHTML = innerHTML.join('\n');
|
|
110
|
-
this.__checkedCount =
|
|
110
|
+
this.__checkedCount = this.__pathTypes.length;
|
|
111
111
|
this.__halfCount = Math.trunc(this.__checkedCount/2);
|
|
112
112
|
|
|
113
113
|
this._button = document.createElement('button');
|
|
@@ -150,11 +150,11 @@ export class PathControl
|
|
|
150
150
|
event.target.indeterminate = false;
|
|
151
151
|
}
|
|
152
152
|
if (event.target.checked) {
|
|
153
|
-
this.__checkedCount =
|
|
153
|
+
this.__checkedCount = this.__pathTypes.length;
|
|
154
154
|
} else {
|
|
155
155
|
this.__checkedCount = 0;
|
|
156
156
|
}
|
|
157
|
-
for (const path of
|
|
157
|
+
for (const path of this.__pathTypes) {
|
|
158
158
|
const pathCheckbox = document.getElementById(`path-${path.type}`);
|
|
159
159
|
if (pathCheckbox) {
|
|
160
160
|
pathCheckbox.checked = event.target.checked;
|
|
@@ -173,7 +173,7 @@ export class PathControl
|
|
|
173
173
|
if (this.__checkedCount === 0) {
|
|
174
174
|
allPathsCheckbox.checked = false;
|
|
175
175
|
allPathsCheckbox.indeterminate = false;
|
|
176
|
-
} else if (this.__checkedCount ===
|
|
176
|
+
} else if (this.__checkedCount === this.__pathTypes.length) {
|
|
177
177
|
allPathsCheckbox.checked = true;
|
|
178
178
|
allPathsCheckbox.indeterminate = false;
|
|
179
179
|
} else {
|
package/src/flatmap-viewer.js
CHANGED
package/src/interactions.js
CHANGED
|
@@ -151,8 +151,7 @@ export class UserInteractions
|
|
|
151
151
|
|
|
152
152
|
if (flatmap.options.pathControls) {
|
|
153
153
|
// Add controls to manage our pathways
|
|
154
|
-
|
|
155
|
-
this._map.addControl(new PathControl(flatmap));
|
|
154
|
+
this._map.addControl(new PathControl(flatmap, this._pathways));
|
|
156
155
|
}
|
|
157
156
|
|
|
158
157
|
// Manage our layers
|
|
@@ -966,6 +965,12 @@ export class UserInteractions
|
|
|
966
965
|
}
|
|
967
966
|
}
|
|
968
967
|
|
|
968
|
+
pathTypes()
|
|
969
|
+
//=========
|
|
970
|
+
{
|
|
971
|
+
return this._pathways.pathTypes;
|
|
972
|
+
}
|
|
973
|
+
|
|
969
974
|
enablePath(pathType, enable=true)
|
|
970
975
|
//===============================
|
|
971
976
|
{
|
package/src/pathways.js
CHANGED
|
@@ -26,17 +26,18 @@ export const PATHWAYS_LAYER = 'pathways';
|
|
|
26
26
|
|
|
27
27
|
//==============================================================================
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
29
|
+
const PATH_TYPES = {
|
|
30
|
+
"cns": {label: "CNS", colour: "#9B1FC1"},
|
|
31
|
+
"lcn": {label: "Local circuit neuron", colour: "#F19E38"},
|
|
32
|
+
"para-pre": {label: "Parasympathetic pre-ganglionic", colour: "#3F8F4A"},
|
|
33
|
+
"para-post": {label: "Parasympathetic post-ganglionic", colour: "#3F8F4A"},
|
|
34
|
+
"sensory": {label: "Sensory (afferent) neuron", colour: "#2A62F6"},
|
|
35
|
+
"somatic": {label: "Somatic lower motor", colour: "#98561D"},
|
|
36
|
+
"symp-pre": {label: "Sympathetic pre-ganglionic", colour: "#EA3423"},
|
|
37
|
+
"symp-post": {label: "Sympathetic post-ganglionic", colour: "#EA3423"},
|
|
38
|
+
"other": {label: "Other neuron type", colour: "#888"},
|
|
39
|
+
"centreline": {label: "Nerve centrelines", colour: "#CC0"}
|
|
40
|
+
};
|
|
40
41
|
|
|
41
42
|
//==============================================================================
|
|
42
43
|
|
|
@@ -121,21 +122,27 @@ export class Pathways
|
|
|
121
122
|
}
|
|
122
123
|
this._allFeatureIds = featureIds;
|
|
123
124
|
|
|
124
|
-
// Construct a list of path types we know about
|
|
125
|
-
const pathTypes = [];
|
|
126
|
-
for (const pathType of PATH_TYPES) {
|
|
127
|
-
pathTypes.push(pathType.type);
|
|
128
|
-
}
|
|
129
125
|
// Map unknown path types to ``other``
|
|
130
126
|
this.__typePaths = {};
|
|
131
127
|
this.__typePaths['other'] = [];
|
|
128
|
+
this.__knownPathTypes = [];
|
|
132
129
|
for (const [pathType, paths] of Object.entries(flatmap.pathways['type-paths'])) {
|
|
133
|
-
if (
|
|
130
|
+
if (pathType in PATH_TYPES && pathType !== 'other') {
|
|
134
131
|
this.__typePaths[pathType] = paths;
|
|
132
|
+
this.__knownPathTypes.push({'type': pathType, ...PATH_TYPES[pathType]});
|
|
135
133
|
} else {
|
|
136
134
|
this.__typePaths['other'].push(...paths);
|
|
137
135
|
}
|
|
138
136
|
}
|
|
137
|
+
if ('other' in this.__typePaths) {
|
|
138
|
+
this.__knownPathTypes.push({'type': 'other', ...PATH_TYPES['other']});
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
get pathTypes()
|
|
143
|
+
//=============
|
|
144
|
+
{
|
|
145
|
+
return this.__knownPathTypes;
|
|
139
146
|
}
|
|
140
147
|
|
|
141
148
|
addPathsToFeatureSet_(paths, featureSet)
|
package/src/styling.js
CHANGED
|
@@ -346,7 +346,8 @@ export class PathLineLayer extends VectorStyleLayer
|
|
|
346
346
|
[
|
|
347
347
|
'any',
|
|
348
348
|
['==', 'type', 'bezier'],
|
|
349
|
-
['==', '
|
|
349
|
+
['==', 'kind', 'centreline'],
|
|
350
|
+
['==', 'type', 'line']
|
|
350
351
|
];
|
|
351
352
|
this.__dashed = dashed;
|
|
352
353
|
}
|
|
@@ -369,6 +370,7 @@ export class PathLineLayer extends VectorStyleLayer
|
|
|
369
370
|
['==', ['get', 'kind'], 'sensory'], '#2A62F6',
|
|
370
371
|
['==', ['get', 'kind'], 'symp-post'], '#EA3423',
|
|
371
372
|
['==', ['get', 'kind'], 'symp-pre'], '#EA3423',
|
|
373
|
+
['==', ['get', 'kind'], 'centreline'], '#CC0',
|
|
372
374
|
'#888'
|
|
373
375
|
],
|
|
374
376
|
'line-opacity': [
|
|
@@ -378,6 +380,7 @@ export class PathLineLayer extends VectorStyleLayer
|
|
|
378
380
|
['boolean', ['get', 'invisible'], false], 0.001,
|
|
379
381
|
['boolean', ['feature-state', 'selected'], false], 1.0,
|
|
380
382
|
['boolean', ['feature-state', 'active'], false], 0.8,
|
|
383
|
+
['==', ['get', 'kind'], 'centreline'], 0.2,
|
|
381
384
|
dimmed ? 0.1 : 0.5
|
|
382
385
|
],
|
|
383
386
|
'line-width': [
|
|
@@ -385,6 +388,7 @@ export class PathLineLayer extends VectorStyleLayer
|
|
|
385
388
|
'width', [
|
|
386
389
|
'case',
|
|
387
390
|
['==', ['get', 'type'], 'bezier'], 0.1,
|
|
391
|
+
['==', ['get', 'kind'], 'centreline'], 2,
|
|
388
392
|
['==', ['get', 'kind'], 'error'], 1,
|
|
389
393
|
['==', ['get', 'kind'], 'unknown'], 1,
|
|
390
394
|
['boolean', ['get', 'invisible'], false], 0.1,
|
|
@@ -452,6 +456,7 @@ export class FeatureNerveLayer extends VectorStyleLayer
|
|
|
452
456
|
'filter': [
|
|
453
457
|
'all',
|
|
454
458
|
['==', '$type', 'LineString'],
|
|
459
|
+
['!=', 'kind', 'centreline'],
|
|
455
460
|
['==', 'type', 'nerve']
|
|
456
461
|
],
|
|
457
462
|
'paint': {
|