comparison client/src/components/fairway/Fairwayprofile.vue @ 3241:ecfa09241437

client: pdf-template: add a set of template-elements (fairwayprofile)
author Fadi Abbud <fadi.abbud@intevation.de>
date Fri, 10 May 2019 13:11:24 +0200
parents 5240f5440b62
children 246754028bf4
comparison
equal deleted inserted replaced
3240:5240f5440b62 3241:ecfa09241437
144 "referenceWaterLevel", 144 "referenceWaterLevel",
145 "selectedWaterLevel", 145 "selectedWaterLevel",
146 "waterLevels" 146 "waterLevels"
147 ]), 147 ]),
148 ...mapState("application", ["paneSetup"]), 148 ...mapState("application", ["paneSetup"]),
149 ...mapState("user", ["user"]),
149 title() { 150 title() {
150 let dates = [this.selectedSurvey.date_info]; 151 let dates = [this.selectedSurvey.date_info];
151 if (this.additionalSurvey) dates.push(this.additionalSurvey.date_info); 152 if (this.additionalSurvey) dates.push(this.additionalSurvey.date_info);
152 dates.map(d => this.$options.filters.dateTime(d, true)); 153 dates.map(d => this.$options.filters.dateTime(d, true));
153 return `${this.$gettext("Fairwayprofile")}: ${ 154 return `${this.$gettext("Fairwayprofile")}: ${
265 // pdf width and height in millimeter (landscape) 266 // pdf width and height in millimeter (landscape)
266 this.pdf.width = 267 this.pdf.width =
267 this.templateData.properties.paperSize === "a3" ? 420 : 297; 268 this.templateData.properties.paperSize === "a3" ? 420 : 297;
268 this.pdf.height = 269 this.pdf.height =
269 this.templateData.properties.paperSize === "a3" ? 297 : 210; 270 this.templateData.properties.paperSize === "a3" ? 297 : 210;
270 let defaultOffset = { x: 0, Y: 0 }, 271 // default values if some are missing in template
271 defaultColor = "black"; 272 let defaultFontSize = 11,
273 defaultWidth = 70,
274 defaultTextColor = "black",
275 defaultBorderColor = "white",
276 defaultBgColor = "white",
277 defaultRounding = 2,
278 defaultPadding = 2,
279 defaultOffset = { x: 0, y: 0 };
272 this.templateData.elements.forEach(e => { 280 this.templateData.elements.forEach(e => {
273 switch (e.type) { 281 switch (e.type) {
274 case "diagram": { 282 case "diagram": {
275 this.addDiagram( 283 this.addDiagram(
276 e.position, 284 e.position,
282 } 290 }
283 case "diagramlegend": { 291 case "diagramlegend": {
284 this.addDiagramLegend( 292 this.addDiagramLegend(
285 e.position, 293 e.position,
286 e.offset || defaultOffset, 294 e.offset || defaultOffset,
287 e.color || defaultColor 295 e.color || defaultTextColor
288 ); 296 );
289 break; 297 break;
290 } 298 }
291 case "diagramtitle": { 299 case "diagramtitle": {
292 this.addDiagramTitle(e.position, e.offset, e.fontsize, e.color); 300 this.addDiagramTitle(e.position, e.offset, e.fontsize, e.color);
301 break;
302 }
303 case "image": {
304 this.addImage(
305 e.url,
306 e.format,
307 e.position,
308 e.offset || defaultOffset,
309 e.width,
310 e.height
311 );
312 break;
313 }
314 case "text": {
315 this.addText(
316 e.position,
317 e.offset || defaultOffset,
318 e.width || defaultWidth,
319 e.fontsize || defaultFontSize,
320 e.color || defaultTextColor,
321 e.text
322 );
323 break;
324 }
325 case "box": {
326 this.addBox(
327 e.position,
328 e.offset,
329 e.width,
330 e.height,
331 e.rounding === 0 || e.rounding ? e.rounding : defaultRounding,
332 e.color || defaultBgColor,
333 e.brcolor || defaultBorderColor
334 );
335 break;
336 }
337 case "textbox": {
338 this.addTextBox(
339 e.position,
340 e.offset || defaultOffset,
341 e.width,
342 e.height,
343 e.rounding === 0 || e.rounding ? e.rounding : defaultRounding,
344 e.padding || defaultPadding,
345 e.fontsize || defaultFontSize,
346 e.color || defaultTextColor,
347 e.background || defaultBgColor,
348 e.text,
349 e.brcolor || defaultBorderColor
350 );
293 break; 351 break;
294 } 352 }
295 } 353 }
296 }); 354 });
297 } 355 }