Mercurial > dive4elements > gnv-client
diff gnv-artifacts/src/main/java/de/intevation/gnv/jfreechart/PolygonSeries.java @ 436:6642ab6c583c
Added vectorizer rings callback which generates polygon datasets suitable
for polygon plots.
gnv-artifacts/trunk@484 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Sat, 26 Dec 2009 15:32:08 +0000 |
parents | f426f55d4f7a |
children | 92b7ccbf6163 |
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/jfreechart/PolygonSeries.java Fri Dec 25 12:00:14 2009 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/jfreechart/PolygonSeries.java Sat Dec 26 15:32:08 2009 +0000 @@ -16,6 +16,15 @@ protected CompactXYItems [] rings; protected Map attributes; + private static long uniqueKey; + + protected synchronized static Long createUniqueKey() { + return new Long(uniqueKey++); + } + + public PolygonSeries() { + this(createUniqueKey(), null); + } public PolygonSeries(Comparable key, CompactXYItems [] rings) { this(key, null, rings, new HashMap()); @@ -49,6 +58,18 @@ return rings; } + public void addRing(CompactXYItems newRing) { + if (rings == null) { + rings = new CompactXYItems [] { newRing }; + } + else { + CompactXYItems [] nRings = new CompactXYItems[rings.length + 1]; + System.arraycopy(rings, 0, nRings, 0, rings.length); + nRings[rings.length] = newRing; + rings = nRings; + } + } + public void addRings(CompactXYItems [] newRings) { if (newRings == null || newRings.length == 0) { return;