# HG changeset patch # User Felix Wolfsteller # Date 1346250828 0 # Node ID 1cd6114603d99db28e82c779a5e47e421c0c22e8 # Parent 1548935582bc2b276b90360b03c4299e9d89e849 Improved logo placement. flys-artifacts/trunk@5296 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 1548935582bc -r 1cd6114603d9 flys-artifacts/ChangeLog --- 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 + + * src/main/java/de/intevation/flys/exports/XYChartGenerator.java: + Use RectangleAnchor to set anchor of logo. + 2012-08-29 Felix Wolfsteller * src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java: diff -r 1548935582bc -r 1cd6114603d9 flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.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); }