Mercurial > dive4elements > river
changeset 3625:f2a5fe968b98
issue814 line labels always visible.
flys-artifacts/trunk@5319 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 30 Aug 2012 14:51:48 +0000 |
parents | 84a19de5f16a |
children | d3e3a7aaeddf |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/jfree/EnhancedLineAndShapeRenderer.java |
diffstat | 2 files changed, 16 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Thu Aug 30 13:59:43 2012 +0000 +++ b/flys-artifacts/ChangeLog Thu Aug 30 14:51:48 2012 +0000 @@ -1,3 +1,10 @@ +2012-08-30 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + issue814, line labels do not follow zoom. + + * src/main/java/de/intevation/flys/jfree/EnhancedLineAndShapeRenderer.java: + Move line label into visible area if otherwise outside. + 2012-08-30 Felix Wolfsteller <felix.wolfsteller@intevation.de> issue695, show waterlevel as line label.
--- a/flys-artifacts/src/main/java/de/intevation/flys/jfree/EnhancedLineAndShapeRenderer.java Thu Aug 30 13:59:43 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/jfree/EnhancedLineAndShapeRenderer.java Thu Aug 30 14:51:48 2012 +0000 @@ -304,6 +304,15 @@ g2.setColor(this.getLineLabelTextColor(series)); g2.setBackground(Color.black); + // Try to always display label if the data is visible. + if (!isPointInRect(dataArea, xx, yy)) { + // Move into the data area. + xx = Math.max(xx, dataArea.getMinX()); + xx = Math.min(xx, dataArea.getMaxX()); + yy = Math.max(yy, dataArea.getMinY()); + yy = Math.min(yy, dataArea.getMaxY()); + } + // Move to right until no collisions exist anymore Shape hotspot = TextUtilities.calculateRotatedStringBounds( waterlevelLabel, g2, (float)xx, (float)yy-3f,