Mercurial > dive4elements > gnv-client
diff gnv-artifacts/src/main/java/de/intevation/gnv/raster/PolygonDatasetProducer.java @ 437:b624879d2902
Added vectorizer rings callback to generate iso lines.
gnv-artifacts/trunk@485 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Sun, 27 Dec 2009 05:25:40 +0000 |
parents | 6642ab6c583c |
children | f7038820df2e |
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/raster/PolygonDatasetProducer.java Sat Dec 26 15:32:08 2009 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/PolygonDatasetProducer.java Sun Dec 27 05:25:40 2009 +0000 @@ -12,12 +12,14 @@ import de.intevation.gnv.jfreechart.PolygonDataset; import de.intevation.gnv.jfreechart.CompactXYItems; +/** + * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) + */ public class PolygonDatasetProducer implements RingsHandler { protected double minX; protected double minY; - protected double maxX; protected double maxY; @@ -65,26 +67,23 @@ * m1 = (maxX - minX)/(width-1) */ - double b1 = minX; - double m1 = width != 1 - ? (maxX - minX)/(width-1) - : 0d; + double b1 = minX; + double m1 = width != 1 + ? (maxX - minX)/(width-1) + : 0d; - double b2 = minY; - double m2 = height != 1 - ? (maxY - minY)/(height-1) - : 0d; + double b2 = minY; + double m2 = height != 1 + ? (maxY - minY)/(height-1) + : 0d; for (Edge head: rings) { Edge current = head; do { - double x = m1*(current.a % width) + b1; - double y = m2*(current.a / width) + b2; - vertices.add(x); - vertices.add(y); - current = current.next; + vertices.add(m1*(current.a % width) + b1); + vertices.add(m2*(current.a / width) + b2); } - while (current != head); + while ((current = current.next) != head); ps.addRing(new CompactXYItems(vertices.toNativeArray())); vertices.clear(); }