Handle refresh on data change for some layers.

Binary layers not included yet.
This commit is contained in:
D. Berge
2025-08-06 11:17:37 +02:00
parent c67a60a7e6
commit 8855da743b
2 changed files with 30 additions and 6 deletions

View File

@@ -598,6 +598,14 @@ export default {
computed: {
lineTStamp () {
return this.$store.state.line.timestamp;
},
sequenceTStamp () {
return this.$store.state.sequence.timestamp;
},
sequenceData () {
return this.sequenceDataElements?.map( el => el.data );
},
@@ -757,7 +765,7 @@ export default {
return title;
},
...mapGetters(['user', 'loading', 'serverEvent', 'lineName', 'serverEvent', 'labels']),
...mapGetters(['user', 'loading', 'serverEvent', 'lineName', 'serverEvent', 'lines', 'plannedSequences', 'sequences', 'labels']),
...mapState({projectSchema: state => state.project.projectSchema})
},
@@ -773,6 +781,22 @@ export default {
deep: true
},
lines () {
// Refresh map on change of preplot data
this.render();
},
plannedSequences () {
// Refresh map on change of planned lines
this.render();
},
sequences () {
// Refresh map on change of sequence data (raw / final)
this.sequenceDataTStamp = Date.now();
this.render();
},
labels () {
// Refresh the events layer on labels change
if (this.layerSelection.includes("log")) {

View File

@@ -234,7 +234,7 @@ export default {
vesselTrackLinesLayer (options = {}) {
return new LineLayer({
id: 'navl',
data: `/api/navdata`,
data: `/api/navdata?v=${Date.now()}`, // NOTE Not too sure about this
lineWidthMinPixels: 2,
getLineColor: (d) => d.properties.ntba ? [240, 248, 255, 200] : [85, 170, 255, 200],
getSourcePosition: (obj, i) => i.index < i.data?.length ? [i.data[i.index]?.longitude, i.data[i.index]?.latitude] : null,
@@ -297,7 +297,7 @@ export default {
preplotSaillinesLinesLayer (options = {}) {
return new GeoJsonLayer({
id: 'psll',
data: `/api/project/${this.$route.params.project}/gis/preplot/line?class=V`,
data: `/api/project/${this.$route.params.project}/gis/preplot/line?class=V&v=${this.lineTStamp?.valueOf()}`,
lineWidthMinPixels: 1,
getLineColor: (d) => d.properties.ntba ? [240, 248, 255, 200] : [85, 170, 255, 200],
getLineWidth: 1,
@@ -312,7 +312,7 @@ export default {
preplotLinesLayer (options = {}) {
return new GeoJsonLayer({
id: 'ppll',
data: `/api/project/${this.$route.params.project}/gis/preplot/line`,
data: `/api/project/${this.$route.params.project}/gis/preplot/line?v=${this.lineTStamp?.valueOf()}`,
lineWidthMinPixels: 1,
getLineColor: (d) => d.properties.ntba ? [240, 248, 255, 200] : [85, 170, 255, 200],
getLineWidth: 1,
@@ -345,7 +345,7 @@ export default {
rawSequencesLinesLayer (options = {}) {
return new GeoJsonLayer({
id: 'seqrl',
data: `/api/project/${this.$route.params.project}/gis/raw/line`,
data: `/api/project/${this.$route.params.project}/gis/raw/line?v=${this.sequenceTStamp?.valueOf()}`,
lineWidthMinPixels: 1,
getLineColor: (d) => d.properties.ntbp ? [0xe6, 0x51, 0x00, 200] : [0xff, 0x98, 0x00, 200],
getLineWidth: 1,
@@ -360,7 +360,7 @@ export default {
finalSequencesLinesLayer (options = {}) {
return new GeoJsonLayer({
id: 'seqfl',
data: `/api/project/${this.$route.params.project}/gis/final/line`,
data: `/api/project/${this.$route.params.project}/gis/final/line?v=${this.sequenceTStamp?.valueOf()}`,
lineWidthMinPixels: 1,
getLineColor: (d) => d.properties.pending ? [0xa7, 0xff, 0xab, 200] : [0x00, 0x96, 0x88, 200],
getLineWidth: 1,