Mercurial > gemma
annotate client/src/components/identify/Identify.vue @ 4269:837f90680d4c
identify: complete helper methods for legend
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Tue, 27 Aug 2019 15:51:05 +0200 |
parents | c5642480eb9b |
children | e4d6c6339cb4 |
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"> |
4258
57c38087fe18
client: correct strings-marking for translations (identify box)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
4224
diff
changeset
|
17 <translate> Measurement</translate> |
2371
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 > |
4258
57c38087fe18
client: correct strings-marking for translations (identify box)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
4224
diff
changeset
|
33 {{ 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> |
4265
2596a028dc3a
Feature_info: display partial legend information for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents:
4258
diff
changeset
|
42 <div |
2596a028dc3a
Feature_info: display partial legend information for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents:
4258
diff
changeset
|
43 v-if="showBottleneckMeta(feature)" |
2596a028dc3a
Feature_info: display partial legend information for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents:
4258
diff
changeset
|
44 class="ml-2 mb-1 text-left d-flex" |
2596a028dc3a
Feature_info: display partial legend information for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents:
4258
diff
changeset
|
45 > |
2596a028dc3a
Feature_info: display partial legend information for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents:
4258
diff
changeset
|
46 <font-awesome-icon |
2596a028dc3a
Feature_info: display partial legend information for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents:
4258
diff
changeset
|
47 icon="caret-up" |
2596a028dc3a
Feature_info: display partial legend information for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents:
4258
diff
changeset
|
48 fixed-width |
4267
c5642480eb9b
styles: rename 'currency' to recency
Thomas Junk <thomas.junk@intevation.de>
parents:
4266
diff
changeset
|
49 :style="{ color: recencyColor(feature), 'font-size': 'x-large' }" |
4265
2596a028dc3a
Feature_info: display partial legend information for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents:
4258
diff
changeset
|
50 /> |
2596a028dc3a
Feature_info: display partial legend information for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents:
4258
diff
changeset
|
51 <small class="my-auto"> |
4267
c5642480eb9b
styles: rename 'currency' to recency
Thomas Junk <thomas.junk@intevation.de>
parents:
4266
diff
changeset
|
52 {{ recency(feature) }} |
4265
2596a028dc3a
Feature_info: display partial legend information for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents:
4258
diff
changeset
|
53 </small> |
2596a028dc3a
Feature_info: display partial legend information for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents:
4258
diff
changeset
|
54 </div> |
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
55 <small |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
56 v-for="prop in featureProps(feature)" |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
57 :key="prop.key" |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
58 v-if="prop.val" |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
59 class="d-flex justify-content-between px-2" |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
60 > |
4258
57c38087fe18
client: correct strings-marking for translations (identify box)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
4224
diff
changeset
|
61 <b>{{ 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
|
62 <span>{{ prop.val }}</span> |
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
63 </small> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
64 </div> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
65 <div |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
66 v-if="!currentMeasurement && !filteredIdentifiedFeatures.length" |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
67 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
|
68 > |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
69 <translate>No features identified.</translate> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
70 </div> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
71 </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
|
72 <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
|
73 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
|
74 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
|
75 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
|
76 > |
3395
6075c4c25568
client: change user manual location
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3369
diff
changeset
|
77 <translate>Download</translate> |
6075c4c25568
client: change user manual location
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3369
diff
changeset
|
78 <a |
6075c4c25568
client: change user manual location
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3369
diff
changeset
|
79 :href="userManualUrl ? userManualUrl : '#'" |
3509
0e91d40af23e
client: fix User manual filename
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3399
diff
changeset
|
80 :download="usermanualFilename" |
3395
6075c4c25568
client: change user manual location
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3369
diff
changeset
|
81 ><translate> User Manual</translate></a |
6075c4c25568
client: change user manual location
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3369
diff
changeset
|
82 > |
6075c4c25568
client: change user manual location
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3369
diff
changeset
|
83 </div> |
2534
bb5286acfee2
client: reduced spacings between and inside boxes and more compact main menu
Markus Kottlaender <markus@intevation.de>
parents:
2441
diff
changeset
|
84 <div class="versioninfo border-top box-body"> |
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
85 <span v-translate="{ license: 'AGPL-3.0-or-later' }"> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
86 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
|
87 %{ license } without warranty, see docs for details. |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
88 </span> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
89 <br /> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
90 <a href="https://hg.intevation.de/gemma/file/tip"> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
91 <translate>source-code</translate> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
92 </a> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
93 {{ versionStr }} <br />© via donau. ⓔ Intevation. <br /> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
94 <span v-translate="{ name: 'OpenSteetMap' }" |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
95 >Some data © |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
96 <a href="https://www.openstreetmap.org/copyright">%{ name }</a> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
97 contributors. |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
98 </span> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
99 <br /> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
100 <span v-translate="{ geoLicense: 'CC-BY-4.0' }"> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
101 Uses |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
102 <a href="https://download.geonames.org/export/dump/readme.txt" |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
103 >GeoNames</a |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
104 > |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
105 under %{ geoLicense }. |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
106 </span> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
107 <translate>Generated PDFs use font: </translate> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
108 <a href="http://libertine-fonts.org">LinBiolinum</a> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
109 </div> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
110 </div> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
111 </div> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
112 </template> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
113 |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
114 <style lang="scss" scoped> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
115 .features { |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
116 max-height: 19rem; |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
117 overflow-y: auto; |
2372
20e4efa64320
client: improved row colors in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2371
diff
changeset
|
118 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
|
119 .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
|
120 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
|
121 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
|
122 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
|
123 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
|
124 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
|
125 } |
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
|
126 } |
2372
20e4efa64320
client: improved row colors in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2371
diff
changeset
|
127 &:nth-child(even) { |
20e4efa64320
client: improved row colors in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2371
diff
changeset
|
128 background: #f8f8f8; |
20e4efa64320
client: improved row colors in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2371
diff
changeset
|
129 } |
20e4efa64320
client: improved row colors in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2371
diff
changeset
|
130 &:hover { |
20e4efa64320
client: improved row colors in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2371
diff
changeset
|
131 background: #eeeeee; |
20e4efa64320
client: improved row colors in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2371
diff
changeset
|
132 } |
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
133 } |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
134 } |
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 .versioninfo { |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
137 font-size: 60%; |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
138 white-space: normal; |
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 </style> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
141 |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
142 <script> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
143 /* 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
|
144 * without warranty, see README.md and license for details. |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
145 * |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
146 * SPDX-License-Identifier: AGPL-3.0-or-later |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
147 * License-Filename: LICENSES/AGPL-3.0.txt |
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 * Copyright (C) 2018, 2019 by via donau |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
150 * – Österreichische Wasserstraßen-Gesellschaft mbH |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
151 * Software engineering by Intevation GmbH |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
152 * |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
153 * Author(s): |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
154 * Thomas Junk <thomas.junk@intevation.de> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
155 * Bernhard E. Reiter <bernhard.reiter@intevation.de> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
156 * Markus Kottländer <markus.kottlaender@intevation.de> |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
157 */ |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
158 import { mapState, mapGetters } from "vuex"; |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
159 import { formatter } from "./formatter"; |
2747
fb5deecb77f1
client:identified box: implement the bbox zoom button
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2743
diff
changeset
|
160 import { getCenter } from "ol/extent"; |
4265
2596a028dc3a
Feature_info: display partial legend information for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents:
4258
diff
changeset
|
161 import classifications from "../../lib/classifications"; |
2596a028dc3a
Feature_info: display partial legend information for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents:
4258
diff
changeset
|
162 import { styleFactory } from "@/components/map/styles"; |
2596a028dc3a
Feature_info: display partial legend information for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents:
4258
diff
changeset
|
163 |
4267
c5642480eb9b
styles: rename 'currency' to recency
Thomas Junk <thomas.junk@intevation.de>
parents:
4266
diff
changeset
|
164 const { |
4269
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
165 recencyColorCodes, |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
166 gmAvailabilityColorCodes, |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
167 forecastAccuracyColorCodes, |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
168 forecastVsRealityColorCodes |
4267
c5642480eb9b
styles: rename 'currency' to recency
Thomas Junk <thomas.junk@intevation.de>
parents:
4266
diff
changeset
|
169 } = styleFactory(); |
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
170 |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
171 export default { |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
172 name: "identify", |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
173 computed: { |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
174 ...mapGetters("application", ["versionStr"]), |
4265
2596a028dc3a
Feature_info: display partial legend information for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents:
4258
diff
changeset
|
175 ...mapState("application", ["showIdentify", "userManualUrl", "config"]), |
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
176 ...mapGetters("map", ["filteredIdentifiedFeatures"]), |
2754
d0f6c222f4f9
client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2747
diff
changeset
|
177 ...mapState("map", ["currentMeasurement"]), |
d0f6c222f4f9
client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2747
diff
changeset
|
178 identifiedLabel() { |
3187
5487abeb380c
client: identify: edited title of box header
Markus Kottlaender <markus@intevation.de>
parents:
3044
diff
changeset
|
179 return this.$gettext("Identified Features"); |
3509
0e91d40af23e
client: fix User manual filename
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3399
diff
changeset
|
180 }, |
0e91d40af23e
client: fix User manual filename
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3399
diff
changeset
|
181 usermanualFilename() { |
0e91d40af23e
client: fix User manual filename
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3399
diff
changeset
|
182 return this.$gettext("User Manual"); |
2754
d0f6c222f4f9
client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2747
diff
changeset
|
183 } |
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
184 }, |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
185 methods: { |
4269
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
186 gmAvailability(feature) { |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
187 const latestInHours = this.config.gm_latest_hours; |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
188 const measurementsIn14D = this.config.gm_min_values_14d; |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
189 const messagesPerState = { |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
190 OK: |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
191 this.$gettext("Last measurement <") + |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
192 ` ${latestInHours} (${measurementsIn14D} in 14d)`, |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
193 WARNING: |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
194 this.$gettext("Below treshold") + `: ${measurementsIn14D} in 14d`, |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
195 DANGER: |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
196 this.$gettext("Latest measurement older than") + ` ${latestInHours} d` |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
197 }; |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
198 return messagesPerState[[classifications.gmAvailability(feature)]]; |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
199 }, |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
200 gmAvailabilityColor(feature) { |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
201 return gmAvailabilityColorCodes[classifications.gmAvailability(feature)]; |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
202 }, |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
203 forecastAccuracy(feature) { |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
204 const offset24 = this.config.gm_forecast_offset_24h; |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
205 const offset72 = this.config.gm_forecast_offset_72h; |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
206 const messagesPerState = { |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
207 OK: |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
208 this.$gettext("Highest confidence") + |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
209 ` <${offset24} cm/24h, <${offset72} cm/72h`, |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
210 WARNING: this.$gettext("Confidence per 72h") + ` > ${offset72} cm`, |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
211 DANGER: this.$gettext("Confidence per 24h") + ` > ${offset24} cm` |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
212 }; |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
213 return messagesPerState[[classifications.forecastAccuracy(feature)]]; |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
214 }, |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
215 forecastAccuracyColor(feature) { |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
216 return forecastAccuracyColorCodes[ |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
217 classifications.forecastAccuracy(feature) |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
218 ]; |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
219 }, |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
220 forecastVsReality(feature) { |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
221 const nsc24 = this.config.gm_forecast_vs_reality_nsc_24h; |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
222 const nsc72 = this.config.gm_forecast_vs_reality_nsc_72h; |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
223 const messagesPerState = { |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
224 OK: this.$gettext("Nash-Sutcliffe") + `>${nsc24} /24h >${nsc72} / 72h`, |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
225 WARNING: this.$gettext("Nash-Sutcliffe") + ` < ${nsc72}`, |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
226 DANGER: this.$gettext("Nash-Sutcliffe") + ` < ${nsc24}` |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
227 }; |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
228 return messagesPerState[[classifications.forecastVsReality(feature)]]; |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
229 }, |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
230 forecastVsRealityColor(feature) { |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
231 return forecastVsRealityColorCodes[ |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
232 classifications.forecastVsReality(feature) |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
233 ]; |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
234 }, |
4267
c5642480eb9b
styles: rename 'currency' to recency
Thomas Junk <thomas.junk@intevation.de>
parents:
4266
diff
changeset
|
235 recency(feature) { |
4265
2596a028dc3a
Feature_info: display partial legend information for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents:
4258
diff
changeset
|
236 const revisitingFactor = this.config.bn_revtime_multiplier; |
2596a028dc3a
Feature_info: display partial legend information for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents:
4258
diff
changeset
|
237 const messagesPerState = { |
2596a028dc3a
Feature_info: display partial legend information for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents:
4258
diff
changeset
|
238 OK: this.$gettext("Data within the revisiting time"), |
2596a028dc3a
Feature_info: display partial legend information for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents:
4258
diff
changeset
|
239 WARNING: |
4269
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
240 this.$gettext("Data within revisiting treshold") + |
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
241 ` (${revisitingFactor})`, |
4265
2596a028dc3a
Feature_info: display partial legend information for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents:
4258
diff
changeset
|
242 DANGER: |
4269
837f90680d4c
identify: complete helper methods for legend
Thomas Junk <thomas.junk@intevation.de>
parents:
4267
diff
changeset
|
243 this.$gettext("Data too old. Treshold:") + ` (${revisitingFactor})` |
4265
2596a028dc3a
Feature_info: display partial legend information for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents:
4258
diff
changeset
|
244 }; |
2596a028dc3a
Feature_info: display partial legend information for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents:
4258
diff
changeset
|
245 return messagesPerState[classifications.surveyCurrency(feature)]; |
2596a028dc3a
Feature_info: display partial legend information for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents:
4258
diff
changeset
|
246 }, |
4267
c5642480eb9b
styles: rename 'currency' to recency
Thomas Junk <thomas.junk@intevation.de>
parents:
4266
diff
changeset
|
247 recencyColor(feature) { |
c5642480eb9b
styles: rename 'currency' to recency
Thomas Junk <thomas.junk@intevation.de>
parents:
4266
diff
changeset
|
248 return recencyColorCodes[classifications.surveyCurrency(feature)]; |
4265
2596a028dc3a
Feature_info: display partial legend information for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents:
4258
diff
changeset
|
249 }, |
2596a028dc3a
Feature_info: display partial legend information for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents:
4258
diff
changeset
|
250 showBottleneckMeta(feature) { |
2596a028dc3a
Feature_info: display partial legend information for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents:
4258
diff
changeset
|
251 const result = /bottleneck/.test(feature.getId().toLowerCase()); |
2596a028dc3a
Feature_info: display partial legend information for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents:
4258
diff
changeset
|
252 return result; |
2596a028dc3a
Feature_info: display partial legend information for bottlenecks
Thomas Junk <thomas.junk@intevation.de>
parents:
4258
diff
changeset
|
253 }, |
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
|
254 zoomTo(feature) { |
3044
c71373594719
client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents:
3029
diff
changeset
|
255 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
|
256 coordinates: getCenter( |
fb5deecb77f1
client:identified box: implement the bbox zoom button
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2743
diff
changeset
|
257 feature |
fb5deecb77f1
client:identified box: implement the bbox zoom button
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2743
diff
changeset
|
258 .getGeometry() |
fb5deecb77f1
client:identified box: implement the bbox zoom button
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2743
diff
changeset
|
259 .clone() |
fb5deecb77f1
client:identified box: implement the bbox zoom button
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2743
diff
changeset
|
260 .transform("EPSG:3857", "EPSG:4326") |
fb5deecb77f1
client:identified box: implement the bbox zoom button
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2743
diff
changeset
|
261 .getExtent() |
fb5deecb77f1
client:identified box: implement the bbox zoom button
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2743
diff
changeset
|
262 ), |
fb5deecb77f1
client:identified box: implement the bbox zoom button
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2743
diff
changeset
|
263 zoom: 17, |
fb5deecb77f1
client:identified box: implement the bbox zoom button
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2743
diff
changeset
|
264 preventZoomOut: true |
2735
3c2ac140ad30
identify_tool: zoom to BBox PoC implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2534
diff
changeset
|
265 }); |
3c2ac140ad30
identify_tool: zoom to BBox PoC implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2534
diff
changeset
|
266 }, |
2387
f185503ef35a
client: unified box's header styles by creating a reusable component
Markus Kottlaender <markus@intevation.de>
parents:
2372
diff
changeset
|
267 close() { |
f185503ef35a
client: unified box's header styles by creating a reusable component
Markus Kottlaender <markus@intevation.de>
parents:
2372
diff
changeset
|
268 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
|
269 }, |
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
270 featureId(feature) { |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
271 // 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
|
272 let id = ""; |
81c2e561fe03
Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2857
diff
changeset
|
273 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
|
274 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
|
275 } |
81c2e561fe03
Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2857
diff
changeset
|
276 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
|
277 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
|
278 } |
81c2e561fe03
Use distance marks an axis via WMS. Added legend and featureinfo.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2857
diff
changeset
|
279 return id.replace(/[.][^.]*$/, ""); |
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
280 }, |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
281 featureLabel(feature) { |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
282 if (formatter.hasOwnProperty(this.featureId(feature))) { |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
283 return formatter[this.featureId(feature)].label; |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
284 } |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
285 return this.featureId(feature); |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
286 }, |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
287 featureProps(feature) { |
2441
9de710bdb535
client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents:
2424
diff
changeset
|
288 let featureId = this.featureId(feature); |
9de710bdb535
client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents:
2424
diff
changeset
|
289 |
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
290 // create array with {key, val} objects |
4224
bb66e144dece
client: fix identify for bottlenecks
Bernhard Reiter <bernhard@intevation.de>
parents:
3509
diff
changeset
|
291 // skip geometry here, because it is slightly more robust |
bb66e144dece
client: fix identify for bottlenecks
Bernhard Reiter <bernhard@intevation.de>
parents:
3509
diff
changeset
|
292 // to get the name of the property to skip and we need a reference |
bb66e144dece
client: fix identify for bottlenecks
Bernhard Reiter <bernhard@intevation.de>
parents:
3509
diff
changeset
|
293 // to `feature` for doing so. |
bb66e144dece
client: fix identify for bottlenecks
Bernhard Reiter <bernhard@intevation.de>
parents:
3509
diff
changeset
|
294 // The geometry is not needed (and previous comments in the code |
bb66e144dece
client: fix identify for bottlenecks
Bernhard Reiter <bernhard@intevation.de>
parents:
3509
diff
changeset
|
295 // mentioned a problem with it becoming cyclic when left in). |
bb66e144dece
client: fix identify for bottlenecks
Bernhard Reiter <bernhard@intevation.de>
parents:
3509
diff
changeset
|
296 let skipList = [feature.getGeometryName()]; |
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
297 let propsArray = []; |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
298 Object.keys(feature.getProperties()).forEach(key => { |
4224
bb66e144dece
client: fix identify for bottlenecks
Bernhard Reiter <bernhard@intevation.de>
parents:
3509
diff
changeset
|
299 if (skipList.indexOf(key) === -1) { |
2423
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
300 let val = feature.getProperties()[key]; |
2405
ef928c63388a
client: handle json values in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2387
diff
changeset
|
301 |
4224
bb66e144dece
client: fix identify for bottlenecks
Bernhard Reiter <bernhard@intevation.de>
parents:
3509
diff
changeset
|
302 // if val is a valid json object string, |
bb66e144dece
client: fix identify for bottlenecks
Bernhard Reiter <bernhard@intevation.de>
parents:
3509
diff
changeset
|
303 // spread its values into the array |
2423
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
304 let jsonObj = this.getObjectFromString(val); |
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
305 if (jsonObj) { |
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
306 Object.keys(jsonObj).forEach(key => { |
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
307 propsArray.push({ key, val: jsonObj[key] }); |
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
308 }); |
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
309 } else { |
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
310 // 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
|
311 propsArray.push({ key, val }); |
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
312 } |
2405
ef928c63388a
client: handle json values in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2387
diff
changeset
|
313 } |
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
314 }); |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
315 |
4224
bb66e144dece
client: fix identify for bottlenecks
Bernhard Reiter <bernhard@intevation.de>
parents:
3509
diff
changeset
|
316 // run general formatter |
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
|
317 propsArray = propsArray.map(formatter.all).filter(p => p); |
4224
bb66e144dece
client: fix identify for bottlenecks
Bernhard Reiter <bernhard@intevation.de>
parents:
3509
diff
changeset
|
318 // run feature specific formatter |
2441
9de710bdb535
client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents:
2424
diff
changeset
|
319 if ( |
9de710bdb535
client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents:
2424
diff
changeset
|
320 formatter.hasOwnProperty(featureId) && |
9de710bdb535
client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents:
2424
diff
changeset
|
321 formatter[featureId].hasOwnProperty("props") |
9de710bdb535
client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents:
2424
diff
changeset
|
322 ) { |
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
|
323 propsArray = propsArray.map(formatter[featureId].props).filter(p => p); |
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
324 } |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
325 // remove underscores in labels that where not previously changed already |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
326 propsArray = propsArray.map(prop => { |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
327 return { key: prop.key.replace(/_/g, " "), val: prop.val }; |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
328 }); |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
329 |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
330 return propsArray; |
2423
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
331 }, |
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
332 getObjectFromString(val) { |
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
333 // 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
|
334 // 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
|
335 // 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
|
336 if ( |
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
337 Object.prototype.toString.call(val) === "[object String]" && |
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
338 val[0] === "{" |
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
339 ) { |
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
340 try { |
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
341 return JSON.parse(val); |
2424
b6deb03ef13f
client: fix linter error (empty block)
Markus Kottlaender <markus@intevation.de>
parents:
2423
diff
changeset
|
342 } catch (e) { |
b6deb03ef13f
client: fix linter error (empty block)
Markus Kottlaender <markus@intevation.de>
parents:
2423
diff
changeset
|
343 return null; |
b6deb03ef13f
client: fix linter error (empty block)
Markus Kottlaender <markus@intevation.de>
parents:
2423
diff
changeset
|
344 } |
2423
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
345 } |
3423cd4b3136
client: fix json parsing in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
346 return null; |
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
347 } |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
348 } |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
349 }; |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
350 </script> |