@abi-software/flatmapvuer 0.3.8 → 0.3.10

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/flatmapvuer",
3
- "version": "0.3.8",
3
+ "version": "0.3.10",
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.5",
24
+ "@abi-software/flatmap-viewer": "^2.2.9",
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
@@ -11,7 +11,7 @@
11
11
  <el-row :gutter="20">
12
12
  <el-button @click="helpMode = !helpMode" size="mini">Help Mode</el-button>
13
13
  <el-button @click="saveSettings()" size="mini">Save Settings</el-button>
14
- <el-button @click="restoreSettings()" size="mini">Restore Settings</el-button>
14
+ <el-button :disabled="mapSettings.length === 0" @click="restoreSettings()" size="mini">Restore Settings</el-button>
15
15
  </el-row>
16
16
  </div>
17
17
  <el-button class="options-button" icon="el-icon-setting" slot="reference">Options</el-button>
@@ -46,11 +46,11 @@ export default {
46
46
  name: 'app',
47
47
  methods: {
48
48
  saveSettings: function() {
49
- this._mapSettings.push(this.$refs.multi.getState());
49
+ this.mapSettings.push(this.$refs.multi.getState());
50
50
  },
51
51
  restoreSettings: function() {
52
- if (this._mapSettings.length > 0)
53
- this.$refs.multi.setState(this._mapSettings.pop());
52
+ if (this.mapSettings.length > 0)
53
+ this.$refs.multi.setState(this.mapSettings.pop());
54
54
  },
55
55
  FlatmapSelected: function(resource) {
56
56
  if (resource.eventType === "click")
@@ -74,8 +74,9 @@ export default {
74
74
  searchable: true,
75
75
  pathControls: true,
76
76
  minZoom: 4,
77
- availableSpecies : {"Human Female":{id: "human-flatmap_female", iconClass:"mapicon-icon_human", displayWarning:true},
78
- "Human Male":{id: "human-flatmap_male", taxo: "NCBITaxon:9606", iconClass:"mapicon-icon_human", displayWarning:true},
77
+ availableSpecies : {
78
+ "Human Female":{taxo: "NCBITaxon:9606", biologicalSex: "PATO:0000383", iconClass:"mapicon-icon_human", displayWarning:true},
79
+ "Human Male":{taxo: "NCBITaxon:9606", biologicalSex: "PATO:0000384", iconClass:"mapicon-icon_human", displayWarning:true},
79
80
  "Rat":{taxo: "NCBITaxon:10114", iconClass:"mapicon-icon_rat", displayWarning:false, displayLatestChanges:true},
80
81
  "Mouse":{taxo: "NCBITaxon:10090", iconClass:"mapicon-icon_mouse", displayWarning:true},
81
82
  "Kember":{taxo: "ABI:1000001", displayWarning:true},
@@ -93,15 +94,13 @@ export default {
93
94
  displayCloseButton: false,
94
95
  initial: "Rat",
95
96
  helpMode: false,
97
+ mapSettings: [],
96
98
  //flatmapAPI: "https://mapcore-demo.org/current/flatmap/v2/"
97
99
  //flatmapAPI: "https://mapcore-demo.org/devel/flatmap/v3/"
98
- flatmapAPI: "https://mapcore-demo.org/fccb/flatmap/"
100
+ flatmapAPI: "https://mapcore-demo.org/current/flatmap/v3/"
99
101
  // flatmapAPI: "https://mapcore-demo.org/devel/flatmap/v1/"
100
102
  }
101
103
  },
102
- mounted: function() {
103
- this._mapSettings = [];
104
- },
105
104
  components: {
106
105
  MultiFlatmapVuer,
107
106
  }
@@ -378,10 +378,10 @@ export default {
378
378
  const label = data.label;
379
379
  const resource = [data.models];
380
380
  const taxonomy = this.entry;
381
- const flatmapId = this.flatmapId;
381
+ const biologicalSex = this.biologicalSex;
382
382
  const payload = {
383
383
  dataset: data.dataset,
384
- flatmapId: flatmapId,
384
+ biologicalSex: biologicalSex,
385
385
  taxonomy: taxonomy,
386
386
  resource: resource,
387
387
  label: label,
@@ -566,20 +566,28 @@ export default {
566
566
  if (this.mapImp) {
567
567
  let state = {
568
568
  entry: this.entry,
569
- flatmapId: this.flatmapId,
570
569
  viewport: this.mapImp.getState()
571
570
  };
571
+ const identifier = this.mapImp.getIdentifier();
572
+ if (this.biologicalSex)
573
+ state['biologicalSex'] = this.biologicalSex;
574
+ else if (identifier && identifier.biologicalSex)
575
+ state['biologicalSex'] = identifier.biologicalSex;
576
+ if (identifier && identifier.uuid)
577
+ state['uuid'] = identifier.uuid;
572
578
  return state;
573
579
  }
574
580
  return undefined;
575
581
  },
576
582
  setState: function(state) {
577
583
  if (state) {
578
- if (this.mapImp && (state.entry || state.flatmapId)) {
579
- if ((this.flatmapId && (this.flatmapId == state.flatmapId)) || (this.entry == state.entry))
580
- if (state.viewport) {
581
- this.mapImp.setState(state.viewport);
582
- }
584
+ if (this.mapImp &&
585
+ (state.entry && (this.entry == state.entry)) &&
586
+ (!state.biologicalSex || (state.biologicalSex === this.biologicalSex)))
587
+ {
588
+ if (state.viewport) {
589
+ this.mapImp.setState(state.viewport);
590
+ }
583
591
  } else {
584
592
  this.createFlatmap(state);
585
593
  }
@@ -593,15 +601,41 @@ export default {
593
601
  minimap = { position: "top-right" };
594
602
  }
595
603
 
596
- let entry = this.flatmapId;
597
- if (state && state.flatmapId) entry = state.flatmapId;
598
- if (!entry) {
599
- entry = this.entry;
600
- if (state && state.entry) entry = state.entry;
604
+ //As for flatmap-viewer@2.2.7, see below for the documentation
605
+ //for the identifier:
606
+
607
+ //@arg identifier {string|Object}
608
+ // A string or object identifying the map to load. If a string its
609
+ // value can be either the map's ``uuid``, assigned at generation time,
610
+ // or taxon and biological sex identifiers of the species that the map
611
+ // represents. The latest version of a map is loaded unless it has been
612
+ // identified using a ``uuid`` (see below).
613
+ // @arg identifier.taxon {string} The taxon identifier of the species
614
+ // represented by the map. This is specified as metadata in the map's source file.
615
+ // @arg identifier.biologicalSex {string} The biological sex of the species
616
+ // represented by the map. This is specified as metadatain the map's source file.
617
+ // @arg identifier.uuid {string} The unique uuid the flatmap. If given then this exact map will
618
+ // be loaded, overriding ``taxon`` and ``biologicalSex``.
619
+
620
+ let identifier = { taxon: this.entry };
621
+ if (state && state.entry) {
622
+ identifier.taxon = state.entry;
623
+ if (state.biologicalSex) {
624
+ identifier["biologicalSex"] = state.biologicalSex;
625
+ } else if (identifier.taxon === "NCBITaxon:9606") {
626
+ //For backward compatibility
627
+ identifier["biologicalSex"] ="PATO:0000384";
628
+ }
629
+ } else {
630
+ // Set the bioloicalSex now if map is not resumed from
631
+ // a saved state
632
+ if (this.biologicalSex) {
633
+ identifier["biologicalSex"] = this.biologicalSex;
634
+ }
601
635
  }
602
636
 
603
637
  let promise1 = this.mapManager.loadMap(
604
- entry,
638
+ identifier,
605
639
  this.$refs.display,
606
640
  this.eventCallback(),
607
641
  {
@@ -633,7 +667,7 @@ export default {
633
667
  this.mapImp.setState(state.viewport);
634
668
  });
635
669
  } else if (state) {
636
- if ((this.flatmapId == state.flatmapId) || this.entry == state.entry)
670
+ if (this.entry == state.entry)
637
671
  this._viewportToBeSet = state.viewport;
638
672
  }
639
673
  },
@@ -675,7 +709,10 @@ export default {
675
709
  },
676
710
  props: {
677
711
  entry: String,
678
- flatmapId: String,
712
+ biologicalSex: {
713
+ type: String,
714
+ default: ""
715
+ },
679
716
  featureInfo: {
680
717
  type: Boolean,
681
718
  default: false
@@ -780,9 +817,6 @@ export default {
780
817
  entry: function() {
781
818
  if (!this.state) this.createFlatmap();
782
819
  },
783
- flatmapId: function() {
784
- if (!this.state) this.createFlatmap();
785
- },
786
820
  helpMode: function(val) {
787
821
  this.setHelpMode(val);
788
822
  },
@@ -888,6 +922,9 @@ export default {
888
922
  transparent 9px
889
923
  );
890
924
  }
925
+ &.other {
926
+ background: #888;
927
+ }
891
928
  }
892
929
 
893
930
  .flatmap-container {
@@ -1276,10 +1313,6 @@ export default {
1276
1313
  }
1277
1314
  }
1278
1315
 
1279
- ::v-deep .flatmap-popper {
1280
-
1281
- }
1282
-
1283
1316
  ::v-deep .popper-zoomout {
1284
1317
  padding-right: 13px !important;
1285
1318
  left: -21px !important;
@@ -31,7 +31,7 @@
31
31
  :showLayer="showLayer"
32
32
  v-show="activeSpecies==key"
33
33
  :entry="item.taxo"
34
- :flatmap-id="item.id"
34
+ :biologicalSex="item.biologicalSex"
35
35
  :displayWarning="item.displayWarning"
36
36
  :warningMessage="warningMessage"
37
37
  :displayLatestChanges="item.displayLatestChanges"
@@ -88,18 +88,20 @@ export default {
88
88
  fetch(this.flatmapAPI)
89
89
  .then(response => response.json())
90
90
  .then(data => {
91
- this.speciesLis= {};
91
+ this.speciesList= {};
92
92
  Object.keys(this.availableSpecies).forEach(key => {
93
93
  for (let i = 0; i < data.length; i++) {
94
- if (this.availableSpecies[key].id === data[i].id) {
95
- this.speciesList[key] = this.availableSpecies[key];
96
- break;
97
- }
98
94
  if (this.availableSpecies[key].taxo === data[i].taxon) {
99
- this.speciesList[key] = this.availableSpecies[key];
100
- //make sure the id is unset as it fails to match the one on
101
- this.speciesList[key].id = undefined;
102
- break;
95
+ if (this.availableSpecies[key].biologicalSex) {
96
+ if (data[i].biologicalSex &&
97
+ data[i].biologicalSex === this.availableSpecies[key].biologicalSex) {
98
+ this.speciesList[key] = this.availableSpecies[key];
99
+ break;
100
+ }
101
+ } else {
102
+ this.speciesList[key] = this.availableSpecies[key];
103
+ break;
104
+ }
103
105
  }
104
106
  }
105
107
  });