Mercurial > dive4elements > gnv-client
diff gnv-artifacts/src/main/java/de/intevation/gnv/raster/Vectorizer.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 | f42ed4f10b79 |
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/raster/Vectorizer.java Sat Dec 26 15:32:08 2009 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/Vectorizer.java Sun Dec 27 05:25:40 2009 +0000 @@ -38,6 +38,11 @@ this.b = b; } + public Edge(Edge other) { + a = other.a; + b = other.b; + } + public void chain(Edge other, int found) { if (found == a) { @@ -70,7 +75,8 @@ public int length() { int length = 0; Edge current = this; - do { ++length; } while ((current = current.next) != this); + do { ++length; } + while ((current = current.next) != null && current != this); return length; } @@ -92,6 +98,10 @@ int length = edge.length(); + if (length < 2) { + return e1; + } + int count = 0; do { @@ -118,7 +128,7 @@ ++count; } } - while (count < length + 2); + while (length > 1 && count < length + 2); return e1; } @@ -171,7 +181,6 @@ protected void emit(Edge edge) { Edge otherA = (Edge)openEdges.remove(edge.a); - if (otherA != null) { otherA.chain(edge, edge.a); }