annotate client/src/components/identify/Identify.vue @ 3399:e5df2cbb4d48

client: user manual: fix console error and hide it when url is not cofigured
author Fadi Abbud <fadi.abbud@intevation.de>
date Thu, 23 May 2019 11:32:23 +0200
parents 6075c4c25568
children 0e91d40af23e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2371
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
1 <template>
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
2 <div
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
3 :class="[
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
4 'box ui-element rounded bg-white text-nowrap',
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
5 { expanded: showIdentify }
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
6 ]"
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
7 >
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
8 <div style="width: 18rem">
2754
d0f6c222f4f9 client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2747
diff changeset
9 <UIBoxHeader
d0f6c222f4f9 client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2747
diff changeset
10 icon="info"
d0f6c222f4f9 client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2747
diff changeset
11 :title="identifiedLabel"
d0f6c222f4f9 client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2747
diff changeset
12 :closeCallback="close"
d0f6c222f4f9 client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2747
diff changeset
13 />
2534
bb5286acfee2 client: reduced spacings between and inside boxes and more compact main menu
Markus Kottlaender <markus@intevation.de>
parents: 2441
diff changeset
14 <div class="features">
2371
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
15 <div v-if="currentMeasurement">
2857
f59cff59a630 client: identify: made header text left aligned for measurements
Markus Kottlaender <markus@intevation.de>
parents: 2856
diff changeset
16 <small class="d-block bg-secondary text-light px-2 py-1">
2371
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
17 {{ $gettext("Measurement") }}
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
18 </small>
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
19 <small class="d-flex justify-content-between px-2">
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
20 <b>
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
21 {{ currentMeasurement.quantity }}
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
22 </b>
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
23 {{ currentMeasurement.value }} {{ currentMeasurement.unitSymbol }}
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
24 </small>
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
25 </div>
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
26 <div
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
27 v-for="feature of filteredIdentifiedFeatures"
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
28 :key="feature.getId()"
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
29 >
2743
4063adda3095 client: identified box: moved bbox zoom button to feature headers and removed bbox from the feature's properties list
Markus Kottlaender <markus@intevation.de>
parents: 2735
diff changeset
30 <small
2835
202a153a3361 client: identify box: made headers lighter
Markus Kottlaender <markus@intevation.de>
parents: 2754
diff changeset
31 class="d-flex justify-content-between bg-secondary text-light px-2 py-1"
2743
4063adda3095 client: identified box: moved bbox zoom button to feature headers and removed bbox from the feature's properties list
Markus Kottlaender <markus@intevation.de>
parents: 2735
diff changeset
32 >
2371
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
33 {{ $gettext(featureLabel(feature)) }}
2743
4063adda3095 client: identified box: moved bbox zoom button to feature headers and removed bbox from the feature's properties list
Markus Kottlaender <markus@intevation.de>
parents: 2735
diff changeset
34 <a
4063adda3095 client: identified box: moved bbox zoom button to feature headers and removed bbox from the feature's properties list
Markus Kottlaender <markus@intevation.de>
parents: 2735
diff changeset
35 v-if="feature.getProperties().hasOwnProperty('bbox')"
4063adda3095 client: identified box: moved bbox zoom button to feature headers and removed bbox from the feature's properties list
Markus Kottlaender <markus@intevation.de>
parents: 2735
diff changeset
36 @click="zoomTo(feature)"
4063adda3095 client: identified box: moved bbox zoom button to feature headers and removed bbox from the feature's properties list
Markus Kottlaender <markus@intevation.de>
parents: 2735
diff changeset
37 class="btn btn-info btn-xs pointer rounded-0 zoom-btn"
4063adda3095 client: identified box: moved bbox zoom button to feature headers and removed bbox from the feature's properties list
Markus Kottlaender <markus@intevation.de>
parents: 2735
diff changeset
38 >
4063adda3095 client: identified box: moved bbox zoom button to feature headers and removed bbox from the feature's properties list
Markus Kottlaender <markus@intevation.de>
parents: 2735
diff changeset
39 <font-awesome-icon icon="crosshairs" />
4063adda3095 client: identified box: moved bbox zoom button to feature headers and removed bbox from the feature's properties list
Markus Kottlaender <markus@intevation.de>
parents: 2735
diff changeset
40 </a>
2371
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
41 </small>
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
42 <small
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
43 v-for="prop in featureProps(feature)"
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
44 :key="prop.key"
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
45 v-if="prop.val"
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
46 class="d-flex justify-content-between px-2"
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
47 >
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
48 <b>{{ $gettext(prop.key) }}</b>
2743
4063adda3095 client: identified box: moved bbox zoom button to feature headers and removed bbox from the feature's properties list
Markus Kottlaender <markus@intevation.de>
parents: 2735
diff changeset
49 <span>{{ prop.val }}</span>
2371
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
50 </small>
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
51 </div>
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
52 <div
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
53 v-if="!currentMeasurement && !filteredIdentifiedFeatures.length"
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
54 class="text-muted small text-center my-auto py-3 px-2"
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
55 >
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
56 <translate>No features identified.</translate>
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
57 </div>
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
58 </div>
3399
e5df2cbb4d48 client: user manual: fix console error and hide it when url is not cofigured
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3395
diff changeset
59 <div
e5df2cbb4d48 client: user manual: fix console error and hide it when url is not cofigured
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3395
diff changeset
60 v-if="userManualUrl"
e5df2cbb4d48 client: user manual: fix console error and hide it when url is not cofigured
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3395
diff changeset
61 class="border-top text-left pl-2"
e5df2cbb4d48 client: user manual: fix console error and hide it when url is not cofigured
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3395
diff changeset
62 style="font-size: 90%;"
e5df2cbb4d48 client: user manual: fix console error and hide it when url is not cofigured
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3395
diff changeset
63 >
3395
6075c4c25568 client: change user manual location
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3369
diff changeset
64 <translate>Download</translate>
6075c4c25568 client: change user manual location
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3369
diff changeset
65 <a
6075c4c25568 client: change user manual location
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3369
diff changeset
66 :href="userManualUrl ? userManualUrl : '#'"
3399
e5df2cbb4d48 client: user manual: fix console error and hide it when url is not cofigured
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3395
diff changeset
67 :download="userManualUrl && !!userManualUrl.length"
3395
6075c4c25568 client: change user manual location
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3369
diff changeset
68 ><translate> User Manual</translate></a
6075c4c25568 client: change user manual location
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3369
diff changeset
69 >
6075c4c25568 client: change user manual location
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3369
diff changeset
70 </div>
2534
bb5286acfee2 client: reduced spacings between and inside boxes and more compact main menu
Markus Kottlaender <markus@intevation.de>
parents: 2441
diff changeset
71 <div class="versioninfo border-top box-body">
2371
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
72 <span v-translate="{ license: 'AGPL-3.0-or-later' }">
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
73 This app uses <i>gemma</i>, which is Free Software under <br />
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
74 %{ license } without warranty, see docs for details.
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
75 </span>
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
76 <br />
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
77 <a href="https://hg.intevation.de/gemma/file/tip">
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
78 <translate>source-code</translate>
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
79 </a>
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
80 {{ versionStr }} <br />© via donau. &#x24D4; Intevation. <br />
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
81 <span v-translate="{ name: 'OpenSteetMap' }"
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
82 >Some data ©
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
83 <a href="https://www.openstreetmap.org/copyright">%{ name }</a>
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
84 contributors.
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
85 </span>
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
86 <br />
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
87 <span v-translate="{ geoLicense: 'CC-BY-4.0' }">
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
88 Uses
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
89 <a href="https://download.geonames.org/export/dump/readme.txt"
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
90 >GeoNames</a
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
91 >
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
92 under %{ geoLicense }.
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
93 </span>
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
94 <translate>Generated PDFs use font: </translate>
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
95 <a href="http://libertine-fonts.org">LinBiolinum</a>
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
96 </div>
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
97 </div>
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
98 </div>
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
99 </template>
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
100
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
101 <style lang="scss" scoped>
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
102 .features {
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
103 max-height: 19rem;
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
104 overflow-y: auto;
2372
20e4efa64320 client: improved row colors in identify box
Markus Kottlaender <markus@intevation.de>
parents: 2371
diff changeset
105 small {
2743
4063adda3095 client: identified box: moved bbox zoom button to feature headers and removed bbox from the feature's properties list
Markus Kottlaender <markus@intevation.de>
parents: 2735
diff changeset
106 .zoom-btn {
4063adda3095 client: identified box: moved bbox zoom button to feature headers and removed bbox from the feature's properties list
Markus Kottlaender <markus@intevation.de>
parents: 2735
diff changeset
107 margin-top: -0.25rem;
4063adda3095 client: identified box: moved bbox zoom button to feature headers and removed bbox from the feature's properties list
Markus Kottlaender <markus@intevation.de>
parents: 2735
diff changeset
108 margin-right: -0.5rem;
4063adda3095 client: identified box: moved bbox zoom button to feature headers and removed bbox from the feature's properties list
Markus Kottlaender <markus@intevation.de>
parents: 2735
diff changeset
109 margin-bottom: -0.25rem;
4063adda3095 client: identified box: moved bbox zoom button to feature headers and removed bbox from the feature's properties list
Markus Kottlaender <markus@intevation.de>
parents: 2735
diff changeset
110 svg {
4063adda3095 client: identified box: moved bbox zoom button to feature headers and removed bbox from the feature's properties list
Markus Kottlaender <markus@intevation.de>
parents: 2735
diff changeset
111 vertical-align: middle;
4063adda3095 client: identified box: moved bbox zoom button to feature headers and removed bbox from the feature's properties list
Markus Kottlaender <markus@intevation.de>
parents: 2735
diff changeset
112 }
4063adda3095 client: identified box: moved bbox zoom button to feature headers and removed bbox from the feature's properties list
Markus Kottlaender <markus@intevation.de>
parents: 2735
diff changeset
113 }
2372
20e4efa64320 client: improved row colors in identify box
Markus Kottlaender <markus@intevation.de>
parents: 2371
diff changeset
114 &:nth-child(even) {
20e4efa64320 client: improved row colors in identify box
Markus Kottlaender <markus@intevation.de>
parents: 2371
diff changeset
115 background: #f8f8f8;
20e4efa64320 client: improved row colors in identify box
Markus Kottlaender <markus@intevation.de>
parents: 2371
diff changeset
116 }
20e4efa64320 client: improved row colors in identify box
Markus Kottlaender <markus@intevation.de>
parents: 2371
diff changeset
117 &:hover {
20e4efa64320 client: improved row colors in identify box
Markus Kottlaender <markus@intevation.de>
parents: 2371
diff changeset
118 background: #eeeeee;
20e4efa64320 client: improved row colors in identify box
Markus Kottlaender <markus@intevation.de>
parents: 2371
diff changeset
119 }
2371
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
120 }
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
121 }
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
122
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
123 .versioninfo {
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
124 font-size: 60%;
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
125 white-space: normal;
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
126 }
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
127 </style>
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
128
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
129 <script>
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
130 /* This is Free Software under GNU Affero General Public License v >= 3.0
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
131 * without warranty, see README.md and license for details.
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
132 *
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
133 * SPDX-License-Identifier: AGPL-3.0-or-later
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
134 * License-Filename: LICENSES/AGPL-3.0.txt
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
135 *
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
136 * Copyright (C) 2018, 2019 by via donau
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
137 * – Österreichische Wasserstraßen-Gesellschaft mbH
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
138 * Software engineering by Intevation GmbH
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
139 *
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
140 * Author(s):
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
141 * Thomas Junk <thomas.junk@intevation.de>
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
142 * Bernhard E. Reiter <bernhard.reiter@intevation.de>
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
143 * Markus Kottländer <markus.kottlaender@intevation.de>
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
144 */
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
145 import { mapState, mapGetters } from "vuex";
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
146 import { formatter } from "./formatter";
2747
fb5deecb77f1 client:identified box: implement the bbox zoom button
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2743
diff changeset
147 import { getCenter } from "ol/extent";
2371
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
148
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
149 export default {
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
150 name: "identify",
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
151 computed: {
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
152 ...mapGetters("application", ["versionStr"]),
3369
33c398df5cb5 client: implement download of the user manual
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3187
diff changeset
153 ...mapState("application", ["showIdentify", "userManualUrl"]),
2371
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
154 ...mapGetters("map", ["filteredIdentifiedFeatures"]),
2754
d0f6c222f4f9 client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2747
diff changeset
155 ...mapState("map", ["currentMeasurement"]),
d0f6c222f4f9 client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2747
diff changeset
156 identifiedLabel() {
3187
5487abeb380c client: identify: edited title of box header
Markus Kottlaender <markus@intevation.de>
parents: 3044
diff changeset
157 return this.$gettext("Identified Features");
2754
d0f6c222f4f9 client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2747
diff changeset
158 }
2371
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
159 },
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
160 methods: {
2743
4063adda3095 client: identified box: moved bbox zoom button to feature headers and removed bbox from the feature's properties list
Markus Kottlaender <markus@intevation.de>
parents: 2735
diff changeset
161 zoomTo(feature) {
3044
c71373594719 client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents: 3029
diff changeset
162 this.$store.dispatch("map/moveMap", {
2747
fb5deecb77f1 client:identified box: implement the bbox zoom button
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2743
diff changeset
163 coordinates: getCenter(
fb5deecb77f1 client:identified box: implement the bbox zoom button
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2743
diff changeset
164 feature
fb5deecb77f1 client:identified box: implement the bbox zoom button
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2743
diff changeset
165 .getGeometry()
fb5deecb77f1 client:identified box: implement the bbox zoom button
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2743
diff changeset
166 .clone()
fb5deecb77f1 client:identified box: implement the bbox zoom button
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2743
diff changeset
167 .transform("EPSG:3857", "EPSG:4326")
fb5deecb77f1 client:identified box: implement the bbox zoom button
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2743
diff changeset
168 .getExtent()
fb5deecb77f1 client:identified box: implement the bbox zoom button
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2743
diff changeset
169 ),
fb5deecb77f1 client:identified box: implement the bbox zoom button
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2743
diff changeset
170 zoom: 17,
fb5deecb77f1 client:identified box: implement the bbox zoom button
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2743
diff changeset
171 preventZoomOut: true
2735
3c2ac140ad30 identify_tool: zoom to BBox PoC implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2534
diff changeset
172 });
3c2ac140ad30 identify_tool: zoom to BBox PoC implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2534
diff changeset
173 },
2387
f185503ef35a client: unified box's header styles by creating a reusable component
Markus Kottlaender <markus@intevation.de>
parents: 2372
diff changeset
174 close() {
f185503ef35a client: unified box's header styles by creating a reusable component
Markus Kottlaender <markus@intevation.de>
parents: 2372
diff changeset
175 this.$store.commit("application/showIdentify", false);
f185503ef35a client: unified box's header styles by creating a reusable component
Markus Kottlaender <markus@intevation.de>
parents: 2372
diff changeset
176 },
2371
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
177 featureId(feature) {
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
178 // cut away everything from the last . to the end
3029
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2857
diff changeset
179 let id = "";
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2857
diff changeset
180 if (feature.getId) {
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2857
diff changeset
181 id = feature.getId();
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2857
diff changeset
182 }
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2857
diff changeset
183 if (feature.id) {
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2857
diff changeset
184 id = feature.id;
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2857
diff changeset
185 }
81c2e561fe03 Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2857
diff changeset
186 return id.replace(/[.][^.]*$/, "");
2371
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
187 },
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
188 featureLabel(feature) {
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
189 if (formatter.hasOwnProperty(this.featureId(feature))) {
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
190 return formatter[this.featureId(feature)].label;
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
191 }
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
192 return this.featureId(feature);
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
193 },
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
194 featureProps(feature) {
2441
9de710bdb535 client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents: 2424
diff changeset
195 let featureId = this.featureId(feature);
9de710bdb535 client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents: 2424
diff changeset
196
2371
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
197 // create array with {key, val} objects
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
198 let propsArray = [];
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
199 Object.keys(feature.getProperties()).forEach(key => {
2423
3423cd4b3136 client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents: 2405
diff changeset
200 // skip geometry (would lead to cyclic object error)
3423cd4b3136 client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents: 2405
diff changeset
201 if (key !== feature.getGeometryName()) {
3423cd4b3136 client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents: 2405
diff changeset
202 let val = feature.getProperties()[key];
2405
ef928c63388a client: handle json values in identify box
Markus Kottlaender <markus@intevation.de>
parents: 2387
diff changeset
203
2423
3423cd4b3136 client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents: 2405
diff changeset
204 // if val is a valid json object string, spread its values into the array
3423cd4b3136 client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents: 2405
diff changeset
205 let jsonObj = this.getObjectFromString(val);
3423cd4b3136 client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents: 2405
diff changeset
206 if (jsonObj) {
3423cd4b3136 client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents: 2405
diff changeset
207 Object.keys(jsonObj).forEach(key => {
3423cd4b3136 client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents: 2405
diff changeset
208 propsArray.push({ key, val: jsonObj[key] });
3423cd4b3136 client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents: 2405
diff changeset
209 });
3423cd4b3136 client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents: 2405
diff changeset
210 } else {
3423cd4b3136 client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents: 2405
diff changeset
211 // otherwise just put the key value pair into the array
3423cd4b3136 client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents: 2405
diff changeset
212 propsArray.push({ key, val });
3423cd4b3136 client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents: 2405
diff changeset
213 }
2405
ef928c63388a client: handle json values in identify box
Markus Kottlaender <markus@intevation.de>
parents: 2387
diff changeset
214 }
2371
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
215 });
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
216
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
217 // change labels and remove unneeded properties
2441
9de710bdb535 client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents: 2424
diff changeset
218 // for all features
2743
4063adda3095 client: identified box: moved bbox zoom button to feature headers and removed bbox from the feature's properties list
Markus Kottlaender <markus@intevation.de>
parents: 2735
diff changeset
219 propsArray = propsArray.map(formatter.all).filter(p => p);
2441
9de710bdb535 client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents: 2424
diff changeset
220 // feature specific
9de710bdb535 client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents: 2424
diff changeset
221 if (
9de710bdb535 client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents: 2424
diff changeset
222 formatter.hasOwnProperty(featureId) &&
9de710bdb535 client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents: 2424
diff changeset
223 formatter[featureId].hasOwnProperty("props")
9de710bdb535 client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents: 2424
diff changeset
224 ) {
2743
4063adda3095 client: identified box: moved bbox zoom button to feature headers and removed bbox from the feature's properties list
Markus Kottlaender <markus@intevation.de>
parents: 2735
diff changeset
225 propsArray = propsArray.map(formatter[featureId].props).filter(p => p);
2371
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
226 }
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
227
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
228 // remove underscores in labels that where not previously changed already
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
229 propsArray = propsArray.map(prop => {
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
230 return { key: prop.key.replace(/_/g, " "), val: prop.val };
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
231 });
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
232
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
233 return propsArray;
2423
3423cd4b3136 client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents: 2405
diff changeset
234 },
3423cd4b3136 client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents: 2405
diff changeset
235 getObjectFromString(val) {
3423cd4b3136 client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents: 2405
diff changeset
236 // JSON.parse() accepts integers and null as valid json. So to be sure to
3423cd4b3136 client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents: 2405
diff changeset
237 // get an object, we cannot just try JSON.parse() but we need to check if
3423cd4b3136 client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents: 2405
diff changeset
238 // the given value is a string and starts with a {.
3423cd4b3136 client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents: 2405
diff changeset
239 if (
3423cd4b3136 client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents: 2405
diff changeset
240 Object.prototype.toString.call(val) === "[object String]" &&
3423cd4b3136 client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents: 2405
diff changeset
241 val[0] === "{"
3423cd4b3136 client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents: 2405
diff changeset
242 ) {
3423cd4b3136 client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents: 2405
diff changeset
243 try {
3423cd4b3136 client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents: 2405
diff changeset
244 return JSON.parse(val);
2424
b6deb03ef13f client: fix linter error (empty block)
Markus Kottlaender <markus@intevation.de>
parents: 2423
diff changeset
245 } catch (e) {
b6deb03ef13f client: fix linter error (empty block)
Markus Kottlaender <markus@intevation.de>
parents: 2423
diff changeset
246 return null;
b6deb03ef13f client: fix linter error (empty block)
Markus Kottlaender <markus@intevation.de>
parents: 2423
diff changeset
247 }
2423
3423cd4b3136 client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents: 2405
diff changeset
248 }
3423cd4b3136 client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents: 2405
diff changeset
249 return null;
2371
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
250 }
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
251 }
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
252 };
045bac575294 client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
253 </script>