changeset 1052:b30361464775

The pdf format depends on the chart's aspect ratio (issue290). gnv-artifacts/trunk@1126 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 26 May 2010 06:45:03 +0000
parents 8f836fb6f592
children 6169ddc827ac
files gnv-artifacts/ChangeLog gnv-artifacts/src/main/java/de/intevation/gnv/exports/ChartExportHelper.java gnv-artifacts/src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java
diffstat 3 files changed, 15 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/gnv-artifacts/ChangeLog	Tue May 25 17:46:28 2010 +0000
+++ b/gnv-artifacts/ChangeLog	Wed May 26 06:45:03 2010 +0000
@@ -1,3 +1,15 @@
+2010-05-26  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue290 - PDF format belongs to the chart's aspect ratio.
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java:
+	  Removed reading the system property "export.pdf.landscape" to adjust the
+	  page format of a pdf.
+
+	* src/main/java/de/intevation/gnv/exports/ChartExportHelper.java: The page
+	  format of a pdf now depends on the chart's aspect ratio. If width > height
+	  the format will be landscape, otherwise the format will be portrait.
+
 2010-05-25  Ingo Weinzierl <ingo.weinzierl@intevation.de>
 
 	  Issue286
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/exports/ChartExportHelper.java	Tue May 25 17:46:28 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/exports/ChartExportHelper.java	Wed May 26 06:45:03 2010 +0000
@@ -235,7 +235,6 @@
         OutputStream out,
         JFreeChart   chart,
         String       pageFormat,
-        boolean      landscape,
         float        marginLeft,
         float        marginRight,
         float        marginTop,
@@ -256,6 +255,8 @@
         int chartWidth  = (Integer) context.getContextValue("chart.width");
         int chartHeight = (Integer) context.getContextValue("chart.height");
 
+        boolean landscape = chartWidth > chartHeight ? true : false;
+
         int width  = 0;
         int height = 0;
         if (landscape) {
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java	Tue May 25 17:46:28 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java	Wed May 26 06:45:03 2010 +0000
@@ -85,15 +85,6 @@
         Boolean.parseBoolean(System.getProperty("cache.chart", "false"));
 
     /**
-     * A field parsing a system property to adjust the alignment of pdf exports.
-     * The system property is 'export.pdf.landscape' and should be true or
-     * false. If this property is true, PDFs will be created in landscape
-     * format.
-     */
-    protected static final boolean PDF_FORMAT_LANDSCAPE =
-        Boolean.parseBoolean(System.getProperty("export.pdf.landscape","true"));
-
-    /**
      * Supported image export formats.
      */
     protected static final String[] IMG_EXPORT_FORMAT = {
@@ -389,7 +380,6 @@
                         chartLables,
                         uuid,
                         "A4",
-                        true,
                         callContext
                     );
                 }
@@ -445,7 +435,7 @@
                         outputStream,
                         histograms,
                         "A4",
-                        PDF_FORMAT_LANDSCAPE,
+                        true,
                         50F, 50F, 50F, 50F
                     );
                 }
@@ -848,7 +838,6 @@
         ChartLabels  chartLables,
         String       uuid,
         String       exportFormat,
-        boolean      landscape,
         CallContext  context
     ) {
         Chart chart = getChart(
@@ -874,7 +863,6 @@
             outputStream,
             chart.generateChart(),
             "A4",
-            PDF_FORMAT_LANDSCAPE,
             50F, 50F, 50F, 50F,
             context
         );

http://dive4elements.wald.intevation.org