@abi-software/flatmapvuer 0.3.15 → 0.4.0-beta-0

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-lock.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@abi-software/flatmapvuer",
3
- "version": "0.3.14",
3
+ "version": "0.4.0-beta-0",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
7
7
  "@abi-software/flatmap-viewer": {
8
- "version": "2.2.9",
9
- "resolved": "https://registry.npmjs.org/@abi-software/flatmap-viewer/-/flatmap-viewer-2.2.9.tgz",
10
- "integrity": "sha512-UN7R84Xn2TeK9Fo/IEFSEKuauRroO5KMYKDUu4wfZQw0qzSC79OdJmHBOeIH4pkS+J4FRZfq+prS7cxiCNCyRw==",
8
+ "version": "2.2.12-b.3",
9
+ "resolved": "https://registry.npmjs.org/@abi-software/flatmap-viewer/-/flatmap-viewer-2.2.12-b.3.tgz",
10
+ "integrity": "sha512-gY/rq0ovzuYgOS4RY4l5GNTiy6yPsS0VbBb4rbsOPrklRKsWiqCr93d3i1hbK4Q0yiW9wDQCZnVztHlVxyV/Hg==",
11
11
  "requires": {
12
12
  "@babel/runtime": "^7.10.4",
13
13
  "@turf/area": "^6.0.1",
@@ -15,7 +15,7 @@
15
15
  "@turf/helpers": "^6.1.4",
16
16
  "@turf/projection": "^6.5.0",
17
17
  "bezier-js": "^6.1.0",
18
- "maplibre-gl": ">=1.15.3",
18
+ "maplibre-gl": ">=2.4.0",
19
19
  "minisearch": "^2.2.1",
20
20
  "polylabel": "^1.1.0"
21
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/flatmapvuer",
3
- "version": "0.3.15",
3
+ "version": "0.4.0-beta-0",
4
4
  "main": "./dist/flatmapvuer.common.js",
5
5
  "files": [
6
6
  "dist/*",
@@ -21,7 +21,7 @@
21
21
  "lint": "vue-cli-service lint"
22
22
  },
23
23
  "dependencies": {
24
- "@abi-software/flatmap-viewer": "2.2.9",
24
+ "@abi-software/flatmap-viewer": "^2.2.12-b.3",
25
25
  "@abi-software/svg-sprite": "^0.1.14",
26
26
  "core-js": "^3.3.2",
27
27
  "css-element-queries": "^1.2.2",
package/src/App.vue CHANGED
@@ -58,11 +58,11 @@ export default {
58
58
  },
59
59
  FlatmapReady: function(component) {
60
60
  let taxon = component.mapImp.describes;
61
- let id = component.mapImp.addMarker("UBERON:0000948", "simulation");
61
+ let id = component.mapImp.addMarker("UBERON:0000948");
62
62
  component.enablePanZoomEvents(true);
63
- component.showPathwaysDrawer(false);
63
+ //component.showPathwaysDrawer(false);
64
64
  console.log(taxon, id);
65
- component.searchAndShowResult("heart");
65
+ //component.searchAndShowResult("heart");
66
66
  },
67
67
  panZoomcallback: function(payload) {
68
68
  this.payload = payload
@@ -82,7 +82,7 @@ export default {
82
82
  "Kember":{taxo: "ABI:1000001", displayWarning:true},
83
83
  "Pig":{taxo: "NCBITaxon:9823", iconClass:"mapicon-icon_pig", displayWarning:true},
84
84
  "Cat":{taxo: "NCBITaxon:9685", iconClass:"mapicon-icon_cat", displayWarning:true},
85
- "Functional Connectivity": {id: "fc-cardio", displayWarning:true},
85
+ "Functional Connectivity": {taxo: "FunctionalConnectivity", displayWarning:true},
86
86
  "digestive tract":{taxo: "digestive tract", displayWarning:true}
87
87
  },
88
88
  tooltipContent: undefined,
@@ -92,12 +92,13 @@ export default {
92
92
  position: "absolute"
93
93
  },
94
94
  displayCloseButton: false,
95
- initial: "Rat",
95
+ initial: "Functional Connectivity",
96
96
  helpMode: false,
97
97
  mapSettings: [],
98
98
  //flatmapAPI: "https://mapcore-demo.org/current/flatmap/v2/"
99
99
  //flatmapAPI: "https://mapcore-demo.org/devel/flatmap/v3/"
100
- flatmapAPI: "https://mapcore-demo.org/current/flatmap/v3/"
100
+ //flatmapAPI: "https://mapcore-demo.org/current/flatmap/v3/"
101
+ flatmapAPI: "https://mapcore-demo.org/devel/flatmap/v4/"
101
102
  // flatmapAPI: "https://mapcore-demo.org/devel/flatmap/v1/"
102
103
  }
103
104
  },
@@ -131,10 +131,11 @@
131
131
  <div class="pathway-location" :class="{ open: drawerOpen, close: !drawerOpen }">
132
132
  <div
133
133
  class="pathway-container"
134
- v-if="pathways.length > 0 && pathControls"
134
+ :style="{'max-height': pathwaysMaxHeight + 'px'}"
135
+ v-if="pathControls"
135
136
  v-popover:checkBoxPopover
136
137
  >
137
- <svg-legends class= "svg-legends-container"/>
138
+ <svg-legends v-if="!isFC" class="svg-legends-container"/>
138
139
  <el-popover
139
140
  content="Find these markers for data"
140
141
  placement="right"
@@ -150,41 +151,56 @@
150
151
  v-html="flatmapMarker"
151
152
  v-popover:markerPopover
152
153
  ></div>
153
- <el-row>
154
- <el-col :span="12">
155
- <div class="pathways-display-text">Pathways</div>
156
- </el-col>
157
- <el-col :span="12">
158
- <el-checkbox
159
- class="all-checkbox"
160
- :indeterminate="isIndeterminate"
161
- v-model="checkAll"
162
- @change="handleCheckAllChange"
163
- >Display all</el-checkbox>
164
- </el-col>
165
- </el-row>
166
- <el-checkbox-group
167
- v-model="checkedItems"
168
- size="small"
169
- class="checkbox-group"
170
- @change="handleCheckedItemsChange"
171
- >
172
- <div class="checkbox-group-inner">
173
- <el-row v-for="item in pathways" :key="item.type" :label="item.type">
174
- <div class="checkbox-container">
175
- <el-checkbox
176
- class="my-checkbox"
177
- :label="item.type"
178
- @change="visibilityToggle()"
179
- :checked="true"
180
- >
181
- <div class="path-visual" :class="item.type"></div>
182
- {{item.label}}
183
- </el-checkbox>
184
- </div>
185
- </el-row>
186
- </div>
187
- </el-checkbox-group>
154
+ <dynamic-legends
155
+ v-if="isFC && systems && systems.length > 0"
156
+ title="Systems"
157
+ identifierKey="name"
158
+ :lists="systems"
159
+ key="systemslegends"
160
+ />
161
+ <selections-group
162
+ v-if="!isFC && centreLines && centreLines.length > 0"
163
+ title="Centrelines"
164
+ labelKey="label"
165
+ identifierKey="key"
166
+ :selections="centreLines"
167
+ @changed="centreLinesSelected"
168
+ ref="centrelinesSelection"
169
+ key="centrelinesSelection"
170
+ />
171
+ <selections-group
172
+ v-if="isFC && sckanDisplay && sckanDisplay.length > 0"
173
+ title="SCKAN"
174
+ labelKey="label"
175
+ identifierKey="key"
176
+ :selections="sckanDisplay"
177
+ @changed="sckanSelected"
178
+ @checkAll="checkAllSCKAN"
179
+ ref="skcanSelection"
180
+ key="skcanSelection"
181
+ />
182
+ <selections-group
183
+ v-if="layers && layers.length > 0"
184
+ title="Layers"
185
+ labelKey="description"
186
+ identifierKey="id"
187
+ :selections="layers"
188
+ @changed="layersSelected"
189
+ @checkAll="checkAllLayers"
190
+ ref="layersSelection"
191
+ key="layersSelection"
192
+ />
193
+ <selections-group
194
+ v-if="pathways && pathways.length > 0"
195
+ title="Pathways"
196
+ labelKey="label"
197
+ identifierKey="type"
198
+ :selections="pathways"
199
+ @changed="pathwaysSelected"
200
+ @checkAll="checkAllPathways"
201
+ ref="pathwaysSelection"
202
+ key="pathwaysSelection"
203
+ />
188
204
  </div>
189
205
  <div
190
206
  @click="toggleDrawer"
@@ -200,6 +216,7 @@
200
216
  width="175"
201
217
  :appendToBody="false"
202
218
  trigger="click"
219
+
203
220
  popper-class="background-popper"
204
221
  >
205
222
  <el-row class="backgroundText">Organs display</el-row>
@@ -229,7 +246,7 @@
229
246
  </el-row>
230
247
  </el-popover>
231
248
  <el-popover
232
- content="Change background color"
249
+ content="Change settings"
233
250
  placement="right"
234
251
  v-model="hoverVisibilities[3].value"
235
252
  :appendToBody="false"
@@ -260,11 +277,11 @@
260
277
  /* eslint-disable no-alert, no-console */
261
278
  import Vue from "vue";
262
279
  import Tooltip from "./Tooltip";
280
+ import SelectionsGroup from "./SelectionsGroup.vue";
263
281
  import { MapSvgIcon, MapSvgSpriteColor } from "@abi-software/svg-sprite";
264
- import SvgLegends from "./legends/Legends";
282
+ import DynamicLegends from "./legends/DynamicLegends.vue";
283
+ import SvgLegends from "./legends/SvgLegends";
265
284
  import {
266
- Checkbox,
267
- CheckboxGroup,
268
285
  Col,
269
286
  Loading,
270
287
  Radio,
@@ -276,8 +293,6 @@ import locale from "element-ui/lib/locale";
276
293
  import flatmapMarker from "../icons/flatmap-marker";
277
294
 
278
295
  locale.use(lang);
279
- Vue.use(Checkbox);
280
- Vue.use(CheckboxGroup);
281
296
  Vue.use(Col);
282
297
  Vue.use(Loading.directive);
283
298
  Vue.use(Radio);
@@ -285,18 +300,14 @@ Vue.use(RadioGroup);
285
300
  Vue.use(Row);
286
301
  const ResizeSensor = require("css-element-queries/src/ResizeSensor");
287
302
 
288
- const mapResize = map => {
289
- return () => {
290
- if (map) map.resize();
291
- };
292
- };
293
-
294
303
  export default {
295
304
  name: "FlatmapVuer",
296
305
  components: {
306
+ DynamicLegends,
297
307
  MapSvgIcon,
298
308
  MapSvgSpriteColor,
299
309
  Tooltip,
310
+ SelectionsGroup,
300
311
  SvgLegends
301
312
  },
302
313
  beforeCreate: function() {
@@ -351,9 +362,18 @@ export default {
351
362
  resetView: function() {
352
363
  if (this.mapImp) {
353
364
  this.mapImp.resetMap();
354
- this.checkedItems = this.mapImp.pathTypes().map(item => item.type);
355
- this.isIndeterminate = false;
356
- this.checkAll = true;
365
+ if (this.$refs.centrelinesSelection) {
366
+ this.$refs.centrelinesSelection.reset();
367
+ }
368
+ if (this.$refs.skcanSelection) {
369
+ this.$refs.skcanSelection.reset();
370
+ }
371
+ if (this.$refs.layersSelection) {
372
+ this.$refs.layersSelection.reset();
373
+ }
374
+ if (this.$refs.pathwaysSelection) {
375
+ this.$refs.pathwaysSelection.reset();
376
+ }
357
377
  }
358
378
  },
359
379
  /**
@@ -374,22 +394,39 @@ export default {
374
394
  this.mapImp.zoomOut();
375
395
  }
376
396
  },
377
- visibilityToggle: function() {
397
+ centreLinesSelected: function(payload) {
398
+ if (this.mapImp) {
399
+ this.mapImp.enableCentrelines(payload.value);
400
+ }
401
+ },
402
+ sckanSelected: function(payload) {
378
403
  if (this.mapImp) {
379
- this.mapImp.showPaths(this.checkedItems);
404
+ this.mapImp.enableSckanPath(payload.key, payload.value);
380
405
  }
381
406
  },
382
- handleCheckedItemsChange: function(value) {
383
- let checkedCount = value.length;
384
- this.checkAll = checkedCount === this.pathways.length;
385
- this.isIndeterminate =
386
- checkedCount > 0 && checkedCount < this.pathways.length;
407
+ checkAllSCKAN: function(payload) {
408
+ if (this.mapImp) {
409
+ payload.keys.forEach(key => this.mapImp.enableSckanPath(key, payload.value));
410
+ }
387
411
  },
388
- handleCheckAllChange(val) {
389
- this.checkedItems = val ? this.pathways.map(a => a.type) : [];
390
- this.isIndeterminate = false;
412
+ layersSelected: function(payload) {
391
413
  if (this.mapImp) {
392
- this.mapImp.showPaths(this.checkedItems);
414
+ this.mapImp.enableLayer(payload.key, payload.value);
415
+ }
416
+ },
417
+ checkAllLayers: function(payload) {
418
+ if (this.mapImp) {
419
+ payload.keys.forEach(key => this.mapImp.enableLayer(key, payload.value));
420
+ }
421
+ },
422
+ pathwaysSelected: function(payload) {
423
+ if (this.mapImp) {
424
+ this.mapImp.enablePath(payload.key, payload.value);
425
+ }
426
+ },
427
+ checkAllPathways: function(payload) {
428
+ if (this.mapImp) {
429
+ payload.keys.forEach(key => this.mapImp.enablePath(key, payload.value));
393
430
  }
394
431
  },
395
432
  enablePanZoomEvents: function(flag) {
@@ -699,7 +736,8 @@ export default {
699
736
  //debug: true,
700
737
  featureInfo: this.featureInfo,
701
738
  "min-zoom": this.minZoom,
702
- pathControls: false,
739
+ layerControl: true,
740
+ pathControls: true,
703
741
  searchable: this.searchable,
704
742
  tooltips: this.tooltips,
705
743
  minimap: minimap
@@ -720,19 +758,40 @@ export default {
720
758
  this.restoreMapState(this._stateToBeSet);
721
759
  }
722
760
  },
761
+ computePathControlsMaximumHeight() {
762
+ const elem = this.$refs.display;
763
+ if (elem) {
764
+ const computed = getComputedStyle(elem);
765
+ const padding = parseInt(computed.paddingTop) + parseInt(computed.paddingBottom);
766
+ const height = elem.clientHeight - padding;
767
+ this.pathwaysMaxHeight = height - 150;
768
+ }
769
+ },
770
+ mapResize: function() {
771
+ if (this.mapImp) {
772
+ this.mapImp.resize();
773
+ }
774
+ this.computePathControlsMaximumHeight();
775
+ },
723
776
  onFlatmapReady: function(){
724
777
  // onFlatmapReady is used for functions that need to run immediately after the flatmap is loaded
725
-
726
778
  this.sensor = new ResizeSensor(
727
779
  this.$refs.display,
728
- mapResize(this.mapImp)
780
+ this.mapResize
729
781
  );
782
+ if (this.mapImp.options && this.mapImp.options.style === "functional") {
783
+ this.isFC = true;
784
+ }
730
785
  this.mapImp.setBackgroundOpacity(1);
731
786
  this.backgroundChangeCallback(this.currentBackground);
732
787
  this.pathways = this.mapImp.pathTypes();
733
- this.$emit("ready", this);
788
+ this.layers = this.mapImp.getLayers();
789
+ this.systems = this.mapImp.getSystems();
734
790
  this.addResizeButtonToMinimap();
735
791
  this.loading = false;
792
+ this.computePathControlsMaximumHeight();
793
+ this.drawerOpen = true;
794
+ this.$emit("ready", this);
736
795
  },
737
796
  showMinimap: function(flag) {
738
797
  if (this.mapImp)
@@ -866,10 +925,26 @@ export default {
866
925
  },
867
926
  data: function() {
868
927
  return {
869
- checkedItems: [],
928
+ layers: [],
870
929
  pathways: [],
871
- isIndeterminate: false,
872
- checkAll: true,
930
+ sckanDisplay: [
931
+ {
932
+ label: "Path consistent with SCKAN",
933
+ key: "VALID",
934
+ },
935
+ {
936
+ label: "Path inconsistent with SCKAN",
937
+ key: "INVALID",
938
+ enable: false,
939
+ }
940
+ ],
941
+ centreLines: [
942
+ {
943
+ label: "Centrelines",
944
+ key: "centrelines"
945
+ }
946
+ ],
947
+ pathwaysMaxHeight: 1000,
873
948
  hoverVisibilities: [
874
949
  { value: false },
875
950
  { value: false },
@@ -880,12 +955,13 @@ export default {
880
955
  { value: false },
881
956
  { value: false }
882
957
  ],
958
+ isFC: false,
883
959
  inHelp: false,
884
960
  currentBackground: "white",
885
961
  availableBackground: ["white", "lightskyblue", "black"],
886
962
  loading: false,
887
963
  flatmapMarker: flatmapMarker,
888
- drawerOpen: true,
964
+ drawerOpen: false,
889
965
  tooltipContent: { featureIds: []},
890
966
  colourRadio: true,
891
967
  outlinesRadio: true,
@@ -919,8 +995,6 @@ export default {
919
995
  <!-- Add "scoped" attribute to limit CSS to this component only -->
920
996
  <style scoped lang="scss">
921
997
  @import "~element-ui/packages/theme-chalk/src/button";
922
- @import "~element-ui/packages/theme-chalk/src/checkbox";
923
- @import "~element-ui/packages/theme-chalk/src/checkbox-group";
924
998
  @import "~element-ui/packages/theme-chalk/src/loading";
925
999
  @import "~element-ui/packages/theme-chalk/src/row";
926
1000
 
@@ -969,53 +1043,6 @@ export default {
969
1043
  vertical-align: 5px;
970
1044
  }
971
1045
 
972
- .path-visual {
973
- margin: 3px 0;
974
- height: 3px;
975
- width: 25px;
976
- margin-right: 5px;
977
- display: inline-block;
978
- &.cns {
979
- background: #9b1fc1;
980
- }
981
- &.lcn {
982
- background: #f19e38;
983
- }
984
- &.para-pre {
985
- background: #3f8f4a;
986
- }
987
- &.para-post {
988
- background: repeating-linear-gradient(
989
- 90deg,
990
- #3f8f4a,
991
- #3f8f4a 6px,
992
- transparent 0,
993
- transparent 9px
994
- );
995
- }
996
- &.sensory {
997
- background: #2a62f6;
998
- }
999
- &.somatic {
1000
- background: #98561d;
1001
- }
1002
- &.symp-pre {
1003
- background: #ea3423;
1004
- }
1005
- &.symp-post {
1006
- background: repeating-linear-gradient(
1007
- 90deg,
1008
- #ea3423,
1009
- #ea3423 6px,
1010
- transparent 0,
1011
- transparent 9px
1012
- );
1013
- }
1014
- &.other {
1015
- background: #888;
1016
- }
1017
- }
1018
-
1019
1046
  .flatmap-container {
1020
1047
  height: 100%;
1021
1048
  width: 100%;
@@ -1044,47 +1071,20 @@ export default {
1044
1071
  float: left;
1045
1072
  padding-left: 16px;
1046
1073
  padding-right: 18px;
1047
- max-height: calc(100% - 140px);
1048
1074
  text-align: left;
1049
1075
  overflow: auto;
1050
1076
  border: 1px solid rgb(220, 223, 230);
1051
1077
  padding-bottom: 16px;
1052
1078
  background: #ffffff;
1053
- }
1054
1079
 
1055
- .pathways-display-text {
1056
- width: 59px;
1057
- height: 20px;
1058
- color: rgb(48, 49, 51);
1059
- font-size: 14px;
1060
- font-weight: normal;
1061
- line-height: 20px;
1062
- margin-left: 8px;
1063
- }
1064
-
1065
- .all-checkbox {
1066
- float: right;
1067
- }
1068
-
1069
- .checkbox-container {
1070
- display: flex;
1071
- cursor: pointer;
1072
- }
1073
-
1074
- .checkbox-group {
1075
- width: 260px;
1076
- border: 1px solid rgb(144, 147, 153);
1077
- border-radius: 4px;
1078
- background: #ffffff;
1079
- }
1080
-
1081
- .my-checkbox {
1082
- background-color: #fff;
1083
- width: 100%;
1084
- }
1080
+ &::-webkit-scrollbar {
1081
+ width: 4px;
1082
+ }
1085
1083
 
1086
- .checkbox-group-inner {
1087
- padding: 18px;
1084
+ &::-webkit-scrollbar-thumb {
1085
+ border-radius: 10px;
1086
+ box-shadow: inset 0 0 6px #c0c4cc;
1087
+ }
1088
1088
  }
1089
1089
 
1090
1090
  .flatmap-marker-help {
@@ -1095,29 +1095,6 @@ export default {
1095
1095
  left: 30px;
1096
1096
  }
1097
1097
 
1098
- ::v-deep .el-checkbox__label {
1099
- padding-left: 5px;
1100
- color: $app-primary-color;
1101
- font-size: 12px;
1102
- font-weight: 500;
1103
- letter-spacing: 0px;
1104
- line-height: 14px;
1105
- }
1106
-
1107
- ::v-deep .el-checkbox__input {
1108
- &.is-indeterminate,
1109
- &.is-checked {
1110
- .el-checkbox__inner {
1111
- background-color: $app-primary-color;
1112
- border-color: $app-primary-color;
1113
- }
1114
- }
1115
- }
1116
-
1117
- ::v-deep .el-checkbox__label {
1118
- color: $app-primary-color !important;
1119
- }
1120
-
1121
1098
  .el-dropdown-link {
1122
1099
  cursor: pointer;
1123
1100
  color: #409eff;
@@ -1324,12 +1301,6 @@ export default {
1324
1301
  }
1325
1302
  }
1326
1303
 
1327
- .togglePaths {
1328
- top: 201px;
1329
- right: 20px;
1330
- position: absolute;
1331
- }
1332
-
1333
1304
  .icon-button {
1334
1305
  height: 24px !important;
1335
1306
  width: 24px !important;