Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/jfree/EnhancedLineAndShapeRenderer.java @ 2648:8aaa7f4ce06a
Let theme define whether or not to display a (yet static) label for line).
flys-artifacts/trunk@4306 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 26 Apr 2012 09:51:13 +0000 |
parents | 4b7a28e81643 |
children | 6f5fc3de0d48 |
comparison
equal
deleted
inserted
replaced
2647:4b7a28e81643 | 2648:8aaa7f4ce06a |
---|---|
31 private static final Logger logger = | 31 private static final Logger logger = |
32 Logger.getLogger(EnhancedLineAndShapeRenderer.class); | 32 Logger.getLogger(EnhancedLineAndShapeRenderer.class); |
33 | 33 |
34 protected BooleanList isMinimumShapeVisible; | 34 protected BooleanList isMinimumShapeVisible; |
35 protected BooleanList isMaximumShapeVisible; | 35 protected BooleanList isMaximumShapeVisible; |
36 protected BooleanList showSeriesMinimumX;; | 36 protected BooleanList showLineLabel; |
37 | 37 |
38 protected Map<Integer, Double> seriesMinimum; | 38 protected Map<Integer, Double> seriesMinimum; |
39 protected Map<Integer, Double> seriesMinimumX; | 39 protected Map<Integer, Double> seriesMinimumX; |
40 protected Map<Integer, Double> seriesMaximum; | 40 protected Map<Integer, Double> seriesMaximum; |
41 | 41 |
42 | 42 |
43 public EnhancedLineAndShapeRenderer(boolean lines, boolean shapes) { | 43 public EnhancedLineAndShapeRenderer(boolean lines, boolean shapes) { |
44 super(lines, shapes); | 44 super(lines, shapes); |
45 this.isMinimumShapeVisible = new BooleanList(); | 45 this.isMinimumShapeVisible = new BooleanList(); |
46 this.isMaximumShapeVisible = new BooleanList(); | 46 this.isMaximumShapeVisible = new BooleanList(); |
47 this.showLineLabel = new BooleanList(); | |
47 this.seriesMinimum = new HashMap<Integer, Double>(); | 48 this.seriesMinimum = new HashMap<Integer, Double>(); |
48 this.seriesMaximum = new HashMap<Integer, Double>(); | 49 this.seriesMaximum = new HashMap<Integer, Double>(); |
49 this.seriesMinimumX = new HashMap<Integer, Double>(); | 50 this.seriesMinimumX = new HashMap<Integer, Double>(); |
50 } | 51 } |
51 | 52 |
234 drawItemLabel(g2, orientation, dataset, series, item, xx, yy, | 235 drawItemLabel(g2, orientation, dataset, series, item, xx, yy, |
235 (y1 < 0.0)); | 236 (y1 < 0.0)); |
236 } | 237 } |
237 | 238 |
238 boolean doWaterlevelLabel = false; | 239 boolean doWaterlevelLabel = false; |
239 if (isMinimumX (dataset, series, item)) { | 240 if (isShowLineLabel(series) && isMinimumX (dataset, series, item)) { |
240 // TODO find name of dataset/series | 241 // TODO find name of dataset/series |
241 String waterlevelLabel = "label"; | 242 String waterlevelLabel = "label"; |
242 // TODO Force water of some German rivers to flow direction mountains. | 243 // TODO Force water of some German rivers to flow direction mountains. |
243 g2.drawString("waterlevel label", (float)xx, (float)yy-3f); | 244 g2.drawString("waterlevel label", (float)xx, (float)yy-3f); |
244 } | 245 } |
281 } | 282 } |
282 | 283 |
283 return isMaximumShapeVisible.getBoolean(series); | 284 return isMaximumShapeVisible.getBoolean(series); |
284 } | 285 } |
285 | 286 |
287 /** Whether or not a label should be shown for series. */ | |
288 public boolean isShowLineLabel(int series) { | |
289 if (this.showLineLabel.size() <= series) { | |
290 return false; | |
291 } | |
292 | |
293 return showLineLabel.getBoolean(series); | |
294 } | |
295 | |
296 | |
297 /** Sets whether or not a label should be shown for series. */ | |
298 public void setShowLineLabel(boolean showLineLabel, int series) { | |
299 this.showLineLabel.setBoolean(series, showLineLabel); | |
300 } | |
301 | |
286 | 302 |
287 /** | 303 /** |
288 * True if the given item of given dataset has the smallest | 304 * True if the given item of given dataset has the smallest |
289 * X value within this set. | 305 * X value within this set. |
290 */ | 306 */ |