Mercurial > gemma
annotate client/src/components/importoverview/FairwayDimensionDetail.vue @ 4644:486495590483
Merged stree-experiment into default to benefit from diff improvements.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Sat, 12 Oct 2019 15:17:51 +0200 |
parents | 09406e3b052c |
children | 96a544504818 |
rev | line source |
---|---|
2917
edc2633c3cc6
client: importsoverview: cleaned up html, removed unnecessary component
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
1 <template> |
4368
e9d2573329da
import_overview: make layer for review togglable (currently only for development visible)
Thomas Junk <thomas.junk@intevation.de>
parents:
4336
diff
changeset
|
2 <div class="d-flex flex-column"> |
e9d2573329da
import_overview: make layer for review togglable (currently only for development visible)
Thomas Junk <thomas.junk@intevation.de>
parents:
4336
diff
changeset
|
3 <div> |
e9d2573329da
import_overview: make layer for review togglable (currently only for development visible)
Thomas Junk <thomas.junk@intevation.de>
parents:
4336
diff
changeset
|
4 Fairwaydimensions |
e9d2573329da
import_overview: make layer for review togglable (currently only for development visible)
Thomas Junk <thomas.junk@intevation.de>
parents:
4336
diff
changeset
|
5 </div> |
e9d2573329da
import_overview: make layer for review togglable (currently only for development visible)
Thomas Junk <thomas.junk@intevation.de>
parents:
4336
diff
changeset
|
6 <template v-if="LOS"> |
e9d2573329da
import_overview: make layer for review togglable (currently only for development visible)
Thomas Junk <thomas.junk@intevation.de>
parents:
4336
diff
changeset
|
7 <span class="ml-2 mt-1">LOS: {{ LOS }}</span> |
e9d2573329da
import_overview: make layer for review togglable (currently only for development visible)
Thomas Junk <thomas.junk@intevation.de>
parents:
4336
diff
changeset
|
8 <span class="ml-2 mb-3" |
e9d2573329da
import_overview: make layer for review togglable (currently only for development visible)
Thomas Junk <thomas.junk@intevation.de>
parents:
4336
diff
changeset
|
9 ><translate>Source</translate>: {{ organization }}</span |
e9d2573329da
import_overview: make layer for review togglable (currently only for development visible)
Thomas Junk <thomas.junk@intevation.de>
parents:
4336
diff
changeset
|
10 > |
e9d2573329da
import_overview: make layer for review togglable (currently only for development visible)
Thomas Junk <thomas.junk@intevation.de>
parents:
4336
diff
changeset
|
11 </template> |
e9d2573329da
import_overview: make layer for review togglable (currently only for development visible)
Thomas Junk <thomas.junk@intevation.de>
parents:
4336
diff
changeset
|
12 </div> |
2917
edc2633c3cc6
client: importsoverview: cleaned up html, removed unnecessary component
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
13 </template> |
edc2633c3cc6
client: importsoverview: cleaned up html, removed unnecessary component
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
14 |
edc2633c3cc6
client: importsoverview: cleaned up html, removed unnecessary component
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
15 <script> |
edc2633c3cc6
client: importsoverview: cleaned up html, removed unnecessary component
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
16 /* This is Free Software under GNU Affero General Public License v >= 3.0 |
edc2633c3cc6
client: importsoverview: cleaned up html, removed unnecessary component
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
17 * without warranty, see README.md and license for details. |
edc2633c3cc6
client: importsoverview: cleaned up html, removed unnecessary component
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
18 * |
edc2633c3cc6
client: importsoverview: cleaned up html, removed unnecessary component
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
19 * SPDX-License-Identifier: AGPL-3.0-or-later |
edc2633c3cc6
client: importsoverview: cleaned up html, removed unnecessary component
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
20 * License-Filename: LICENSES/AGPL-3.0.txt |
edc2633c3cc6
client: importsoverview: cleaned up html, removed unnecessary component
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
21 * |
edc2633c3cc6
client: importsoverview: cleaned up html, removed unnecessary component
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
22 * Copyright (C) 2018 by via donau |
edc2633c3cc6
client: importsoverview: cleaned up html, removed unnecessary component
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
23 * – Österreichische Wasserstraßen-Gesellschaft mbH |
edc2633c3cc6
client: importsoverview: cleaned up html, removed unnecessary component
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
24 * Software engineering by Intevation GmbH |
edc2633c3cc6
client: importsoverview: cleaned up html, removed unnecessary component
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
25 * |
edc2633c3cc6
client: importsoverview: cleaned up html, removed unnecessary component
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
26 * Author(s): |
edc2633c3cc6
client: importsoverview: cleaned up html, removed unnecessary component
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
27 * Thomas Junk <thomas.junk@intevation.de> |
edc2633c3cc6
client: importsoverview: cleaned up html, removed unnecessary component
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
28 */ |
4336
45307cf4931a
Review of fairway dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
2917
diff
changeset
|
29 import { or as orFilter, equalTo as equalToFilter } from "ol/format/filter"; |
45307cf4931a
Review of fairway dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
2917
diff
changeset
|
30 //import { displayError } from "@/lib/errors"; |
45307cf4931a
Review of fairway dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
2917
diff
changeset
|
31 import { mapGetters } from "vuex"; |
4374
ad2bf9580696
importoverview: review of fairwaydimensions improved
Thomas Junk <thomas.junk@intevation.de>
parents:
4368
diff
changeset
|
32 import VectorSource from "ol/source/Vector"; |
ad2bf9580696
importoverview: review of fairwaydimensions improved
Thomas Junk <thomas.junk@intevation.de>
parents:
4368
diff
changeset
|
33 import { buildVectorLoader } from "@/components/map/layers.js"; |
ad2bf9580696
importoverview: review of fairwaydimensions improved
Thomas Junk <thomas.junk@intevation.de>
parents:
4368
diff
changeset
|
34 import { bbox as bboxStrategy } from "ol/loadingstrategy"; |
4376
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
35 import { WFS } from "ol/format"; |
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
36 import { HTTP } from "@/lib/http"; |
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
37 |
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
38 const getFromWFS = (type, filter) => { |
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
39 return new Promise((resolve, reject) => { |
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
40 var featureCollectionRequest = new WFS().writeGetFeature({ |
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
41 srsName: "EPSG:4326", |
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
42 featureNS: "gemma", |
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
43 featurePrefix: "gemma", |
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
44 featureTypes: [type], |
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
45 outputFormat: "application/json", |
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
46 filter: filter |
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
47 }); |
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
48 HTTP.post( |
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
49 "/internal/wfs", |
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
50 new XMLSerializer().serializeToString(featureCollectionRequest), |
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
51 { |
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
52 headers: { |
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
53 "X-Gemma-Auth": localStorage.getItem("token"), |
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
54 "Content-type": "text/xml; charset=UTF-8" |
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
55 } |
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
56 } |
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
57 ) |
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
58 .then(response => { |
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
59 resolve(response); |
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
60 }) |
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
61 .catch(error => { |
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
62 reject(error); |
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
63 }); |
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
64 }); |
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
65 }; |
4336
45307cf4931a
Review of fairway dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
2917
diff
changeset
|
66 |
45307cf4931a
Review of fairway dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
2917
diff
changeset
|
67 export default { |
45307cf4931a
Review of fairway dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
2917
diff
changeset
|
68 props: ["summary"], |
4368
e9d2573329da
import_overview: make layer for review togglable (currently only for development visible)
Thomas Junk <thomas.junk@intevation.de>
parents:
4336
diff
changeset
|
69 data() { |
e9d2573329da
import_overview: make layer for review togglable (currently only for development visible)
Thomas Junk <thomas.junk@intevation.de>
parents:
4336
diff
changeset
|
70 return { |
e9d2573329da
import_overview: make layer for review togglable (currently only for development visible)
Thomas Junk <thomas.junk@intevation.de>
parents:
4336
diff
changeset
|
71 organization: "", |
e9d2573329da
import_overview: make layer for review togglable (currently only for development visible)
Thomas Junk <thomas.junk@intevation.de>
parents:
4336
diff
changeset
|
72 LOS: "" |
e9d2573329da
import_overview: make layer for review togglable (currently only for development visible)
Thomas Junk <thomas.junk@intevation.de>
parents:
4336
diff
changeset
|
73 }; |
e9d2573329da
import_overview: make layer for review togglable (currently only for development visible)
Thomas Junk <thomas.junk@intevation.de>
parents:
4336
diff
changeset
|
74 }, |
4336
45307cf4931a
Review of fairway dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
2917
diff
changeset
|
75 mounted() { |
45307cf4931a
Review of fairway dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
2917
diff
changeset
|
76 const ids = this.fairWayDimensionIDs.map(id => { |
45307cf4931a
Review of fairway dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
2917
diff
changeset
|
77 return equalToFilter("id", id); |
45307cf4931a
Review of fairway dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
2917
diff
changeset
|
78 }); |
4374
ad2bf9580696
importoverview: review of fairwaydimensions improved
Thomas Junk <thomas.junk@intevation.de>
parents:
4368
diff
changeset
|
79 const fairwaydimensionLayer = this.openLayersMap().getLayer( |
ad2bf9580696
importoverview: review of fairwaydimensions improved
Thomas Junk <thomas.junk@intevation.de>
parents:
4368
diff
changeset
|
80 "FDREVIEWLAYER" |
ad2bf9580696
importoverview: review of fairwaydimensions improved
Thomas Junk <thomas.junk@intevation.de>
parents:
4368
diff
changeset
|
81 ); |
ad2bf9580696
importoverview: review of fairwaydimensions improved
Thomas Junk <thomas.junk@intevation.de>
parents:
4368
diff
changeset
|
82 const source = new VectorSource({ strategy: bboxStrategy }); |
ad2bf9580696
importoverview: review of fairwaydimensions improved
Thomas Junk <thomas.junk@intevation.de>
parents:
4368
diff
changeset
|
83 this.$store.commit("map/reviewActive", true); |
ad2bf9580696
importoverview: review of fairwaydimensions improved
Thomas Junk <thomas.junk@intevation.de>
parents:
4368
diff
changeset
|
84 fairwaydimensionLayer.setVisible(true); |
ad2bf9580696
importoverview: review of fairwaydimensions improved
Thomas Junk <thomas.junk@intevation.de>
parents:
4368
diff
changeset
|
85 source.setLoader( |
ad2bf9580696
importoverview: review of fairwaydimensions improved
Thomas Junk <thomas.junk@intevation.de>
parents:
4368
diff
changeset
|
86 buildVectorLoader( |
ad2bf9580696
importoverview: review of fairwaydimensions improved
Thomas Junk <thomas.junk@intevation.de>
parents:
4368
diff
changeset
|
87 { |
ad2bf9580696
importoverview: review of fairwaydimensions improved
Thomas Junk <thomas.junk@intevation.de>
parents:
4368
diff
changeset
|
88 geometryName: "area", |
ad2bf9580696
importoverview: review of fairwaydimensions improved
Thomas Junk <thomas.junk@intevation.de>
parents:
4368
diff
changeset
|
89 featureTypes: ["fairway_dimensions"], |
ad2bf9580696
importoverview: review of fairwaydimensions improved
Thomas Junk <thomas.junk@intevation.de>
parents:
4368
diff
changeset
|
90 filter: orFilter(...ids) |
ad2bf9580696
importoverview: review of fairwaydimensions improved
Thomas Junk <thomas.junk@intevation.de>
parents:
4368
diff
changeset
|
91 }, |
ad2bf9580696
importoverview: review of fairwaydimensions improved
Thomas Junk <thomas.junk@intevation.de>
parents:
4368
diff
changeset
|
92 source, |
ad2bf9580696
importoverview: review of fairwaydimensions improved
Thomas Junk <thomas.junk@intevation.de>
parents:
4368
diff
changeset
|
93 false |
ad2bf9580696
importoverview: review of fairwaydimensions improved
Thomas Junk <thomas.junk@intevation.de>
parents:
4368
diff
changeset
|
94 ) |
ad2bf9580696
importoverview: review of fairwaydimensions improved
Thomas Junk <thomas.junk@intevation.de>
parents:
4368
diff
changeset
|
95 ); |
ad2bf9580696
importoverview: review of fairwaydimensions improved
Thomas Junk <thomas.junk@intevation.de>
parents:
4368
diff
changeset
|
96 fairwaydimensionLayer.setSource(source); |
4376
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
97 getFromWFS("fairway_dimensions", ids[0]).then(response => { |
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
98 const { |
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
99 level_of_service, |
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
100 source_organization |
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
101 } = response.data.features[0].properties; |
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
102 this.LOS = level_of_service; |
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
103 this.organization = source_organization; |
8949b4d714ee
importoverview: improve identification of features to review
Thomas Junk <thomas.junk@intevation.de>
parents:
4374
diff
changeset
|
104 }); |
4336
45307cf4931a
Review of fairway dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
2917
diff
changeset
|
105 }, |
45307cf4931a
Review of fairway dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
2917
diff
changeset
|
106 computed: { |
45307cf4931a
Review of fairway dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
2917
diff
changeset
|
107 ...mapGetters("map", ["openLayersMap"]), |
45307cf4931a
Review of fairway dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
2917
diff
changeset
|
108 fairWayDimensionIDs() { |
45307cf4931a
Review of fairway dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
2917
diff
changeset
|
109 return this.summary["fd-area"].map(e => e.id); |
45307cf4931a
Review of fairway dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
2917
diff
changeset
|
110 } |
45307cf4931a
Review of fairway dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
2917
diff
changeset
|
111 } |
45307cf4931a
Review of fairway dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
2917
diff
changeset
|
112 }; |
2917
edc2633c3cc6
client: importsoverview: cleaned up html, removed unnecessary component
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
113 </script> |