Mercurial > gemma
annotate client/src/components/fairway/Profiles.vue @ 2412:0ed53a7a1221
login fixed
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Thu, 28 Feb 2019 12:29:12 +0100 |
parents | f185503ef35a |
children | 817b3d726b43 |
rev | line source |
---|---|
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
1 <template> |
1480 | 2 <div |
3 :class="[ | |
4 'box ui-element rounded bg-white text-nowrap', | |
5 { expanded: showProfiles } | |
6 ]" | |
7 > | |
2260
531e776cb81d
client: reduced width of pdf-, profile- and identify-box
Markus Kottlaender <markus@intevation.de>
parents:
2154
diff
changeset
|
8 <div style="width: 18rem"> |
2387
f185503ef35a
client: unified box's header styles by creating a reusable component
Markus Kottlaender <markus@intevation.de>
parents:
2365
diff
changeset
|
9 <UIBoxHeader icon="chart-area" title="Profiles" :closeCallback="close" /> |
1480 | 10 <div |
11 class="d-flex flex-column p-3 flex-grow-1 text-left position-relative" | |
12 > | |
1416
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
13 <div |
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
14 class="loading d-flex justify-content-center align-items-center" |
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
15 v-if="surveysLoading || profileLoading" |
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
16 > |
1480 | 17 <font-awesome-icon icon="spinner" spin /> |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
18 </div> |
1416
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
19 <select |
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
20 @click="moveToBottleneck" |
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
21 v-model="selectedBottleneck" |
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
22 class="form-control font-weight-bold" |
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
23 > |
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
24 <option :value="null"> |
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
25 <translate>Select Bottleneck</translate> |
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
26 </option> |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
27 <option |
1379 | 28 v-for="bn in bottlenecks" |
29 :key="bn.properties.name" | |
30 :value="bn.properties.name" | |
1480 | 31 >{{ bn.properties.name }}</option |
32 > | |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
33 </select> |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
34 <div v-if="selectedBottleneck"> |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
35 <div class="d-flex mt-2"> |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
36 <div class="flex-fill"> |
1416
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
37 <small class="text-muted"> |
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
38 <translate>Sounding Result</translate>: |
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
39 </small> |
1480 | 40 <select |
41 v-model="selectedSurvey" | |
42 class="form-control form-control-sm" | |
43 > | |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
44 <option |
1379 | 45 v-for="survey in surveys" |
46 :key="survey.date_info" | |
47 :value="survey" | |
1521
276df8dadc14
bought localized datestrings
Thomas Junk <thomas.junk@intevation.de>
parents:
1518
diff
changeset
|
48 >{{ formatSurveyDate(survey.date_info) }}</option |
1480 | 49 > |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
50 </select> |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
51 </div> |
1480 | 52 <div |
53 class="flex-fill ml-3" | |
54 v-if="selectedSurvey && surveys.length > 1" | |
55 > | |
1416
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
56 <small class="text-muted mt-1"> |
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
57 <translate>Compare with</translate>: |
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
58 </small> |
1480 | 59 <select |
60 v-model="additionalSurvey" | |
61 class="form-control form-control-sm" | |
62 > | |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
63 <option :value="null">None</option> |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
64 <option |
1379 | 65 v-for="survey in additionalSurveys" |
66 :key="survey.date_info" | |
67 :value="survey" | |
1521
276df8dadc14
bought localized datestrings
Thomas Junk <thomas.junk@intevation.de>
parents:
1518
diff
changeset
|
68 >{{ formatSurveyDate(survey.date_info) }}</option |
1480 | 69 > |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
70 </select> |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
71 </div> |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
72 </div> |
1480 | 73 <hr class="w-100 mb-0" /> |
1416
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
74 <small class="text-muted d-block mt-2"> |
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
75 <translate>Saved cross profiles</translate>: |
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
76 </small> |
1395
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
77 <div class="d-flex"> |
1416
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
78 <select |
1480 | 79 :class="[ |
80 'form-control form-control-sm flex-fill', | |
81 { 'rounded-left-only': selectedCut } | |
82 ]" | |
1416
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
83 v-model="selectedCut" |
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
84 > |
1395
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
85 <option></option> |
1480 | 86 <option |
87 v-for="(cut, index) in previousCuts" | |
88 :value="cut" | |
89 :key="index" | |
90 >{{ cut.label }}</option | |
91 > | |
1395
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
92 </select> |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
93 <button |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
94 class="btn btn-sm btn-danger input-button-right" |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
95 @click="confirmDeleteSelectedCut = true" |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
96 v-if="selectedCut && !confirmDeleteSelectedCut" |
1416
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
97 > |
1480 | 98 <font-awesome-icon icon="trash" /> |
1416
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
99 </button> |
1395
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
100 <button |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
101 class="btn btn-sm btn-info rounded-0" |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
102 @click="confirmDeleteSelectedCut = false" |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
103 v-if="selectedCut && confirmDeleteSelectedCut" |
1416
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
104 > |
2154
a08e0f532304
staging: improve UI
Thomas Junk <thomas.junk@intevation.de>
parents:
2136
diff
changeset
|
105 <font-awesome-icon icon="times" class="pointer" /> |
1416
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
106 </button> |
1395
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
107 <button |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
108 class="btn btn-sm btn-danger input-button-right" |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
109 @click="deleteSelectedCut" |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
110 v-if="selectedCut && confirmDeleteSelectedCut" |
1416
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
111 > |
1480 | 112 <font-awesome-icon icon="check" /> |
1416
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
113 </button> |
1395
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
114 </div> |
1416
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
115 <small class="text-muted d-block mt-2"> |
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
116 <translate>Enter coordinates manually</translate>: |
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
117 </small> |
1395
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
118 <div class="position-relative"> |
1416
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
119 <input |
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
120 class="form-control form-control-sm pr-5" |
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
121 placeholder="Lat,Lon,Lat,Lon" |
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
122 v-model="coordinatesInput" |
1480 | 123 /> |
1395
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
124 <button |
1416
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
125 class="btn btn-sm btn-info position-absolute input-button-right" |
1395
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
126 @click="applyManualCoordinates" |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
127 style="top: 0; right: 0;" |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
128 v-if="coordinatesInputIsValid" |
1416
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
129 > |
1480 | 130 <font-awesome-icon icon="check" /> |
1416
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
131 </button> |
1395
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
132 </div> |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
133 <small class="d-flex text-left mt-2" v-if="startPoint && endPoint"> |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
134 <div class="text-nowrap mr-3"> |
1480 | 135 <b> <translate>Start</translate>: </b> <br /> |
136 Lat: {{ startPoint[1] }} <br /> | |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
137 Lon: {{ startPoint[0] }} |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
138 </div> |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
139 <div class="text-nowrap"> |
1480 | 140 <b>End:</b> <br /> |
141 Lat: {{ endPoint[1] }} <br /> | |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
142 Lon: {{ endPoint[0] }} |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
143 </div> |
1416
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
144 <button |
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
145 v-clipboard:copy="coordinatesForClipboard" |
1379 | 146 v-clipboard:success="onCopyCoordinates" |
147 class="btn btn-info btn-sm ml-auto mt-auto" | |
1416
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
148 > |
1480 | 149 <font-awesome-icon icon="copy" /> |
1416
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
150 </button> |
1379 | 151 </small> |
1395
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
152 <div class="d-flex mt-3"> |
1480 | 153 <div |
154 class="pr-3 w-50" | |
155 v-if="startPoint && endPoint && !selectedCut" | |
156 > | |
157 <button | |
158 class="btn btn-info btn-sm w-100" | |
159 @click="showLabelInput = !showLabelInput" | |
160 > | |
161 <font-awesome-icon :icon="showLabelInput ? 'times' : 'check'" /> | |
1379 | 162 {{ showLabelInput ? "Cancel" : "Save" }} |
163 </button> | |
164 </div> | |
1480 | 165 <div |
166 :class="startPoint && endPoint && !selectedCut ? 'w-50' : 'w-100'" | |
167 > | |
1416
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
168 <button class="btn btn-info btn-sm w-100" @click="toggleCutTool"> |
1480 | 169 <font-awesome-icon |
170 :icon="cutTool && cutTool.getActive() ? 'times' : 'plus'" | |
171 ></font-awesome-icon> | |
1379 | 172 {{ cutTool && cutTool.getActive() ? "Cancel" : "New" }} |
173 </button> | |
174 </div> | |
175 </div> | |
176 <div v-if="showLabelInput" class="mt-2"> | |
1416
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
177 <small class="text-muted"> |
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
178 <translate>Enter label for cross profile</translate>: |
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
179 </small> |
1379 | 180 <div class="position-relative"> |
1480 | 181 <input |
182 class="form-control form-control-sm pr-5" | |
183 v-model="cutLabel" | |
184 /> | |
1379 | 185 <button |
186 class="btn btn-sm btn-info position-absolute input-button-right" | |
187 @click="saveCut" | |
188 v-if="cutLabel" | |
189 style="top: 0; right: 0;" | |
1416
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
190 > |
1480 | 191 <font-awesome-icon icon="check" /> |
1416
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
192 </button> |
1379 | 193 </div> |
194 </div> | |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
195 </div> |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
196 </div> |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
197 </div> |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
198 </div> |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
199 </template> |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
200 |
1449 | 201 <style lang="scss" scoped> |
202 .loading { | |
203 background: rgba(255, 255, 255, 0.9); | |
204 position: absolute; | |
205 z-index: 99; | |
206 top: 0; | |
207 right: 0; | |
208 bottom: 0; | |
209 left: 0; | |
210 } | |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
211 |
1449 | 212 .input-button-right { |
213 border-top-right-radius: $border-radius; | |
214 border-bottom-right-radius: $border-radius; | |
215 border-top-left-radius: 0 !important; | |
216 border-bottom-left-radius: 0 !important; | |
217 } | |
1395
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
218 |
1449 | 219 .rounded-left-only { |
220 border-top-right-radius: 0 !important; | |
221 border-bottom-right-radius: 0 !important; | |
222 border-top-left-radius: $border-radius; | |
223 border-bottom-left-radius: $border-radius; | |
224 } | |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
225 </style> |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
226 |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
227 <script> |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
228 /* This is Free Software under GNU Affero General Public License v >= 3.0 |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
229 * without warranty, see README.md and license for details. |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
230 * |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
231 * SPDX-License-Identifier: AGPL-3.0-or-later |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
232 * License-Filename: LICENSES/AGPL-3.0.txt |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
233 * |
1416
3af7ad9717e2
Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1399
diff
changeset
|
234 * Copyright (C) 2018 by via donau |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
235 * – Österreichische Wasserstraßen-Gesellschaft mbH |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
236 * Software engineering by Intevation GmbH |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
237 * |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
238 * Author(s): |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
239 * Markus Kottländer <markus.kottlaender@intevation.de> |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
240 */ |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
241 import { mapState, mapGetters } from "vuex"; |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
242 import Feature from "ol/Feature"; |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
243 import LineString from "ol/geom/LineString"; |
1613
f2d24dceecc7
refac: cleanup import paths
Thomas Junk <thomas.junk@intevation.de>
parents:
1558
diff
changeset
|
244 import { displayError, displayInfo } from "@/lib/errors.js"; |
f2d24dceecc7
refac: cleanup import paths
Thomas Junk <thomas.junk@intevation.de>
parents:
1558
diff
changeset
|
245 import { formatSurveyDate } from "@/lib/date.js"; |
2365
242c170e00ce
client:use the name constants instead of strings
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2260
diff
changeset
|
246 import { LAYERS } from "@/store/map.js"; |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
247 |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
248 export default { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
249 name: "profiles", |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
250 data() { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
251 return { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
252 coordinatesInput: "", |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
253 cutLabel: "", |
1395
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
254 showLabelInput: false, |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
255 confirmDeleteSelectedCut: false |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
256 }; |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
257 }, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
258 computed: { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
259 ...mapGetters("map", ["getVSourceByName"]), |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
260 ...mapState("application", ["showProfiles"]), |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
261 ...mapState("map", ["lineTool", "polygonTool", "cutTool"]), |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
262 ...mapState("bottlenecks", ["bottlenecks", "surveys", "surveysLoading"]), |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
263 ...mapState("fairwayprofile", [ |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
264 "previousCuts", |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
265 "startPoint", |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
266 "endPoint", |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
267 "profileLoading" |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
268 ]), |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
269 selectedBottleneck: { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
270 get() { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
271 return this.$store.state.bottlenecks.selectedBottleneck; |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
272 }, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
273 set(name) { |
1553
35f85da41fdb
fix: select first sounfing result after selecting bottleneck
Thomas Junk <thomas.junk@intevation.de>
parents:
1521
diff
changeset
|
274 this.$store |
35f85da41fdb
fix: select first sounfing result after selecting bottleneck
Thomas Junk <thomas.junk@intevation.de>
parents:
1521
diff
changeset
|
275 .dispatch("bottlenecks/setSelectedBottleneck", name) |
35f85da41fdb
fix: select first sounfing result after selecting bottleneck
Thomas Junk <thomas.junk@intevation.de>
parents:
1521
diff
changeset
|
276 .then(() => { |
35f85da41fdb
fix: select first sounfing result after selecting bottleneck
Thomas Junk <thomas.junk@intevation.de>
parents:
1521
diff
changeset
|
277 this.$store.commit("bottlenecks/setFirstSurveySelected"); |
35f85da41fdb
fix: select first sounfing result after selecting bottleneck
Thomas Junk <thomas.junk@intevation.de>
parents:
1521
diff
changeset
|
278 }); |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
279 } |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
280 }, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
281 selectedSurvey: { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
282 get() { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
283 return this.$store.state.bottlenecks.selectedSurvey; |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
284 }, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
285 set(survey) { |
1394
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
286 this.$store.commit("fairwayprofile/additionalSurvey", null); |
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
287 this.$store.commit("bottlenecks/selectedSurvey", survey); |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
288 } |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
289 }, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
290 additionalSurvey: { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
291 get() { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
292 return this.$store.state.fairwayprofile.additionalSurvey; |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
293 }, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
294 set(survey) { |
1391
801ae5f4bc5b
fixed bug when changing additional survey in profile dialog
Markus Kottlaender <markus@intevation.de>
parents:
1382
diff
changeset
|
295 this.$store.commit("fairwayprofile/additionalSurvey", survey); |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
296 } |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
297 }, |
1395
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
298 selectedCut: { |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
299 get() { |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
300 return this.$store.state.fairwayprofile.selectedCut; |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
301 }, |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
302 set(cut) { |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
303 this.$store.commit("fairwayprofile/selectedCut", cut); |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
304 if (!cut) { |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
305 this.$store.commit("fairwayprofile/clearCurrentProfile"); |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
306 this.$store.commit("application/showSplitscreen", false); |
2365
242c170e00ce
client:use the name constants instead of strings
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2260
diff
changeset
|
307 this.getVSourceByName(LAYERS.CUTTOOL).clear(); |
1395
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
308 } |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
309 } |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
310 }, |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
311 additionalSurveys() { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
312 return this.surveys.filter(survey => survey !== this.selectedSurvey); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
313 }, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
314 coordinatesForClipboard() { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
315 return ( |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
316 this.startPoint[1] + |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
317 "," + |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
318 this.startPoint[0] + |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
319 "," + |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
320 this.endPoint[1] + |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
321 "," + |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
322 this.endPoint[0] |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
323 ); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
324 }, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
325 coordinatesInputIsValid() { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
326 const coordinates = this.coordinatesInput |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
327 .split(",") |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
328 .map(coord => parseFloat(coord.trim())) |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
329 .filter(c => Number(c) === c); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
330 return coordinates.length === 4; |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
331 } |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
332 }, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
333 watch: { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
334 selectedBottleneck() { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
335 this.$store.dispatch("fairwayprofile/previousCuts"); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
336 this.cutLabel = |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
337 this.selectedBottleneck + " (" + new Date().toISOString() + ")"; |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
338 }, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
339 selectedSurvey(survey) { |
1394
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
340 this.loadProfile(survey); |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
341 }, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
342 additionalSurvey(survey) { |
1394
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
343 this.loadProfile(survey); |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
344 }, |
1395
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
345 selectedCut(cut) { |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
346 if (cut) { |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
347 this.confirmDeleteSelectedCut = false; |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
348 this.applyCoordinates(cut.coordinates); |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
349 } |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
350 } |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
351 }, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
352 methods: { |
2387
f185503ef35a
client: unified box's header styles by creating a reusable component
Markus Kottlaender <markus@intevation.de>
parents:
2365
diff
changeset
|
353 close() { |
f185503ef35a
client: unified box's header styles by creating a reusable component
Markus Kottlaender <markus@intevation.de>
parents:
2365
diff
changeset
|
354 this.$store.commit("application/showProfiles", false); |
f185503ef35a
client: unified box's header styles by creating a reusable component
Markus Kottlaender <markus@intevation.de>
parents:
2365
diff
changeset
|
355 }, |
1521
276df8dadc14
bought localized datestrings
Thomas Junk <thomas.junk@intevation.de>
parents:
1518
diff
changeset
|
356 formatSurveyDate(date) { |
276df8dadc14
bought localized datestrings
Thomas Junk <thomas.junk@intevation.de>
parents:
1518
diff
changeset
|
357 return formatSurveyDate(date); |
276df8dadc14
bought localized datestrings
Thomas Junk <thomas.junk@intevation.de>
parents:
1518
diff
changeset
|
358 }, |
1394
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
359 loadProfile(survey) { |
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
360 if (survey) { |
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
361 this.$store.commit("fairwayprofile/profileLoading", true); |
1399
8e2c9e518440
improved search style
Markus Kottlaender <markus@intevation.de>
parents:
1396
diff
changeset
|
362 this.$store |
8e2c9e518440
improved search style
Markus Kottlaender <markus@intevation.de>
parents:
1396
diff
changeset
|
363 .dispatch("fairwayprofile/loadProfile", survey) |
8e2c9e518440
improved search style
Markus Kottlaender <markus@intevation.de>
parents:
1396
diff
changeset
|
364 .finally(() => |
8e2c9e518440
improved search style
Markus Kottlaender <markus@intevation.de>
parents:
1396
diff
changeset
|
365 this.$store.commit("fairwayprofile/profileLoading", false) |
8e2c9e518440
improved search style
Markus Kottlaender <markus@intevation.de>
parents:
1396
diff
changeset
|
366 ); |
1394
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
367 } |
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
368 }, |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
369 toggleCutTool() { |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
370 this.cutTool.setActive(!this.cutTool.getActive()); |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
371 this.lineTool.setActive(false); |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
372 this.polygonTool.setActive(false); |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
373 this.$store.commit("map/setCurrentMeasurement", null); |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
374 }, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
375 onCopyCoordinates() { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
376 displayInfo({ |
1441
a4554e942954
Client: add a set of marked translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1437
diff
changeset
|
377 title: this.$gettext("Success"), |
a4554e942954
Client: add a set of marked translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1437
diff
changeset
|
378 message: this.$gettext("Coordinates copied to clipboard!") |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
379 }); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
380 }, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
381 applyManualCoordinates() { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
382 const coordinates = this.coordinatesInput |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
383 .split(",") |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
384 .map(coord => parseFloat(coord.trim())); |
1395
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
385 this.selectedCut = null; |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
386 this.coordinatesInput = ""; |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
387 this.applyCoordinates([ |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
388 coordinates[1], |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
389 coordinates[0], |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
390 coordinates[3], |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
391 coordinates[2] |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
392 ]); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
393 }, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
394 applyCoordinates(coordinates) { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
395 // allow only numbers |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
396 coordinates = coordinates.filter(c => Number(c) === c); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
397 if (coordinates.length === 4) { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
398 // draw line on map |
2365
242c170e00ce
client:use the name constants instead of strings
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2260
diff
changeset
|
399 this.getVSourceByName(LAYERS.CUTTOOL).clear(); |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
400 const cut = new Feature({ |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
401 geometry: new LineString([ |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
402 [coordinates[0], coordinates[1]], |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
403 [coordinates[2], coordinates[3]] |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
404 ]).transform("EPSG:4326", "EPSG:3857") |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
405 }); |
2365
242c170e00ce
client:use the name constants instead of strings
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2260
diff
changeset
|
406 this.getVSourceByName(LAYERS.CUTTOOL).addFeature(cut); |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
407 |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
408 // draw diagram |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
409 this.$store.dispatch("fairwayprofile/cut", cut); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
410 } else { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
411 displayError({ |
1441
a4554e942954
Client: add a set of marked translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1437
diff
changeset
|
412 title: this.$gettext("Invalid input"), |
a4554e942954
Client: add a set of marked translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1437
diff
changeset
|
413 message: this.$gettext( |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
414 "Please enter correct coordinates in the format: Lat,Lon,Lat,Lon" |
1441
a4554e942954
Client: add a set of marked translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1437
diff
changeset
|
415 ) |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
416 }); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
417 } |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
418 }, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
419 saveCut() { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
420 const previousCuts = |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
421 JSON.parse(localStorage.getItem("previousCuts")) || []; |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
422 const newEntry = { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
423 label: this.cutLabel, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
424 bottleneckName: this.selectedBottleneck, |
1377
fa7d647f8d77
added timestamp to saved cross profiles
Markus Kottlaender <markus@intevation.de>
parents:
1372
diff
changeset
|
425 coordinates: [...this.startPoint, ...this.endPoint], |
fa7d647f8d77
added timestamp to saved cross profiles
Markus Kottlaender <markus@intevation.de>
parents:
1372
diff
changeset
|
426 timestamp: new Date().getTime() |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
427 }; |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
428 const existingEntry = previousCuts.find(cut => { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
429 return JSON.stringify(cut) === JSON.stringify(newEntry); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
430 }); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
431 if (!existingEntry) previousCuts.push(newEntry); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
432 if (previousCuts.length > 100) previousCuts.shift(); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
433 localStorage.setItem("previousCuts", JSON.stringify(previousCuts)); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
434 this.$store.dispatch("fairwayprofile/previousCuts"); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
435 |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
436 this.showLabelInput = false; |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
437 displayInfo({ |
1441
a4554e942954
Client: add a set of marked translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1437
diff
changeset
|
438 title: this.$gettext("Profile saved!"), |
a4554e942954
Client: add a set of marked translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1437
diff
changeset
|
439 message: this.$gettext( |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
440 'You can now select these coordinates from the "Saved cross profiles" menu to restore this cross profile.' |
1441
a4554e942954
Client: add a set of marked translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1437
diff
changeset
|
441 ) |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
442 }); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
443 }, |
1395
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
444 deleteSelectedCut() { |
1399
8e2c9e518440
improved search style
Markus Kottlaender <markus@intevation.de>
parents:
1396
diff
changeset
|
445 let previousCuts = JSON.parse(localStorage.getItem("previousCuts")) || []; |
1395
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
446 previousCuts = previousCuts.filter(cut => { |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
447 return JSON.stringify(cut) !== JSON.stringify(this.selectedCut); |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
448 }); |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
449 localStorage.setItem("previousCuts", JSON.stringify(previousCuts)); |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
450 this.$store.commit("fairwayprofile/selectedCut", null); |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
451 this.$store.dispatch("fairwayprofile/previousCuts"); |
1441
a4554e942954
Client: add a set of marked translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1437
diff
changeset
|
452 displayInfo({ title: this.$gettext("Profile deleted!") }); |
1395
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
453 }, |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
454 moveToBottleneck() { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
455 const bottleneck = this.bottlenecks.find( |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
456 bn => bn.properties.name === this.selectedBottleneck |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
457 ); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
458 if (!bottleneck) return; |
2136
3138d60dd1a6
moveToExtent substitutes moveMap where easy doable
Thomas Junk <thomas.junk@intevation.de>
parents:
1613
diff
changeset
|
459 this.$store.commit("map/moveToExtent", { |
3138d60dd1a6
moveToExtent substitutes moveMap where easy doable
Thomas Junk <thomas.junk@intevation.de>
parents:
1613
diff
changeset
|
460 feature: bottleneck, |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
461 zoom: 17, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
462 preventZoomOut: true |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
463 }); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
464 } |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
465 } |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
466 }; |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
467 </script> |