comparison flys-artifacts/src/main/java/de/intevation/flys/jfree/EnhancedLineAndShapeRenderer.java @ 3015:9cea02b51241

Added better doc and todo. flys-artifacts/trunk@4580 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 05 Jun 2012 11:53:51 +0000
parents bdc86e61428c
children e19ff9086035
comparison
equal deleted inserted replaced
3014:e341606faeb4 3015:9cea02b51241
64 this.lineLabelTextColors = new HashMap<Integer, Color>(); 64 this.lineLabelTextColors = new HashMap<Integer, Color>();
65 this.lineLabelBGColors = new HashMap<Integer, Color>(); 65 this.lineLabelBGColors = new HashMap<Integer, Color>();
66 } 66 }
67 67
68 68
69 /** Draw a background-box of a text to render. */ 69 /**
70 public static void drawTextBox(Graphics2D g2, String text, float textX, float textY, Color bgColor) { 70 * Draw a background-box of a text to render.
71 * @param g2 graphics device to use
72 * @param text text to draw
73 * @param textX x-position for text
74 * @param textY y-position for text
75 * @param bgColor color to fill box with.
76 */
77 public static void drawTextBox(Graphics2D g2,
78 String text, float textX, float textY, Color bgColor
79 ) {
71 Rectangle2D hotspotBox = g2.getFontMetrics().getStringBounds(text, g2); 80 Rectangle2D hotspotBox = g2.getFontMetrics().getStringBounds(text, g2);
72 float w = (float) hotspotBox.getWidth(), h = (float) hotspotBox.getHeight(); 81 float w = (float) hotspotBox.getWidth(), h = (float) hotspotBox.getHeight();
73 hotspotBox.setRect(textX, textY-h, w, h); 82 hotspotBox.setRect(textX, textY-h, w, h);
74 Color oldColor = g2.getColor(); 83 Color oldColor = g2.getColor();
75 g2.setColor(bgColor); 84 g2.setColor(bgColor);
261 drawItemLabel(g2, orientation, dataset, series, item, xx, yy, 270 drawItemLabel(g2, orientation, dataset, series, item, xx, yy,
262 (y1 < 0.0)); 271 (y1 < 0.0));
263 } 272 }
264 273
265 // Draw label of line. 274 // Draw label of line.
275 // TODO add colision detection
266 if (isShowLineLabel(series) && isMinimumX (dataset, series, item)) { 276 if (isShowLineLabel(series) && isMinimumX (dataset, series, item)) {
267 XYSeries xYSeries = ((XYSeriesCollection) dataset).getSeries(series); 277 XYSeries xYSeries = ((XYSeriesCollection) dataset).getSeries(series);
268 String waterlevelLabel = (xYSeries instanceof HasLabel) 278 String waterlevelLabel = (xYSeries instanceof HasLabel)
269 ? ((HasLabel)xYSeries).getLabel() 279 ? ((HasLabel)xYSeries).getLabel()
270 : xYSeries.getKey().toString(); 280 : xYSeries.getKey().toString();

http://dive4elements.wald.intevation.org