diff flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java @ 3618:b7867c03760a

Split logo placement property in two (vertical/horizontal). flys-artifacts/trunk@5286 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 29 Aug 2012 07:58:08 +0000
parents 05deafdcbf39
children 1cd6114603d9
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Tue Aug 28 15:53:05 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Wed Aug 29 07:58:08 2012 +0000
@@ -261,37 +261,48 @@
         }
 
         ImageIcon imageIcon = null; 
-        // TODO: Which logo?
+        if (logo.equals("none")) {
+            return;
+        }
         if (logo.equals("Intevation")) {
             imageIcon = new ImageIcon("/home/felix/Downloads/intevation_logo_120.png");
         }
-        else {
+        else { // TODO else if ...
             imageIcon = new ImageIcon("/home/felix/Downloads/bfg_logo.gif");
         }
 
         double xPos = 0d, yPos = 0d;
 
         // TODO placement should be decided by from other properties.
-        String place = logoPlace();
-        if (place == null || place.equals("none")) {
-            place = "top";
+        String placeh = logoHPlace();
+        String placev = logoVPlace();
+        if (placev == null || placev.equals("none")) {
+            placev = "top";
         }
-        if (place.equals("top")) {
-            xPos = ((Double)getXBounds(0).getUpper() - (Double)getXBounds(0).getLower())/2d;
+        if (placev.equals("top")) {
             yPos = (Double)getYBounds(0).getUpper();
         }
-        else if (place.equals("bottom")) {
-            xPos = ((Double)getXBounds(0).getUpper() - (Double)getXBounds(0).getLower())/2d;
+        else if (placev.equals("bottom")) {
             yPos = (Double)getYBounds(0).getLower();
         }
-        else if (place.equals("left")) {
-            xPos = (Double)getXBounds(0).getLower();
-            yPos = ((Double)getYBounds(0).getLower() - (Double)getYBounds(0).getLower())/2d;
+        else if (placev.equals("center")) {
+            yPos = ((Double)getYBounds(0).getUpper() + (Double)getYBounds(0).getLower())/2d;
         }
-        else if (place.equals("right")) {
+        // TODO else
+
+        if (placeh == null || placeh.equals("none")) {
+            placeh = "center";
+        }
+        if (placeh.equals("left")) {
+            xPos = (Double)getXBounds(0).getLower();
+        }
+        else if (placeh.equals("right")) {
             xPos = (Double)getXBounds(0).getUpper();
-            yPos = ((Double)getYBounds(0).getLower() - (Double)getYBounds(0).getLower())/2d;
         }
+        else if (placeh.equals("center")) {
+            xPos = ((Double)getXBounds(0).getUpper() + (Double)getXBounds(0).getLower())/2d;
+        }
+        // TODO else
         logger.debug("logo position: " + xPos + "/" + yPos);
 
         XYAnnotation xyannotation =

http://dive4elements.wald.intevation.org