Mercurial > gemma
annotate client/src/components/fairway/Fairwayprofile.vue @ 3968:ea4e1ea04e44 diagram-cleanup
client: fairway profile diagram: inlined scaleFairwayProfile method to be more in line with other diagrams
author | Markus Kottlaender <markus@intevation.de> |
---|---|
date | Fri, 12 Jul 2019 16:18:49 +0200 |
parents | 2aaa1948b525 |
children | 2f024d6189ca |
rev | line source |
---|---|
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
1 <template> |
3146
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
2 <div class="d-flex flex-column flex-fill"> |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
3 <UIBoxHeader icon="chart-area" :title="title" :closeCallback="close" /> |
3683
4a00ff7e44f0
client: fairway profile: avoid console error spamming by properly checking properties
Markus Kottlaender <markus@intevation.de>
parents:
3682
diff
changeset
|
4 <div class="d-flex flex-fill" v-if="openLayersMap()"> |
3146
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
5 <DiagramLegend> |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
6 <div class="legend"> |
3323
de0d0685a17b
client: improve diagram-legends style
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3285
diff
changeset
|
7 <span |
de0d0685a17b
client: improve diagram-legends style
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3285
diff
changeset
|
8 style="background-color: #5995ff; width: 20px; height: 20px;" |
de0d0685a17b
client: improve diagram-legends style
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3285
diff
changeset
|
9 ></span> |
de0d0685a17b
client: improve diagram-legends style
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3285
diff
changeset
|
10 Water |
3146
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
11 </div> |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
12 <div class="legend"> |
3323
de0d0685a17b
client: improve diagram-legends style
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3285
diff
changeset
|
13 <span |
3571
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
14 :style=" |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
15 'width: 16px; height: 16px; background-color: rgba(' + |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
16 this.getLayerStyle(1).fillColor.join(',') + |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
17 ',' + |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
18 this.getLayerStyle(1).fillOpacity + |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
19 '); border: dotted 2px rgba(' + |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
20 this.getLayerStyle(1).strokeColor.join(',') + |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
21 ',' + |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
22 this.getLayerStyle(1).strokeOpacity + |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
23 '); background-clip: padding-box; box-sizing: content-box;' |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
24 " |
3323
de0d0685a17b
client: improve diagram-legends style
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3285
diff
changeset
|
25 ></span> |
3571
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
26 Fairway (LOS 1) |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
27 </div> |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
28 <div class="legend"> |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
29 <span |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
30 :style=" |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
31 'width: 16px; height: 16px; background-color: rgba(' + |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
32 this.getLayerStyle(2).fillColor.join(',') + |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
33 ',' + |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
34 this.getLayerStyle(2).fillOpacity + |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
35 '); border: dashed 2px rgba(' + |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
36 this.getLayerStyle(2).strokeColor.join(',') + |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
37 ',' + |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
38 this.getLayerStyle(2).strokeOpacity + |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
39 '); background-clip: padding-box; box-sizing: content-box;' |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
40 " |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
41 ></span> |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
42 Fairway (LOS 2) |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
43 </div> |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
44 <div class="legend"> |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
45 <span |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
46 :style=" |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
47 'width: 16px; height: 16px; background-color: rgba(' + |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
48 this.getLayerStyle(3).fillColor.join(',') + |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
49 ',' + |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
50 this.getLayerStyle(3).fillOpacity + |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
51 '); border: solid 2px rgba(' + |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
52 this.getLayerStyle(3).strokeColor.join(',') + |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
53 ',' + |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
54 this.getLayerStyle(3).strokeOpacity + |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
55 '); background-clip: padding-box; box-sizing: content-box;' |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
56 " |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
57 ></span> |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
58 Fairway (LOS 3) |
3146
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
59 </div> |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
60 <div class="legend"> |
3323
de0d0685a17b
client: improve diagram-legends style
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3285
diff
changeset
|
61 <span |
3534
034657d6604f
client: fairway profiles: improved legend
Markus Kottlaender <markus@intevation.de>
parents:
3531
diff
changeset
|
62 style="width: 14px; height: 14px; background-color: #4a2f06; border: solid 3px black; background-clip: padding-box; box-sizing: content-box;" |
3323
de0d0685a17b
client: improve diagram-legends style
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3285
diff
changeset
|
63 ></span> |
3534
034657d6604f
client: fairway profiles: improved legend
Markus Kottlaender <markus@intevation.de>
parents:
3531
diff
changeset
|
64 Sediment |
034657d6604f
client: fairway profiles: improved legend
Markus Kottlaender <markus@intevation.de>
parents:
3531
diff
changeset
|
65 </div> |
034657d6604f
client: fairway profiles: improved legend
Markus Kottlaender <markus@intevation.de>
parents:
3531
diff
changeset
|
66 <div class="legend"> |
034657d6604f
client: fairway profiles: improved legend
Markus Kottlaender <markus@intevation.de>
parents:
3531
diff
changeset
|
67 <span |
034657d6604f
client: fairway profiles: improved legend
Markus Kottlaender <markus@intevation.de>
parents:
3531
diff
changeset
|
68 style="width: 14px; height: 14px; background-color: rgba(74, 47, 6, 0.6); border: solid 3px #943007; background-clip: padding-box; box-sizing: content-box;" |
034657d6604f
client: fairway profiles: improved legend
Markus Kottlaender <markus@intevation.de>
parents:
3531
diff
changeset
|
69 ></span> |
034657d6604f
client: fairway profiles: improved legend
Markus Kottlaender <markus@intevation.de>
parents:
3531
diff
changeset
|
70 Sediment (Compare) |
3146
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
71 </div> |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
72 <div> |
3240
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
73 <select |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
74 v-model="form.template" |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
75 @change="applyChange" |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
76 class="form-control d-block custom-select-sm w-100" |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
77 > |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
78 <option |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
79 v-for="template in templates" |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
80 :value="template" |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
81 :key="template.name" |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
82 > |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
83 {{ template.name }} |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
84 </option> |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
85 </select> |
3146
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
86 <button |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
87 @click="downloadPDF" |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
88 type="button" |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
89 class="btn btn-sm btn-info d-block w-100 mt-2" |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
90 > |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
91 <translate>Export to PDF</translate> |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
92 </button> |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
93 </div> |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
94 </DiagramLegend> |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
95 <div |
3963
feb53713bc2f
client: moved duplicated code to mixins and unified code patterns in diagram components [WIP]
Markus Kottlaender <markus@intevation.de>
parents:
3942
diff
changeset
|
96 class="d-flex flex-fill justify-content-center align-items-center position-relative" |
feb53713bc2f
client: moved duplicated code to mixins and unified code patterns in diagram components [WIP]
Markus Kottlaender <markus@intevation.de>
parents:
3942
diff
changeset
|
97 :id="containerId" |
3146
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
98 > |
3644
9e91b416d5bb
client: cross profile: display arrow in diagram
Markus Kottlaender <markus@intevation.de>
parents:
3590
diff
changeset
|
99 <div class="direction-indicator"></div> |
3963
feb53713bc2f
client: moved duplicated code to mixins and unified code patterns in diagram components [WIP]
Markus Kottlaender <markus@intevation.de>
parents:
3942
diff
changeset
|
100 <div v-if="!fairwayData.length"> |
3146
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
101 <translate>No data available.</translate> |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
102 </div> |
2854
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
103 </div> |
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
104 </div> |
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
105 </div> |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
106 </template> |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
107 |
3644
9e91b416d5bb
client: cross profile: display arrow in diagram
Markus Kottlaender <markus@intevation.de>
parents:
3590
diff
changeset
|
108 <style lang="sass" scoped> |
9e91b416d5bb
client: cross profile: display arrow in diagram
Markus Kottlaender <markus@intevation.de>
parents:
3590
diff
changeset
|
109 .direction-indicator |
9e91b416d5bb
client: cross profile: display arrow in diagram
Markus Kottlaender <markus@intevation.de>
parents:
3590
diff
changeset
|
110 width: 70px |
9e91b416d5bb
client: cross profile: display arrow in diagram
Markus Kottlaender <markus@intevation.de>
parents:
3590
diff
changeset
|
111 height: 0 |
9e91b416d5bb
client: cross profile: display arrow in diagram
Markus Kottlaender <markus@intevation.de>
parents:
3590
diff
changeset
|
112 border-top: dashed 2px #333 |
9e91b416d5bb
client: cross profile: display arrow in diagram
Markus Kottlaender <markus@intevation.de>
parents:
3590
diff
changeset
|
113 position: absolute |
9e91b416d5bb
client: cross profile: display arrow in diagram
Markus Kottlaender <markus@intevation.de>
parents:
3590
diff
changeset
|
114 bottom: 20px |
9e91b416d5bb
client: cross profile: display arrow in diagram
Markus Kottlaender <markus@intevation.de>
parents:
3590
diff
changeset
|
115 left: 115px |
9e91b416d5bb
client: cross profile: display arrow in diagram
Markus Kottlaender <markus@intevation.de>
parents:
3590
diff
changeset
|
116 margin-left: -35px |
9e91b416d5bb
client: cross profile: display arrow in diagram
Markus Kottlaender <markus@intevation.de>
parents:
3590
diff
changeset
|
117 &::after |
9e91b416d5bb
client: cross profile: display arrow in diagram
Markus Kottlaender <markus@intevation.de>
parents:
3590
diff
changeset
|
118 content: "" |
9e91b416d5bb
client: cross profile: display arrow in diagram
Markus Kottlaender <markus@intevation.de>
parents:
3590
diff
changeset
|
119 width: 0 |
9e91b416d5bb
client: cross profile: display arrow in diagram
Markus Kottlaender <markus@intevation.de>
parents:
3590
diff
changeset
|
120 height: 0 |
9e91b416d5bb
client: cross profile: display arrow in diagram
Markus Kottlaender <markus@intevation.de>
parents:
3590
diff
changeset
|
121 border-width: 10px |
9e91b416d5bb
client: cross profile: display arrow in diagram
Markus Kottlaender <markus@intevation.de>
parents:
3590
diff
changeset
|
122 border-top-width: 5px |
9e91b416d5bb
client: cross profile: display arrow in diagram
Markus Kottlaender <markus@intevation.de>
parents:
3590
diff
changeset
|
123 border-bottom-width: 5px |
9e91b416d5bb
client: cross profile: display arrow in diagram
Markus Kottlaender <markus@intevation.de>
parents:
3590
diff
changeset
|
124 border-style: solid |
9e91b416d5bb
client: cross profile: display arrow in diagram
Markus Kottlaender <markus@intevation.de>
parents:
3590
diff
changeset
|
125 border-color: transparent |
9e91b416d5bb
client: cross profile: display arrow in diagram
Markus Kottlaender <markus@intevation.de>
parents:
3590
diff
changeset
|
126 border-left-color: #333 |
9e91b416d5bb
client: cross profile: display arrow in diagram
Markus Kottlaender <markus@intevation.de>
parents:
3590
diff
changeset
|
127 position: absolute |
9e91b416d5bb
client: cross profile: display arrow in diagram
Markus Kottlaender <markus@intevation.de>
parents:
3590
diff
changeset
|
128 right: -20px |
9e91b416d5bb
client: cross profile: display arrow in diagram
Markus Kottlaender <markus@intevation.de>
parents:
3590
diff
changeset
|
129 top: -6px |
9e91b416d5bb
client: cross profile: display arrow in diagram
Markus Kottlaender <markus@intevation.de>
parents:
3590
diff
changeset
|
130 </style> |
9e91b416d5bb
client: cross profile: display arrow in diagram
Markus Kottlaender <markus@intevation.de>
parents:
3590
diff
changeset
|
131 |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
132 <script> |
1362
ca33ad696594
remove the first empyty lines
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1361
diff
changeset
|
133 /* This is Free Software under GNU Affero General Public License v >= 3.0 |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
134 * without warranty, see README.md and license for details. |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1313
diff
changeset
|
135 * |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
136 * SPDX-License-Identifier: AGPL-3.0-or-later |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
137 * License-Filename: LICENSES/AGPL-3.0.txt |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1313
diff
changeset
|
138 * |
3799
f4deb4aae485
client: improve pdf generation
Bernhard Reiter <bernhard@intevation.de>
parents:
3785
diff
changeset
|
139 * Copyright (C) 2018, 2019 by via donau |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
140 * – Österreichische Wasserstraßen-Gesellschaft mbH |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
141 * Software engineering by Intevation GmbH |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1313
diff
changeset
|
142 * |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
143 * Author(s): |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
144 * Thomas Junk <thomas.junk@intevation.de> |
2549
9bf6b767a56a
client: refactored and improved splitscreen for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2540
diff
changeset
|
145 * Markus Kottländer <markus.kottlaender@intevation.de> |
3285
aac1ca73e92a
client: diagram-template:(cleanup) move reusable pdf-functions to mixins.js
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3250
diff
changeset
|
146 * Fadi Abbud <fadi.abbud@intevation.de> |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
147 */ |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
148 import * as d3 from "d3"; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
149 import { mapState, mapGetters } from "vuex"; |
3936
d859ec6cf2f0
Fairwayprofile enhanced
Thomas Junk <thomas.junk@intevation.de>
parents:
3928
diff
changeset
|
150 import { diagram, pdfgen, templateLoader } from "@/lib/mixins"; |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
151 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
152 const GROUND_COLOR = "#4A2F06"; |
2854
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
153 const WATER_COLOR = "#005DFF"; |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
154 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
155 export default { |
3936
d859ec6cf2f0
Fairwayprofile enhanced
Thomas Junk <thomas.junk@intevation.de>
parents:
3928
diff
changeset
|
156 mixins: [diagram, pdfgen, templateLoader], |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
157 data() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
158 return { |
3968
ea4e1ea04e44
client: fairway profile diagram: inlined scaleFairwayProfile method to be more in line with other diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3965
diff
changeset
|
159 containerId: "fairwayprofile-diagram-container" |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
160 }; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
161 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
162 computed: { |
3514
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
163 ...mapGetters("map", ["openLayersMap"]), |
1394
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
164 ...mapGetters("fairwayprofile", ["totalLength"]), |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
165 ...mapState("fairwayprofile", [ |
2392
0b8793a1947c
fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
166 "additionalSurvey", |
0b8793a1947c
fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
167 "currentProfile", |
2566
83b938bf4da9
client: prepared store and minimized splitscreens for multiple simultaneous diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2549
diff
changeset
|
168 "startPoint", |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
169 "endPoint", |
2392
0b8793a1947c
fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
170 "fairwayData", |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
171 "maxAlt", |
3512
30a47d9fc667
client: fairway profiles: removed some old code
Markus Kottlaender <markus@intevation.de>
parents:
3408
diff
changeset
|
172 "selectedWaterLevel" |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
173 ]), |
3513
ca9590be1da2
client: fairway profiles: removed more code
Markus Kottlaender <markus@intevation.de>
parents:
3512
diff
changeset
|
174 ...mapState("bottlenecks", ["selectedSurvey", "selectedBottleneck"]), |
3146
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
175 ...mapState("application", ["paneSetup"]), |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
176 title() { |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
177 let dates = [this.selectedSurvey.date_info]; |
3531
804df080c826
client: fairway profiles: added waterlevel to title and used title as pdf filename
Markus Kottlaender <markus@intevation.de>
parents:
3527
diff
changeset
|
178 let waterlevelLabel = |
804df080c826
client: fairway profiles: added waterlevel to title and used title as pdf filename
Markus Kottlaender <markus@intevation.de>
parents:
3527
diff
changeset
|
179 this.selectedWaterLevel === "ref" |
804df080c826
client: fairway profiles: added waterlevel to title and used title as pdf filename
Markus Kottlaender <markus@intevation.de>
parents:
3527
diff
changeset
|
180 ? this.selectedSurvey.depth_reference |
804df080c826
client: fairway profiles: added waterlevel to title and used title as pdf filename
Markus Kottlaender <markus@intevation.de>
parents:
3527
diff
changeset
|
181 : "Current"; |
3146
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
182 if (this.additionalSurvey) dates.push(this.additionalSurvey.date_info); |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
183 dates.map(d => this.$options.filters.dateTime(d, true)); |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
184 return `${this.$gettext("Fairwayprofile")}: ${ |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
185 this.selectedBottleneck |
3576
1109a38f7ff1
client: waterlevel format in diagrams changed from cm to m and localized
Markus Kottlaender <markus@intevation.de>
parents:
3571
diff
changeset
|
186 } (${dates.join( |
1109a38f7ff1
client: waterlevel format in diagrams changed from cm to m and localized
Markus Kottlaender <markus@intevation.de>
parents:
3571
diff
changeset
|
187 ", " |
1109a38f7ff1
client: waterlevel format in diagrams changed from cm to m and localized
Markus Kottlaender <markus@intevation.de>
parents:
3571
diff
changeset
|
188 )}) WL: ${waterlevelLabel} (${this.$options.filters.waterlevel( |
1109a38f7ff1
client: waterlevel format in diagrams changed from cm to m and localized
Markus Kottlaender <markus@intevation.de>
parents:
3571
diff
changeset
|
189 this.waterlevel |
1109a38f7ff1
client: waterlevel format in diagrams changed from cm to m and localized
Markus Kottlaender <markus@intevation.de>
parents:
3571
diff
changeset
|
190 )} m)`; |
3146
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
191 }, |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
192 currentData() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
193 if ( |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
194 !this.selectedSurvey || |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
195 !this.currentProfile.hasOwnProperty(this.selectedSurvey.date_info) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
196 ) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
197 return []; |
1394
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
198 return this.currentProfile[this.selectedSurvey.date_info].points; |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
199 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
200 additionalData() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
201 if ( |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
202 !this.additionalSurvey || |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
203 !this.currentProfile.hasOwnProperty(this.additionalSurvey.date_info) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
204 ) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
205 return []; |
1394
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
206 return this.currentProfile[this.additionalSurvey.date_info].points; |
3514
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
207 }, |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
208 bottleneck() { |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
209 return this.openLayersMap() |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
210 .getLayer("BOTTLENECKS") |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
211 .getSource() |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
212 .getFeatures() |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
213 .find(f => f.get("objnam") === this.selectedBottleneck); |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
214 }, |
3527
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
215 waterlevel() { |
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
216 return this.selectedWaterLevel === "ref" |
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
217 ? this.refWaterlevel |
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
218 : this.bottleneck.get("gm_waterlevel"); |
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
219 }, |
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
220 refWaterlevel() { |
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
221 return this.selectedSurvey.waterlevel_value; |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
222 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
223 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
224 watch: { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
225 currentData() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
226 this.drawDiagram(); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
227 }, |
1382
8b85032ed3cd
added loading animation to profile
Markus Kottlaender <markus@intevation.de>
parents:
1372
diff
changeset
|
228 additionalData() { |
8b85032ed3cd
added loading animation to profile
Markus Kottlaender <markus@intevation.de>
parents:
1372
diff
changeset
|
229 this.drawDiagram(); |
8b85032ed3cd
added loading animation to profile
Markus Kottlaender <markus@intevation.de>
parents:
1372
diff
changeset
|
230 }, |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
231 width() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
232 this.drawDiagram(); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
233 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
234 height() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
235 this.drawDiagram(); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
236 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
237 waterLevels() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
238 this.drawDiagram(); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
239 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
240 selectedWaterLevel() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
241 this.drawDiagram(); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
242 }, |
2264
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2154
diff
changeset
|
243 fairwayData() { |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
244 this.drawDiagram(); |
3149
a90091aaef67
client: fairwayprofile: close profile diagram when switching bottlenecks
Markus Kottlaender <markus@intevation.de>
parents:
3146
diff
changeset
|
245 }, |
a90091aaef67
client: fairwayprofile: close profile diagram when switching bottlenecks
Markus Kottlaender <markus@intevation.de>
parents:
3146
diff
changeset
|
246 selectedBottleneck() { |
a90091aaef67
client: fairwayprofile: close profile diagram when switching bottlenecks
Markus Kottlaender <markus@intevation.de>
parents:
3146
diff
changeset
|
247 this.$store.commit("application/paneSetup", "DEFAULT"); |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
248 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
249 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
250 methods: { |
3146
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
251 close() { |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
252 this.$store.commit( |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
253 "application/paneSetup", |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
254 this.paneSetup === "COMPARESURVEYS_FAIRWAYPROFILE" |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
255 ? "COMPARESURVEYS" |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
256 : "DEFAULT" |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
257 ); |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
258 this.$store.dispatch("fairwayprofile/clearCurrentProfile"); |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
259 }, |
3571
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
260 getLayerStyle(los) { |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
261 let style = this.openLayersMap() |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
262 .getLayer("FAIRWAYDIMENSIONSLOS" + los) |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
263 .getStyle()()[0]; |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
264 |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
265 // use spread operator to clone arrays |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
266 let fillColor = [...style.getFill().getColor()]; |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
267 let fillOpacity = fillColor.pop(); |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
268 let strokeColor = [...style.getStroke().getColor()]; |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
269 let strokeOpacity = strokeColor.pop(); |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
270 let strokeDash = style.getStroke().getLineDash(); |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
271 |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
272 return { fillColor, fillOpacity, strokeColor, strokeOpacity, strokeDash }; |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
273 }, |
3129
136b86794453
client: improve pdf-gen code for diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3061
diff
changeset
|
274 // Diagram legend |
3240
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
275 addDiagramLegend(position, offset, color) { |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
276 let x = offset.x, |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
277 y = offset.y; |
3590
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
278 this.pdf.doc.setFontSize(10); |
3240
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
279 let width = |
3590
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
280 (this.pdf.doc.getStringUnitWidth("Sediment (Compare)") * 10) / |
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
281 (72 / 25.6) + |
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
282 4; |
3240
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
283 if (["topright", "bottomright"].indexOf(position) !== -1) { |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
284 x = this.pdf.width - offset.x - width; |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
285 } |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
286 if (["bottomright", "bottomleft"].indexOf(position) !== -1) { |
3590
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
287 y = this.pdf.height - offset.y - this.getTextHeight(8); |
3240
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
288 } |
3590
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
289 |
3240
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
290 this.pdf.doc.setTextColor(color); |
3590
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
291 this.pdf.doc.setDrawColor("#5995ff"); |
3240
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
292 this.pdf.doc.setFillColor("#5995ff"); |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
293 this.pdf.doc.circle(x, y, 2, "FD"); |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
294 this.pdf.doc.text(x + 3, y + 1, "Water"); |
3590
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
295 |
3785
0c5816af79a5
client: improve pdf generation of Fairwayprofile
Bernhard Reiter <bernhard@intevation.de>
parents:
3784
diff
changeset
|
296 this.pdf.doc.setLineDashPattern([0.8], 0); |
3590
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
297 this.pdf.doc.setDrawColor("#0000ff"); |
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
298 this.pdf.doc.setFillColor("#fcfacc"); |
3240
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
299 this.pdf.doc.circle(x, y + 5, 2, "FD"); |
3590
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
300 this.pdf.doc.text(x + 3, y + 6, "Fairway (LOS 1)"); |
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
301 |
3785
0c5816af79a5
client: improve pdf generation of Fairwayprofile
Bernhard Reiter <bernhard@intevation.de>
parents:
3784
diff
changeset
|
302 this.pdf.doc.setLineDashPattern([1.8], 0); |
3590
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
303 this.pdf.doc.setFillColor("#fdfce5"); |
3240
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
304 this.pdf.doc.circle(x, y + 10, 2, "FD"); |
3590
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
305 this.pdf.doc.text(x + 3, y + 11, "Fairway (LOS 2)"); |
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
306 |
3784
110436ee8ed2
Fairwayprofile: dashed patterns in PDF
Thomas Junk <thomas.junk@intevation.de>
parents:
3783
diff
changeset
|
307 this.pdf.doc.setLineDashPattern([], 0); |
3590
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
308 this.pdf.doc.setFillColor("#ffffff"); |
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
309 this.pdf.doc.circle(x, y + 15, 2, "FD"); |
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
310 this.pdf.doc.text(x + 3, y + 16, "Fairway (LOS 3)"); |
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
311 |
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
312 this.pdf.doc.setDrawColor("black"); |
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
313 this.pdf.doc.setFillColor("#4a2e06"); |
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
314 this.pdf.doc.circle(x, y + 20, 2, "FD"); |
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
315 this.pdf.doc.text(x + 3, y + 21, "Sediment"); |
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
316 |
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
317 this.pdf.doc.setDrawColor("#943007"); |
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
318 this.pdf.doc.setFillColor("#928269"); |
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
319 this.pdf.doc.circle(x, y + 25, 2, "FD"); |
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
320 this.pdf.doc.text(x + 3, y + 26, "Sediment (Compare)"); |
3240
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
321 }, |
3941
7b3935a8d9ee
refactor addDiagram to mixin and remove code duplication
Thomas Junk <thomas.junk@intevation.de>
parents:
3936
diff
changeset
|
322 getPrintLayout() { |
7b3935a8d9ee
refactor addDiagram to mixin and remove code duplication
Thomas Junk <thomas.junk@intevation.de>
parents:
3936
diff
changeset
|
323 return { |
3963
feb53713bc2f
client: moved duplicated code to mixins and unified code patterns in diagram components [WIP]
Markus Kottlaender <markus@intevation.de>
parents:
3942
diff
changeset
|
324 main: { top: 20, right: 80, bottom: 60, left: 80 } |
3941
7b3935a8d9ee
refactor addDiagram to mixin and remove code duplication
Thomas Junk <thomas.junk@intevation.de>
parents:
3936
diff
changeset
|
325 }; |
7b3935a8d9ee
refactor addDiagram to mixin and remove code duplication
Thomas Junk <thomas.junk@intevation.de>
parents:
3936
diff
changeset
|
326 }, |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
327 drawDiagram() { |
3968
ea4e1ea04e44
client: fairway profile diagram: inlined scaleFairwayProfile method to be more in line with other diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3965
diff
changeset
|
328 // remove old diagram and exit if necessary data is missing |
3963
feb53713bc2f
client: moved duplicated code to mixins and unified code patterns in diagram components [WIP]
Markus Kottlaender <markus@intevation.de>
parents:
3942
diff
changeset
|
329 d3.select("#" + this.containerId + " svg").remove(); |
3968
ea4e1ea04e44
client: fairway profile diagram: inlined scaleFairwayProfile method to be more in line with other diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3965
diff
changeset
|
330 const elem = document.querySelector("#" + this.containerId); |
ea4e1ea04e44
client: fairway profile diagram: inlined scaleFairwayProfile method to be more in line with other diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3965
diff
changeset
|
331 const svgWidth = elem.clientWidth; |
ea4e1ea04e44
client: fairway profile diagram: inlined scaleFairwayProfile method to be more in line with other diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3965
diff
changeset
|
332 const svgHeight = elem.clientHeight; |
ea4e1ea04e44
client: fairway profile diagram: inlined scaleFairwayProfile method to be more in line with other diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3965
diff
changeset
|
333 const layout = this.getPrintLayout(); |
3893
9dfd225b92e8
fairwayprofile: offscreen printing
Thomas Junk <thomas.junk@intevation.de>
parents:
3819
diff
changeset
|
334 this.renderTo({ |
3963
feb53713bc2f
client: moved duplicated code to mixins and unified code patterns in diagram components [WIP]
Markus Kottlaender <markus@intevation.de>
parents:
3942
diff
changeset
|
335 element: "#" + this.containerId, |
3936
d859ec6cf2f0
Fairwayprofile enhanced
Thomas Junk <thomas.junk@intevation.de>
parents:
3928
diff
changeset
|
336 dimensions: this.getDimensions({ |
3968
ea4e1ea04e44
client: fairway profile diagram: inlined scaleFairwayProfile method to be more in line with other diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3965
diff
changeset
|
337 svgWidth: svgWidth, |
ea4e1ea04e44
client: fairway profile diagram: inlined scaleFairwayProfile method to be more in line with other diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3965
diff
changeset
|
338 svgHeight: svgHeight, |
3941
7b3935a8d9ee
refactor addDiagram to mixin and remove code duplication
Thomas Junk <thomas.junk@intevation.de>
parents:
3936
diff
changeset
|
339 ...layout |
3936
d859ec6cf2f0
Fairwayprofile enhanced
Thomas Junk <thomas.junk@intevation.de>
parents:
3928
diff
changeset
|
340 }) |
3893
9dfd225b92e8
fairwayprofile: offscreen printing
Thomas Junk <thomas.junk@intevation.de>
parents:
3819
diff
changeset
|
341 }); |
9dfd225b92e8
fairwayprofile: offscreen printing
Thomas Junk <thomas.junk@intevation.de>
parents:
3819
diff
changeset
|
342 }, |
9dfd225b92e8
fairwayprofile: offscreen printing
Thomas Junk <thomas.junk@intevation.de>
parents:
3819
diff
changeset
|
343 renderTo({ element, dimensions }) { |
9dfd225b92e8
fairwayprofile: offscreen printing
Thomas Junk <thomas.junk@intevation.de>
parents:
3819
diff
changeset
|
344 let svg = d3.select(element).append("svg"); |
2854
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
345 svg.attr("width", "100%"); |
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
346 svg.attr("height", "100%"); |
3936
d859ec6cf2f0
Fairwayprofile enhanced
Thomas Junk <thomas.junk@intevation.de>
parents:
3928
diff
changeset
|
347 const width = dimensions.width; |
d859ec6cf2f0
Fairwayprofile enhanced
Thomas Junk <thomas.junk@intevation.de>
parents:
3928
diff
changeset
|
348 const height = dimensions.mainHeight; |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
349 const currentData = this.currentData; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
350 const additionalData = this.additionalData; |
3942
cd8ba6599a99
fairway_profile: remove dependency on local state variable
Thomas Junk <thomas.junk@intevation.de>
parents:
3941
diff
changeset
|
351 const { xScale, yScaleRight, graph } = this.generateScalesAndGraph({ |
1394
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
352 svg, |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
353 height, |
3942
cd8ba6599a99
fairway_profile: remove dependency on local state variable
Thomas Junk <thomas.junk@intevation.de>
parents:
3941
diff
changeset
|
354 width, |
cd8ba6599a99
fairway_profile: remove dependency on local state variable
Thomas Junk <thomas.junk@intevation.de>
parents:
3941
diff
changeset
|
355 dimensions |
cd8ba6599a99
fairway_profile: remove dependency on local state variable
Thomas Junk <thomas.junk@intevation.de>
parents:
3941
diff
changeset
|
356 }); |
1394
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
357 this.drawWaterlevel({ graph, xScale, yScaleRight, height }); |
3893
9dfd225b92e8
fairwayprofile: offscreen printing
Thomas Junk <thomas.junk@intevation.de>
parents:
3819
diff
changeset
|
358 this.drawLabels({ graph, dimensions }); |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
359 if (currentData) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
360 this.drawProfile({ |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
361 graph, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
362 xScale, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
363 yScaleRight, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
364 currentData, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
365 height, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
366 color: GROUND_COLOR, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
367 strokeColor: "black", |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
368 opacity: 1 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
369 }); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
370 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
371 if (additionalData) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
372 this.drawProfile({ |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
373 graph, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
374 xScale, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
375 yScaleRight, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
376 currentData: additionalData, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
377 height, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
378 color: GROUND_COLOR, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
379 strokeColor: "#943007", |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
380 opacity: 0.6 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
381 }); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
382 } |
2358
da75385887b9
fairway_profile: render riverbed on layer behind LOS
Thomas Junk <thomas.junk@intevation.de>
parents:
2265
diff
changeset
|
383 this.drawFairway({ graph, xScale, yScaleRight }); |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
384 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
385 drawFairway({ graph, xScale, yScaleRight }) { |
2264
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2154
diff
changeset
|
386 if (this.fairwayData === undefined) { |
2265
940ae7c20326
client: pdf-gen: use default template when backend does not provide any
Markus Kottlaender <markus@intevation.de>
parents:
2264
diff
changeset
|
387 return; |
2264
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2154
diff
changeset
|
388 } |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2154
diff
changeset
|
389 for (let data of this.fairwayData) { |
3571
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
390 data.coordinates.forEach(coordinates => { |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
391 const [startPoint, endPoint, depth] = coordinates; |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
392 let fairwayArea = d3 |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
393 .area() |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
394 .x(function(d) { |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
395 return xScale(d.x); |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
396 }) |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
397 .y0(yScaleRight(0)) |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
398 .y1(function(d) { |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
399 return yScaleRight(d.y); |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
400 }); |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
401 graph |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
402 .append("path") |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
403 .datum([{ x: startPoint, y: depth }, { x: endPoint, y: depth }]) |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
404 .attr( |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
405 "fill", |
3926
3ebde6dd336f
client: pdf-gen: fix rendering part of diagram (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3921
diff
changeset
|
406 `#${this.getLayerStyle(data.los) |
3ebde6dd336f
client: pdf-gen: fix rendering part of diagram (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3921
diff
changeset
|
407 .fillColor.map(x => { |
3ebde6dd336f
client: pdf-gen: fix rendering part of diagram (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3921
diff
changeset
|
408 if (x < 10) return "0" + x.toString(16); |
3ebde6dd336f
client: pdf-gen: fix rendering part of diagram (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3921
diff
changeset
|
409 return x.toString(16); |
3ebde6dd336f
client: pdf-gen: fix rendering part of diagram (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3921
diff
changeset
|
410 }) |
3ebde6dd336f
client: pdf-gen: fix rendering part of diagram (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3921
diff
changeset
|
411 .join("")}` |
3571
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
412 ) |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
413 .attr("fill-opacity", this.getLayerStyle(data.los).fillOpacity) |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
414 .attr( |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
415 "stroke", |
3926
3ebde6dd336f
client: pdf-gen: fix rendering part of diagram (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3921
diff
changeset
|
416 `#${this.getLayerStyle(data.los) |
3ebde6dd336f
client: pdf-gen: fix rendering part of diagram (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3921
diff
changeset
|
417 .strokeColor.map(x => { |
3ebde6dd336f
client: pdf-gen: fix rendering part of diagram (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3921
diff
changeset
|
418 if (x < 10) return "0" + x.toString(16); |
3ebde6dd336f
client: pdf-gen: fix rendering part of diagram (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3921
diff
changeset
|
419 return x.toString(16); |
3ebde6dd336f
client: pdf-gen: fix rendering part of diagram (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3921
diff
changeset
|
420 }) |
3ebde6dd336f
client: pdf-gen: fix rendering part of diagram (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3921
diff
changeset
|
421 .join("")}` |
3571
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
422 ) |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
423 .attr("stroke-opacity", this.getLayerStyle(data.los).strokeOpacity) |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
424 .attr("stroke-dasharray", this.getLayerStyle(data.los).strokeDash) |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
425 .attr("d", fairwayArea); |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
426 }); |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
427 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
428 }, |
3893
9dfd225b92e8
fairwayprofile: offscreen printing
Thomas Junk <thomas.junk@intevation.de>
parents:
3819
diff
changeset
|
429 drawLabels({ graph, dimensions }) { |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
430 graph |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
431 .append("text") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
432 .attr("transform", ["rotate(-90)"]) |
3936
d859ec6cf2f0
Fairwayprofile enhanced
Thomas Junk <thomas.junk@intevation.de>
parents:
3928
diff
changeset
|
433 .attr("y", dimensions.width + 45) |
d859ec6cf2f0
Fairwayprofile enhanced
Thomas Junk <thomas.junk@intevation.de>
parents:
3928
diff
changeset
|
434 .attr("x", -dimensions.mainHeight / 2) |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
435 .attr("fill", "black") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
436 .style("text-anchor", "middle") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
437 .text("Depth [m]"); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
438 graph |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
439 .append("text") |
3514
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
440 .attr("transform", ["rotate(-90)"]) |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
441 .attr("y", -50) |
3936
d859ec6cf2f0
Fairwayprofile enhanced
Thomas Junk <thomas.junk@intevation.de>
parents:
3928
diff
changeset
|
442 .attr("x", -dimensions.mainHeight / 2) |
3514
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
443 .attr("fill", "black") |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
444 .style("text-anchor", "middle") |
3576
1109a38f7ff1
client: waterlevel format in diagrams changed from cm to m and localized
Markus Kottlaender <markus@intevation.de>
parents:
3571
diff
changeset
|
445 .text("Waterlevel [m]"); |
3514
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
446 graph |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
447 .append("text") |
3893
9dfd225b92e8
fairwayprofile: offscreen printing
Thomas Junk <thomas.junk@intevation.de>
parents:
3819
diff
changeset
|
448 .attr("y", 30) |
9dfd225b92e8
fairwayprofile: offscreen printing
Thomas Junk <thomas.junk@intevation.de>
parents:
3819
diff
changeset
|
449 .attr("x", 0) |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
450 .attr("dy", "1em") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
451 .attr("fill", "black") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
452 .style("text-anchor", "middle") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
453 .attr("transform", [ |
3893
9dfd225b92e8
fairwayprofile: offscreen printing
Thomas Junk <thomas.junk@intevation.de>
parents:
3819
diff
changeset
|
454 "translate(" + |
3936
d859ec6cf2f0
Fairwayprofile enhanced
Thomas Junk <thomas.junk@intevation.de>
parents:
3928
diff
changeset
|
455 dimensions.width / 2 + |
3893
9dfd225b92e8
fairwayprofile: offscreen printing
Thomas Junk <thomas.junk@intevation.de>
parents:
3819
diff
changeset
|
456 "," + |
3936
d859ec6cf2f0
Fairwayprofile enhanced
Thomas Junk <thomas.junk@intevation.de>
parents:
3928
diff
changeset
|
457 dimensions.mainHeight + |
3893
9dfd225b92e8
fairwayprofile: offscreen printing
Thomas Junk <thomas.junk@intevation.de>
parents:
3819
diff
changeset
|
458 ")", |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
459 "rotate(0)" |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
460 ]) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
461 .text("Width [m]"); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
462 }, |
3942
cd8ba6599a99
fairway_profile: remove dependency on local state variable
Thomas Junk <thomas.junk@intevation.de>
parents:
3941
diff
changeset
|
463 generateScalesAndGraph({ svg, height, width, dimensions }) { |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
464 let xScale = d3 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
465 .scaleLinear() |
3512
30a47d9fc667
client: fairway profiles: removed some old code
Markus Kottlaender <markus@intevation.de>
parents:
3408
diff
changeset
|
466 .domain([0, this.totalLength]) |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
467 .rangeRound([0, width]); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
468 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
469 let yScaleRight = d3 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
470 .scaleLinear() |
3527
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
471 .domain([ |
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
472 this.maxAlt * 1.1 + |
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
473 Math.abs(this.waterlevel - this.refWaterlevel) / 100, |
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
474 -(this.maxAlt * 0.1) |
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
475 ]) |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
476 .rangeRound([height, 0]); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
477 |
3514
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
478 let yScaleLeft = d3 |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
479 .scaleLinear() |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
480 .domain([ |
3527
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
481 this.waterlevel - |
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
482 (this.maxAlt * 100 + |
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
483 Math.abs(this.waterlevel - this.refWaterlevel)), |
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
484 this.waterlevel + this.maxAlt * 0.1 * 100 |
3514
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
485 ]) |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
486 .rangeRound([height, 0]); |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
487 |
3512
30a47d9fc667
client: fairway profiles: removed some old code
Markus Kottlaender <markus@intevation.de>
parents:
3408
diff
changeset
|
488 let xAxis = d3.axisBottom(xScale).ticks(5); |
3514
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
489 let yAxisRight = d3.axisRight(yScaleRight); |
3576
1109a38f7ff1
client: waterlevel format in diagrams changed from cm to m and localized
Markus Kottlaender <markus@intevation.de>
parents:
3571
diff
changeset
|
490 let yAxisLeft = d3 |
1109a38f7ff1
client: waterlevel format in diagrams changed from cm to m and localized
Markus Kottlaender <markus@intevation.de>
parents:
3571
diff
changeset
|
491 .axisLeft(yScaleLeft) |
1109a38f7ff1
client: waterlevel format in diagrams changed from cm to m and localized
Markus Kottlaender <markus@intevation.de>
parents:
3571
diff
changeset
|
492 .tickFormat(d => this.$options.filters.waterlevel(d)); |
3514
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
493 |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
494 let graph = svg |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
495 .append("g") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
496 .attr( |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
497 "transform", |
3942
cd8ba6599a99
fairway_profile: remove dependency on local state variable
Thomas Junk <thomas.junk@intevation.de>
parents:
3941
diff
changeset
|
498 "translate(" + |
cd8ba6599a99
fairway_profile: remove dependency on local state variable
Thomas Junk <thomas.junk@intevation.de>
parents:
3941
diff
changeset
|
499 dimensions.mainMargin.left + |
cd8ba6599a99
fairway_profile: remove dependency on local state variable
Thomas Junk <thomas.junk@intevation.de>
parents:
3941
diff
changeset
|
500 "," + |
cd8ba6599a99
fairway_profile: remove dependency on local state variable
Thomas Junk <thomas.junk@intevation.de>
parents:
3941
diff
changeset
|
501 dimensions.mainMargin.top + |
cd8ba6599a99
fairway_profile: remove dependency on local state variable
Thomas Junk <thomas.junk@intevation.de>
parents:
3941
diff
changeset
|
502 ")" |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
503 ); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
504 graph |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
505 .append("g") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
506 .attr("transform", "translate(0," + height + ")") |
3512
30a47d9fc667
client: fairway profiles: removed some old code
Markus Kottlaender <markus@intevation.de>
parents:
3408
diff
changeset
|
507 .call(xAxis) |
3007
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
508 .selectAll(".tick text") |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
509 .attr("fill", "black") |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
510 .select(function() { |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
511 return this.parentNode; |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
512 }) |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
513 .selectAll(".tick line") |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
514 .attr("stroke", "black"); |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
515 graph |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
516 .append("g") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
517 .attr("transform", "translate(" + width + ",0)") |
3514
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
518 .call(yAxisRight) |
3007
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
519 .selectAll(".tick text") |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
520 .attr("fill", "black") |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
521 .select(function() { |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
522 return this.parentNode; |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
523 }) |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
524 .selectAll(".tick line") |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
525 .attr("stroke", "black"); |
3514
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
526 graph |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
527 .append("g") |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
528 .attr("transform", "translate(0 0)") |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
529 .call(yAxisLeft) |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
530 .selectAll(".tick text") |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
531 .attr("fill", "black") |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
532 .select(function() { |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
533 return this.parentNode; |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
534 }) |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
535 .selectAll(".tick line") |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
536 .attr("stroke", "black"); |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
537 |
3007
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
538 graph.selectAll(".domain").attr("stroke", "black"); |
2368
96b0314f2bd6
fairway_profile: consuming the offered waterlevel WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2358
diff
changeset
|
539 return { xScale, yScaleRight, graph }; |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
540 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
541 drawWaterlevel({ graph, xScale, yScaleRight, height }) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
542 let waterArea = d3 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
543 .area() |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
544 .x(function(d) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
545 return xScale(d.x); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
546 }) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
547 .y0(height) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
548 .y1(function(d) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
549 return yScaleRight(d.y); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
550 }); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
551 graph |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
552 .append("path") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
553 .datum([{ x: 0, y: 0 }, { x: this.totalLength, y: 0 }]) |
2264
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2154
diff
changeset
|
554 .attr("fill-opacity", 0.65) |
2854
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
555 .attr("fill", WATER_COLOR) |
3520
70cd7383325b
client: fairway profiles: removed strokes for sharper edges
Markus Kottlaender <markus@intevation.de>
parents:
3514
diff
changeset
|
556 .attr("stroke", "transparent") |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
557 .attr("d", waterArea); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
558 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
559 drawProfile({ |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
560 graph, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
561 xScale, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
562 yScaleRight, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
563 currentData, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
564 height, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
565 color, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
566 strokeColor, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
567 opacity |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
568 }) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
569 for (let part of currentData) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
570 let profileLine = d3 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
571 .line() |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
572 .x(d => { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
573 return xScale(d.x); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
574 }) |
3527
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
575 .y(d => |
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
576 yScaleRight( |
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
577 d.y + Math.abs(this.waterlevel - this.refWaterlevel) / 100 |
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
578 ) |
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
579 ); |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
580 let profileArea = d3 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
581 .area() |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
582 .x(function(d) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
583 return xScale(d.x); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
584 }) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
585 .y0(height) |
3527
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
586 .y1(d => |
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
587 yScaleRight( |
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
588 d.y + Math.abs(this.waterlevel - this.refWaterlevel) / 100 |
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
589 ) |
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
590 ); |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
591 graph |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
592 .append("path") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
593 .datum(part) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
594 .attr("fill", color) |
3534
034657d6604f
client: fairway profiles: improved legend
Markus Kottlaender <markus@intevation.de>
parents:
3531
diff
changeset
|
595 .attr("stroke", "transparent") |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
596 .attr("fill-opacity", opacity) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
597 .attr("d", profileArea); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
598 graph |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
599 .append("path") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
600 .datum(part) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
601 .attr("fill", "none") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
602 .attr("stroke", strokeColor) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
603 .attr("stroke-linejoin", "round") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
604 .attr("stroke-linecap", "round") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
605 .attr("stroke-width", 3) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
606 .attr("stroke-opacity", opacity) |
3007
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
607 .attr("fill-opacity", 0) |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
608 .attr("d", profileLine); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
609 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
610 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
611 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
612 }; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
613 </script> |