Mercurial > gemma
annotate client/src/components/identify/Identify.vue @ 2856:a2a82e887b18
client: identify: changed header color for measurements
author | Markus Kottlaender <markus@intevation.de> |
---|---|
date | Thu, 28 Mar 2019 17:51:25 +0100 |
parents | 202a153a3361 |
children | f59cff59a630 |
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"> |
2856
a2a82e887b18
client: identify: changed header color for measurements
Markus Kottlaender <markus@intevation.de>
parents:
2835
diff
changeset
|
16 <small class="d-block bg-secondary text-light text-center 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> |
2534
bb5286acfee2
client: reduced spacings between and inside boxes and more compact main menu
Markus Kottlaender <markus@intevation.de>
parents:
2441
diff
changeset
|
59 <div class="versioninfo border-top box-body"> |
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
60 <span v-translate="{ license: 'AGPL-3.0-or-later' }"> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
61 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
|
62 %{ license } without warranty, see docs for details. |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
63 </span> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
64 <br /> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
65 <a href="https://hg.intevation.de/gemma/file/tip"> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
66 <translate>source-code</translate> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
67 </a> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
68 {{ versionStr }} <br />© via donau. ⓔ Intevation. <br /> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
69 <span v-translate="{ name: 'OpenSteetMap' }" |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
70 >Some data © |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
71 <a href="https://www.openstreetmap.org/copyright">%{ name }</a> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
72 contributors. |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
73 </span> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
74 <br /> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
75 <span v-translate="{ geoLicense: 'CC-BY-4.0' }"> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
76 Uses |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
77 <a href="https://download.geonames.org/export/dump/readme.txt" |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
78 >GeoNames</a |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
79 > |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
80 under %{ geoLicense }. |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
81 </span> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
82 <translate>Generated PDFs use font: </translate> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
83 <a href="http://libertine-fonts.org">LinBiolinum</a> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
84 </div> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
85 </div> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
86 </div> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
87 </template> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
88 |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
89 <style lang="scss" scoped> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
90 .features { |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
91 max-height: 19rem; |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
92 overflow-y: auto; |
2372
20e4efa64320
client: improved row colors in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2371
diff
changeset
|
93 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
|
94 .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
|
95 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
|
96 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
|
97 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
|
98 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
|
99 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
|
100 } |
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
|
101 } |
2372
20e4efa64320
client: improved row colors in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2371
diff
changeset
|
102 &:nth-child(even) { |
20e4efa64320
client: improved row colors in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2371
diff
changeset
|
103 background: #f8f8f8; |
20e4efa64320
client: improved row colors in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2371
diff
changeset
|
104 } |
20e4efa64320
client: improved row colors in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2371
diff
changeset
|
105 &:hover { |
20e4efa64320
client: improved row colors in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2371
diff
changeset
|
106 background: #eeeeee; |
20e4efa64320
client: improved row colors in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2371
diff
changeset
|
107 } |
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
108 } |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
109 } |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
110 |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
111 .versioninfo { |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
112 font-size: 60%; |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
113 white-space: normal; |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
114 } |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
115 </style> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
116 |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
117 <script> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
118 /* 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
|
119 * without warranty, see README.md and license for details. |
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 * SPDX-License-Identifier: AGPL-3.0-or-later |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
122 * License-Filename: LICENSES/AGPL-3.0.txt |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
123 * |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
124 * Copyright (C) 2018, 2019 by via donau |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
125 * – Österreichische Wasserstraßen-Gesellschaft mbH |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
126 * Software engineering by Intevation GmbH |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
127 * |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
128 * Author(s): |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
129 * Thomas Junk <thomas.junk@intevation.de> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
130 * Bernhard E. Reiter <bernhard.reiter@intevation.de> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
131 * Markus Kottländer <markus.kottlaender@intevation.de> |
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 import { mapState, mapGetters } from "vuex"; |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
134 import { formatter } from "./formatter"; |
2747
fb5deecb77f1
client:identified box: implement the bbox zoom button
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2743
diff
changeset
|
135 import { getCenter } from "ol/extent"; |
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
136 |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
137 export default { |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
138 name: "identify", |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
139 computed: { |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
140 ...mapGetters("application", ["versionStr"]), |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
141 ...mapState("application", ["showIdentify"]), |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
142 ...mapGetters("map", ["filteredIdentifiedFeatures"]), |
2754
d0f6c222f4f9
client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2747
diff
changeset
|
143 ...mapState("map", ["currentMeasurement"]), |
d0f6c222f4f9
client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2747
diff
changeset
|
144 identifiedLabel() { |
d0f6c222f4f9
client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2747
diff
changeset
|
145 return this.$gettext("Identified"); |
d0f6c222f4f9
client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2747
diff
changeset
|
146 } |
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
147 }, |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
148 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
|
149 zoomTo(feature) { |
2747
fb5deecb77f1
client:identified box: implement the bbox zoom button
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2743
diff
changeset
|
150 this.$store.commit("map/moveMap", { |
fb5deecb77f1
client:identified box: implement the bbox zoom button
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2743
diff
changeset
|
151 coordinates: getCenter( |
fb5deecb77f1
client:identified box: implement the bbox zoom button
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2743
diff
changeset
|
152 feature |
fb5deecb77f1
client:identified box: implement the bbox zoom button
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2743
diff
changeset
|
153 .getGeometry() |
fb5deecb77f1
client:identified box: implement the bbox zoom button
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2743
diff
changeset
|
154 .clone() |
fb5deecb77f1
client:identified box: implement the bbox zoom button
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2743
diff
changeset
|
155 .transform("EPSG:3857", "EPSG:4326") |
fb5deecb77f1
client:identified box: implement the bbox zoom button
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2743
diff
changeset
|
156 .getExtent() |
fb5deecb77f1
client:identified box: implement the bbox zoom button
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2743
diff
changeset
|
157 ), |
fb5deecb77f1
client:identified box: implement the bbox zoom button
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2743
diff
changeset
|
158 zoom: 17, |
fb5deecb77f1
client:identified box: implement the bbox zoom button
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2743
diff
changeset
|
159 preventZoomOut: true |
2735
3c2ac140ad30
identify_tool: zoom to BBox PoC implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2534
diff
changeset
|
160 }); |
3c2ac140ad30
identify_tool: zoom to BBox PoC implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2534
diff
changeset
|
161 }, |
2387
f185503ef35a
client: unified box's header styles by creating a reusable component
Markus Kottlaender <markus@intevation.de>
parents:
2372
diff
changeset
|
162 close() { |
f185503ef35a
client: unified box's header styles by creating a reusable component
Markus Kottlaender <markus@intevation.de>
parents:
2372
diff
changeset
|
163 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
|
164 }, |
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
165 featureId(feature) { |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
166 // cut away everything from the last . to the end |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
167 return feature.getId().replace(/[.][^.]*$/, ""); |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
168 }, |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
169 featureLabel(feature) { |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
170 if (formatter.hasOwnProperty(this.featureId(feature))) { |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
171 return formatter[this.featureId(feature)].label; |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
172 } |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
173 return this.featureId(feature); |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
174 }, |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
175 featureProps(feature) { |
2441
9de710bdb535
client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents:
2424
diff
changeset
|
176 let featureId = this.featureId(feature); |
9de710bdb535
client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents:
2424
diff
changeset
|
177 |
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
178 // create array with {key, val} objects |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
179 let propsArray = []; |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
180 Object.keys(feature.getProperties()).forEach(key => { |
2423
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
181 // 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
|
182 if (key !== feature.getGeometryName()) { |
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
183 let val = feature.getProperties()[key]; |
2405
ef928c63388a
client: handle json values in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2387
diff
changeset
|
184 |
2423
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
185 // 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
|
186 let jsonObj = this.getObjectFromString(val); |
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
187 if (jsonObj) { |
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
188 Object.keys(jsonObj).forEach(key => { |
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
189 propsArray.push({ key, val: jsonObj[key] }); |
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
190 }); |
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
191 } else { |
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
192 // 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
|
193 propsArray.push({ key, val }); |
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
194 } |
2405
ef928c63388a
client: handle json values in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2387
diff
changeset
|
195 } |
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
196 }); |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
197 |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
198 // change labels and remove unneeded properties |
2441
9de710bdb535
client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents:
2424
diff
changeset
|
199 // 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
|
200 propsArray = propsArray.map(formatter.all).filter(p => p); |
2441
9de710bdb535
client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents:
2424
diff
changeset
|
201 // feature specific |
9de710bdb535
client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents:
2424
diff
changeset
|
202 if ( |
9de710bdb535
client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents:
2424
diff
changeset
|
203 formatter.hasOwnProperty(featureId) && |
9de710bdb535
client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents:
2424
diff
changeset
|
204 formatter[featureId].hasOwnProperty("props") |
9de710bdb535
client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents:
2424
diff
changeset
|
205 ) { |
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
|
206 propsArray = propsArray.map(formatter[featureId].props).filter(p => p); |
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
207 } |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
208 |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
209 // remove underscores in labels that where not previously changed already |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
210 propsArray = propsArray.map(prop => { |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
211 return { key: prop.key.replace(/_/g, " "), val: prop.val }; |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
212 }); |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
213 |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
214 return propsArray; |
2423
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
215 }, |
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
216 getObjectFromString(val) { |
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
217 // 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
|
218 // 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
|
219 // 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
|
220 if ( |
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
221 Object.prototype.toString.call(val) === "[object String]" && |
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
222 val[0] === "{" |
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
223 ) { |
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
224 try { |
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
225 return JSON.parse(val); |
2424
b6deb03ef13f
client: fix linter error (empty block)
Markus Kottlaender <markus@intevation.de>
parents:
2423
diff
changeset
|
226 } catch (e) { |
b6deb03ef13f
client: fix linter error (empty block)
Markus Kottlaender <markus@intevation.de>
parents:
2423
diff
changeset
|
227 return null; |
b6deb03ef13f
client: fix linter error (empty block)
Markus Kottlaender <markus@intevation.de>
parents:
2423
diff
changeset
|
228 } |
2423
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
229 } |
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
230 return null; |
2371
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 }; |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
234 </script> |