annotate client/src/components/fairway/Profiles.vue @ 2844:77cef49d93ca

client: profiles: bottleneck list sorted by country
author Markus Kottlaender <markus@intevation.de>
date Thu, 28 Mar 2019 11:53:19 +0100
parents 503a73e9a755
children b6886706b325
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1372
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
1 <template>
1480
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
2 <div
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
3 :class="[
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
4 'box ui-element rounded bg-white text-nowrap',
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
5 { expanded: showProfiles }
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
6 ]"
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
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">
2754
d0f6c222f4f9 client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2740
diff changeset
9 <UIBoxHeader
d0f6c222f4f9 client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2740
diff changeset
10 icon="chart-area"
d0f6c222f4f9 client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2740
diff changeset
11 :title="profilesLable"
d0f6c222f4f9 client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2740
diff changeset
12 :closeCallback="close"
d0f6c222f4f9 client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2740
diff changeset
13 />
2534
bb5286acfee2 client: reduced spacings between and inside boxes and more compact main menu
Markus Kottlaender <markus@intevation.de>
parents: 2436
diff changeset
14 <div class="box-body">
2840
503a73e9a755 client: ui: implemented global SpinnerOverlay component
Markus Kottlaender <markus@intevation.de>
parents: 2812
diff changeset
15 <SpinnerOverlay v-if="surveysLoading || profileLoading" />
1416
3af7ad9717e2 Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1399
diff changeset
16 <select
2540
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
17 @change="moveToBottleneck"
1416
3af7ad9717e2 Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1399
diff changeset
18 v-model="selectedBottleneck"
3af7ad9717e2 Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1399
diff changeset
19 class="form-control font-weight-bold"
3af7ad9717e2 Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1399
diff changeset
20 >
3af7ad9717e2 Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1399
diff changeset
21 <option :value="null">
3af7ad9717e2 Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1399
diff changeset
22 <translate>Select Bottleneck</translate>
3af7ad9717e2 Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1399
diff changeset
23 </option>
2812
30a753f51a3c client: profiles: ordered bottleneck list by country code
Markus Kottlaender <markus@intevation.de>
parents: 2754
diff changeset
24 <optgroup
30a753f51a3c client: profiles: ordered bottleneck list by country code
Markus Kottlaender <markus@intevation.de>
parents: 2754
diff changeset
25 v-for="(bottlenecksForCountry, cc) in orderedBottlenecks"
30a753f51a3c client: profiles: ordered bottleneck list by country code
Markus Kottlaender <markus@intevation.de>
parents: 2754
diff changeset
26 :key="cc"
30a753f51a3c client: profiles: ordered bottleneck list by country code
Markus Kottlaender <markus@intevation.de>
parents: 2754
diff changeset
27 :label="cc"
1480
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
28 >
2812
30a753f51a3c client: profiles: ordered bottleneck list by country code
Markus Kottlaender <markus@intevation.de>
parents: 2754
diff changeset
29 <option
30a753f51a3c client: profiles: ordered bottleneck list by country code
Markus Kottlaender <markus@intevation.de>
parents: 2754
diff changeset
30 v-for="bn in bottlenecksForCountry"
30a753f51a3c client: profiles: ordered bottleneck list by country code
Markus Kottlaender <markus@intevation.de>
parents: 2754
diff changeset
31 :key="bn.properties.name"
30a753f51a3c client: profiles: ordered bottleneck list by country code
Markus Kottlaender <markus@intevation.de>
parents: 2754
diff changeset
32 :value="bn.properties.name"
30a753f51a3c client: profiles: ordered bottleneck list by country code
Markus Kottlaender <markus@intevation.de>
parents: 2754
diff changeset
33 >
30a753f51a3c client: profiles: ordered bottleneck list by country code
Markus Kottlaender <markus@intevation.de>
parents: 2754
diff changeset
34 {{ bn.properties.name }}
30a753f51a3c client: profiles: ordered bottleneck list by country code
Markus Kottlaender <markus@intevation.de>
parents: 2754
diff changeset
35 </option>
30a753f51a3c client: profiles: ordered bottleneck list by country code
Markus Kottlaender <markus@intevation.de>
parents: 2754
diff changeset
36 </optgroup>
1372
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
37 </select>
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
38 <div v-if="selectedBottleneck">
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
39 <div class="d-flex mt-2">
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
40 <div class="flex-fill">
1416
3af7ad9717e2 Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1399
diff changeset
41 <small class="text-muted">
2540
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
42 <translate>Waterlevel</translate>:
1416
3af7ad9717e2 Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1399
diff changeset
43 </small>
1480
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
44 <select
2540
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
45 v-model="selectedWaterLevel"
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
46 class="form-control form-control-sm small"
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
47 >
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
48 <option value="" v-if="Object.keys(waterLevels).length === 0">
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
49 <translate>Current</translate>
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
50 </option>
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
51 <option
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
52 v-for="wl in Object.keys(waterLevels)"
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
53 :key="wl"
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
54 :value="wl"
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
55 >
2541
468c8dc796cf client: convert lib helper functions to Vue filters
Markus Kottlaender <markus@intevation.de>
parents: 2540
diff changeset
56 {{ wl | surveyDate }}
2540
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
57 </option>
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
58 </select>
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
59 </div>
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
60 <div class="flex-fill ml-2">
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
61 <small class="text-muted"> <translate>Survey</translate>: </small>
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
62 <select
1480
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
63 v-model="selectedSurvey"
2540
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
64 class="form-control form-control-sm small"
1480
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
65 >
1372
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
66 <option
1379
da44c669c9f5 formatted file
Markus Kottlaender <markus@intevation.de>
parents: 1377
diff changeset
67 v-for="survey in surveys"
da44c669c9f5 formatted file
Markus Kottlaender <markus@intevation.de>
parents: 1377
diff changeset
68 :key="survey.date_info"
da44c669c9f5 formatted file
Markus Kottlaender <markus@intevation.de>
parents: 1377
diff changeset
69 :value="survey"
2541
468c8dc796cf client: convert lib helper functions to Vue filters
Markus Kottlaender <markus@intevation.de>
parents: 2540
diff changeset
70 >{{ survey.date_info | surveyDate }}</option
1480
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
71 >
1372
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
72 </select>
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
73 </div>
1480
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
74 <div
2540
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
75 class="flex-fill ml-2"
1480
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
76 v-if="selectedSurvey && surveys.length > 1"
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
77 >
1416
3af7ad9717e2 Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1399
diff changeset
78 <small class="text-muted mt-1">
3af7ad9717e2 Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1399
diff changeset
79 <translate>Compare with</translate>:
3af7ad9717e2 Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1399
diff changeset
80 </small>
1480
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
81 <select
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
82 v-model="additionalSurvey"
2540
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
83 class="form-control form-control-sm small"
1480
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
84 >
1372
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
85 <option :value="null">None</option>
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
86 <option
1379
da44c669c9f5 formatted file
Markus Kottlaender <markus@intevation.de>
parents: 1377
diff changeset
87 v-for="survey in additionalSurveys"
da44c669c9f5 formatted file
Markus Kottlaender <markus@intevation.de>
parents: 1377
diff changeset
88 :key="survey.date_info"
da44c669c9f5 formatted file
Markus Kottlaender <markus@intevation.de>
parents: 1377
diff changeset
89 :value="survey"
2541
468c8dc796cf client: convert lib helper functions to Vue filters
Markus Kottlaender <markus@intevation.de>
parents: 2540
diff changeset
90 >{{ survey.date_info | surveyDate }}</option
1480
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
91 >
1372
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
92 </select>
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
93 </div>
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
94 </div>
1480
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
95 <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
96 <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
97 <translate>Saved cross profiles</translate>:
3af7ad9717e2 Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1399
diff changeset
98 </small>
1395
210e9f16f8a0 delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents: 1394
diff changeset
99 <div class="d-flex">
1416
3af7ad9717e2 Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1399
diff changeset
100 <select
1480
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
101 :class="[
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
102 'form-control form-control-sm flex-fill',
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
103 { 'rounded-left-only': selectedCut }
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
104 ]"
1416
3af7ad9717e2 Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1399
diff changeset
105 v-model="selectedCut"
3af7ad9717e2 Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1399
diff changeset
106 >
1395
210e9f16f8a0 delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents: 1394
diff changeset
107 <option></option>
1480
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
108 <option
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
109 v-for="(cut, index) in previousCuts"
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
110 :value="cut"
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
111 :key="index"
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
112 >{{ cut.label }}</option
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
113 >
1395
210e9f16f8a0 delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents: 1394
diff changeset
114 </select>
210e9f16f8a0 delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents: 1394
diff changeset
115 <button
2540
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
116 class="btn btn-sm btn-dark input-button-right"
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
117 @click="deleteSelectedCut(selectedCut)"
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
118 v-if="selectedCut"
1416
3af7ad9717e2 Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1399
diff changeset
119 >
1480
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
120 <font-awesome-icon icon="trash" />
1416
3af7ad9717e2 Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1399
diff changeset
121 </button>
1395
210e9f16f8a0 delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents: 1394
diff changeset
122 </div>
1416
3af7ad9717e2 Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1399
diff changeset
123 <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
124 <translate>Enter coordinates manually</translate>:
3af7ad9717e2 Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1399
diff changeset
125 </small>
1395
210e9f16f8a0 delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents: 1394
diff changeset
126 <div class="position-relative">
1416
3af7ad9717e2 Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1399
diff changeset
127 <input
3af7ad9717e2 Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1399
diff changeset
128 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
129 placeholder="Lat,Lon,Lat,Lon"
3af7ad9717e2 Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1399
diff changeset
130 v-model="coordinatesInput"
1480
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
131 />
1395
210e9f16f8a0 delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents: 1394
diff changeset
132 <button
1416
3af7ad9717e2 Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1399
diff changeset
133 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
134 @click="applyManualCoordinates"
210e9f16f8a0 delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents: 1394
diff changeset
135 style="top: 0; right: 0;"
210e9f16f8a0 delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents: 1394
diff changeset
136 v-if="coordinatesInputIsValid"
1416
3af7ad9717e2 Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1399
diff changeset
137 >
1480
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
138 <font-awesome-icon icon="check" />
1416
3af7ad9717e2 Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1399
diff changeset
139 </button>
1395
210e9f16f8a0 delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents: 1394
diff changeset
140 </div>
210e9f16f8a0 delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents: 1394
diff changeset
141 <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
142 <div class="text-nowrap mr-3">
1480
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
143 <b> <translate>Start</translate>: </b> <br />
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
144 Lat: {{ startPoint[1] }} <br />
1372
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
145 Lon: {{ startPoint[0] }}
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
146 </div>
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
147 <div class="text-nowrap">
1480
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
148 <b>End:</b> <br />
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
149 Lat: {{ endPoint[1] }} <br />
1372
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
150 Lon: {{ endPoint[0] }}
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
151 </div>
1416
3af7ad9717e2 Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1399
diff changeset
152 <button
3af7ad9717e2 Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1399
diff changeset
153 v-clipboard:copy="coordinatesForClipboard"
1379
da44c669c9f5 formatted file
Markus Kottlaender <markus@intevation.de>
parents: 1377
diff changeset
154 v-clipboard:success="onCopyCoordinates"
da44c669c9f5 formatted file
Markus Kottlaender <markus@intevation.de>
parents: 1377
diff changeset
155 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
156 >
1480
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
157 <font-awesome-icon icon="copy" />
1416
3af7ad9717e2 Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1399
diff changeset
158 </button>
1379
da44c669c9f5 formatted file
Markus Kottlaender <markus@intevation.de>
parents: 1377
diff changeset
159 </small>
1395
210e9f16f8a0 delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents: 1394
diff changeset
160 <div class="d-flex mt-3">
1480
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
161 <div
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
162 class="pr-3 w-50"
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
163 v-if="startPoint && endPoint && !selectedCut"
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
164 >
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
165 <button
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
166 class="btn btn-info btn-sm w-100"
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
167 @click="showLabelInput = !showLabelInput"
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
168 >
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
169 <font-awesome-icon :icon="showLabelInput ? 'times' : 'check'" />
1379
da44c669c9f5 formatted file
Markus Kottlaender <markus@intevation.de>
parents: 1377
diff changeset
170 {{ showLabelInput ? "Cancel" : "Save" }}
da44c669c9f5 formatted file
Markus Kottlaender <markus@intevation.de>
parents: 1377
diff changeset
171 </button>
da44c669c9f5 formatted file
Markus Kottlaender <markus@intevation.de>
parents: 1377
diff changeset
172 </div>
1480
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
173 <div
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
174 :class="startPoint && endPoint && !selectedCut ? 'w-50' : 'w-100'"
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
175 >
1416
3af7ad9717e2 Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1399
diff changeset
176 <button class="btn btn-info btn-sm w-100" @click="toggleCutTool">
1480
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
177 <font-awesome-icon
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
178 :icon="cutTool && cutTool.getActive() ? 'times' : 'plus'"
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
179 ></font-awesome-icon>
1379
da44c669c9f5 formatted file
Markus Kottlaender <markus@intevation.de>
parents: 1377
diff changeset
180 {{ cutTool && cutTool.getActive() ? "Cancel" : "New" }}
da44c669c9f5 formatted file
Markus Kottlaender <markus@intevation.de>
parents: 1377
diff changeset
181 </button>
da44c669c9f5 formatted file
Markus Kottlaender <markus@intevation.de>
parents: 1377
diff changeset
182 </div>
da44c669c9f5 formatted file
Markus Kottlaender <markus@intevation.de>
parents: 1377
diff changeset
183 </div>
da44c669c9f5 formatted file
Markus Kottlaender <markus@intevation.de>
parents: 1377
diff changeset
184 <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
185 <small class="text-muted">
3af7ad9717e2 Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1399
diff changeset
186 <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
187 </small>
1379
da44c669c9f5 formatted file
Markus Kottlaender <markus@intevation.de>
parents: 1377
diff changeset
188 <div class="position-relative">
1480
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
189 <input
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
190 class="form-control form-control-sm pr-5"
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
191 v-model="cutLabel"
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
192 />
1379
da44c669c9f5 formatted file
Markus Kottlaender <markus@intevation.de>
parents: 1377
diff changeset
193 <button
da44c669c9f5 formatted file
Markus Kottlaender <markus@intevation.de>
parents: 1377
diff changeset
194 class="btn btn-sm btn-info position-absolute input-button-right"
da44c669c9f5 formatted file
Markus Kottlaender <markus@intevation.de>
parents: 1377
diff changeset
195 @click="saveCut"
da44c669c9f5 formatted file
Markus Kottlaender <markus@intevation.de>
parents: 1377
diff changeset
196 v-if="cutLabel"
da44c669c9f5 formatted file
Markus Kottlaender <markus@intevation.de>
parents: 1377
diff changeset
197 style="top: 0; right: 0;"
1416
3af7ad9717e2 Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1399
diff changeset
198 >
1480
9b81ac91a43e fix: linting
Thomas Junk <thomas.junk@intevation.de>
parents: 1449
diff changeset
199 <font-awesome-icon icon="check" />
1416
3af7ad9717e2 Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1399
diff changeset
200 </button>
1379
da44c669c9f5 formatted file
Markus Kottlaender <markus@intevation.de>
parents: 1377
diff changeset
201 </div>
da44c669c9f5 formatted file
Markus Kottlaender <markus@intevation.de>
parents: 1377
diff changeset
202 </div>
1372
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
203 </div>
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
204 </div>
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
205 </div>
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
206 </div>
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
207 </template>
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
208
1449
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
209 <style lang="scss" scoped>
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
210 .input-button-right {
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
211 border-top-right-radius: $border-radius;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
212 border-bottom-right-radius: $border-radius;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
213 border-top-left-radius: 0 !important;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
214 border-bottom-left-radius: 0 !important;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
215 }
1395
210e9f16f8a0 delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents: 1394
diff changeset
216
1449
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
217 .rounded-left-only {
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
218 border-top-right-radius: 0 !important;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
219 border-bottom-right-radius: 0 !important;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
220 border-top-left-radius: $border-radius;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
221 border-bottom-left-radius: $border-radius;
bb47531bdd22 sass to scss
Thomas Junk <thomas.junk@intevation.de>
parents: 1441
diff changeset
222 }
1372
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
223 </style>
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
224
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
225 <script>
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
226 /* 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
227 * without warranty, see README.md and license for details.
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
228 *
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
229 * SPDX-License-Identifier: AGPL-3.0-or-later
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
230 * License-Filename: LICENSES/AGPL-3.0.txt
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
231 *
1416
3af7ad9717e2 Client: add a set fo marked translation
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1399
diff changeset
232 * Copyright (C) 2018 by via donau
1372
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
233 * – Österreichische Wasserstraßen-Gesellschaft mbH
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
234 * Software engineering by Intevation GmbH
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
235 *
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
236 * Author(s):
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
237 * Markus Kottländer <markus.kottlaender@intevation.de>
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
238 */
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
239 import { mapState, mapGetters } from "vuex";
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
240 import Feature from "ol/Feature";
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
241 import LineString from "ol/geom/LineString";
1613
f2d24dceecc7 refac: cleanup import paths
Thomas Junk <thomas.junk@intevation.de>
parents: 1558
diff changeset
242 import { displayError, displayInfo } from "@/lib/errors.js";
2365
242c170e00ce client:use the name constants instead of strings
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2260
diff changeset
243 import { LAYERS } from "@/store/map.js";
1372
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
244
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
245 export default {
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
246 name: "profiles",
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
247 data() {
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
248 return {
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
249 coordinatesInput: "",
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
250 cutLabel: "",
2540
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
251 showLabelInput: false
1372
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
252 };
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
253 },
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
254 computed: {
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
255 ...mapGetters("map", ["getVSourceByName"]),
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
256 ...mapState("application", ["showProfiles"]),
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
257 ...mapState("map", ["lineTool", "polygonTool", "cutTool"]),
2436
64ff5984351e client: renamed store property
Markus Kottlaender <markus@intevation.de>
parents: 2435
diff changeset
258 ...mapState("bottlenecks", [
64ff5984351e client: renamed store property
Markus Kottlaender <markus@intevation.de>
parents: 2435
diff changeset
259 "bottlenecksList",
64ff5984351e client: renamed store property
Markus Kottlaender <markus@intevation.de>
parents: 2435
diff changeset
260 "surveys",
64ff5984351e client: renamed store property
Markus Kottlaender <markus@intevation.de>
parents: 2435
diff changeset
261 "surveysLoading"
64ff5984351e client: renamed store property
Markus Kottlaender <markus@intevation.de>
parents: 2435
diff changeset
262 ]),
1372
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",
2540
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
267 "profileLoading",
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
268 "waterLevels"
1372
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
269 ]),
2812
30a753f51a3c client: profiles: ordered bottleneck list by country code
Markus Kottlaender <markus@intevation.de>
parents: 2754
diff changeset
270 orderedBottlenecks() {
2844
77cef49d93ca client: profiles: bottleneck list sorted by country
Markus Kottlaender <markus@intevation.de>
parents: 2840
diff changeset
271 let groupedBottlenecks = {},
77cef49d93ca client: profiles: bottleneck list sorted by country
Markus Kottlaender <markus@intevation.de>
parents: 2840
diff changeset
272 orderedGroups = {};
77cef49d93ca client: profiles: bottleneck list sorted by country
Markus Kottlaender <markus@intevation.de>
parents: 2840
diff changeset
273
77cef49d93ca client: profiles: bottleneck list sorted by country
Markus Kottlaender <markus@intevation.de>
parents: 2840
diff changeset
274 // group bottlenecks by cc
2812
30a753f51a3c client: profiles: ordered bottleneck list by country code
Markus Kottlaender <markus@intevation.de>
parents: 2754
diff changeset
275 this.bottlenecksList.forEach(bn => {
30a753f51a3c client: profiles: ordered bottleneck list by country code
Markus Kottlaender <markus@intevation.de>
parents: 2754
diff changeset
276 let cc = bn.properties.responsible_country;
2844
77cef49d93ca client: profiles: bottleneck list sorted by country
Markus Kottlaender <markus@intevation.de>
parents: 2840
diff changeset
277 if (groupedBottlenecks.hasOwnProperty(cc)) {
77cef49d93ca client: profiles: bottleneck list sorted by country
Markus Kottlaender <markus@intevation.de>
parents: 2840
diff changeset
278 groupedBottlenecks[cc].push(bn);
2812
30a753f51a3c client: profiles: ordered bottleneck list by country code
Markus Kottlaender <markus@intevation.de>
parents: 2754
diff changeset
279 } else {
2844
77cef49d93ca client: profiles: bottleneck list sorted by country
Markus Kottlaender <markus@intevation.de>
parents: 2840
diff changeset
280 groupedBottlenecks[cc] = [bn];
2812
30a753f51a3c client: profiles: ordered bottleneck list by country code
Markus Kottlaender <markus@intevation.de>
parents: 2754
diff changeset
281 }
30a753f51a3c client: profiles: ordered bottleneck list by country code
Markus Kottlaender <markus@intevation.de>
parents: 2754
diff changeset
282 });
2844
77cef49d93ca client: profiles: bottleneck list sorted by country
Markus Kottlaender <markus@intevation.de>
parents: 2840
diff changeset
283
77cef49d93ca client: profiles: bottleneck list sorted by country
Markus Kottlaender <markus@intevation.de>
parents: 2840
diff changeset
284 // order groups by cc
77cef49d93ca client: profiles: bottleneck list sorted by country
Markus Kottlaender <markus@intevation.de>
parents: 2840
diff changeset
285 Object.keys(groupedBottlenecks)
77cef49d93ca client: profiles: bottleneck list sorted by country
Markus Kottlaender <markus@intevation.de>
parents: 2840
diff changeset
286 .sort()
77cef49d93ca client: profiles: bottleneck list sorted by country
Markus Kottlaender <markus@intevation.de>
parents: 2840
diff changeset
287 .forEach(cc => (orderedGroups[cc] = groupedBottlenecks[cc]));
77cef49d93ca client: profiles: bottleneck list sorted by country
Markus Kottlaender <markus@intevation.de>
parents: 2840
diff changeset
288
77cef49d93ca client: profiles: bottleneck list sorted by country
Markus Kottlaender <markus@intevation.de>
parents: 2840
diff changeset
289 return orderedGroups;
2812
30a753f51a3c client: profiles: ordered bottleneck list by country code
Markus Kottlaender <markus@intevation.de>
parents: 2754
diff changeset
290 },
2754
d0f6c222f4f9 client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2740
diff changeset
291 profilesLable() {
d0f6c222f4f9 client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2740
diff changeset
292 return this.$gettext("Profiles");
d0f6c222f4f9 client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2740
diff changeset
293 },
1372
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
294 selectedBottleneck: {
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.bottlenecks.selectedBottleneck;
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(name) {
1553
35f85da41fdb fix: select first sounfing result after selecting bottleneck
Thomas Junk <thomas.junk@intevation.de>
parents: 1521
diff changeset
299 this.$store
35f85da41fdb fix: select first sounfing result after selecting bottleneck
Thomas Junk <thomas.junk@intevation.de>
parents: 1521
diff changeset
300 .dispatch("bottlenecks/setSelectedBottleneck", name)
35f85da41fdb fix: select first sounfing result after selecting bottleneck
Thomas Junk <thomas.junk@intevation.de>
parents: 1521
diff changeset
301 .then(() => {
35f85da41fdb fix: select first sounfing result after selecting bottleneck
Thomas Junk <thomas.junk@intevation.de>
parents: 1521
diff changeset
302 this.$store.commit("bottlenecks/setFirstSurveySelected");
35f85da41fdb fix: select first sounfing result after selecting bottleneck
Thomas Junk <thomas.junk@intevation.de>
parents: 1521
diff changeset
303 });
1372
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
304 }
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
305 },
2540
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
306 selectedWaterLevel: {
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
307 get() {
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
308 return this.$store.state.fairwayprofile.selectedWaterLevel.date || "";
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
309 },
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
310 set(value) {
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
311 this.$store.commit("fairwayprofile/setSelectedWaterLevel", value);
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
312 }
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
313 },
1372
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
314 selectedSurvey: {
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
315 get() {
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
316 return this.$store.state.bottlenecks.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 set(survey) {
1394
b350b0b5cb6c refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1391
diff changeset
319 this.$store.commit("fairwayprofile/additionalSurvey", null);
b350b0b5cb6c refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1391
diff changeset
320 this.$store.commit("bottlenecks/selectedSurvey", survey);
1372
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 },
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
323 additionalSurvey: {
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
324 get() {
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
325 return this.$store.state.fairwayprofile.additionalSurvey;
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
326 },
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
327 set(survey) {
1391
801ae5f4bc5b fixed bug when changing additional survey in profile dialog
Markus Kottlaender <markus@intevation.de>
parents: 1382
diff changeset
328 this.$store.commit("fairwayprofile/additionalSurvey", survey);
1372
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
329 }
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
330 },
1395
210e9f16f8a0 delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents: 1394
diff changeset
331 selectedCut: {
210e9f16f8a0 delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents: 1394
diff changeset
332 get() {
210e9f16f8a0 delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents: 1394
diff changeset
333 return this.$store.state.fairwayprofile.selectedCut;
210e9f16f8a0 delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents: 1394
diff changeset
334 },
210e9f16f8a0 delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents: 1394
diff changeset
335 set(cut) {
210e9f16f8a0 delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents: 1394
diff changeset
336 this.$store.commit("fairwayprofile/selectedCut", cut);
210e9f16f8a0 delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents: 1394
diff changeset
337 if (!cut) {
210e9f16f8a0 delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents: 1394
diff changeset
338 this.$store.commit("fairwayprofile/clearCurrentProfile");
210e9f16f8a0 delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents: 1394
diff changeset
339 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
340 this.getVSourceByName(LAYERS.CUTTOOL).clear();
1395
210e9f16f8a0 delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents: 1394
diff changeset
341 }
210e9f16f8a0 delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents: 1394
diff changeset
342 }
210e9f16f8a0 delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents: 1394
diff changeset
343 },
1372
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
344 additionalSurveys() {
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
345 return this.surveys.filter(survey => survey !== this.selectedSurvey);
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
346 },
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
347 coordinatesForClipboard() {
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
348 return (
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
349 this.startPoint[1] +
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 this.startPoint[0] +
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
352 "," +
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
353 this.endPoint[1] +
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 this.endPoint[0]
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
356 );
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
357 },
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
358 coordinatesInputIsValid() {
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
359 const coordinates = this.coordinatesInput
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
360 .split(",")
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
361 .map(coord => parseFloat(coord.trim()))
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
362 .filter(c => Number(c) === c);
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
363 return coordinates.length === 4;
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
364 }
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
365 },
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
366 watch: {
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
367 selectedBottleneck() {
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
368 this.$store.dispatch("fairwayprofile/previousCuts");
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
369 this.cutLabel =
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
370 this.selectedBottleneck + " (" + new Date().toISOString() + ")";
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
371 },
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
372 selectedSurvey(survey) {
1394
b350b0b5cb6c refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1391
diff changeset
373 this.loadProfile(survey);
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 additionalSurvey(survey) {
1394
b350b0b5cb6c refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1391
diff changeset
376 this.loadProfile(survey);
1372
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
377 },
1395
210e9f16f8a0 delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents: 1394
diff changeset
378 selectedCut(cut) {
210e9f16f8a0 delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents: 1394
diff changeset
379 if (cut) {
210e9f16f8a0 delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents: 1394
diff changeset
380 this.applyCoordinates(cut.coordinates);
1372
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
381 }
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
382 }
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 methods: {
2387
f185503ef35a client: unified box's header styles by creating a reusable component
Markus Kottlaender <markus@intevation.de>
parents: 2365
diff changeset
385 close() {
f185503ef35a client: unified box's header styles by creating a reusable component
Markus Kottlaender <markus@intevation.de>
parents: 2365
diff changeset
386 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
387 },
1394
b350b0b5cb6c refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1391
diff changeset
388 loadProfile(survey) {
b350b0b5cb6c refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1391
diff changeset
389 if (survey) {
b350b0b5cb6c refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1391
diff changeset
390 this.$store.commit("fairwayprofile/profileLoading", true);
2550
dc42faf90e1d client: profiles: trigger splitscreen loading animation when changing compare survey
Markus Kottlaender <markus@intevation.de>
parents: 2541
diff changeset
391 this.$store.commit("application/splitscreenLoading", true);
1399
8e2c9e518440 improved search style
Markus Kottlaender <markus@intevation.de>
parents: 1396
diff changeset
392 this.$store
8e2c9e518440 improved search style
Markus Kottlaender <markus@intevation.de>
parents: 1396
diff changeset
393 .dispatch("fairwayprofile/loadProfile", survey)
2550
dc42faf90e1d client: profiles: trigger splitscreen loading animation when changing compare survey
Markus Kottlaender <markus@intevation.de>
parents: 2541
diff changeset
394 .finally(() => {
dc42faf90e1d client: profiles: trigger splitscreen loading animation when changing compare survey
Markus Kottlaender <markus@intevation.de>
parents: 2541
diff changeset
395 this.$store.commit("fairwayprofile/profileLoading", false);
dc42faf90e1d client: profiles: trigger splitscreen loading animation when changing compare survey
Markus Kottlaender <markus@intevation.de>
parents: 2541
diff changeset
396 this.$store.commit("application/splitscreenLoading", false);
dc42faf90e1d client: profiles: trigger splitscreen loading animation when changing compare survey
Markus Kottlaender <markus@intevation.de>
parents: 2541
diff changeset
397 });
1394
b350b0b5cb6c refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1391
diff changeset
398 }
b350b0b5cb6c refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1391
diff changeset
399 },
1372
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
400 toggleCutTool() {
1437
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
401 this.cutTool.setActive(!this.cutTool.getActive());
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
402 this.lineTool.setActive(false);
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
403 this.polygonTool.setActive(false);
1cd1549aab47 fixed panning problem when drawing cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1435
diff changeset
404 this.$store.commit("map/setCurrentMeasurement", null);
1372
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
405 },
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
406 onCopyCoordinates() {
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
407 displayInfo({
1441
a4554e942954 Client: add a set of marked translations
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1437
diff changeset
408 message: this.$gettext("Coordinates copied to clipboard!")
1372
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
409 });
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
410 },
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
411 applyManualCoordinates() {
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
412 const coordinates = this.coordinatesInput
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
413 .split(",")
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
414 .map(coord => parseFloat(coord.trim()));
1395
210e9f16f8a0 delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents: 1394
diff changeset
415 this.selectedCut = null;
1372
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
416 this.coordinatesInput = "";
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
417 this.applyCoordinates([
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
418 coordinates[1],
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
419 coordinates[0],
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
420 coordinates[3],
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
421 coordinates[2]
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 },
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
424 applyCoordinates(coordinates) {
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
425 // allow only numbers
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
426 coordinates = coordinates.filter(c => Number(c) === c);
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
427 if (coordinates.length === 4) {
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
428 // draw line on map
2365
242c170e00ce client:use the name constants instead of strings
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2260
diff changeset
429 this.getVSourceByName(LAYERS.CUTTOOL).clear();
1372
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
430 const cut = new Feature({
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
431 geometry: new LineString([
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
432 [coordinates[0], coordinates[1]],
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
433 [coordinates[2], coordinates[3]]
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
434 ]).transform("EPSG:4326", "EPSG:3857")
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
435 });
2365
242c170e00ce client:use the name constants instead of strings
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2260
diff changeset
436 this.getVSourceByName(LAYERS.CUTTOOL).addFeature(cut);
1372
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
437
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
438 // draw diagram
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
439 this.$store.dispatch("fairwayprofile/cut", cut);
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
440 } else {
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
441 displayError({
1441
a4554e942954 Client: add a set of marked translations
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1437
diff changeset
442 title: this.$gettext("Invalid input"),
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 "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
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 }
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
448 },
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
449 saveCut() {
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
450 const previousCuts =
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
451 JSON.parse(localStorage.getItem("previousCuts")) || [];
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
452 const newEntry = {
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
453 label: this.cutLabel,
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
454 bottleneckName: this.selectedBottleneck,
1377
fa7d647f8d77 added timestamp to saved cross profiles
Markus Kottlaender <markus@intevation.de>
parents: 1372
diff changeset
455 coordinates: [...this.startPoint, ...this.endPoint],
fa7d647f8d77 added timestamp to saved cross profiles
Markus Kottlaender <markus@intevation.de>
parents: 1372
diff changeset
456 timestamp: new Date().getTime()
1372
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 const existingEntry = previousCuts.find(cut => {
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
459 return JSON.stringify(cut) === JSON.stringify(newEntry);
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
460 });
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
461 if (!existingEntry) previousCuts.push(newEntry);
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
462 if (previousCuts.length > 100) previousCuts.shift();
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
463 localStorage.setItem("previousCuts", JSON.stringify(previousCuts));
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
464 this.$store.dispatch("fairwayprofile/previousCuts");
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 this.showLabelInput = false;
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
467 displayInfo({
1441
a4554e942954 Client: add a set of marked translations
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1437
diff changeset
468 title: this.$gettext("Profile saved!"),
a4554e942954 Client: add a set of marked translations
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1437
diff changeset
469 message: this.$gettext(
1372
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
470 '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
471 )
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 },
2540
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
474 deleteSelectedCut(cut) {
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
475 this.$store.commit("application/popup", {
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
476 icon: "trash",
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
477 title: this.$gettext("Delete cross profile"),
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
478 content:
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
479 this.$gettext("Do you really want to delete the cross profile:") +
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
480 `<br>
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
481 <b>${cut.label}</b>`,
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
482 confirm: {
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
483 label: this.$gettext("Delete"),
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
484 icon: "trash",
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
485 callback: () => {
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
486 let previousCuts =
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
487 JSON.parse(localStorage.getItem("previousCuts")) || [];
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
488 previousCuts = previousCuts.filter(cut => {
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
489 return JSON.stringify(cut) !== JSON.stringify(this.selectedCut);
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
490 });
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
491 localStorage.setItem("previousCuts", JSON.stringify(previousCuts));
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
492 this.$store.commit("fairwayprofile/selectedCut", null);
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
493 this.$store.dispatch("fairwayprofile/previousCuts");
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
494 displayInfo({ title: this.$gettext("Profile deleted!") });
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
495 }
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
496 },
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
497 cancel: {
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
498 label: this.$gettext("Cancel"),
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
499 icon: "times"
3c17d401fbd4 client: cross profiles: moved waterlevel select to Profiles dialog
Markus Kottlaender <markus@intevation.de>
parents: 2534
diff changeset
500 }
1395
210e9f16f8a0 delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents: 1394
diff changeset
501 });
210e9f16f8a0 delete cross profiles from localstorage
Markus Kottlaender <markus@intevation.de>
parents: 1394
diff changeset
502 },
1372
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
503 moveToBottleneck() {
2436
64ff5984351e client: renamed store property
Markus Kottlaender <markus@intevation.de>
parents: 2435
diff changeset
504 const bottleneck = this.bottlenecksList.find(
1372
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
505 bn => bn.properties.name === this.selectedBottleneck
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
506 );
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
507 if (!bottleneck) return;
2136
3138d60dd1a6 moveToExtent substitutes moveMap where easy doable
Thomas Junk <thomas.junk@intevation.de>
parents: 1613
diff changeset
508 this.$store.commit("map/moveToExtent", {
3138d60dd1a6 moveToExtent substitutes moveMap where easy doable
Thomas Junk <thomas.junk@intevation.de>
parents: 1613
diff changeset
509 feature: bottleneck,
1372
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
510 zoom: 17,
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
511 preventZoomOut: true
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
512 });
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
513 }
2434
817b3d726b43 client: loadBottlenecks (bottleneck_overview) only where needed
Markus Kottlaender <markus@intevation.de>
parents: 2387
diff changeset
514 },
817b3d726b43 client: loadBottlenecks (bottleneck_overview) only where needed
Markus Kottlaender <markus@intevation.de>
parents: 2387
diff changeset
515 mounted() {
2435
3679d604645e client: renamed store action
Markus Kottlaender <markus@intevation.de>
parents: 2434
diff changeset
516 this.$store.dispatch("bottlenecks/loadBottlenecksList");
1372
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
517 }
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
518 };
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
519 </script>