Mercurial > dive4elements > river
changeset 2021:1ae17b100973
Let StableDifferenceRenderer create a rectangular legenditem.
flys-artifacts/trunk@3476 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 20 Dec 2011 06:50:06 +0000 (2011-12-20) |
parents | 4f7f781e4481 |
children | 3c3693e9c538 |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/jfree/StableXYDifferenceRenderer.java |
diffstat | 2 files changed, 32 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Tue Dec 20 06:47:08 2011 +0000 +++ b/flys-artifacts/ChangeLog Tue Dec 20 06:50:06 2011 +0000 @@ -1,3 +1,13 @@ +2011-12-20 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + With StableXYDifferenceRenderer, create legend items in rectangular + form, to discern "line" from "area" in legend. + + * src/main/java/de/intevation/flys/jfree/StableXYDifferenceRenderer.java + (legendLine, legendShape): Renamed. + (getLegendItem): Create LegendItem with fill, use PositivePaint for + that. + 2011-12-20 Felix Wolfsteller <felix.wolfsteller@intevation.de> Added further 'area' infrastructure.
--- a/flys-artifacts/src/main/java/de/intevation/flys/jfree/StableXYDifferenceRenderer.java Tue Dec 20 06:47:08 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/jfree/StableXYDifferenceRenderer.java Tue Dec 20 06:50:06 2011 +0000 @@ -71,7 +71,9 @@ * 18-May-2007 : Set dataset and seriesKey for LegendItem (DG); * 05-Nov-2007 : Draw item labels if visible (RW); * 17-Jun-2008 : Apply legend shape, font and paint attributes (DG); - * + */ +/* + * For further changes within the FLYS project, refer to the ChangeLog. */ package de.intevation.flys.jfree; @@ -143,7 +145,7 @@ private boolean shapesVisible; /** The shape to display in the legend item. */ - private transient Shape legendLine; + private transient Shape legendShape; //private XYDatasetToZeroMapper mapper; @@ -187,7 +189,7 @@ this.positivePaint = positivePaint; this.negativePaint = negativePaint; this.shapesVisible = shapes; - this.legendLine = new Line2D.Double(-7.0, 0.0, 7.0, 0.0); + this.legendShape = new Rectangle2D.Double(-3.0, -3.0, 10.0, 10.0); this.roundXCoordinates = false; } @@ -278,7 +280,7 @@ * @see #setLegendLine(Shape) */ public Shape getLegendLine() { - return this.legendLine; + return this.legendShape; } /** @@ -293,7 +295,7 @@ if (line == null) { throw new IllegalArgumentException("Null 'line' argument."); } - this.legendLine = line; + this.legendShape = line; fireChangeEvent(); } @@ -1438,11 +1440,20 @@ urlText = getLegendItemURLGenerator().generateLabel( dataset, series); } - Paint paint = lookupSeriesPaint(series); + // Individualized Paints: + //Paint paint = lookupSeriesPaint(series); + + // "Area-Style"- Paint. + Paint paint = getPositivePaint(); Stroke stroke = lookupSeriesStroke(series); Shape line = getLegendLine(); + // Not-filled Shape: + //result = new LegendItem(label, description, + // toolTipText, urlText, line, stroke, paint); + + // Filled Shape ("Area-Style"). result = new LegendItem(label, description, - toolTipText, urlText, line, stroke, paint); + toolTipText, urlText, line, paint); result.setLabelFont(lookupLegendTextFont(series)); Paint labelPaint = lookupLegendTextPaint(series); if (labelPaint != null) { @@ -1458,7 +1469,6 @@ } return result; - } /** @@ -1488,7 +1498,7 @@ if (this.shapesVisible != that.shapesVisible) { return false; } - if (!ShapeUtilities.equal(this.legendLine, that.legendLine)) { + if (!ShapeUtilities.equal(this.legendShape, that.legendShape)) { return false; } if (this.roundXCoordinates != that.roundXCoordinates) { @@ -1506,7 +1516,7 @@ */ public Object clone() throws CloneNotSupportedException { StableXYDifferenceRenderer clone = (StableXYDifferenceRenderer) super.clone(); - clone.legendLine = ShapeUtilities.clone(this.legendLine); + clone.legendShape = ShapeUtilities.clone(this.legendShape); return clone; } @@ -1521,7 +1531,7 @@ stream.defaultWriteObject(); SerialUtilities.writePaint(this.positivePaint, stream); SerialUtilities.writePaint(this.negativePaint, stream); - SerialUtilities.writeShape(this.legendLine, stream); + SerialUtilities.writeShape(this.legendShape, stream); } /** @@ -1537,6 +1547,6 @@ stream.defaultReadObject(); this.positivePaint = SerialUtilities.readPaint(stream); this.negativePaint = SerialUtilities.readPaint(stream); - this.legendLine = SerialUtilities.readShape(stream); + this.legendShape = SerialUtilities.readShape(stream); } }