Mercurial > gemma
changeset 2137:a31c9fa47ab8
client: pdf-gen: add bottleneck details
* Add a simple version of Bottleneck details into the right upper corner.
The legend is pushed down.
author | Bernhard Reiter <bernhard@intevation.de> |
---|---|
date | Wed, 06 Feb 2019 16:26:39 +0100 |
parents | 3138d60dd1a6 |
children | 4a903d382901 |
files | client/src/components/Pdftool.vue |
diffstat | 1 files changed, 25 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/components/Pdftool.vue Wed Feb 06 15:53:24 2019 +0100 +++ b/client/src/components/Pdftool.vue Wed Feb 06 16:26:39 2019 +0100 @@ -163,7 +163,7 @@ }, computed: { ...mapState("application", ["showPdfTool", "logoForPDF"]), - ...mapState("bottlenecks", ["selectedSurvey"]), + ...mapState("bottlenecks", ["selectedBottleneck", "selectedSurvey"]), ...mapState("map", ["openLayersMap", "isolinesLegendImgDataURL"]), ...mapGetters("map", ["getLayerByName"]), ...mapState("user", ["user"]) @@ -272,7 +272,8 @@ self.addAboutBox(pdf, width, height); if (self.getLayerByName("Bottleneck isolines").isVisible) { - self.addLegend(pdf, width, height); + self.addBottleneckInfo(pdf, 13, width, height); + self.addLegend(pdf, 14, width, height); } pdf.save("map.pdf"); @@ -466,7 +467,7 @@ "Dislaimer: Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua."; this.addText(doc, 5, docHeight - 6, 8, "black", 115, str); }, - addLegend(doc, docWidth) { + addLegend(doc, fromTop, docWidth) { // transforming into an HTMLImageElement only to find out // the width x height of the legend image // FUTURE: find a better way to get the width and height @@ -474,8 +475,27 @@ legendImage.src = this.isolinesLegendImgDataURL; let aspectRatio = legendImage.width / legendImage.height; - this.addRoundedBox(doc, docWidth - 54, 0, 54, 50 / aspectRatio + 4); - doc.addImage(legendImage, docWidth - 52, 2, 50, 50 / aspectRatio); + this.addRoundedBox(doc, docWidth - 54, fromTop, 54, 50 / aspectRatio + 4); + doc.addImage( + legendImage, + docWidth - 52, + fromTop + 2, + 50, + 50 / aspectRatio + ); + }, + addBottleneckInfo(doc, height, docWidth) { + this.addRoundedBox(doc, docWidth - 54, 0, 54, height); + let str1 = this.$gettext("Bottleneck") + ": " + this.selectedBottleneck; + this.addText(doc, docWidth - 51, 4, 8, "black", 46, str1); + + let survey = this.selectedSurvey; + + let str2 = this.$gettext("Survey date") + ": " + survey.date_info; + this.addText(doc, docWidth - 51, 7.5, 8, "black", 46, str2); + + let str3 = this.$gettext("Ref gauge") + ": " + survey.gauge_objname; + this.addText(doc, docWidth - 51, 11, 8, "black", 46, str3); } } };