Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java @ 3617:05deafdcbf39
sloppy logo placement property implementation.
flys-artifacts/trunk@5284 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 28 Aug 2012 15:53:05 +0000 |
parents | d4751be54745 |
children | b7867c03760a |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java Tue Aug 28 13:21:38 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java Tue Aug 28 15:53:05 2012 +0000 @@ -269,9 +269,33 @@ 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"; + } + if (place.equals("top")) { + xPos = ((Double)getXBounds(0).getUpper() - (Double)getXBounds(0).getLower())/2d; + yPos = (Double)getYBounds(0).getUpper(); + } + else if (place.equals("bottom")) { + xPos = ((Double)getXBounds(0).getUpper() - (Double)getXBounds(0).getLower())/2d; + 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 (place.equals("right")) { + xPos = (Double)getXBounds(0).getUpper(); + yPos = ((Double)getYBounds(0).getLower() - (Double)getYBounds(0).getLower())/2d; + } + logger.debug("logo position: " + xPos + "/" + yPos); + XYAnnotation xyannotation = - new XYImageAnnotation(10, 10, imageIcon.getImage()); + new XYImageAnnotation(xPos, yPos, imageIcon.getImage()); plot.getRenderer().addAnnotation(xyannotation, org.jfree.ui.Layer.BACKGROUND); }