Mercurial > dive4elements > river
changeset 3620:1cd6114603d9
Improved logo placement.
flys-artifacts/trunk@5296 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 29 Aug 2012 14:33:48 +0000 |
parents | 1548935582bc |
children | 6772e9f9b65f |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java |
diffstat | 2 files changed, 50 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Wed Aug 29 14:32:00 2012 +0000 +++ b/flys-artifacts/ChangeLog Wed Aug 29 14:33:48 2012 +0000 @@ -1,3 +1,8 @@ +2012-08-29 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + * src/main/java/de/intevation/flys/exports/XYChartGenerator.java: + Use RectangleAnchor to set anchor of logo. + 2012-08-29 Felix Wolfsteller <felix.wolfsteller@intevation.de> * src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java Wed Aug 29 14:32:00 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java Wed Aug 29 14:33:48 2012 +0000 @@ -273,9 +273,9 @@ double xPos = 0d, yPos = 0d; - // TODO placement should be decided by from other properties. String placeh = logoHPlace(); String placev = logoVPlace(); + if (placev == null || placev.equals("none")) { placev = "top"; } @@ -288,7 +288,9 @@ else if (placev.equals("center")) { yPos = ((Double)getYBounds(0).getUpper() + (Double)getYBounds(0).getLower())/2d; } - // TODO else + else { + logger.debug("Unknown place-v value: " + placev); + } if (placeh == null || placeh.equals("none")) { placeh = "center"; @@ -302,11 +304,50 @@ else if (placeh.equals("center")) { xPos = ((Double)getXBounds(0).getUpper() + (Double)getXBounds(0).getLower())/2d; } - // TODO else + else { + logger.debug("Unknown place-h value: " + placeh); + } + logger.debug("logo position: " + xPos + "/" + yPos); + org.jfree.ui.RectangleAnchor anchor + = org.jfree.ui.RectangleAnchor.TOP; + if (placev.equals("top")) { + if (placeh.equals("left")) { + anchor = org.jfree.ui.RectangleAnchor.TOP_LEFT; + } + else if (placeh.equals("right")) { + anchor = org.jfree.ui.RectangleAnchor.TOP_RIGHT; + } + else if (placeh.equals("center")) { + anchor = org.jfree.ui.RectangleAnchor.TOP; + } + } + else if (placev.equals("bottom")) { + if (placeh.equals("left")) { + anchor = org.jfree.ui.RectangleAnchor.BOTTOM_LEFT; + } + else if (placeh.equals("right")) { + anchor = org.jfree.ui.RectangleAnchor.BOTTOM_RIGHT; + } + else if (placeh.equals("center")) { + anchor = org.jfree.ui.RectangleAnchor.BOTTOM; + } + } + else if (placev.equals("center")) { + if (placeh.equals("left")) { + anchor = org.jfree.ui.RectangleAnchor.LEFT; + } + else if (placeh.equals("right")) { + anchor = org.jfree.ui.RectangleAnchor.RIGHT; + } + else if (placeh.equals("center")) { + anchor = org.jfree.ui.RectangleAnchor.CENTER; + } + } + XYAnnotation xyannotation = - new XYImageAnnotation(xPos, yPos, imageIcon.getImage()); + new XYImageAnnotation(xPos, yPos, imageIcon.getImage(), anchor); plot.getRenderer().addAnnotation(xyannotation, org.jfree.ui.Layer.BACKGROUND); }