Mercurial > gemma
annotate client/src/components/fairway/BottleneckDialogue.vue @ 4410:3759b47f20f3
FD_import: change unit of depth to meter for consistency
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Tue, 17 Sep 2019 16:08:45 +0200 |
parents | d336a78985ad |
children | 2d2c9f98360a |
rev | line source |
---|---|
4322
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
1 <template> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
2 <div |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
3 :class="[ |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
4 'box ui-element rounded bg-white text-nowrap', |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
5 { expanded: showProfiles } |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
6 ]" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
7 > |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
8 <div style="width: 18rem"> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
9 <UIBoxHeader |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
10 icon="chart-area" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
11 :title="profilesLable" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
12 :closeCallback="close" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
13 /> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
14 <div class="box-body"> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
15 <UISpinnerOverlay v-if="surveysLoading || profileLoading" /> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
16 <select |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
17 @change="moveToBottleneck" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
18 v-model="selectedBottleneck" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
19 class="form-control font-weight-bold" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
20 > |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
21 <option :value="null"> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
22 <translate>Select Bottleneck</translate> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
23 </option> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
24 <optgroup |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
25 v-for="(bottlenecksForCountry, cc) in orderedBottlenecks" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
26 :key="cc" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
27 :label="cc" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
28 > |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
29 <option |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
30 v-for="bn in bottlenecksForCountry" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
31 :key="bn.properties.id" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
32 :value="bn.properties.name" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
33 > |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
34 {{ bn.properties.name }} |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
35 </option> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
36 </optgroup> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
37 </select> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
38 <div v-if="selectedBottleneck"> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
39 <div class="d-flex flex-column mt-2"> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
40 <div class="flex-fill"> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
41 <small class="text-muted"> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
42 <translate>Waterlevel</translate>: |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
43 </small> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
44 <select |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
45 v-model="selectedWaterLevel" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
46 class="form-control form-control-sm small" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
47 > |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
48 <option value="ref"> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
49 <translate>Depth Reference</translate> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
50 <template v-if="selectedSurvey"> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
51 ({{ selectedSurvey.depth_reference }}/{{ |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
52 $options.filters.waterlevel( |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
53 selectedSurvey.waterlevel_value |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
54 ) |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
55 }} |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
56 m) |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
57 </template> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
58 </option> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
59 <option value="current"> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
60 <translate>Current Waterlevel</translate> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
61 <template v-if="bottleneck"> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
62 ({{ |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
63 $options.filters.waterlevel( |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
64 bottleneck.get("gm_waterlevel") |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
65 ) |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
66 }} |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
67 m) |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
68 </template> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
69 </option> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
70 </select> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
71 </div> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
72 <div class="flex-fill"> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
73 <small class="text-muted"> <translate>Survey</translate>: </small> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
74 <div class="d-flex"> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
75 <select |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
76 v-model="selectedSurvey" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
77 class="form-control form-control-sm small" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
78 > |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
79 <option |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
80 v-for="survey in surveys" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
81 :key="survey.date_info" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
82 :value="survey" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
83 >{{ survey.date_info | surveyDate }}</option |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
84 > |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
85 </select> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
86 <button |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
87 class="btn btn-dark btn-xs ml-2" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
88 @click="deleteSelectedSurvey" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
89 > |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
90 <font-awesome-icon icon="trash" /> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
91 </button> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
92 </div> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
93 </div> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
94 <div class="flex-fill" v-if="selectedSurvey && surveys.length > 1"> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
95 <small class="text-muted mt-1"> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
96 <translate>Compare with</translate>: |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
97 </small> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
98 <select |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
99 v-model="additionalSurvey" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
100 class="form-control form-control-sm small" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
101 > |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
102 <option :value="null">None</option> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
103 <option |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
104 v-for="survey in additionalSurveys" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
105 :key="survey.date_info" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
106 :value="survey" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
107 >{{ survey.date_info | surveyDate }}</option |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
108 > |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
109 </select> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
110 </div> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
111 </div> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
112 <div class="mt-2 d-flex" v-if="additionalSurvey"> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
113 <button |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
114 v-if="differencesLoading" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
115 class="btn btn-info btn-xs flex-fill" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
116 disabled |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
117 > |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
118 <font-awesome-icon icon="spinner" spin class="mr-1" /> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
119 <translate>Calculating differences</translate> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
120 </button> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
121 <button |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
122 class="btn btn-info btn-xs flex-fill" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
123 @click="differencesVisible ? showSurvey() : showDifferences()" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
124 v-else |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
125 > |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
126 <translate v-if="differencesVisible" key="showsurvey" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
127 >Show survey</translate |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
128 > |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
129 <translate v-else key="showdifferences" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
130 >Show differences</translate |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
131 > |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
132 </button> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
133 <button |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
134 v-if="!paneSetup.includes('FAIRWAYPROFILE')" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
135 class="btn btn-info btn-xs ml-2" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
136 @click="$store.commit('application/paneRotate')" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
137 v-tooltip="rotatePanesTooltip" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
138 > |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
139 <font-awesome-icon icon="redo" fixed-width /> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
140 </button> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
141 <button |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
142 class="btn btn-info btn-xs ml-2" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
143 @click="toggleSyncMaps()" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
144 v-tooltip="syncMapsTooltip" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
145 > |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
146 <font-awesome-icon |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
147 :icon="mapsAreSynced ? 'unlink' : 'link'" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
148 fixed-width |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
149 /> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
150 </button> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
151 </div> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
152 <hr class="w-100 mb-0" /> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
153 <small class="text-muted d-block mt-2"> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
154 <translate>Saved cross profiles</translate>: |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
155 </small> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
156 <div class="d-flex"> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
157 <select |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
158 :class="[ |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
159 'form-control form-control-sm flex-fill', |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
160 { 'rounded-left-only': selectedCut } |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
161 ]" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
162 v-model="selectedCut" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
163 > |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
164 <option></option> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
165 <option |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
166 v-for="(cut, index) in previousCuts" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
167 :value="cut" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
168 :key="index" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
169 >{{ cut.label }}</option |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
170 > |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
171 </select> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
172 <button |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
173 class="btn btn-xs btn-dark ml-2" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
174 @click="deleteSelectedCut(selectedCut)" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
175 v-if="selectedCut" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
176 > |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
177 <font-awesome-icon icon="trash" /> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
178 </button> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
179 </div> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
180 <small class="text-muted d-block mt-2"> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
181 <translate>Enter coordinates manually</translate>: |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
182 </small> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
183 <div class="position-relative"> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
184 <input |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
185 class="form-control form-control-sm pr-5" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
186 placeholder="Lat,Lon,Lat,Lon" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
187 v-model="coordinatesInput" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
188 /> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
189 <button |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
190 class="btn btn-sm btn-info position-absolute input-button-right" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
191 @click="applyManualCoordinates" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
192 style="top: 0; right: 0;" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
193 v-if="coordinatesInputIsValid" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
194 > |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
195 <font-awesome-icon icon="check" /> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
196 </button> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
197 </div> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
198 <small class="d-flex text-left mt-2" v-if="startPoint && endPoint"> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
199 <div class="text-nowrap mr-3"> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
200 <b> <translate>Start</translate>: </b> <br /> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
201 Lat: {{ startPoint[1] }} <br /> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
202 Lon: {{ startPoint[0] }} |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
203 </div> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
204 <div class="text-nowrap"> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
205 <b>End:</b> <br /> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
206 Lat: {{ endPoint[1] }} <br /> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
207 Lon: {{ endPoint[0] }} |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
208 </div> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
209 <button |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
210 v-clipboard:copy="coordinatesForClipboard" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
211 v-clipboard:success="onCopyCoordinates" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
212 class="btn btn-info btn-sm ml-auto mt-auto" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
213 > |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
214 <font-awesome-icon icon="copy" /> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
215 </button> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
216 </small> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
217 <div class="d-flex mt-3"> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
218 <div |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
219 class="pr-3 w-50" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
220 v-if="startPoint && endPoint && !selectedCut" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
221 > |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
222 <button |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
223 class="btn btn-info btn-sm w-100" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
224 @click="showLabelInput = !showLabelInput" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
225 > |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
226 <font-awesome-icon :icon="showLabelInput ? 'times' : 'check'" /> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
227 {{ showLabelInput ? "Cancel" : "Save" }} |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
228 </button> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
229 </div> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
230 <div |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
231 :class="startPoint && endPoint && !selectedCut ? 'w-50' : 'w-100'" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
232 > |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
233 <button |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
234 class="btn btn-info btn-sm w-100" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
235 @click="toggleCutTool" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
236 :disabled="!selectedSurvey" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
237 > |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
238 <font-awesome-icon :icon="cutToolEnabled ? 'times' : 'plus'" /> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
239 {{ cutToolEnabled ? "Cancel" : "New" }} |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
240 </button> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
241 </div> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
242 </div> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
243 <div v-if="showLabelInput" class="mt-2"> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
244 <small class="text-muted"> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
245 <translate>Enter label for cross profile</translate>: |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
246 </small> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
247 <div class="position-relative"> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
248 <input |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
249 class="form-control form-control-sm pr-5" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
250 v-model="cutLabel" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
251 /> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
252 <button |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
253 class="btn btn-sm btn-info position-absolute input-button-right" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
254 @click="saveCut" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
255 v-if="cutLabel" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
256 style="top: 0; right: 0;" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
257 > |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
258 <font-awesome-icon icon="check" /> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
259 </button> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
260 </div> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
261 </div> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
262 </div> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
263 </div> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
264 </div> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
265 </div> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
266 </template> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
267 |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
268 <style lang="scss" scoped> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
269 .input-button-right { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
270 border-top-right-radius: $border-radius; |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
271 border-bottom-right-radius: $border-radius; |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
272 border-top-left-radius: 0 !important; |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
273 border-bottom-left-radius: 0 !important; |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
274 } |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
275 |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
276 .rounded-left-only { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
277 border-top-right-radius: 0 !important; |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
278 border-bottom-right-radius: 0 !important; |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
279 border-top-left-radius: $border-radius; |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
280 border-bottom-left-radius: $border-radius; |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
281 } |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
282 |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
283 input, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
284 select { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
285 font-size: 0.8em; |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
286 } |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
287 </style> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
288 |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
289 <script> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
290 /* This is Free Software under GNU Affero General Public License v >= 3.0 |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
291 * without warranty, see README.md and license for details. |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
292 * |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
293 * SPDX-License-Identifier: AGPL-3.0-or-later |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
294 * License-Filename: LICENSES/AGPL-3.0.txt |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
295 * |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
296 * Copyright (C) 2018 by via donau |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
297 * – Österreichische Wasserstraßen-Gesellschaft mbH |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
298 * Software engineering by Intevation GmbH |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
299 * |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
300 * Author(s): |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
301 * Markus Kottländer <markus.kottlaender@intevation.de> |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
302 */ |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
303 import { mapState, mapGetters } from "vuex"; |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
304 import Feature from "ol/Feature"; |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
305 import LineString from "ol/geom/LineString"; |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
306 import { displayError, displayInfo } from "@/lib/errors"; |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
307 import { HTTP } from "@/lib/http"; |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
308 import { COMPARESURVEYS } from "@/components/paneSetups"; |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
309 |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
310 export default { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
311 name: "profiles", |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
312 data() { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
313 return { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
314 coordinatesInput: "", |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
315 cutLabel: "", |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
316 showLabelInput: false |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
317 }; |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
318 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
319 computed: { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
320 ...mapState("application", ["showProfiles", "paneSetup"]), |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
321 ...mapState("map", ["openLayersMaps", "syncedMaps", "cutToolEnabled"]), |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
322 ...mapState("bottlenecks", [ |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
323 "bottlenecksList", |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
324 "surveys", |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
325 "surveysLoading" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
326 ]), |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
327 ...mapState("fairwayprofile", [ |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
328 "previousCuts", |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
329 "startPoint", |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
330 "endPoint", |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
331 "profileLoading", |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
332 "differencesLoading", |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
333 "waterLevels", |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
334 "currentProfile" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
335 ]), |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
336 ...mapGetters("map", ["openLayersMap"]), |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
337 ...mapGetters("bottlenecks", ["orderedBottlenecks"]), |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
338 profilesLable() { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
339 return this.$gettext("Bottleneck Surveys"); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
340 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
341 selectedBottleneck: { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
342 get() { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
343 return this.$store.state.bottlenecks.selectedBottleneck; |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
344 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
345 set(name) { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
346 this.$store.dispatch("bottlenecks/setSelectedBottleneck", name); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
347 } |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
348 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
349 selectedWaterLevel: { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
350 get() { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
351 return this.$store.state.fairwayprofile.selectedWaterLevel; |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
352 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
353 set(value) { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
354 this.$store.commit("fairwayprofile/setSelectedWaterLevel", value); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
355 } |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
356 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
357 selectedSurvey: { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
358 get() { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
359 return this.$store.state.bottlenecks.selectedSurvey; |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
360 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
361 set(survey) { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
362 this.$store.commit("fairwayprofile/additionalSurvey", null); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
363 this.$store.commit("bottlenecks/selectedSurvey", survey); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
364 } |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
365 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
366 additionalSurvey: { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
367 get() { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
368 return this.$store.state.fairwayprofile.additionalSurvey; |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
369 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
370 set(survey) { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
371 this.$store.commit("fairwayprofile/additionalSurvey", survey); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
372 } |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
373 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
374 selectedCut: { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
375 get() { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
376 return this.$store.state.fairwayprofile.selectedCut; |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
377 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
378 set(cut) { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
379 this.$store.commit("fairwayprofile/selectedCut", cut); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
380 if (!cut) { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
381 this.$store.commit("fairwayprofile/clearCurrentProfile"); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
382 this.openLayersMaps.forEach(m => { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
383 m.getLayer("CUTTOOL") |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
384 .getSource() |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
385 .clear(); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
386 }); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
387 } |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
388 } |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
389 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
390 additionalSurveys() { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
391 return this.surveys.filter( |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
392 survey => survey.date_info !== this.selectedSurvey.date_info |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
393 ); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
394 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
395 coordinatesForClipboard() { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
396 return ( |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
397 this.startPoint[1] + |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
398 "," + |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
399 this.startPoint[0] + |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
400 "," + |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
401 this.endPoint[1] + |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
402 "," + |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
403 this.endPoint[0] |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
404 ); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
405 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
406 coordinatesInputIsValid() { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
407 const coordinates = this.coordinatesInput |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
408 .split(",") |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
409 .map(coord => parseFloat(coord.trim())) |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
410 .filter(c => Number(c) === c); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
411 return coordinates.length === 4; |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
412 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
413 differencesVisible() { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
414 return ( |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
415 this.openLayersMap(COMPARESURVEYS.compare.id) && |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
416 !this.openLayersMap(COMPARESURVEYS.compare.id) |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
417 .getLayer("BOTTLENECKISOLINE") |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
418 .getVisible() && |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
419 this.openLayersMap(COMPARESURVEYS.compare.id) |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
420 .getLayer("DIFFERENCES") |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
421 .getVisible() |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
422 ); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
423 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
424 rotatePanesTooltip() { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
425 return this.$gettext("Rotate Maps"); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
426 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
427 syncMapsTooltip() { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
428 return this.$gettext( |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
429 this.mapsAreSynced ? "Unsynchronize Maps" : "Synchronize Maps" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
430 ); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
431 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
432 mapsAreSynced() { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
433 return this.syncedMaps.includes(COMPARESURVEYS.compare.id); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
434 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
435 bottleneck() { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
436 return this.openLayersMap() |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
437 ? this.openLayersMap() |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
438 .getLayer("BOTTLENECKS") |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
439 .getSource() |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
440 .getFeatures() |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
441 .find(f => f.get("objnam") === this.selectedBottleneck) |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
442 : null; |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
443 } |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
444 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
445 watch: { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
446 selectedBottleneck() { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
447 this.$store.dispatch("fairwayprofile/previousCuts"); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
448 this.cutLabel = |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
449 this.selectedBottleneck + " (" + new Date().toISOString() + ")"; |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
450 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
451 selectedSurvey(survey) { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
452 this.loadProfile(survey); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
453 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
454 additionalSurvey(survey) { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
455 if (survey) { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
456 this.loadDifferences(); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
457 this.$store.commit( |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
458 "application/paneSetup", |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
459 Object.keys(this.currentProfile).length |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
460 ? "COMPARESURVEYS_FAIRWAYPROFILE" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
461 : "COMPARESURVEYS" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
462 ); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
463 this.$store.commit("map/syncedMaps", [COMPARESURVEYS.compare.id]); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
464 } else { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
465 this.$store.commit( |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
466 "application/paneSetup", |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
467 Object.keys(this.currentProfile).length ? "FAIRWAYPROFILE" : "DEFAULT" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
468 ); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
469 this.$store.commit("map/syncedMaps", []); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
470 } |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
471 this.loadProfile(survey); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
472 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
473 selectedCut(cut) { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
474 if (cut) { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
475 this.applyCoordinates(cut.coordinates); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
476 } |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
477 } |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
478 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
479 methods: { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
480 toggleSyncMaps() { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
481 if (this.mapsAreSynced) { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
482 this.$store.commit( |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
483 "map/syncedMaps", |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
484 this.syncedMaps.filter(m => m !== COMPARESURVEYS.compare.id) |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
485 ); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
486 } else { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
487 this.$store.commit("map/syncedMaps", [COMPARESURVEYS.compare.id]); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
488 } |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
489 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
490 loadDifferences() { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
491 this.$store.commit("fairwayprofile/setDifferencesLoading", true); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
492 HTTP.post( |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
493 "/diff", |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
494 { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
495 bottleneck: this.selectedSurvey.bottleneck_id, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
496 minuend: this.selectedSurvey.date_info, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
497 subtrahend: this.additionalSurvey.date_info |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
498 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
499 { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
500 headers: { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
501 "X-Gemma-Auth": localStorage.getItem("token") |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
502 } |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
503 } |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
504 ) |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
505 .then() |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
506 .catch(error => { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
507 let status, data, message; |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
508 if (error.response) { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
509 status = error.response.status; |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
510 data = error.response.data; |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
511 message = `${status}: ${data.message || data}`; |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
512 } else { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
513 message = error; |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
514 } |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
515 displayError({ |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
516 title: this.$gettext("Backend Error"), |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
517 message: message |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
518 }); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
519 }) |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
520 .finally(() => { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
521 this.$store.commit("fairwayprofile/setDifferencesLoading", false); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
522 }); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
523 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
524 showDifferences() { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
525 this.openLayersMap(COMPARESURVEYS.compare.id) |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
526 .getLayer("BOTTLENECKISOLINE") |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
527 .setVisible(false); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
528 this.openLayersMap(COMPARESURVEYS.compare.id) |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
529 .getLayer("DIFFERENCES") |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
530 .setVisible(true); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
531 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
532 showSurvey() { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
533 this.openLayersMap(COMPARESURVEYS.compare.id) |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
534 .getLayer("BOTTLENECKISOLINE") |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
535 .setVisible(true); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
536 this.openLayersMap(COMPARESURVEYS.compare.id) |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
537 .getLayer("DIFFERENCES") |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
538 .setVisible(false); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
539 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
540 close() { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
541 this.$store.commit("application/showProfiles", false); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
542 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
543 loadProfile(survey) { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
544 if (survey) { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
545 this.$store.commit("fairwayprofile/profileLoading", true); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
546 this.$store |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
547 .dispatch("fairwayprofile/loadProfile", survey) |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
548 .finally(() => { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
549 this.$store.commit("fairwayprofile/profileLoading", false); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
550 }); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
551 } |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
552 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
553 toggleCutTool() { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
554 this.$store.commit("map/cutToolEnabled", !this.cutToolEnabled); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
555 this.$store.commit("map/lineToolEnabled", false); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
556 this.$store.commit("map/polygonToolEnabled", false); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
557 this.$store.commit("map/setCurrentMeasurement", null); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
558 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
559 onCopyCoordinates() { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
560 displayInfo({ |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
561 message: this.$gettext("Coordinates copied to clipboard!") |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
562 }); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
563 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
564 applyManualCoordinates() { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
565 const coordinates = this.coordinatesInput |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
566 .split(",") |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
567 .map(coord => parseFloat(coord.trim())); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
568 this.selectedCut = null; |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
569 this.coordinatesInput = ""; |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
570 this.applyCoordinates([ |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
571 coordinates[1], |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
572 coordinates[0], |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
573 coordinates[3], |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
574 coordinates[2] |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
575 ]); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
576 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
577 applyCoordinates(coordinates) { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
578 // allow only numbers |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
579 coordinates = coordinates.filter(c => Number(c) === c); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
580 if (coordinates.length === 4) { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
581 // draw line on map |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
582 this.openLayersMaps.forEach(m => { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
583 m.getLayer("CUTTOOL") |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
584 .getSource() |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
585 .clear(); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
586 }); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
587 const cut = new Feature({ |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
588 geometry: new LineString([ |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
589 [coordinates[0], coordinates[1]], |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
590 [coordinates[2], coordinates[3]] |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
591 ]).transform("EPSG:4326", "EPSG:3857") |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
592 }); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
593 this.openLayersMaps.forEach(m => { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
594 m.getLayer("CUTTOOL") |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
595 .getSource() |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
596 .addFeature(cut); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
597 }); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
598 |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
599 // draw diagram |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
600 this.$store.dispatch("fairwayprofile/cut", cut); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
601 } else { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
602 displayError({ |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
603 title: this.$gettext("Invalid input"), |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
604 message: this.$gettext( |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
605 "Please enter correct coordinates in the format: Lat,Lon,Lat,Lon" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
606 ) |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
607 }); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
608 } |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
609 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
610 saveCut() { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
611 const previousCuts = |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
612 JSON.parse(localStorage.getItem("previousCuts")) || []; |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
613 const newEntry = { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
614 label: this.cutLabel, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
615 bottleneckName: this.selectedBottleneck, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
616 coordinates: [...this.startPoint, ...this.endPoint], |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
617 timestamp: new Date().getTime() |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
618 }; |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
619 const existingEntry = previousCuts.find(cut => { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
620 return JSON.stringify(cut) === JSON.stringify(newEntry); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
621 }); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
622 if (!existingEntry) previousCuts.push(newEntry); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
623 if (previousCuts.length > 100) previousCuts.shift(); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
624 localStorage.setItem("previousCuts", JSON.stringify(previousCuts)); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
625 this.$store.dispatch("fairwayprofile/previousCuts"); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
626 |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
627 this.showLabelInput = false; |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
628 displayInfo({ |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
629 title: this.$gettext("Profile saved!"), |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
630 message: this.$gettext( |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
631 'You can now select these coordinates from the "Saved cross profiles" menu to restore this cross profile.' |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
632 ) |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
633 }); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
634 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
635 deleteSelectedSurvey() { |
4402
5e894e680e0d
dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents:
4324
diff
changeset
|
636 HTTP.post( |
5e894e680e0d
dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents:
4324
diff
changeset
|
637 "/imports/dsr", |
5e894e680e0d
dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents:
4324
diff
changeset
|
638 { |
4406
d336a78985ad
bottleneck_dialogue: send correct bottleneck_id
Thomas Junk <thomas.junk@intevation.de>
parents:
4402
diff
changeset
|
639 "bottleneck-id": this.selectedSurvey.bottleneck_id, |
4402
5e894e680e0d
dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents:
4324
diff
changeset
|
640 "date-info": this.selectedSurvey.date_info |
4322
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
641 }, |
4402
5e894e680e0d
dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents:
4324
diff
changeset
|
642 { |
5e894e680e0d
dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents:
4324
diff
changeset
|
643 headers: { "X-Gemma-Auth": localStorage.getItem("token") } |
4322
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
644 } |
4402
5e894e680e0d
dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents:
4324
diff
changeset
|
645 ) |
5e894e680e0d
dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents:
4324
diff
changeset
|
646 .then(() => { |
5e894e680e0d
dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents:
4324
diff
changeset
|
647 displayInfo({ |
5e894e680e0d
dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents:
4324
diff
changeset
|
648 title: this.$gettext("Survey"), |
5e894e680e0d
dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents:
4324
diff
changeset
|
649 message: |
5e894e680e0d
dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents:
4324
diff
changeset
|
650 this.$gettext("Deleting ") + |
5e894e680e0d
dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents:
4324
diff
changeset
|
651 `${this.selectedBottleneck}: ${this.selectedSurvey.date_info}` |
5e894e680e0d
dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents:
4324
diff
changeset
|
652 }); |
5e894e680e0d
dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents:
4324
diff
changeset
|
653 }) |
5e894e680e0d
dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents:
4324
diff
changeset
|
654 .catch(error => { |
5e894e680e0d
dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents:
4324
diff
changeset
|
655 const { status, data } = error.response; |
5e894e680e0d
dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents:
4324
diff
changeset
|
656 displayError({ |
5e894e680e0d
dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents:
4324
diff
changeset
|
657 title: this.$gettext("Backend Error"), |
5e894e680e0d
dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents:
4324
diff
changeset
|
658 message: `${status}: ${data.message || data}` |
5e894e680e0d
dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents:
4324
diff
changeset
|
659 }); |
5e894e680e0d
dsr implemented in frontend
Thomas Junk <thomas.junk@intevation.de>
parents:
4324
diff
changeset
|
660 }); |
4322
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
661 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
662 deleteSelectedCut(cut) { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
663 this.$store.commit("application/popup", { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
664 icon: "trash", |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
665 title: this.$gettext("Delete cross profile"), |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
666 content: |
4324
36d384326407
BottleneckDialogue: Prototype for delete of surveys implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
4322
diff
changeset
|
667 `<small><b>` + |
4322
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
668 this.$gettext("Do you really want to delete the cross profile:") + |
4324
36d384326407
BottleneckDialogue: Prototype for delete of surveys implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
4322
diff
changeset
|
669 `</b><br> |
36d384326407
BottleneckDialogue: Prototype for delete of surveys implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
4322
diff
changeset
|
670 ${cut.label}</small>`, |
4322
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
671 confirm: { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
672 label: this.$gettext("Delete"), |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
673 icon: "trash", |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
674 callback: () => { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
675 let previousCuts = |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
676 JSON.parse(localStorage.getItem("previousCuts")) || []; |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
677 previousCuts = previousCuts.filter(cut => { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
678 return JSON.stringify(cut) !== JSON.stringify(this.selectedCut); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
679 }); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
680 localStorage.setItem("previousCuts", JSON.stringify(previousCuts)); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
681 this.$store.commit("fairwayprofile/selectedCut", null); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
682 this.$store.dispatch("fairwayprofile/previousCuts"); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
683 displayInfo({ title: this.$gettext("Profile deleted!") }); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
684 } |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
685 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
686 cancel: { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
687 label: this.$gettext("Cancel"), |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
688 icon: "times" |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
689 } |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
690 }); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
691 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
692 moveToBottleneck() { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
693 const bottleneck = this.bottlenecksList.find( |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
694 bn => bn.properties.name === this.selectedBottleneck |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
695 ); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
696 if (!bottleneck) return; |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
697 this.$store.dispatch("map/moveToFeauture", { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
698 feature: bottleneck, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
699 zoom: 17, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
700 preventZoomOut: true |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
701 }); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
702 } |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
703 }, |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
704 mounted() { |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
705 this.$store.dispatch("bottlenecks/loadBottlenecksList"); |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
706 } |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
707 }; |
fabe67e204e7
bottleneckDialogue added
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
708 </script> |