Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java @ 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 | b7867c03760a |
children | 6772e9f9b65f |
comparison
equal
deleted
inserted
replaced
3619:1548935582bc | 3620:1cd6114603d9 |
---|---|
271 imageIcon = new ImageIcon("/home/felix/Downloads/bfg_logo.gif"); | 271 imageIcon = new ImageIcon("/home/felix/Downloads/bfg_logo.gif"); |
272 } | 272 } |
273 | 273 |
274 double xPos = 0d, yPos = 0d; | 274 double xPos = 0d, yPos = 0d; |
275 | 275 |
276 // TODO placement should be decided by from other properties. | |
277 String placeh = logoHPlace(); | 276 String placeh = logoHPlace(); |
278 String placev = logoVPlace(); | 277 String placev = logoVPlace(); |
278 | |
279 if (placev == null || placev.equals("none")) { | 279 if (placev == null || placev.equals("none")) { |
280 placev = "top"; | 280 placev = "top"; |
281 } | 281 } |
282 if (placev.equals("top")) { | 282 if (placev.equals("top")) { |
283 yPos = (Double)getYBounds(0).getUpper(); | 283 yPos = (Double)getYBounds(0).getUpper(); |
286 yPos = (Double)getYBounds(0).getLower(); | 286 yPos = (Double)getYBounds(0).getLower(); |
287 } | 287 } |
288 else if (placev.equals("center")) { | 288 else if (placev.equals("center")) { |
289 yPos = ((Double)getYBounds(0).getUpper() + (Double)getYBounds(0).getLower())/2d; | 289 yPos = ((Double)getYBounds(0).getUpper() + (Double)getYBounds(0).getLower())/2d; |
290 } | 290 } |
291 // TODO else | 291 else { |
292 logger.debug("Unknown place-v value: " + placev); | |
293 } | |
292 | 294 |
293 if (placeh == null || placeh.equals("none")) { | 295 if (placeh == null || placeh.equals("none")) { |
294 placeh = "center"; | 296 placeh = "center"; |
295 } | 297 } |
296 if (placeh.equals("left")) { | 298 if (placeh.equals("left")) { |
300 xPos = (Double)getXBounds(0).getUpper(); | 302 xPos = (Double)getXBounds(0).getUpper(); |
301 } | 303 } |
302 else if (placeh.equals("center")) { | 304 else if (placeh.equals("center")) { |
303 xPos = ((Double)getXBounds(0).getUpper() + (Double)getXBounds(0).getLower())/2d; | 305 xPos = ((Double)getXBounds(0).getUpper() + (Double)getXBounds(0).getLower())/2d; |
304 } | 306 } |
305 // TODO else | 307 else { |
308 logger.debug("Unknown place-h value: " + placeh); | |
309 } | |
310 | |
306 logger.debug("logo position: " + xPos + "/" + yPos); | 311 logger.debug("logo position: " + xPos + "/" + yPos); |
307 | 312 |
313 org.jfree.ui.RectangleAnchor anchor | |
314 = org.jfree.ui.RectangleAnchor.TOP; | |
315 if (placev.equals("top")) { | |
316 if (placeh.equals("left")) { | |
317 anchor = org.jfree.ui.RectangleAnchor.TOP_LEFT; | |
318 } | |
319 else if (placeh.equals("right")) { | |
320 anchor = org.jfree.ui.RectangleAnchor.TOP_RIGHT; | |
321 } | |
322 else if (placeh.equals("center")) { | |
323 anchor = org.jfree.ui.RectangleAnchor.TOP; | |
324 } | |
325 } | |
326 else if (placev.equals("bottom")) { | |
327 if (placeh.equals("left")) { | |
328 anchor = org.jfree.ui.RectangleAnchor.BOTTOM_LEFT; | |
329 } | |
330 else if (placeh.equals("right")) { | |
331 anchor = org.jfree.ui.RectangleAnchor.BOTTOM_RIGHT; | |
332 } | |
333 else if (placeh.equals("center")) { | |
334 anchor = org.jfree.ui.RectangleAnchor.BOTTOM; | |
335 } | |
336 } | |
337 else if (placev.equals("center")) { | |
338 if (placeh.equals("left")) { | |
339 anchor = org.jfree.ui.RectangleAnchor.LEFT; | |
340 } | |
341 else if (placeh.equals("right")) { | |
342 anchor = org.jfree.ui.RectangleAnchor.RIGHT; | |
343 } | |
344 else if (placeh.equals("center")) { | |
345 anchor = org.jfree.ui.RectangleAnchor.CENTER; | |
346 } | |
347 } | |
348 | |
308 XYAnnotation xyannotation = | 349 XYAnnotation xyannotation = |
309 new XYImageAnnotation(xPos, yPos, imageIcon.getImage()); | 350 new XYImageAnnotation(xPos, yPos, imageIcon.getImage(), anchor); |
310 plot.getRenderer().addAnnotation(xyannotation, org.jfree.ui.Layer.BACKGROUND); | 351 plot.getRenderer().addAnnotation(xyannotation, org.jfree.ui.Layer.BACKGROUND); |
311 } | 352 } |
312 | 353 |
313 | 354 |
314 protected NumberAxis createXAxis(String label) { | 355 protected NumberAxis createXAxis(String label) { |