Mercurial > gemma
annotate client/src/components/fairway/Fairwayprofile.vue @ 3667:c91bcb92e0b7
client: fix rendering of diagram on PDF (Fairwayprofile)
author | Fadi Abbud <fadi.abbud@intevation.de> |
---|---|
date | Mon, 17 Jun 2019 11:00:21 +0200 |
parents | 9e91b416d5bb |
children | c086f5176ef2 |
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" /> |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
4 <div class="d-flex flex-fill"> |
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 |
3667
c91bcb92e0b7
client: fix rendering of diagram on PDF (Fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3644
diff
changeset
|
96 id="pdfContainer" |
3644
9e91b416d5bb
client: cross profile: display arrow in diagram
Markus Kottlaender <markus@intevation.de>
parents:
3590
diff
changeset
|
97 class="d-flex flex-fill justify-content-center align-items-center diagram-container position-relative" |
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> |
3146
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
100 <div v-if="!fairwayData"> |
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 * |
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1313
diff
changeset
|
139 * Copyright (C) 2018 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"; |
1312
3c37017f5eb8
fixed cross profile diagram after switching to to admin context and back and it's responsive behavior
Markus Kottlaender <markus@intevation.de>
parents:
1305
diff
changeset
|
150 import debounce from "debounce"; |
3007
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
151 import jsPDF from "jspdf"; |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
152 import canvg from "canvg"; |
3240
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
153 import { pdfgen } from "@/lib/mixins"; |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
154 import { HTTP } from "@/lib/http"; |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
155 import { displayError } from "@/lib/errors"; |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
156 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
157 const GROUND_COLOR = "#4A2F06"; |
2854
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
158 const WATER_COLOR = "#005DFF"; |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
159 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
160 export default { |
3240
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
161 mixins: [pdfgen], |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
162 name: "fairwayprofile", |
2854
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
163 components: { |
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
164 DiagramLegend: () => import("@/components/DiagramLegend") |
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
165 }, |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
166 data() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
167 return { |
1312
3c37017f5eb8
fixed cross profile diagram after switching to to admin context and back and it's responsive behavior
Markus Kottlaender <markus@intevation.de>
parents:
1305
diff
changeset
|
168 width: null, |
1372
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1362
diff
changeset
|
169 height: null, |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1362
diff
changeset
|
170 margin: { |
553aadd97087
new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
1362
diff
changeset
|
171 top: 20, |
3514
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
172 right: 80, |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
173 bottom: 60, |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
174 left: 80 |
3240
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
175 }, |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
176 form: { |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
177 template: null |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
178 }, |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
179 templates: [], |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
180 defaultTemplate: { |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
181 name: "default", |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
182 properties: { |
3350
8da2f7b9a04b
client: diagram-template:remove unnecessary template properties and typo
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3323
diff
changeset
|
183 paperSize: "a4" |
3240
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
184 }, |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
185 elements: [ |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
186 { |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
187 type: "diagram", |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
188 position: "topleft", |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
189 offset: { x: 20, y: 60 }, |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
190 width: 290, |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
191 height: 100 |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
192 }, |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
193 { |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
194 type: "diagramtitle", |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
195 position: "topleft", |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
196 offset: { x: 90, y: 30 }, |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
197 fontsize: 22, |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
198 color: "steelblue" |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
199 }, |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
200 { |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
201 type: "diagramlegend", |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
202 position: "topleft", |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
203 offset: { x: 30, y: 160 }, |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
204 color: "black" |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
205 } |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
206 ] |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
207 }, |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
208 pdf: { |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
209 doc: null, |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
210 width: 32, |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
211 height: 297 |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
212 }, |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
213 templateData: null |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
214 }; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
215 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
216 computed: { |
3514
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
217 ...mapGetters("map", ["openLayersMap"]), |
1394
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
218 ...mapGetters("fairwayprofile", ["totalLength"]), |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
219 ...mapState("fairwayprofile", [ |
2392
0b8793a1947c
fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
220 "additionalSurvey", |
0b8793a1947c
fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
221 "currentProfile", |
2566
83b938bf4da9
client: prepared store and minimized splitscreens for multiple simultaneous diagrams
Markus Kottlaender <markus@intevation.de>
parents:
2549
diff
changeset
|
222 "startPoint", |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
223 "endPoint", |
2392
0b8793a1947c
fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
2389
diff
changeset
|
224 "fairwayData", |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
225 "maxAlt", |
3512
30a47d9fc667
client: fairway profiles: removed some old code
Markus Kottlaender <markus@intevation.de>
parents:
3408
diff
changeset
|
226 "selectedWaterLevel" |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
227 ]), |
3513
ca9590be1da2
client: fairway profiles: removed more code
Markus Kottlaender <markus@intevation.de>
parents:
3512
diff
changeset
|
228 ...mapState("bottlenecks", ["selectedSurvey", "selectedBottleneck"]), |
3146
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
229 ...mapState("application", ["paneSetup"]), |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
230 title() { |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
231 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
|
232 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
|
233 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
|
234 ? 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
|
235 : "Current"; |
3146
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
236 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
|
237 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
|
238 return `${this.$gettext("Fairwayprofile")}: ${ |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
239 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
|
240 } (${dates.join( |
1109a38f7ff1
client: waterlevel format in diagrams changed from cm to m and localized
Markus Kottlaender <markus@intevation.de>
parents:
3571
diff
changeset
|
241 ", " |
1109a38f7ff1
client: waterlevel format in diagrams changed from cm to m and localized
Markus Kottlaender <markus@intevation.de>
parents:
3571
diff
changeset
|
242 )}) 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
|
243 this.waterlevel |
1109a38f7ff1
client: waterlevel format in diagrams changed from cm to m and localized
Markus Kottlaender <markus@intevation.de>
parents:
3571
diff
changeset
|
244 )} m)`; |
3146
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
245 }, |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
246 currentData() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
247 if ( |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
248 !this.selectedSurvey || |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
249 !this.currentProfile.hasOwnProperty(this.selectedSurvey.date_info) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
250 ) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
251 return []; |
1394
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
252 return this.currentProfile[this.selectedSurvey.date_info].points; |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
253 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
254 additionalData() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
255 if ( |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
256 !this.additionalSurvey || |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
257 !this.currentProfile.hasOwnProperty(this.additionalSurvey.date_info) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
258 ) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
259 return []; |
1394
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
260 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
|
261 }, |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
262 bottleneck() { |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
263 return this.openLayersMap() |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
264 .getLayer("BOTTLENECKS") |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
265 .getSource() |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
266 .getFeatures() |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
267 .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
|
268 }, |
3527
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
269 waterlevel() { |
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
270 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
|
271 ? this.refWaterlevel |
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
272 : 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
|
273 }, |
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
274 refWaterlevel() { |
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
275 return this.selectedSurvey.waterlevel_value; |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
276 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
277 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
278 watch: { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
279 currentData() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
280 this.drawDiagram(); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
281 }, |
1382
8b85032ed3cd
added loading animation to profile
Markus Kottlaender <markus@intevation.de>
parents:
1372
diff
changeset
|
282 additionalData() { |
8b85032ed3cd
added loading animation to profile
Markus Kottlaender <markus@intevation.de>
parents:
1372
diff
changeset
|
283 this.drawDiagram(); |
8b85032ed3cd
added loading animation to profile
Markus Kottlaender <markus@intevation.de>
parents:
1372
diff
changeset
|
284 }, |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
285 width() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
286 this.drawDiagram(); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
287 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
288 height() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
289 this.drawDiagram(); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
290 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
291 waterLevels() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
292 this.drawDiagram(); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
293 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
294 selectedWaterLevel() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
295 this.drawDiagram(); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
296 }, |
2264
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2154
diff
changeset
|
297 fairwayData() { |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
298 this.drawDiagram(); |
3149
a90091aaef67
client: fairwayprofile: close profile diagram when switching bottlenecks
Markus Kottlaender <markus@intevation.de>
parents:
3146
diff
changeset
|
299 }, |
a90091aaef67
client: fairwayprofile: close profile diagram when switching bottlenecks
Markus Kottlaender <markus@intevation.de>
parents:
3146
diff
changeset
|
300 selectedBottleneck() { |
a90091aaef67
client: fairwayprofile: close profile diagram when switching bottlenecks
Markus Kottlaender <markus@intevation.de>
parents:
3146
diff
changeset
|
301 this.$store.commit("application/paneSetup", "DEFAULT"); |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
302 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
303 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
304 methods: { |
3146
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
305 close() { |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
306 this.$store.commit( |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
307 "application/paneSetup", |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
308 this.paneSetup === "COMPARESURVEYS_FAIRWAYPROFILE" |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
309 ? "COMPARESURVEYS" |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
310 : "DEFAULT" |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
311 ); |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
312 this.$store.dispatch("fairwayprofile/clearCurrentProfile"); |
b6cc4838d2c0
client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents:
3129
diff
changeset
|
313 }, |
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
|
314 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
|
315 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
|
316 .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
|
317 .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
|
318 |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
319 // 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
|
320 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
|
321 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
|
322 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
|
323 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
|
324 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
|
325 |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
326 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
|
327 }, |
3240
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
328 applyChange() { |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
329 if (this.form.template.hasOwnProperty("properties")) { |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
330 this.templateData = this.defaultTemplate; |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
331 return; |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
332 } |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
333 if (this.form.template) { |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
334 HTTP.get("/templates/diagram/" + this.form.template.name, { |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
335 headers: { |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
336 "X-Gemma-Auth": localStorage.getItem("token"), |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
337 "Content-type": "text/xml; charset=UTF-8" |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
338 } |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
339 }) |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
340 .then(response => { |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
341 this.templateData = response.data.template_data; |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
342 }) |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
343 .catch(e => { |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
344 const { status, data } = e.response; |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
345 displayError({ |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
346 title: this.$gettext("Backend Error"), |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
347 message: `${status}: ${data.message || data}` |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
348 }); |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
349 }); |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
350 } |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
351 }, |
3007
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
352 downloadPDF() { |
3240
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
353 if (this.templateData) { |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
354 this.pdf.doc = new jsPDF( |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
355 "l", |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
356 "mm", |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
357 this.templateData.properties.paperSize |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
358 ); |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
359 // pdf width and height in millimeter (landscape) |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
360 this.pdf.width = |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
361 this.templateData.properties.paperSize === "a3" ? 420 : 297; |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
362 this.pdf.height = |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
363 this.templateData.properties.paperSize === "a3" ? 297 : 210; |
3241
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
364 // default values if some are missing in template |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
365 let defaultFontSize = 11, |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
366 defaultWidth = 70, |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
367 defaultTextColor = "black", |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
368 defaultBorderColor = "white", |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
369 defaultBgColor = "white", |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
370 defaultRounding = 2, |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
371 defaultPadding = 2, |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
372 defaultOffset = { x: 0, y: 0 }; |
3240
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
373 this.templateData.elements.forEach(e => { |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
374 switch (e.type) { |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
375 case "diagram": { |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
376 this.addDiagram( |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
377 e.position, |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
378 e.offset || defaultOffset, |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
379 e.width, |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
380 e.height |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
381 ); |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
382 break; |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
383 } |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
384 case "diagramlegend": { |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
385 this.addDiagramLegend( |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
386 e.position, |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
387 e.offset || defaultOffset, |
3241
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
388 e.color || defaultTextColor |
3240
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
389 ); |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
390 break; |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
391 } |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
392 case "diagramtitle": { |
3285
aac1ca73e92a
client: diagram-template:(cleanup) move reusable pdf-functions to mixins.js
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3250
diff
changeset
|
393 let fairwayInfo = |
aac1ca73e92a
client: diagram-template:(cleanup) move reusable pdf-functions to mixins.js
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3250
diff
changeset
|
394 this.selectedBottleneck + |
aac1ca73e92a
client: diagram-template:(cleanup) move reusable pdf-functions to mixins.js
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3250
diff
changeset
|
395 " (" + |
aac1ca73e92a
client: diagram-template:(cleanup) move reusable pdf-functions to mixins.js
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3250
diff
changeset
|
396 this.selectedSurvey.date_info + |
aac1ca73e92a
client: diagram-template:(cleanup) move reusable pdf-functions to mixins.js
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3250
diff
changeset
|
397 ")"; |
aac1ca73e92a
client: diagram-template:(cleanup) move reusable pdf-functions to mixins.js
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3250
diff
changeset
|
398 this.addDiagramTitle( |
aac1ca73e92a
client: diagram-template:(cleanup) move reusable pdf-functions to mixins.js
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3250
diff
changeset
|
399 e.position, |
3544
067ad32fba69
client: diagram-template: improve values of template elements
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3534
diff
changeset
|
400 e.offset || defaultOffset, |
067ad32fba69
client: diagram-template: improve values of template elements
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3534
diff
changeset
|
401 e.fontsize || defaultFontSize, |
067ad32fba69
client: diagram-template: improve values of template elements
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3534
diff
changeset
|
402 e.color || defaultTextColor, |
3285
aac1ca73e92a
client: diagram-template:(cleanup) move reusable pdf-functions to mixins.js
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3250
diff
changeset
|
403 fairwayInfo |
aac1ca73e92a
client: diagram-template:(cleanup) move reusable pdf-functions to mixins.js
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3250
diff
changeset
|
404 ); |
3240
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
405 break; |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
406 } |
3241
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
407 case "image": { |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
408 this.addImage( |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
409 e.url, |
3544
067ad32fba69
client: diagram-template: improve values of template elements
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3534
diff
changeset
|
410 e.format || "", |
3241
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
411 e.position, |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
412 e.offset || defaultOffset, |
3544
067ad32fba69
client: diagram-template: improve values of template elements
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3534
diff
changeset
|
413 e.width || 90, |
067ad32fba69
client: diagram-template: improve values of template elements
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3534
diff
changeset
|
414 e.height || 60 |
3241
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
415 ); |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
416 break; |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
417 } |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
418 case "text": { |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
419 this.addText( |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
420 e.position, |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
421 e.offset || defaultOffset, |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
422 e.width || defaultWidth, |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
423 e.fontsize || defaultFontSize, |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
424 e.color || defaultTextColor, |
3544
067ad32fba69
client: diagram-template: improve values of template elements
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3534
diff
changeset
|
425 e.text || "" |
3241
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
426 ); |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
427 break; |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
428 } |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
429 case "box": { |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
430 this.addBox( |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
431 e.position, |
3544
067ad32fba69
client: diagram-template: improve values of template elements
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3534
diff
changeset
|
432 e.offset || defaultOffset, |
067ad32fba69
client: diagram-template: improve values of template elements
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3534
diff
changeset
|
433 e.width || 90, |
067ad32fba69
client: diagram-template: improve values of template elements
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3534
diff
changeset
|
434 e.height || 60, |
3241
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
435 e.rounding === 0 || e.rounding ? e.rounding : defaultRounding, |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
436 e.color || defaultBgColor, |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
437 e.brcolor || defaultBorderColor |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
438 ); |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
439 break; |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
440 } |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
441 case "textbox": { |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
442 this.addTextBox( |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
443 e.position, |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
444 e.offset || defaultOffset, |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
445 e.width, |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
446 e.height, |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
447 e.rounding === 0 || e.rounding ? e.rounding : defaultRounding, |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
448 e.padding || defaultPadding, |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
449 e.fontsize || defaultFontSize, |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
450 e.color || defaultTextColor, |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
451 e.background || defaultBgColor, |
3544
067ad32fba69
client: diagram-template: improve values of template elements
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3534
diff
changeset
|
452 e.text || "", |
3241
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
453 e.brcolor || defaultBorderColor |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
454 ); |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
455 break; |
ecfa09241437
client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3240
diff
changeset
|
456 } |
3240
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
457 } |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
458 }); |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
459 } |
3590
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
460 this.pdf.doc.save( |
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
461 this.title.replace(/\s/g, "_").replace(/[():,]/g, "") + ".pdf" |
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
462 ); |
3240
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
463 }, |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
464 addDiagram(position, offset, width, height) { |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
465 let x = offset.x, |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
466 y = offset.y; |
3667
c91bcb92e0b7
client: fix rendering of diagram on PDF (Fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3644
diff
changeset
|
467 let svg = document.querySelector("#pdfContainer>svg").outerHTML; |
c91bcb92e0b7
client: fix rendering of diagram on PDF (Fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3644
diff
changeset
|
468 |
3544
067ad32fba69
client: diagram-template: improve values of template elements
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3534
diff
changeset
|
469 // use default width,height if they are missing in the template definition |
3240
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
470 if (!width) { |
3250
246754028bf4
client: cleanup code (fairwayprofile diagram)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3241
diff
changeset
|
471 width = this.templateData.properties.paperSize === "a3" ? 380 : 290; |
3240
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
472 } |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
473 if (!height) { |
3250
246754028bf4
client: cleanup code (fairwayprofile diagram)
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3241
diff
changeset
|
474 height = this.templateData.properties.paperSize === "a3" ? 130 : 100; |
3240
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
475 } |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
476 if (["topright", "bottomright"].indexOf(position) !== -1) { |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
477 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
|
478 } |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
479 if (["bottomright", "bottomleft"].indexOf(position) !== -1) { |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
480 y = this.pdf.height - offset.y - height; |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
481 } |
3007
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
482 var canvas = document.createElement("canvas"); |
3018
42d1e31de844
client:give the generated pdf name and improve canvas size
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3007
diff
changeset
|
483 canvas.width = window.innerWidth; |
3020 | 484 canvas.height = window.innerHeight / 2; |
3007
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
485 canvg(canvas, svg, { |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
486 ignoreMouse: true, |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
487 ignoreAnimation: true, |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
488 ignoreDimensions: true |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
489 }); |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
490 var imgData = canvas.toDataURL("image/png"); |
3240
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
491 this.pdf.doc.addImage(imgData, "PNG", x, y, width, height); |
3129
136b86794453
client: improve pdf-gen code for diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3061
diff
changeset
|
492 }, |
136b86794453
client: improve pdf-gen code for diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3061
diff
changeset
|
493 // Diagram legend |
3240
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
494 addDiagramLegend(position, offset, color) { |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
495 let x = offset.x, |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
496 y = offset.y; |
3590
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
497 this.pdf.doc.setFontSize(10); |
3240
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
498 let width = |
3590
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
499 (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
|
500 (72 / 25.6) + |
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
501 4; |
3240
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
502 if (["topright", "bottomright"].indexOf(position) !== -1) { |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
503 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
|
504 } |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
505 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
|
506 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
|
507 } |
3590
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
508 |
3240
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
509 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
|
510 this.pdf.doc.setDrawColor("#5995ff"); |
3240
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
511 this.pdf.doc.setFillColor("#5995ff"); |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
512 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
|
513 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
|
514 |
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
515 this.pdf.doc.setLineDash([0.3]); |
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
516 this.pdf.doc.setDrawColor("#0000ff"); |
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
517 this.pdf.doc.setFillColor("#fcfacc"); |
3240
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
518 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
|
519 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
|
520 |
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
521 this.pdf.doc.setLineDash([1]); |
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
522 this.pdf.doc.setFillColor("#fdfce5"); |
3240
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
523 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
|
524 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
|
525 |
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
526 this.pdf.doc.setLineDash(); |
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
527 this.pdf.doc.setFillColor("#ffffff"); |
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
528 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
|
529 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
|
530 |
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
531 this.pdf.doc.setDrawColor("black"); |
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
532 this.pdf.doc.setFillColor("#4a2e06"); |
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
533 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
|
534 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
|
535 |
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
536 this.pdf.doc.setDrawColor("#943007"); |
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
537 this.pdf.doc.setFillColor("#928269"); |
309084558808
client: diagram-template: improve diagramlegend for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3576
diff
changeset
|
538 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
|
539 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
|
540 }, |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
541 drawDiagram() { |
2854
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
542 d3.select(".diagram-container svg").remove(); |
1312
3c37017f5eb8
fixed cross profile diagram after switching to to admin context and back and it's responsive behavior
Markus Kottlaender <markus@intevation.de>
parents:
1305
diff
changeset
|
543 this.scaleFairwayProfile(); |
2854
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
544 let svg = d3.select(".diagram-container").append("svg"); |
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
545 svg.attr("width", "100%"); |
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
546 svg.attr("height", "100%"); |
3514
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
547 const width = this.width - this.margin.right - this.margin.left; |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
548 const height = this.height - this.margin.top - this.margin.bottom; |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
549 const currentData = this.currentData; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
550 const additionalData = this.additionalData; |
3512
30a47d9fc667
client: fairway profiles: removed some old code
Markus Kottlaender <markus@intevation.de>
parents:
3408
diff
changeset
|
551 const { xScale, yScaleRight, graph } = this.generateScalesAndGraph( |
1394
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
552 svg, |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
553 height, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
554 width |
1394
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
555 ); |
1588
2888bfacd331
fairwayprofile: do not try to render fairwayprofile without dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
1558
diff
changeset
|
556 if (!this.height || !this.width) return; // do not try to render when height and width are unknown |
1394
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
557 this.drawWaterlevel({ graph, xScale, yScaleRight, height }); |
b350b0b5cb6c
refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents:
1391
diff
changeset
|
558 this.drawLabels({ graph, height }); |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
559 if (currentData) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
560 this.drawProfile({ |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
561 graph, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
562 xScale, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
563 yScaleRight, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
564 currentData, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
565 height, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
566 color: GROUND_COLOR, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
567 strokeColor: "black", |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
568 opacity: 1 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
569 }); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
570 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
571 if (additionalData) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
572 this.drawProfile({ |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
573 graph, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
574 xScale, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
575 yScaleRight, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
576 currentData: additionalData, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
577 height, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
578 color: GROUND_COLOR, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
579 strokeColor: "#943007", |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
580 opacity: 0.6 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
581 }); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
582 } |
2358
da75385887b9
fairway_profile: render riverbed on layer behind LOS
Thomas Junk <thomas.junk@intevation.de>
parents:
2265
diff
changeset
|
583 this.drawFairway({ graph, xScale, yScaleRight }); |
1272
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 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
|
586 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
|
587 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
|
588 } |
627bfcbbf631
client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2154
diff
changeset
|
589 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
|
590 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
|
591 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
|
592 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
|
593 .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
|
594 .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
|
595 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
|
596 }) |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
597 .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
|
598 .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
|
599 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
|
600 }); |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
601 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
|
602 .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
|
603 .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
|
604 .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
|
605 "fill", |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
606 `rgba(${this.getLayerStyle(data.los).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
|
607 ) |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
608 .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
|
609 .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
|
610 "stroke", |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
611 `rgba(${this.getLayerStyle(data.los).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
|
612 ) |
9e296d686f16
client: cross profiles: support gabs in fairway and improved display in diagram and legend
Markus Kottlaender <markus@intevation.de>
parents:
3555
diff
changeset
|
613 .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
|
614 .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
|
615 .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
|
616 }); |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
617 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
618 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
619 drawLabels({ graph, height }) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
620 graph |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
621 .append("text") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
622 .attr("transform", ["rotate(-90)"]) |
3514
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
623 .attr("y", this.width - 100) |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
624 .attr("x", -(this.height - this.margin.top - this.margin.bottom) / 2) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
625 .attr("fill", "black") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
626 .style("text-anchor", "middle") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
627 .text("Depth [m]"); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
628 graph |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
629 .append("text") |
3514
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
630 .attr("transform", ["rotate(-90)"]) |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
631 .attr("y", -50) |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
632 .attr("x", -(this.height - this.margin.top - this.margin.bottom) / 2) |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
633 .attr("fill", "black") |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
634 .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
|
635 .text("Waterlevel [m]"); |
3514
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
636 graph |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
637 .append("text") |
2854
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
638 .attr("y", -50) |
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
639 .attr("x", -(height / 4)) |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
640 .attr("dy", "1em") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
641 .attr("fill", "black") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
642 .style("text-anchor", "middle") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
643 .attr("transform", [ |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
644 "translate(" + this.width / 2 + "," + this.height + ")", |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
645 "rotate(0)" |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
646 ]) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
647 .text("Width [m]"); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
648 }, |
3512
30a47d9fc667
client: fairway profiles: removed some old code
Markus Kottlaender <markus@intevation.de>
parents:
3408
diff
changeset
|
649 generateScalesAndGraph(svg, height, width) { |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
650 let xScale = d3 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
651 .scaleLinear() |
3512
30a47d9fc667
client: fairway profiles: removed some old code
Markus Kottlaender <markus@intevation.de>
parents:
3408
diff
changeset
|
652 .domain([0, this.totalLength]) |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
653 .rangeRound([0, width]); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
654 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
655 let yScaleRight = d3 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
656 .scaleLinear() |
3527
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
657 .domain([ |
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
658 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
|
659 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
|
660 -(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
|
661 ]) |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
662 .rangeRound([height, 0]); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
663 |
3514
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
664 let yScaleLeft = d3 |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
665 .scaleLinear() |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
666 .domain([ |
3527
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
667 this.waterlevel - |
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
668 (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
|
669 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
|
670 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
|
671 ]) |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
672 .rangeRound([height, 0]); |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
673 |
3512
30a47d9fc667
client: fairway profiles: removed some old code
Markus Kottlaender <markus@intevation.de>
parents:
3408
diff
changeset
|
674 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
|
675 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
|
676 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
|
677 .axisLeft(yScaleLeft) |
1109a38f7ff1
client: waterlevel format in diagrams changed from cm to m and localized
Markus Kottlaender <markus@intevation.de>
parents:
3571
diff
changeset
|
678 .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
|
679 |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
680 let graph = svg |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
681 .append("g") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
682 .attr( |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
683 "transform", |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
684 "translate(" + this.margin.left + "," + this.margin.top + ")" |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
685 ); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
686 graph |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
687 .append("g") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
688 .attr("transform", "translate(0," + height + ")") |
3512
30a47d9fc667
client: fairway profiles: removed some old code
Markus Kottlaender <markus@intevation.de>
parents:
3408
diff
changeset
|
689 .call(xAxis) |
3007
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
690 .selectAll(".tick text") |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
691 .attr("fill", "black") |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
692 .select(function() { |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
693 return this.parentNode; |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
694 }) |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
695 .selectAll(".tick line") |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
696 .attr("stroke", "black"); |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
697 graph |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
698 .append("g") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
699 .attr("transform", "translate(" + width + ",0)") |
3514
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
700 .call(yAxisRight) |
3007
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
701 .selectAll(".tick text") |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
702 .attr("fill", "black") |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
703 .select(function() { |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
704 return this.parentNode; |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
705 }) |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
706 .selectAll(".tick line") |
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
707 .attr("stroke", "black"); |
3514
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
708 graph |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
709 .append("g") |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
710 .attr("transform", "translate(0 0)") |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
711 .call(yAxisLeft) |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
712 .selectAll(".tick text") |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
713 .attr("fill", "black") |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
714 .select(function() { |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
715 return this.parentNode; |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
716 }) |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
717 .selectAll(".tick line") |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
718 .attr("stroke", "black"); |
fcb4f3fabde8
client: fairway profiles: added second y-axis (WIP)
Markus Kottlaender <markus@intevation.de>
parents:
3513
diff
changeset
|
719 |
3007
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
720 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
|
721 return { xScale, yScaleRight, graph }; |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
722 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
723 drawWaterlevel({ graph, xScale, yScaleRight, height }) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
724 let waterArea = d3 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
725 .area() |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
726 .x(function(d) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
727 return xScale(d.x); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
728 }) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
729 .y0(height) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
730 .y1(function(d) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
731 return yScaleRight(d.y); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
732 }); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
733 graph |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
734 .append("path") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
735 .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
|
736 .attr("fill-opacity", 0.65) |
2854
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
737 .attr("fill", WATER_COLOR) |
3520
70cd7383325b
client: fairway profiles: removed strokes for sharper edges
Markus Kottlaender <markus@intevation.de>
parents:
3514
diff
changeset
|
738 .attr("stroke", "transparent") |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
739 .attr("d", waterArea); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
740 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
741 drawProfile({ |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
742 graph, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
743 xScale, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
744 yScaleRight, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
745 currentData, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
746 height, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
747 color, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
748 strokeColor, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
749 opacity |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
750 }) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
751 for (let part of currentData) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
752 let profileLine = d3 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
753 .line() |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
754 .x(d => { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
755 return xScale(d.x); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
756 }) |
3527
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
757 .y(d => |
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
758 yScaleRight( |
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
759 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
|
760 ) |
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
761 ); |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
762 let profileArea = d3 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
763 .area() |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
764 .x(function(d) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
765 return xScale(d.x); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
766 }) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
767 .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
|
768 .y1(d => |
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
769 yScaleRight( |
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
770 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
|
771 ) |
8a9ee18de13f
client: fairway profiles: implemented selection between depth reference waterlevel and current waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3522
diff
changeset
|
772 ); |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
773 graph |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
774 .append("path") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
775 .datum(part) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
776 .attr("fill", color) |
3534
034657d6604f
client: fairway profiles: improved legend
Markus Kottlaender <markus@intevation.de>
parents:
3531
diff
changeset
|
777 .attr("stroke", "transparent") |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
778 .attr("fill-opacity", opacity) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
779 .attr("d", profileArea); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
780 graph |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
781 .append("path") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
782 .datum(part) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
783 .attr("fill", "none") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
784 .attr("stroke", strokeColor) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
785 .attr("stroke-linejoin", "round") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
786 .attr("stroke-linecap", "round") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
787 .attr("stroke-width", 3) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
788 .attr("stroke-opacity", opacity) |
3007
792d4476d5d5
client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2860
diff
changeset
|
789 .attr("fill-opacity", 0) |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
790 .attr("d", profileLine); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
791 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
792 }, |
1312
3c37017f5eb8
fixed cross profile diagram after switching to to admin context and back and it's responsive behavior
Markus Kottlaender <markus@intevation.de>
parents:
1305
diff
changeset
|
793 scaleFairwayProfile() { |
2854
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
794 if (!document.querySelector(".diagram-container")) return; |
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
795 const clientHeight = document.querySelector(".diagram-container") |
1312
3c37017f5eb8
fixed cross profile diagram after switching to to admin context and back and it's responsive behavior
Markus Kottlaender <markus@intevation.de>
parents:
1305
diff
changeset
|
796 .clientHeight; |
2854
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
797 const clientWidth = document.querySelector(".diagram-container") |
1b5acce6120d
client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents:
2566
diff
changeset
|
798 .clientWidth; |
1312
3c37017f5eb8
fixed cross profile diagram after switching to to admin context and back and it's responsive behavior
Markus Kottlaender <markus@intevation.de>
parents:
1305
diff
changeset
|
799 if (!clientHeight || !clientWidth) return; |
3c37017f5eb8
fixed cross profile diagram after switching to to admin context and back and it's responsive behavior
Markus Kottlaender <markus@intevation.de>
parents:
1305
diff
changeset
|
800 this.height = clientHeight; |
3c37017f5eb8
fixed cross profile diagram after switching to to admin context and back and it's responsive behavior
Markus Kottlaender <markus@intevation.de>
parents:
1305
diff
changeset
|
801 this.width = clientWidth; |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
802 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
803 }, |
1312
3c37017f5eb8
fixed cross profile diagram after switching to to admin context and back and it's responsive behavior
Markus Kottlaender <markus@intevation.de>
parents:
1305
diff
changeset
|
804 created() { |
3c37017f5eb8
fixed cross profile diagram after switching to to admin context and back and it's responsive behavior
Markus Kottlaender <markus@intevation.de>
parents:
1305
diff
changeset
|
805 window.addEventListener("resize", debounce(this.drawDiagram), 100); |
3c37017f5eb8
fixed cross profile diagram after switching to to admin context and back and it's responsive behavior
Markus Kottlaender <markus@intevation.de>
parents:
1305
diff
changeset
|
806 }, |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
807 mounted() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
808 this.drawDiagram(); |
3240
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
809 this.templates[0] = this.defaultTemplate; |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
810 this.form.template = this.templates[0]; |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
811 this.templateData = this.form.template; |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
812 HTTP.get("/templates/diagram", { |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
813 headers: { |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
814 "X-Gemma-Auth": localStorage.getItem("token"), |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
815 "Content-type": "text/xml; charset=UTF-8" |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
816 } |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
817 }) |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
818 .then(response => { |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
819 if (response.data.length) { |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
820 this.templates = response.data; |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
821 this.form.template = this.templates[0]; |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
822 this.templates[this.templates.length] = this.defaultTemplate; |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
823 this.applyChange(); |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
824 } |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
825 }) |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
826 .catch(e => { |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
827 const { status, data } = e.response; |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
828 displayError({ |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
829 title: this.$gettext("Backend Error"), |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
830 message: `${status}: ${data.message || data}` |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
831 }); |
5240f5440b62
client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents:
3149
diff
changeset
|
832 }); |
1312
3c37017f5eb8
fixed cross profile diagram after switching to to admin context and back and it's responsive behavior
Markus Kottlaender <markus@intevation.de>
parents:
1305
diff
changeset
|
833 }, |
3c37017f5eb8
fixed cross profile diagram after switching to to admin context and back and it's responsive behavior
Markus Kottlaender <markus@intevation.de>
parents:
1305
diff
changeset
|
834 updated() { |
2860
dbc799261811
client: fairway profile: removed old code
Markus Kottlaender <markus@intevation.de>
parents:
2854
diff
changeset
|
835 this.drawDiagram(); |
1312
3c37017f5eb8
fixed cross profile diagram after switching to to admin context and back and it's responsive behavior
Markus Kottlaender <markus@intevation.de>
parents:
1305
diff
changeset
|
836 }, |
3c37017f5eb8
fixed cross profile diagram after switching to to admin context and back and it's responsive behavior
Markus Kottlaender <markus@intevation.de>
parents:
1305
diff
changeset
|
837 destroyed() { |
3c37017f5eb8
fixed cross profile diagram after switching to to admin context and back and it's responsive behavior
Markus Kottlaender <markus@intevation.de>
parents:
1305
diff
changeset
|
838 window.removeEventListener("resize", debounce(this.drawDiagram)); |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
839 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
840 }; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
841 </script> |