Mercurial > gemma
annotate client/src/components/fairway/Profiles.vue @ 2455:54c9fe587fe6
Subdivide SQL function to prepare for improved error handling
The context of an error (e.g. the function in which it occured)
can be inferred by the database client. Not doing all in one
statement will render the context more meaningful.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 01 Mar 2019 18:38:02 +0100 |
parents | 64ff5984351e |
children | bb5286acfee2 |
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 |
2436
64ff5984351e
client: renamed store property
Markus Kottlaender <markus@intevation.de>
parents:
2435
diff
changeset
|
28 v-for="bn in bottlenecksList" |
1379 | 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"]), |
2436
64ff5984351e
client: renamed store property
Markus Kottlaender <markus@intevation.de>
parents:
2435
diff
changeset
|
262 ...mapState("bottlenecks", [ |
64ff5984351e
client: renamed store property
Markus Kottlaender <markus@intevation.de>
parents:
2435
diff
changeset
|
263 "bottlenecksList", |
64ff5984351e
client: renamed store property
Markus Kottlaender <markus@intevation.de>
parents:
2435
diff
changeset
|
264 "surveys", |
64ff5984351e
client: renamed store property
Markus Kottlaender <markus@intevation.de>
parents:
2435
diff
changeset
|
265 "surveysLoading" |
64ff5984351e
client: renamed store property
Markus Kottlaender <markus@intevation.de>
parents:
2435
diff
changeset
|
266 ]), |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
267 ...mapState("fairwayprofile", [ |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
268 "previousCuts", |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
269 "startPoint", |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
270 "endPoint", |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
271 "profileLoading" |
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 selectedBottleneck: { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
274 get() { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
275 return this.$store.state.bottlenecks.selectedBottleneck; |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
276 }, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
277 set(name) { |
1553
35f85da41fdb
fix: select first sounfing result after selecting bottleneck
Thomas Junk <thomas.junk@intevation.de>
parents:
1521
diff
changeset
|
278 this.$store |
35f85da41fdb
fix: select first sounfing result after selecting bottleneck
Thomas Junk <thomas.junk@intevation.de>
parents:
1521
diff
changeset
|
279 .dispatch("bottlenecks/setSelectedBottleneck", name) |
35f85da41fdb
fix: select first sounfing result after selecting bottleneck
Thomas Junk <thomas.junk@intevation.de>
parents:
1521
diff
changeset
|
280 .then(() => { |
35f85da41fdb
fix: select first sounfing result after selecting bottleneck
Thomas Junk <thomas.junk@intevation.de>
parents:
1521
diff
changeset
|
281 this.$store.commit("bottlenecks/setFirstSurveySelected"); |
35f85da41fdb
fix: select first sounfing result after selecting bottleneck
Thomas Junk <thomas.junk@intevation.de>
parents:
1521
diff
changeset
|
282 }); |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
283 } |
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 selectedSurvey: { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
286 get() { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
287 return this.$store.state.bottlenecks.selectedSurvey; |
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 set(survey) { |
1394
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
290 this.$store.commit("fairwayprofile/additionalSurvey", null); |
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
291 this.$store.commit("bottlenecks/selectedSurvey", survey); |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
292 } |
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 additionalSurvey: { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
295 get() { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
296 return this.$store.state.fairwayprofile.additionalSurvey; |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
297 }, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
298 set(survey) { |
1391
801ae5f4bc5b
fixed bug when changing additional survey in profile dialog
Markus Kottlaender <markus@intevation.de>
parents:
1382
diff
changeset
|
299 this.$store.commit("fairwayprofile/additionalSurvey", survey); |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
300 } |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
301 }, |
1395
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
302 selectedCut: { |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
303 get() { |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
304 return this.$store.state.fairwayprofile.selectedCut; |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
305 }, |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
306 set(cut) { |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
307 this.$store.commit("fairwayprofile/selectedCut", cut); |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
308 if (!cut) { |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
309 this.$store.commit("fairwayprofile/clearCurrentProfile"); |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
310 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
|
311 this.getVSourceByName(LAYERS.CUTTOOL).clear(); |
1395
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
312 } |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
313 } |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
314 }, |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
315 additionalSurveys() { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
316 return this.surveys.filter(survey => survey !== this.selectedSurvey); |
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 coordinatesForClipboard() { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
319 return ( |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
320 this.startPoint[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.startPoint[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 this.endPoint[1] + |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
325 "," + |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
326 this.endPoint[0] |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
327 ); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
328 }, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
329 coordinatesInputIsValid() { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
330 const coordinates = this.coordinatesInput |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
331 .split(",") |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
332 .map(coord => parseFloat(coord.trim())) |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
333 .filter(c => Number(c) === c); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
334 return coordinates.length === 4; |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
335 } |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
336 }, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
337 watch: { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
338 selectedBottleneck() { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
339 this.$store.dispatch("fairwayprofile/previousCuts"); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
340 this.cutLabel = |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
341 this.selectedBottleneck + " (" + new Date().toISOString() + ")"; |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
342 }, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
343 selectedSurvey(survey) { |
1394
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
344 this.loadProfile(survey); |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
345 }, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
346 additionalSurvey(survey) { |
1394
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
347 this.loadProfile(survey); |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
348 }, |
1395
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
349 selectedCut(cut) { |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
350 if (cut) { |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
351 this.confirmDeleteSelectedCut = false; |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
352 this.applyCoordinates(cut.coordinates); |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
353 } |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
354 } |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
355 }, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
356 methods: { |
2387
f185503ef35a
client: unified box's header styles by creating a reusable component
Markus Kottlaender <markus@intevation.de>
parents:
2365
diff
changeset
|
357 close() { |
f185503ef35a
client: unified box's header styles by creating a reusable component
Markus Kottlaender <markus@intevation.de>
parents:
2365
diff
changeset
|
358 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
|
359 }, |
1521
276df8dadc14
bought localized datestrings
Thomas Junk <thomas.junk@intevation.de>
parents:
1518
diff
changeset
|
360 formatSurveyDate(date) { |
276df8dadc14
bought localized datestrings
Thomas Junk <thomas.junk@intevation.de>
parents:
1518
diff
changeset
|
361 return formatSurveyDate(date); |
276df8dadc14
bought localized datestrings
Thomas Junk <thomas.junk@intevation.de>
parents:
1518
diff
changeset
|
362 }, |
1394
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
363 loadProfile(survey) { |
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
364 if (survey) { |
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
365 this.$store.commit("fairwayprofile/profileLoading", true); |
1399
8e2c9e518440
improved search style
Markus Kottlaender <markus@intevation.de>
parents:
1396
diff
changeset
|
366 this.$store |
8e2c9e518440
improved search style
Markus Kottlaender <markus@intevation.de>
parents:
1396
diff
changeset
|
367 .dispatch("fairwayprofile/loadProfile", survey) |
8e2c9e518440
improved search style
Markus Kottlaender <markus@intevation.de>
parents:
1396
diff
changeset
|
368 .finally(() => |
8e2c9e518440
improved search style
Markus Kottlaender <markus@intevation.de>
parents:
1396
diff
changeset
|
369 this.$store.commit("fairwayprofile/profileLoading", false) |
8e2c9e518440
improved search style
Markus Kottlaender <markus@intevation.de>
parents:
1396
diff
changeset
|
370 ); |
1394
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
371 } |
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
372 }, |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
373 toggleCutTool() { |
1437
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
374 this.cutTool.setActive(!this.cutTool.getActive()); |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
375 this.lineTool.setActive(false); |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
376 this.polygonTool.setActive(false); |
1cd1549aab47
fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1435
diff
changeset
|
377 this.$store.commit("map/setCurrentMeasurement", null); |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
378 }, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
379 onCopyCoordinates() { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
380 displayInfo({ |
1441
a4554e942954
Client: add a set of marked translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1437
diff
changeset
|
381 title: this.$gettext("Success"), |
a4554e942954
Client: add a set of marked translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1437
diff
changeset
|
382 message: this.$gettext("Coordinates copied to clipboard!") |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
383 }); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
384 }, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
385 applyManualCoordinates() { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
386 const coordinates = this.coordinatesInput |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
387 .split(",") |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
388 .map(coord => parseFloat(coord.trim())); |
1395
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
389 this.selectedCut = null; |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
390 this.coordinatesInput = ""; |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
391 this.applyCoordinates([ |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
392 coordinates[1], |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
393 coordinates[0], |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
394 coordinates[3], |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
395 coordinates[2] |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
396 ]); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
397 }, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
398 applyCoordinates(coordinates) { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
399 // allow only numbers |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
400 coordinates = coordinates.filter(c => Number(c) === c); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
401 if (coordinates.length === 4) { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
402 // draw line on map |
2365
242c170e00ce
client:use the name constants instead of strings
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2260
diff
changeset
|
403 this.getVSourceByName(LAYERS.CUTTOOL).clear(); |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
404 const cut = new Feature({ |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
405 geometry: new LineString([ |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
406 [coordinates[0], coordinates[1]], |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
407 [coordinates[2], coordinates[3]] |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
408 ]).transform("EPSG:4326", "EPSG:3857") |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
409 }); |
2365
242c170e00ce
client:use the name constants instead of strings
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2260
diff
changeset
|
410 this.getVSourceByName(LAYERS.CUTTOOL).addFeature(cut); |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
411 |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
412 // draw diagram |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
413 this.$store.dispatch("fairwayprofile/cut", cut); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
414 } else { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
415 displayError({ |
1441
a4554e942954
Client: add a set of marked translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1437
diff
changeset
|
416 title: this.$gettext("Invalid input"), |
a4554e942954
Client: add a set of marked translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1437
diff
changeset
|
417 message: this.$gettext( |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
418 "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
|
419 ) |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
420 }); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
421 } |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
422 }, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
423 saveCut() { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
424 const previousCuts = |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
425 JSON.parse(localStorage.getItem("previousCuts")) || []; |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
426 const newEntry = { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
427 label: this.cutLabel, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
428 bottleneckName: this.selectedBottleneck, |
1377
fa7d647f8d77
added timestamp to saved cross profiles
Markus Kottlaender <markus@intevation.de>
parents:
1372
diff
changeset
|
429 coordinates: [...this.startPoint, ...this.endPoint], |
fa7d647f8d77
added timestamp to saved cross profiles
Markus Kottlaender <markus@intevation.de>
parents:
1372
diff
changeset
|
430 timestamp: new Date().getTime() |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
431 }; |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
432 const existingEntry = previousCuts.find(cut => { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
433 return JSON.stringify(cut) === JSON.stringify(newEntry); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
434 }); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
435 if (!existingEntry) previousCuts.push(newEntry); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
436 if (previousCuts.length > 100) previousCuts.shift(); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
437 localStorage.setItem("previousCuts", JSON.stringify(previousCuts)); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
438 this.$store.dispatch("fairwayprofile/previousCuts"); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
439 |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
440 this.showLabelInput = false; |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
441 displayInfo({ |
1441
a4554e942954
Client: add a set of marked translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1437
diff
changeset
|
442 title: this.$gettext("Profile saved!"), |
a4554e942954
Client: add a set of marked translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1437
diff
changeset
|
443 message: this.$gettext( |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
444 '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
|
445 ) |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
446 }); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
447 }, |
1395
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
448 deleteSelectedCut() { |
1399
8e2c9e518440
improved search style
Markus Kottlaender <markus@intevation.de>
parents:
1396
diff
changeset
|
449 let previousCuts = JSON.parse(localStorage.getItem("previousCuts")) || []; |
1395
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
450 previousCuts = previousCuts.filter(cut => { |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
451 return JSON.stringify(cut) !== JSON.stringify(this.selectedCut); |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
452 }); |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
453 localStorage.setItem("previousCuts", JSON.stringify(previousCuts)); |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
454 this.$store.commit("fairwayprofile/selectedCut", null); |
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
455 this.$store.dispatch("fairwayprofile/previousCuts"); |
1441
a4554e942954
Client: add a set of marked translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1437
diff
changeset
|
456 displayInfo({ title: this.$gettext("Profile deleted!") }); |
1395
210e9f16f8a0
delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents:
1394
diff
changeset
|
457 }, |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
458 moveToBottleneck() { |
2436
64ff5984351e
client: renamed store property
Markus Kottlaender <markus@intevation.de>
parents:
2435
diff
changeset
|
459 const bottleneck = this.bottlenecksList.find( |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
460 bn => bn.properties.name === this.selectedBottleneck |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
461 ); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
462 if (!bottleneck) return; |
2136
3138d60dd1a6
moveToExtent substitutes moveMap where easy doable
Thomas Junk <thomas.junk@intevation.de>
parents:
1613
diff
changeset
|
463 this.$store.commit("map/moveToExtent", { |
3138d60dd1a6
moveToExtent substitutes moveMap where easy doable
Thomas Junk <thomas.junk@intevation.de>
parents:
1613
diff
changeset
|
464 feature: bottleneck, |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
465 zoom: 17, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
466 preventZoomOut: true |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
467 }); |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
468 } |
2434
817b3d726b43
client: loadBottlenecks (bottleneck_overview) only where needed
Markus Kottlaender <markus@intevation.de>
parents:
2387
diff
changeset
|
469 }, |
817b3d726b43
client: loadBottlenecks (bottleneck_overview) only where needed
Markus Kottlaender <markus@intevation.de>
parents:
2387
diff
changeset
|
470 mounted() { |
2435
3679d604645e
client: renamed store action
Markus Kottlaender <markus@intevation.de>
parents:
2434
diff
changeset
|
471 this.$store.dispatch("bottlenecks/loadBottlenecksList"); |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
472 } |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
473 }; |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
474 </script> |