Mercurial > gemma
annotate client/src/morphtool/Morphtool.vue @ 1063:7ec2133c6404
client: add area measurement. simpify code
* Add a third draw mode which can only be activated when no
morphology is selected and we are already in LineString mode.
It adds an area calculation. Because the Polygon drawMode ends
on a double click, there needs to be an extra callback for this to
run identify so that the area calculation is shown all times.
* Add Bernhard as author to some files and also simplify copyright
note.
* Remove DRAWMODES in the code to simplify as this is just one
indirection used once in stores/application.js.
* Use mapState instead mapGetters to get the drawMode at all places
to save some code lines.
author | Bernhard Reiter <bernhard@intevation.de> |
---|---|
date | Thu, 25 Oct 2018 23:16:53 +0200 |
parents | 04a9e78dcc5f |
children | 907321455f39 |
rev | line source |
---|---|
823
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
1 <template> |
1011
9d4af4b1c5c8
refac: make template logic more clear
Thomas Junk <thomas.junk@intevation.de>
parents:
1002
diff
changeset
|
2 <div class="morphcontainer"> |
9d4af4b1c5c8
refac: make template logic more clear
Thomas Junk <thomas.junk@intevation.de>
parents:
1002
diff
changeset
|
3 <div v-if="selectedBottleneck"> |
9d4af4b1c5c8
refac: make template logic more clear
Thomas Junk <thomas.junk@intevation.de>
parents:
1002
diff
changeset
|
4 <div v-if="surveyList && !drawMode" class="ui-element card card-body shadow"> |
9d4af4b1c5c8
refac: make template logic more clear
Thomas Junk <thomas.junk@intevation.de>
parents:
1002
diff
changeset
|
5 <div class="headline"> |
9d4af4b1c5c8
refac: make template logic more clear
Thomas Junk <thomas.junk@intevation.de>
parents:
1002
diff
changeset
|
6 <h4>{{bottleneckName}}</h4> |
9d4af4b1c5c8
refac: make template logic more clear
Thomas Junk <thomas.junk@intevation.de>
parents:
1002
diff
changeset
|
7 <hr> |
1027
04a9e78dcc5f
refac: remove morphstore. not necessary
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
8 <div |
04a9e78dcc5f
refac: remove morphstore. not necessary
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
9 @click="clearSelection" |
04a9e78dcc5f
refac: remove morphstore. not necessary
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
10 class="float-left ui-element d-flex morphtoolminus" |
04a9e78dcc5f
refac: remove morphstore. not necessary
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
11 > |
1011
9d4af4b1c5c8
refac: make template logic more clear
Thomas Junk <thomas.junk@intevation.de>
parents:
1002
diff
changeset
|
12 <i class="fa fa-close morphtoolsminus"></i> |
9d4af4b1c5c8
refac: make template logic more clear
Thomas Junk <thomas.junk@intevation.de>
parents:
1002
diff
changeset
|
13 </div> |
892
81b84ad962f8
morphtool streamlined
Thomas Junk <thomas.junk@intevation.de>
parents:
891
diff
changeset
|
14 </div> |
1011
9d4af4b1c5c8
refac: make template logic more clear
Thomas Junk <thomas.junk@intevation.de>
parents:
1002
diff
changeset
|
15 <ul class="list-group surveylist"> |
1027
04a9e78dcc5f
refac: remove morphstore. not necessary
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
16 <li |
04a9e78dcc5f
refac: remove morphstore. not necessary
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
17 v-for="survey of surveyList.surveys" |
04a9e78dcc5f
refac: remove morphstore. not necessary
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
18 :key="survey.data_info" |
04a9e78dcc5f
refac: remove morphstore. not necessary
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
19 class="list-group-item" |
04a9e78dcc5f
refac: remove morphstore. not necessary
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
20 @click.prevent="selectSurvey(survey)" |
04a9e78dcc5f
refac: remove morphstore. not necessary
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
21 > |
04a9e78dcc5f
refac: remove morphstore. not necessary
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
22 <a href="#" @click.prevent>{{survey.date_info}}</a> |
1011
9d4af4b1c5c8
refac: make template logic more clear
Thomas Junk <thomas.junk@intevation.de>
parents:
1002
diff
changeset
|
23 </li> |
9d4af4b1c5c8
refac: make template logic more clear
Thomas Junk <thomas.junk@intevation.de>
parents:
1002
diff
changeset
|
24 </ul> |
886
b1489669ba52
morphtool layout fixed
Thomas Junk <thomas.junk@intevation.de>
parents:
836
diff
changeset
|
25 </div> |
892
81b84ad962f8
morphtool streamlined
Thomas Junk <thomas.junk@intevation.de>
parents:
891
diff
changeset
|
26 </div> |
81b84ad962f8
morphtool streamlined
Thomas Junk <thomas.junk@intevation.de>
parents:
891
diff
changeset
|
27 <div v-if="selectedMorph" @click="clearSelection" class="ui-element shadow morphtool"> |
81b84ad962f8
morphtool streamlined
Thomas Junk <thomas.junk@intevation.de>
parents:
891
diff
changeset
|
28 <div class="d-flex flex-row justify-content-between"> |
894 | 29 <i class="fa fa-close text-danger"></i> |
893
5ea4c3f5d2a7
refinement of bottleneck selection
Thomas Junk <thomas.junk@intevation.de>
parents:
892
diff
changeset
|
30 <small>Bottleneck: </small> |
1027
04a9e78dcc5f
refac: remove morphstore. not necessary
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
31 <h6> |
04a9e78dcc5f
refac: remove morphstore. not necessary
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
32 {{bottleneckName}} |
04a9e78dcc5f
refac: remove morphstore. not necessary
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
33 <small>( {{selectedMorph.date_info}} )</small> |
04a9e78dcc5f
refac: remove morphstore. not necessary
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
34 </h6> |
886
b1489669ba52
morphtool layout fixed
Thomas Junk <thomas.junk@intevation.de>
parents:
836
diff
changeset
|
35 </div> |
b1489669ba52
morphtool layout fixed
Thomas Junk <thomas.junk@intevation.de>
parents:
836
diff
changeset
|
36 </div> |
826
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
37 </div> |
823
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
38 </template> |
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
39 |
892
81b84ad962f8
morphtool streamlined
Thomas Junk <thomas.junk@intevation.de>
parents:
891
diff
changeset
|
40 <style scoped lang="scss"> |
81b84ad962f8
morphtool streamlined
Thomas Junk <thomas.junk@intevation.de>
parents:
891
diff
changeset
|
41 .headline { |
81b84ad962f8
morphtool streamlined
Thomas Junk <thomas.junk@intevation.de>
parents:
891
diff
changeset
|
42 margin-right: $offset; |
886
b1489669ba52
morphtool layout fixed
Thomas Junk <thomas.junk@intevation.de>
parents:
836
diff
changeset
|
43 margin-left: $offset; |
b1489669ba52
morphtool layout fixed
Thomas Junk <thomas.junk@intevation.de>
parents:
836
diff
changeset
|
44 } |
892
81b84ad962f8
morphtool streamlined
Thomas Junk <thomas.junk@intevation.de>
parents:
891
diff
changeset
|
45 .morphcontainer { |
81b84ad962f8
morphtool streamlined
Thomas Junk <thomas.junk@intevation.de>
parents:
891
diff
changeset
|
46 margin-bottom: $offset; |
81b84ad962f8
morphtool streamlined
Thomas Junk <thomas.junk@intevation.de>
parents:
891
diff
changeset
|
47 margin-left: auto; |
899 | 48 margin-right: $large-offset + $icon-width; |
892
81b84ad962f8
morphtool streamlined
Thomas Junk <thomas.junk@intevation.de>
parents:
891
diff
changeset
|
49 border-radius: $border-radius; |
81b84ad962f8
morphtool streamlined
Thomas Junk <thomas.junk@intevation.de>
parents:
891
diff
changeset
|
50 } |
886
b1489669ba52
morphtool layout fixed
Thomas Junk <thomas.junk@intevation.de>
parents:
836
diff
changeset
|
51 .surveylist { |
892
81b84ad962f8
morphtool streamlined
Thomas Junk <thomas.junk@intevation.de>
parents:
891
diff
changeset
|
52 text-align: left; |
886
b1489669ba52
morphtool layout fixed
Thomas Junk <thomas.junk@intevation.de>
parents:
836
diff
changeset
|
53 margin-bottom: $offset !important; |
b1489669ba52
morphtool layout fixed
Thomas Junk <thomas.junk@intevation.de>
parents:
836
diff
changeset
|
54 margin-left: $offset; |
b1489669ba52
morphtool layout fixed
Thomas Junk <thomas.junk@intevation.de>
parents:
836
diff
changeset
|
55 margin-right: $offset; |
b1489669ba52
morphtool layout fixed
Thomas Junk <thomas.junk@intevation.de>
parents:
836
diff
changeset
|
56 } |
892
81b84ad962f8
morphtool streamlined
Thomas Junk <thomas.junk@intevation.de>
parents:
891
diff
changeset
|
57 |
81b84ad962f8
morphtool streamlined
Thomas Junk <thomas.junk@intevation.de>
parents:
891
diff
changeset
|
58 .surveylist li { |
81b84ad962f8
morphtool streamlined
Thomas Junk <thomas.junk@intevation.de>
parents:
891
diff
changeset
|
59 margin-left: auto; |
81b84ad962f8
morphtool streamlined
Thomas Junk <thomas.junk@intevation.de>
parents:
891
diff
changeset
|
60 margin-right: auto; |
81b84ad962f8
morphtool streamlined
Thomas Junk <thomas.junk@intevation.de>
parents:
891
diff
changeset
|
61 border-style: none; |
81b84ad962f8
morphtool streamlined
Thomas Junk <thomas.junk@intevation.de>
parents:
891
diff
changeset
|
62 padding-bottom: 0rem; |
81b84ad962f8
morphtool streamlined
Thomas Junk <thomas.junk@intevation.de>
parents:
891
diff
changeset
|
63 } |
81b84ad962f8
morphtool streamlined
Thomas Junk <thomas.junk@intevation.de>
parents:
891
diff
changeset
|
64 |
823
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
65 .morphtool { |
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
66 position: relative; |
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
67 background-color: white; |
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
68 padding: $small-offset; |
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
69 border-radius: $border-radius; |
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
70 height: $icon-width; |
826
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
71 margin-right: $offset; |
892
81b84ad962f8
morphtool streamlined
Thomas Junk <thomas.junk@intevation.de>
parents:
891
diff
changeset
|
72 margin-top: auto; |
81b84ad962f8
morphtool streamlined
Thomas Junk <thomas.junk@intevation.de>
parents:
891
diff
changeset
|
73 margin-bottom: auto; |
826
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
74 z-index: 2; |
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
75 } |
892
81b84ad962f8
morphtool streamlined
Thomas Junk <thomas.junk@intevation.de>
parents:
891
diff
changeset
|
76 |
81b84ad962f8
morphtool streamlined
Thomas Junk <thomas.junk@intevation.de>
parents:
891
diff
changeset
|
77 .morphcontainer i { |
81b84ad962f8
morphtool streamlined
Thomas Junk <thomas.junk@intevation.de>
parents:
891
diff
changeset
|
78 margin-right: $small-offset; |
81b84ad962f8
morphtool streamlined
Thomas Junk <thomas.junk@intevation.de>
parents:
891
diff
changeset
|
79 } |
81b84ad962f8
morphtool streamlined
Thomas Junk <thomas.junk@intevation.de>
parents:
891
diff
changeset
|
80 |
826
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
81 .morphtoolminus { |
886
b1489669ba52
morphtool layout fixed
Thomas Junk <thomas.junk@intevation.de>
parents:
836
diff
changeset
|
82 position: absolute; |
892
81b84ad962f8
morphtool streamlined
Thomas Junk <thomas.junk@intevation.de>
parents:
891
diff
changeset
|
83 top: 0; |
81b84ad962f8
morphtool streamlined
Thomas Junk <thomas.junk@intevation.de>
parents:
891
diff
changeset
|
84 right: 0; |
826
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
85 background-color: white; |
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
86 padding: $small-offset; |
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
87 border-radius: $border-radius; |
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
88 height: $icon-width; |
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
89 width: $icon-height; |
823
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
90 z-index: 2; |
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
91 } |
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
92 </style> |
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
93 |
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
94 <script> |
1019
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
1015
diff
changeset
|
95 /* |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
1015
diff
changeset
|
96 * This is Free Software under GNU Affero General Public License v >= 3.0 |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
1015
diff
changeset
|
97 * without warranty, see README.md and license for details. |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
1015
diff
changeset
|
98 * |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
1015
diff
changeset
|
99 * SPDX-License-Identifier: AGPL-3.0-or-later |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
1015
diff
changeset
|
100 * License-Filename: LICENSES/AGPL-3.0.txt |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
1015
diff
changeset
|
101 * |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
1015
diff
changeset
|
102 * Copyright (C) 2018 by via donau |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
1015
diff
changeset
|
103 * – Österreichische Wasserstraßen-Gesellschaft mbH |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
1015
diff
changeset
|
104 * Software engineering by Intevation GmbH |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
1015
diff
changeset
|
105 * |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
1015
diff
changeset
|
106 * Author(s): |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
1015
diff
changeset
|
107 * Thomas Junk <thomas.junk@intevation.de> |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
1015
diff
changeset
|
108 */ |
1063
7ec2133c6404
client: add area measurement. simpify code
Bernhard Reiter <bernhard@intevation.de>
parents:
1027
diff
changeset
|
109 import { mapState } from "vuex"; |
823
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
110 |
826
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
111 import { displayError } from "../application/lib/errors.js"; |
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
112 import { HTTP } from "../application/lib/http"; |
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
113 |
823
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
114 export default { |
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
115 name: "morphtool", |
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
116 data() { |
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
117 return { |
997
26ca04caa330
fix: Setting selected Bottleneck null caused Nullpointer Exception.
Thomas Junk <thomas.junk@intevation.de>
parents:
994
diff
changeset
|
118 surveyList: null, |
26ca04caa330
fix: Setting selected Bottleneck null caused Nullpointer Exception.
Thomas Junk <thomas.junk@intevation.de>
parents:
994
diff
changeset
|
119 bottleneckName: "" |
823
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
120 }; |
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
121 }, |
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
122 computed: { |
1063
7ec2133c6404
client: add area measurement. simpify code
Bernhard Reiter <bernhard@intevation.de>
parents:
1027
diff
changeset
|
123 ...mapState("application", ["drawMode"]), |
975
3da707172772
refac: removed technical debt
Thomas Junk <thomas.junk@intevation.de>
parents:
962
diff
changeset
|
124 ...mapState("identifystore", ["identifiedFeatures"]), |
1027
04a9e78dcc5f
refac: remove morphstore. not necessary
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
125 ...mapState("fairwayprofile", ["selectedMorph"]), |
823
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
126 selectedBottleneck: function() { |
1002
99d27dc9db5e
fix: Morphtool works again
Thomas Junk <thomas.junk@intevation.de>
parents:
997
diff
changeset
|
127 if (this.identifiedFeatures && !this.drawMode) { |
823
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
128 for (let feature of this.identifiedFeatures) { |
836
0b994949a4a0
client: make Morphtool selection more robust
Bernhard Reiter <bernhard@intevation.de>
parents:
829
diff
changeset
|
129 let id = feature.getId(); |
941
8a80ef09a62c
client: improve identify
Bernhard Reiter <bernhard@intevation.de>
parents:
936
diff
changeset
|
130 // RegExp.prototype.test() works with number, str and undefined |
8a80ef09a62c
client: improve identify
Bernhard Reiter <bernhard@intevation.de>
parents:
936
diff
changeset
|
131 if (/^bottlenecks\./.test(id)) { |
1027
04a9e78dcc5f
refac: remove morphstore. not necessary
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
132 this.$store.commit("fairwayprofile/setSelectedMorph", null); |
823
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
133 return feature; |
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
134 } |
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
135 } |
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
136 } |
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
137 return null; |
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
138 } |
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
139 }, |
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
140 watch: { |
826
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
141 selectedBottleneck: function(bottleneckFeature) { |
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
142 if (bottleneckFeature) { |
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
143 let bottleneckName = bottleneckFeature.get("objnam"); |
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
144 if (bottleneckName) { |
997
26ca04caa330
fix: Setting selected Bottleneck null caused Nullpointer Exception.
Thomas Junk <thomas.junk@intevation.de>
parents:
994
diff
changeset
|
145 this.bottleneckName = bottleneckName; |
826
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
146 this.queryBottleneck(bottleneckName); |
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
147 } |
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
148 } |
823
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
149 } |
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
150 }, |
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
151 methods: { |
826
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
152 queryBottleneck(name) { |
836
0b994949a4a0
client: make Morphtool selection more robust
Bernhard Reiter <bernhard@intevation.de>
parents:
829
diff
changeset
|
153 // DEBUG console.log("starting to query bottleneck", name); |
826
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
154 HTTP.get("/surveys/" + name, { |
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
155 headers: { |
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
156 "X-Gemma-Auth": localStorage.getItem("token"), |
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
157 "Content-type": "text/xml; charset=UTF-8" |
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
158 } |
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
159 }) |
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
160 .then(response => { |
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
161 this.surveyList = response.data; |
1015
d2f30a784fb3
feat: add selectfield to fairwayprofile
Thomas Junk <thomas.junk@intevation.de>
parents:
1011
diff
changeset
|
162 this.$store.commit( |
d2f30a784fb3
feat: add selectfield to fairwayprofile
Thomas Junk <thomas.junk@intevation.de>
parents:
1011
diff
changeset
|
163 "fairwayprofile/setAvailableSurveys", |
d2f30a784fb3
feat: add selectfield to fairwayprofile
Thomas Junk <thomas.junk@intevation.de>
parents:
1011
diff
changeset
|
164 response.data |
d2f30a784fb3
feat: add selectfield to fairwayprofile
Thomas Junk <thomas.junk@intevation.de>
parents:
1011
diff
changeset
|
165 ); |
826
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
166 }) |
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
167 .catch(error => { |
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
168 this.surveyList = null; |
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
169 const { status, data } = error.response; |
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
170 displayError({ |
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
171 title: "Backend Error", |
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
172 message: `${status}: ${data.message || data}` |
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
173 }); |
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
174 }); |
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
175 }, |
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
176 selectSurvey(survey) { |
1027
04a9e78dcc5f
refac: remove morphstore. not necessary
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
177 this.$store.commit("fairwayprofile/setSelectedMorph", survey); |
826
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
178 this.surveyList = null; |
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
179 }, |
823
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
180 clearSelection() { |
975
3da707172772
refac: removed technical debt
Thomas Junk <thomas.junk@intevation.de>
parents:
962
diff
changeset
|
181 this.$store.commit("identifystore/setIdentifiedFeatures", []); |
1027
04a9e78dcc5f
refac: remove morphstore. not necessary
Thomas Junk <thomas.junk@intevation.de>
parents:
1019
diff
changeset
|
182 this.$store.commit("fairwayprofile/setSelectedMorph", null); |
826
90a601884ff2
client: improve survey selection for Morphtool
Bernhard Reiter <bernhard@intevation.de>
parents:
823
diff
changeset
|
183 this.surveyList = null; |
936
f27fe4e9bfd9
client: improve morphology mode
Bernhard Reiter <bernhard@intevation.de>
parents:
910
diff
changeset
|
184 if (this.drawMode) { |
f27fe4e9bfd9
client: improve morphology mode
Bernhard Reiter <bernhard@intevation.de>
parents:
910
diff
changeset
|
185 this.$store.commit("application/toggleDrawModeLine"); |
f27fe4e9bfd9
client: improve morphology mode
Bernhard Reiter <bernhard@intevation.de>
parents:
910
diff
changeset
|
186 } |
823
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
187 } |
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
188 } |
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
189 }; |
d7ae7338872d
client: add morphtool again
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
190 </script> |