comparison client/src/store/fairwayprofile.js @ 3512:30a47d9fc667 waterlevel-in-crossprofile

client: fairway profiles: removed some old code
author Markus Kottlaender <markus@intevation.de>
date Tue, 28 May 2019 18:27:21 +0200
parents ba7bc3740fb3
children 8a9ee18de13f
comparison
equal deleted inserted replaced
3511:c50d955372b9 3512:30a47d9fc667
26 return { 26 return {
27 additionalSurvey: null, 27 additionalSurvey: null,
28 minAlt: 0, 28 minAlt: 0,
29 maxAlt: 0, 29 maxAlt: 0,
30 currentProfile: {}, 30 currentProfile: {},
31 referenceWaterLevel: null, 31 selectedWaterLevel: "LDC",
32 waterLevels: {},
33 selectedWaterLevel: "",
34 fairwayData: [], 32 fairwayData: [],
35 startPoint: null, 33 startPoint: null,
36 endPoint: null, 34 endPoint: null,
37 previousCuts: [], 35 previousCuts: [],
38 profileLoading: false, 36 profileLoading: false,
59 mutations: { 57 mutations: {
60 additionalSurvey: (state, additionalSurvey) => { 58 additionalSurvey: (state, additionalSurvey) => {
61 state.additionalSurvey = additionalSurvey; 59 state.additionalSurvey = additionalSurvey;
62 }, 60 },
63 setSelectedWaterLevel: (state, level) => { 61 setSelectedWaterLevel: (state, level) => {
64 state.selectedWaterLevel = state.waterLevels[level]; 62 state.selectedWaterLevel = level;
65 }, 63 },
66 setDifferencesLoading: (state, value) => { 64 setDifferencesLoading: (state, value) => {
67 state.differencesLoading = value; 65 state.differencesLoading = value;
68 }, 66 },
69 profileLoaded: (state, answer) => { 67 profileLoaded: (state, answer) => {
70 const { response, surveyDate } = answer; 68 const { response, surveyDate } = answer;
71 const { data } = response; 69 const { data } = response;
72 const { waterlevel } = response.data.properties;
73 const { value, when } = waterlevel;
74 const coordinates = data.geometry.coordinates; 70 const coordinates = data.geometry.coordinates;
75 if (!coordinates) return; 71 if (!coordinates) return;
76 const startPoint = state.startPoint; 72 const startPoint = state.startPoint;
77 const endPoint = state.endPoint; 73 const endPoint = state.endPoint;
78 const geoJSON = data; 74 const geoJSON = data;
79 const result = prepareProfile({ geoJSON, startPoint, endPoint }); 75 const result = prepareProfile({ geoJSON, startPoint, endPoint });
80 // Use Vue.set() to make new object properties rective 76 // Use Vue.set() to make new object properties rective
81 // https://vuejs.org/v2/guide/reactivity.html#Change-Detection-Caveats 77 // https://vuejs.org/v2/guide/reactivity.html#Change-Detection-Caveats
82 const entry = {
83 date: when,
84 value: value
85 };
86 state.waterLevels = { [when]: entry };
87 state.selectedWaterLevel = entry;
88 Vue.set(state.currentProfile, surveyDate, { 78 Vue.set(state.currentProfile, surveyDate, {
89 points: result.points, 79 points: result.points,
90 length: result.lengthPolyLine 80 length: result.lengthPolyLine
91 }); 81 });
92 if (!state.minAlt || state.minAlt > result.minAlt) { 82 if (!state.minAlt || state.minAlt > result.minAlt) {
114 state.maxAlt = null; 104 state.maxAlt = null;
115 state.totalLength = null; 105 state.totalLength = null;
116 state.fairwayData = []; 106 state.fairwayData = [];
117 state.startPoint = null; 107 state.startPoint = null;
118 state.endPoint = null; 108 state.endPoint = null;
119 state.referenceWaterLevel = null; 109 state.selectedWaterLevel = "LDC";
120 state.waterLevels = {};
121 state.selectedWaterLevel = "";
122 }, 110 },
123 previousCuts: (state, previousCuts) => { 111 previousCuts: (state, previousCuts) => {
124 state.previousCuts = previousCuts; 112 state.previousCuts = previousCuts;
125 }, 113 },
126 profileLoading: (state, loading) => { 114 profileLoading: (state, loading) => {