annotate client/src/components/fairway/Fairwayprofile.vue @ 3285:aac1ca73e92a

client: diagram-template:(cleanup) move reusable pdf-functions to mixins.js
author Fadi Abbud <fadi.abbud@intevation.de>
date Thu, 16 May 2019 11:28:44 +0200
parents 246754028bf4
children de0d0685a17b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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">
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
7 <span style="background-color: #5995ff"></span> Water
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
8 </div>
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
9 <div class="legend">
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
10 <span style="background-color: #1f4fff"></span> Fairway
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">
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
13 <span style="background-color: #4a2f06"></span>
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
14 Ground
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
15 </div>
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
16 <div>
3240
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
17 <select
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
18 v-model="form.template"
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
19 @change="applyChange"
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
20 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
21 >
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
22 <option
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
23 v-for="template in templates"
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
24 :value="template"
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
25 :key="template.name"
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
26 >
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
27 {{ template.name }}
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
28 </option>
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
29 </select>
3146
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
30 <button
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
31 @click="downloadPDF"
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
32 type="button"
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
33 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
34 >
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
35 <translate>Export to PDF</translate>
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
36 </button>
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
37 </div>
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
38 </DiagramLegend>
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
39 <div
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
40 ref="diagramContainer"
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
41 class="d-flex flex-fill justify-content-center align-items-center diagram-container"
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
42 >
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
43 <div v-if="!fairwayData">
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
44 <translate>No data available.</translate>
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
45 </div>
2854
1b5acce6120d client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents: 2566
diff changeset
46 </div>
1b5acce6120d client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents: 2566
diff changeset
47 </div>
1b5acce6120d client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents: 2566
diff changeset
48 </div>
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
49 </template>
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
50
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
51 <script>
1362
ca33ad696594 remove the first empyty lines
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1361
diff changeset
52 /* 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
53 * 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
54 *
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
55 * SPDX-License-Identifier: AGPL-3.0-or-later
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
56 * 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
57 *
ea3a89a1813a remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents: 1313
diff changeset
58 * Copyright (C) 2018 by via donau
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
59 * – Österreichische Wasserstraßen-Gesellschaft mbH
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
60 * 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
61 *
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
62 * Author(s):
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
63 * Thomas Junk <thomas.junk@intevation.de>
2549
9bf6b767a56a client: refactored and improved splitscreen for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 2540
diff changeset
64 * 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
65 * Fadi Abbud <fadi.abbud@intevation.de>
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
66 */
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
67 import * as d3 from "d3";
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
68 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
69 import debounce from "debounce";
3007
792d4476d5d5 client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2860
diff changeset
70 import jsPDF from "jspdf";
792d4476d5d5 client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2860
diff changeset
71 import canvg from "canvg";
3240
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
72 import { pdfgen } from "@/lib/mixins";
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
73 import { HTTP } from "@/lib/http";
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
74 import { displayError } from "@/lib/errors";
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
75
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
76 const GROUND_COLOR = "#4A2F06";
2854
1b5acce6120d client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents: 2566
diff changeset
77 const WATER_COLOR = "#005DFF";
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
78
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
79 export default {
3240
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
80 mixins: [pdfgen],
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
81 name: "fairwayprofile",
2854
1b5acce6120d client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents: 2566
diff changeset
82 components: {
1b5acce6120d client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents: 2566
diff changeset
83 DiagramLegend: () => import("@/components/DiagramLegend")
1b5acce6120d client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents: 2566
diff changeset
84 },
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
85 data() {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
86 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
87 width: null,
1372
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents: 1362
diff changeset
88 height: null,
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents: 1362
diff changeset
89 margin: {
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents: 1362
diff changeset
90 top: 20,
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents: 1362
diff changeset
91 right: 40,
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents: 1362
diff changeset
92 bottom: 30,
553aadd97087 new cross profile workflow (WIP)
Markus Kottlaender <markus@intevation.de>
parents: 1362
diff changeset
93 left: 40
3240
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
94 },
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
95 form: {
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
96 template: null
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
97 },
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
98 templates: [],
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
99 defaultTemplate: {
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
100 name: "default",
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
101 properties: {
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
102 paperSize: "a4",
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
103 format: "lanscape"
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
104 },
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
105 elements: [
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
106 {
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
107 type: "diagram",
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
108 position: "topleft",
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
109 offset: { x: 20, y: 60 },
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
110 width: 290,
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
111 height: 100
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
112 },
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
113 {
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
114 type: "diagramtitle",
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
115 position: "topleft",
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
116 offset: { x: 90, y: 30 },
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
117 fontsize: 22,
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
118 color: "steelblue"
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
119 },
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
120 {
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
121 type: "diagramlegend",
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
122 position: "topleft",
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
123 offset: { x: 30, y: 160 },
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
124 color: "black"
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
125 }
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
126 ]
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
127 },
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
128 pdf: {
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
129 doc: null,
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
130 width: 32,
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
131 height: 297
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
132 },
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
133 templateData: null
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
134 };
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
135 },
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
136 computed: {
1394
b350b0b5cb6c refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1391
diff changeset
137 ...mapGetters("fairwayprofile", ["totalLength"]),
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
138 ...mapState("fairwayprofile", [
2392
0b8793a1947c fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2389
diff changeset
139 "additionalSurvey",
0b8793a1947c fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2389
diff changeset
140 "currentProfile",
2566
83b938bf4da9 client: prepared store and minimized splitscreens for multiple simultaneous diagrams
Markus Kottlaender <markus@intevation.de>
parents: 2549
diff changeset
141 "startPoint",
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
142 "endPoint",
2392
0b8793a1947c fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2389
diff changeset
143 "fairwayData",
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
144 "maxAlt",
2392
0b8793a1947c fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2389
diff changeset
145 "referenceWaterLevel",
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
146 "selectedWaterLevel",
2392
0b8793a1947c fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2389
diff changeset
147 "waterLevels"
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
148 ]),
3146
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
149 ...mapState("application", ["paneSetup"]),
3241
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
150 ...mapState("user", ["user"]),
3146
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
151 title() {
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
152 let dates = [this.selectedSurvey.date_info];
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
153 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
154 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
155 return `${this.$gettext("Fairwayprofile")}: ${
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
156 this.selectedBottleneck
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
157 } (${dates.join(", ")})`;
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
158 },
3061
563176194d74 client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3032
diff changeset
159 selectedSurvey: {
563176194d74 client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3032
diff changeset
160 get() {
563176194d74 client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3032
diff changeset
161 return this.$store.state.bottlenecks.selectedSurvey;
563176194d74 client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3032
diff changeset
162 }
563176194d74 client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3032
diff changeset
163 },
563176194d74 client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3032
diff changeset
164 selectedBottleneck: {
563176194d74 client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3032
diff changeset
165 get() {
563176194d74 client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3032
diff changeset
166 return this.$store.state.bottlenecks.selectedBottleneck;
563176194d74 client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3032
diff changeset
167 }
563176194d74 client: add infos and diagram legend for the generated pdf(Fairway profiles)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3032
diff changeset
168 },
2549
9bf6b767a56a client: refactored and improved splitscreen for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 2540
diff changeset
169 ...mapState("bottlenecks", ["selectedSurvey"]),
2392
0b8793a1947c fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2389
diff changeset
170 relativeWaterLevelDelta() {
0b8793a1947c fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2389
diff changeset
171 return this.selectedWaterLevel.value - this.referenceWaterLevel;
0b8793a1947c fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2389
diff changeset
172 },
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
173 currentData() {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
174 if (
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
175 !this.selectedSurvey ||
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
176 !this.currentProfile.hasOwnProperty(this.selectedSurvey.date_info)
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
177 )
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
178 return [];
1394
b350b0b5cb6c refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1391
diff changeset
179 return this.currentProfile[this.selectedSurvey.date_info].points;
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
180 },
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
181 additionalData() {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
182 if (
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
183 !this.additionalSurvey ||
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
184 !this.currentProfile.hasOwnProperty(this.additionalSurvey.date_info)
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
185 )
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
186 return [];
1394
b350b0b5cb6c refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1391
diff changeset
187 return this.currentProfile[this.additionalSurvey.date_info].points;
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
188 },
1394
b350b0b5cb6c refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1391
diff changeset
189 xScale() {
b350b0b5cb6c refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1391
diff changeset
190 return [0, this.totalLength];
b350b0b5cb6c refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1391
diff changeset
191 },
b350b0b5cb6c refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1391
diff changeset
192 yScaleRight() {
2392
0b8793a1947c fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2389
diff changeset
193 //ToDO calcReleativeDepth(this.maxAlt) to get the
0b8793a1947c fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2389
diff changeset
194 // maximum depth according to the actual waterlevel
0b8793a1947c fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2389
diff changeset
195 // additionally: take the one which is higher reference or current waterlevel
1394
b350b0b5cb6c refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1391
diff changeset
196 const DELTA = this.maxAlt * 1.1 - this.maxAlt;
b350b0b5cb6c refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1391
diff changeset
197 return [this.maxAlt * 1 + DELTA, -DELTA];
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
198 }
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
199 },
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
200 watch: {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
201 currentData() {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
202 this.drawDiagram();
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
203 },
1382
8b85032ed3cd added loading animation to profile
Markus Kottlaender <markus@intevation.de>
parents: 1372
diff changeset
204 additionalData() {
8b85032ed3cd added loading animation to profile
Markus Kottlaender <markus@intevation.de>
parents: 1372
diff changeset
205 this.drawDiagram();
8b85032ed3cd added loading animation to profile
Markus Kottlaender <markus@intevation.de>
parents: 1372
diff changeset
206 },
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
207 width() {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
208 this.drawDiagram();
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
209 },
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
210 height() {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
211 this.drawDiagram();
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
212 },
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
213 waterLevels() {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
214 this.drawDiagram();
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 selectedWaterLevel() {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
217 this.drawDiagram();
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
218 },
2264
627bfcbbf631 client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2154
diff changeset
219 fairwayData() {
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
220 this.drawDiagram();
3149
a90091aaef67 client: fairwayprofile: close profile diagram when switching bottlenecks
Markus Kottlaender <markus@intevation.de>
parents: 3146
diff changeset
221 },
a90091aaef67 client: fairwayprofile: close profile diagram when switching bottlenecks
Markus Kottlaender <markus@intevation.de>
parents: 3146
diff changeset
222 selectedBottleneck() {
a90091aaef67 client: fairwayprofile: close profile diagram when switching bottlenecks
Markus Kottlaender <markus@intevation.de>
parents: 3146
diff changeset
223 this.$store.commit("application/paneSetup", "DEFAULT");
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
224 }
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
225 },
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
226 methods: {
3146
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
227 close() {
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
228 this.$store.commit(
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
229 "application/paneSetup",
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
230 this.paneSetup === "COMPARESURVEYS_FAIRWAYPROFILE"
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
231 ? "COMPARESURVEYS"
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
232 : "DEFAULT"
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
233 );
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
234 this.$store.dispatch("fairwayprofile/clearCurrentProfile");
b6cc4838d2c0 client: implemented pane mechanic for diagrams
Markus Kottlaender <markus@intevation.de>
parents: 3129
diff changeset
235 },
3240
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
236 applyChange() {
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
237 if (this.form.template.hasOwnProperty("properties")) {
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
238 this.templateData = this.defaultTemplate;
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
239 return;
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
240 }
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
241 if (this.form.template) {
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
242 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
243 headers: {
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
244 "X-Gemma-Auth": localStorage.getItem("token"),
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
245 "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
246 }
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
247 })
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
248 .then(response => {
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
249 this.templateData = response.data.template_data;
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
250 })
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
251 .catch(e => {
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
252 const { status, data } = e.response;
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
253 displayError({
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
254 title: this.$gettext("Backend Error"),
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
255 message: `${status}: ${data.message || data}`
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
256 });
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
257 });
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
258 }
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
259 },
3007
792d4476d5d5 client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2860
diff changeset
260 downloadPDF() {
3240
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
261 if (this.templateData) {
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
262 this.pdf.doc = new jsPDF(
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
263 "l",
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
264 "mm",
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
265 this.templateData.properties.paperSize
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
266 );
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
267 // 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
268 this.pdf.width =
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
269 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
270 this.pdf.height =
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
271 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
272 // 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
273 let defaultFontSize = 11,
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
274 defaultWidth = 70,
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
275 defaultTextColor = "black",
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
276 defaultBorderColor = "white",
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
277 defaultBgColor = "white",
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
278 defaultRounding = 2,
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
279 defaultPadding = 2,
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
280 defaultOffset = { x: 0, y: 0 };
3240
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
281 this.templateData.elements.forEach(e => {
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
282 switch (e.type) {
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
283 case "diagram": {
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
284 this.addDiagram(
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
285 e.position,
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
286 e.offset || defaultOffset,
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
287 e.width,
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
288 e.height
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
289 );
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
290 break;
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
291 }
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
292 case "diagramlegend": {
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
293 this.addDiagramLegend(
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
294 e.position,
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
295 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
296 e.color || defaultTextColor
3240
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
297 );
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
298 break;
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
299 }
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
300 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
301 let fairwayInfo =
aac1ca73e92a client: diagram-template:(cleanup) move reusable pdf-functions to mixins.js
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3250
diff changeset
302 this.selectedBottleneck +
aac1ca73e92a client: diagram-template:(cleanup) move reusable pdf-functions to mixins.js
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3250
diff changeset
303 " (" +
aac1ca73e92a client: diagram-template:(cleanup) move reusable pdf-functions to mixins.js
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3250
diff changeset
304 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
305 ")";
aac1ca73e92a client: diagram-template:(cleanup) move reusable pdf-functions to mixins.js
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3250
diff changeset
306 this.addDiagramTitle(
aac1ca73e92a client: diagram-template:(cleanup) move reusable pdf-functions to mixins.js
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3250
diff changeset
307 e.position,
aac1ca73e92a client: diagram-template:(cleanup) move reusable pdf-functions to mixins.js
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3250
diff changeset
308 e.offset,
aac1ca73e92a client: diagram-template:(cleanup) move reusable pdf-functions to mixins.js
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3250
diff changeset
309 e.fontsize,
aac1ca73e92a client: diagram-template:(cleanup) move reusable pdf-functions to mixins.js
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3250
diff changeset
310 e.color,
aac1ca73e92a client: diagram-template:(cleanup) move reusable pdf-functions to mixins.js
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3250
diff changeset
311 fairwayInfo
aac1ca73e92a client: diagram-template:(cleanup) move reusable pdf-functions to mixins.js
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3250
diff changeset
312 );
3240
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
313 break;
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
314 }
3241
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
315 case "image": {
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
316 this.addImage(
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
317 e.url,
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
318 e.format,
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
319 e.position,
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
320 e.offset || defaultOffset,
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
321 e.width,
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
322 e.height
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
323 );
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
324 break;
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
325 }
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
326 case "text": {
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
327 this.addText(
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
328 e.position,
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
329 e.offset || defaultOffset,
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
330 e.width || defaultWidth,
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
331 e.fontsize || defaultFontSize,
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
332 e.color || defaultTextColor,
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
333 e.text
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
334 );
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
335 break;
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
336 }
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
337 case "box": {
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
338 this.addBox(
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
339 e.position,
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
340 e.offset,
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
341 e.width,
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
342 e.height,
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
343 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
344 e.color || defaultBgColor,
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
345 e.brcolor || defaultBorderColor
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
346 );
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
347 break;
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
348 }
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
349 case "textbox": {
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
350 this.addTextBox(
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
351 e.position,
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
352 e.offset || defaultOffset,
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
353 e.width,
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
354 e.height,
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
355 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
356 e.padding || defaultPadding,
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
357 e.fontsize || defaultFontSize,
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
358 e.color || defaultTextColor,
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
359 e.background || defaultBgColor,
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
360 e.text,
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
361 e.brcolor || defaultBorderColor
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
362 );
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
363 break;
ecfa09241437 client: pdf-template: add a set of template-elements (fairwayprofile)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3240
diff changeset
364 }
3240
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
365 }
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
366 });
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
367 }
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
368 this.pdf.doc.save("Fairwayprofile diagram");
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
369 },
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
370 addDiagram(position, offset, width, height) {
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
371 let x = offset.x,
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
372 y = offset.y;
3007
792d4476d5d5 client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2860
diff changeset
373 var svg = this.$refs.diagramContainer.innerHTML;
792d4476d5d5 client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2860
diff changeset
374 if (svg) {
792d4476d5d5 client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2860
diff changeset
375 svg = svg.replace(/\r?\n|\r/g, "").trim();
792d4476d5d5 client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2860
diff changeset
376 }
3240
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
377 // landscape format is used for both a3,a4 papersize
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
378 if (!width) {
3250
246754028bf4 client: cleanup code (fairwayprofile diagram)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3241
diff changeset
379 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
380 }
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
381 if (!height) {
3250
246754028bf4 client: cleanup code (fairwayprofile diagram)
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3241
diff changeset
382 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
383 }
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
384 if (["topright", "bottomright"].indexOf(position) !== -1) {
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
385 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
386 }
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
387 if (["bottomright", "bottomleft"].indexOf(position) !== -1) {
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
388 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
389 }
3007
792d4476d5d5 client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2860
diff changeset
390 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
391 canvas.width = window.innerWidth;
3020
94edd5e5dd1b client: linting
Markus Kottlaender <markus@intevation.de>
parents: 3018
diff changeset
392 canvas.height = window.innerHeight / 2;
3007
792d4476d5d5 client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2860
diff changeset
393 canvg(canvas, svg, {
792d4476d5d5 client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2860
diff changeset
394 ignoreMouse: true,
792d4476d5d5 client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2860
diff changeset
395 ignoreAnimation: true,
792d4476d5d5 client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2860
diff changeset
396 ignoreDimensions: true
792d4476d5d5 client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2860
diff changeset
397 });
792d4476d5d5 client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2860
diff changeset
398 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
399 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
400 },
136b86794453 client: improve pdf-gen code for diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3061
diff changeset
401 // Diagram legend
3240
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
402 addDiagramLegend(position, offset, color) {
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
403 let x = offset.x,
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
404 y = offset.y;
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
405 let width =
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
406 (this.pdf.doc.getStringUnitWidth("Ground") * 10) / (72 / 25.6) + 5;
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
407 if (["topright", "bottomright"].indexOf(position) !== -1) {
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
408 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
409 }
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
410 if (["bottomright", "bottomleft"].indexOf(position) !== -1) {
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
411 y = this.pdf.height - offset.y - this.getTextHeight(3);
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
412 }
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
413 this.pdf.doc.setFontSize(10);
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
414 this.pdf.doc.setTextColor(color);
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
415 this.pdf.doc.setDrawColor("white");
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
416 this.pdf.doc.setFillColor("#5995ff");
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
417 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
418 this.pdf.doc.text(x + 3, y + 1, "Water");
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
419 this.pdf.doc.setFillColor("#1f4fff");
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
420 this.pdf.doc.circle(x, y + 5, 2, "FD");
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
421 this.pdf.doc.text(x + 3, y + 6, "Fairway");
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
422 this.pdf.doc.setFillColor("#4a2f06");
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
423 this.pdf.doc.circle(x, y + 10, 2, "FD");
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
424 this.pdf.doc.text(x + 3, y + 11, "Ground");
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
425 },
2392
0b8793a1947c fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2389
diff changeset
426 calcRelativeDepth(depth) {
0b8793a1947c fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2389
diff changeset
427 /* takes a depth value and substracts the delta of the relative waterlevel
0b8793a1947c fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2389
diff changeset
428 * say the reference level is above the current level, the ground is nearer,
0b8793a1947c fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2389
diff changeset
429 * thus, the depth is lower.
0b8793a1947c fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2389
diff changeset
430 *
0b8793a1947c fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2389
diff changeset
431 * E.g.:
0b8793a1947c fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2389
diff changeset
432 *
0b8793a1947c fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2389
diff changeset
433 * Reference waterlevel 5m, current 4m => delta = -1m
0b8793a1947c fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2389
diff changeset
434 * If the distance to the ground was 3m from the 5m mark
0b8793a1947c fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2389
diff changeset
435 * it is now only 2m from the current waterlevel.
0b8793a1947c fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2389
diff changeset
436 *
0b8793a1947c fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2389
diff changeset
437 * Vice versa:
0b8793a1947c fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2389
diff changeset
438 *
0b8793a1947c fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2389
diff changeset
439 * If the reference level is 5m and the current 6m => delta = +1m
0b8793a1947c fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2389
diff changeset
440 * The ground is one meter farer away from the current waterlevel
0b8793a1947c fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2389
diff changeset
441 *
0b8793a1947c fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2389
diff changeset
442 */
0b8793a1947c fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2389
diff changeset
443 return depth - this.relativeWaterLevelDelta;
0b8793a1947c fairway_profile: calc relative depth WIP
Thomas Junk <thomas.junk@intevation.de>
parents: 2389
diff changeset
444 },
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
445 drawDiagram() {
2854
1b5acce6120d client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents: 2566
diff changeset
446 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
447 this.scaleFairwayProfile();
2854
1b5acce6120d client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents: 2566
diff changeset
448 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
449 svg.attr("width", "100%");
1b5acce6120d client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents: 2566
diff changeset
450 svg.attr("height", "100%");
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
451 const width = this.width - this.margin.right - 1.5 * this.margin.left;
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
452 const height = this.height - this.margin.top - 2 * this.margin.bottom;
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
453 const currentData = this.currentData;
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
454 const additionalData = this.additionalData;
1394
b350b0b5cb6c refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1391
diff changeset
455 const { xScale, yScaleRight, graph } = this.generateCoordinates(
b350b0b5cb6c refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1391
diff changeset
456 svg,
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
457 height,
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
458 width
1394
b350b0b5cb6c refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1391
diff changeset
459 );
1588
2888bfacd331 fairwayprofile: do not try to render fairwayprofile without dimensions
Thomas Junk <thomas.junk@intevation.de>
parents: 1558
diff changeset
460 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
461 this.drawWaterlevel({ graph, xScale, yScaleRight, height });
b350b0b5cb6c refactored fairwayprofile cross cuts
Markus Kottlaender <markus@intevation.de>
parents: 1391
diff changeset
462 this.drawLabels({ graph, height });
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
463 if (currentData) {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
464 this.drawProfile({
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
465 graph,
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
466 xScale,
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
467 yScaleRight,
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
468 currentData,
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
469 height,
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
470 color: GROUND_COLOR,
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
471 strokeColor: "black",
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
472 opacity: 1
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
473 });
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
474 }
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
475 if (additionalData) {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
476 this.drawProfile({
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
477 graph,
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
478 xScale,
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
479 yScaleRight,
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
480 currentData: additionalData,
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
481 height,
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
482 color: GROUND_COLOR,
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
483 strokeColor: "#943007",
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
484 opacity: 0.6
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
485 });
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
486 }
2358
da75385887b9 fairway_profile: render riverbed on layer behind LOS
Thomas Junk <thomas.junk@intevation.de>
parents: 2265
diff changeset
487 this.drawFairway({ graph, xScale, yScaleRight });
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
488 },
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
489 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
490 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
491 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
492 }
627bfcbbf631 client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2154
diff changeset
493 for (let data of this.fairwayData) {
627bfcbbf631 client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2154
diff changeset
494 const [startPoint, endPoint, depth] = data.coordinates[0];
627bfcbbf631 client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2154
diff changeset
495 const style = data.style();
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
496 let fairwayArea = d3
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
497 .area()
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
498 .x(function(d) {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
499 return xScale(d.x);
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
500 })
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
501 .y0(yScaleRight(0))
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
502 .y1(function(d) {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
503 return yScaleRight(d.y);
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
504 });
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
505 graph
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
506 .append("path")
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
507 .datum([{ x: startPoint, y: depth }, { x: endPoint, y: depth }])
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
508 .attr("fill", "#002AFF")
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
509 .attr("fill-opacity", 0.65)
2264
627bfcbbf631 client: Draw fairway dimensions for all LoS and in more "cut cases".
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2154
diff changeset
510 .attr("stroke", style[0].getStroke().getColor())
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
511 .attr("d", fairwayArea);
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
512 }
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
513 },
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
514 drawLabels({ graph, height }) {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
515 graph
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
516 .append("text")
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
517 .attr("transform", ["rotate(-90)"])
2854
1b5acce6120d client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents: 2566
diff changeset
518 .attr("y", this.width - 70)
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
519 .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
520 .attr("dy", "1em")
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
521 .attr("fill", "black")
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
522 .style("text-anchor", "middle")
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
523 .text("Depth [m]");
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
524 graph
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
525 .append("text")
2854
1b5acce6120d client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents: 2566
diff changeset
526 .attr("y", -50)
1b5acce6120d client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents: 2566
diff changeset
527 .attr("x", -(height / 4))
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
528 .attr("dy", "1em")
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
529 .attr("fill", "black")
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
530 .style("text-anchor", "middle")
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
531 .attr("transform", [
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
532 "translate(" + this.width / 2 + "," + this.height + ")",
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
533 "rotate(0)"
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
534 ])
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
535 .text("Width [m]");
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
536 },
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
537 generateCoordinates(svg, height, width) {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
538 let xScale = d3
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
539 .scaleLinear()
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
540 .domain(this.xScale)
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
541 .rangeRound([0, width]);
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
542
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
543 xScale.ticks(5);
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
544
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
545 let yScaleRight = d3
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
546 .scaleLinear()
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
547 .domain(this.yScaleRight)
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
548 .rangeRound([height, 0]);
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
549
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
550 let xAxis = d3.axisBottom(xScale);
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
551 let yAxis2 = d3.axisRight(yScaleRight);
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
552 let graph = svg
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
553 .append("g")
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
554 .attr(
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
555 "transform",
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
556 "translate(" + this.margin.left + "," + this.margin.top + ")"
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
557 );
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
558 graph
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
559 .append("g")
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
560 .attr("transform", "translate(0," + height + ")")
3007
792d4476d5d5 client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2860
diff changeset
561 .call(xAxis.ticks(5))
792d4476d5d5 client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2860
diff changeset
562 .selectAll(".tick text")
792d4476d5d5 client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2860
diff changeset
563 .attr("fill", "black")
792d4476d5d5 client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2860
diff changeset
564 .select(function() {
792d4476d5d5 client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2860
diff changeset
565 return this.parentNode;
792d4476d5d5 client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2860
diff changeset
566 })
792d4476d5d5 client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2860
diff changeset
567 .selectAll(".tick line")
792d4476d5d5 client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2860
diff changeset
568 .attr("stroke", "black");
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
569 graph
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
570 .append("g")
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
571 .attr("transform", "translate(" + width + ",0)")
3007
792d4476d5d5 client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2860
diff changeset
572 .call(yAxis2)
792d4476d5d5 client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2860
diff changeset
573 .selectAll(".tick text")
792d4476d5d5 client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2860
diff changeset
574 .attr("fill", "black")
792d4476d5d5 client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2860
diff changeset
575 .select(function() {
792d4476d5d5 client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2860
diff changeset
576 return this.parentNode;
792d4476d5d5 client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2860
diff changeset
577 })
792d4476d5d5 client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2860
diff changeset
578 .selectAll(".tick line")
792d4476d5d5 client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2860
diff changeset
579 .attr("stroke", "black");
792d4476d5d5 client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2860
diff changeset
580 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
581 return { xScale, yScaleRight, graph };
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
582 },
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
583 drawWaterlevel({ graph, xScale, yScaleRight, height }) {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
584 let waterArea = d3
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
585 .area()
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
586 .x(function(d) {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
587 return xScale(d.x);
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
588 })
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
589 .y0(height)
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
590 .y1(function(d) {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
591 return yScaleRight(d.y);
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
592 });
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
593 graph
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
594 .append("path")
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
595 .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
596 .attr("fill-opacity", 0.65)
2854
1b5acce6120d client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents: 2566
diff changeset
597 .attr("fill", WATER_COLOR)
1b5acce6120d client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents: 2566
diff changeset
598 .attr("stroke", WATER_COLOR)
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
599 .attr("d", waterArea);
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
600 },
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
601 drawProfile({
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
602 graph,
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
603 xScale,
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
604 yScaleRight,
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
605 currentData,
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
606 height,
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
607 color,
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
608 strokeColor,
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
609 opacity
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
610 }) {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
611 for (let part of currentData) {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
612 let profileLine = d3
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
613 .line()
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
614 .x(d => {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
615 return xScale(d.x);
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
616 })
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
617 .y(d => {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
618 return yScaleRight(d.y);
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
619 });
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
620 let profileArea = d3
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
621 .area()
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
622 .x(function(d) {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
623 return xScale(d.x);
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
624 })
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
625 .y0(height)
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
626 .y1(function(d) {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
627 return yScaleRight(d.y);
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
628 });
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
629 graph
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
630 .append("path")
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
631 .datum(part)
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
632 .attr("fill", color)
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
633 .attr("stroke", color)
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
634 .attr("stroke-width", 3)
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
635 .attr("stroke-opacity", opacity)
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
636 .attr("fill-opacity", opacity)
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
637 .attr("d", profileArea);
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
638 graph
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
639 .append("path")
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
640 .datum(part)
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
641 .attr("fill", "none")
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
642 .attr("stroke", strokeColor)
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
643 .attr("stroke-linejoin", "round")
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
644 .attr("stroke-linecap", "round")
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
645 .attr("stroke-width", 3)
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
646 .attr("stroke-opacity", opacity)
3007
792d4476d5d5 client:implemented pdf-generation for profiles diagrams
Fadi Abbud <fadi.abbud@intevation.de>
parents: 2860
diff changeset
647 .attr("fill-opacity", 0)
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
648 .attr("d", profileLine);
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
649 }
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
650 },
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
651 scaleFairwayProfile() {
2854
1b5acce6120d client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents: 2566
diff changeset
652 if (!document.querySelector(".diagram-container")) return;
1b5acce6120d client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents: 2566
diff changeset
653 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
654 .clientHeight;
2854
1b5acce6120d client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents: 2566
diff changeset
655 const clientWidth = document.querySelector(".diagram-container")
1b5acce6120d client: added legend to cross profile diagram
Markus Kottlaender <markus@intevation.de>
parents: 2566
diff changeset
656 .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
657 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
658 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
659 this.width = clientWidth;
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
660 }
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
661 },
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
662 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
663 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
664 },
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
665 mounted() {
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
666 this.drawDiagram();
3240
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
667 this.templates[0] = this.defaultTemplate;
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
668 this.form.template = this.templates[0];
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
669 this.templateData = this.form.template;
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
670 HTTP.get("/templates/diagram", {
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
671 headers: {
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
672 "X-Gemma-Auth": localStorage.getItem("token"),
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
673 "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
674 }
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
675 })
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
676 .then(response => {
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
677 if (response.data.length) {
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
678 this.templates = response.data;
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
679 this.form.template = this.templates[0];
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
680 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
681 this.applyChange();
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
682 }
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
683 })
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
684 .catch(e => {
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
685 const { status, data } = e.response;
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
686 displayError({
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
687 title: this.$gettext("Backend Error"),
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
688 message: `${status}: ${data.message || data}`
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
689 });
5240f5440b62 client: implemnt pdf-template for fairwayprofile diagram
Fadi Abbud <fadi.abbud@intevation.de>
parents: 3149
diff changeset
690 });
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
691 },
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
692 updated() {
2860
dbc799261811 client: fairway profile: removed old code
Markus Kottlaender <markus@intevation.de>
parents: 2854
diff changeset
693 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
694 },
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
695 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
696 window.removeEventListener("resize", debounce(this.drawDiagram));
1272
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
697 }
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
698 };
bc55ffaeb639 cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
699 </script>