Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/raster/PolygonDatasetProducer.java @ 465:f7038820df2e
Added support to trace rasters to JTS multi polygons and multi line strings.
Write them to shape files with GeoTools.
gnv-artifacts/trunk@526 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 11 Jan 2010 00:29:45 +0000 |
parents | b624879d2902 |
children | 1bf058f1a2d1 |
comparison
equal
deleted
inserted
replaced
464:70df44021a9f | 465:f7038820df2e |
---|---|
3 import java.util.List; | 3 import java.util.List; |
4 import java.util.HashMap; | 4 import java.util.HashMap; |
5 | 5 |
6 import gnu.trove.TDoubleArrayList; | 6 import gnu.trove.TDoubleArrayList; |
7 | 7 |
8 import de.intevation.gnv.raster.Vectorizer.RingsHandler; | |
9 import de.intevation.gnv.raster.Vectorizer.Edge; | 8 import de.intevation.gnv.raster.Vectorizer.Edge; |
10 | 9 |
11 import de.intevation.gnv.jfreechart.PolygonSeries; | 10 import de.intevation.gnv.jfreechart.PolygonSeries; |
12 import de.intevation.gnv.jfreechart.PolygonDataset; | 11 import de.intevation.gnv.jfreechart.PolygonDataset; |
13 import de.intevation.gnv.jfreechart.CompactXYItems; | 12 import de.intevation.gnv.jfreechart.CompactXYItems; |
14 | 13 |
15 /** | 14 /** |
16 * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) | 15 * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) |
17 */ | 16 */ |
18 public class PolygonDatasetProducer | 17 public class PolygonDatasetProducer |
19 implements RingsHandler | 18 extends AbstractProducer |
20 { | 19 { |
21 protected double minX; | |
22 protected double minY; | |
23 protected double maxX; | |
24 protected double maxY; | |
25 | |
26 protected HashMap<Integer, PolygonSeries> polygonSeries; | 20 protected HashMap<Integer, PolygonSeries> polygonSeries; |
27 | 21 |
28 protected PolygonDatasetProducer() { | 22 protected PolygonDatasetProducer() { |
29 } | 23 } |
30 | 24 |
31 public PolygonDatasetProducer( | 25 public PolygonDatasetProducer( |
32 double minX, double minY, | 26 double minX, double minY, |
33 double maxX, double maxY | 27 double maxX, double maxY |
34 | 28 |
35 ) { | 29 ) { |
36 this.minX = minX; | 30 super(minX, minY, maxX, maxY); |
37 this.minY = minY; | |
38 this.maxX = maxX; | |
39 this.maxY = maxY; | |
40 | |
41 polygonSeries = new HashMap<Integer, PolygonSeries>(); | 31 polygonSeries = new HashMap<Integer, PolygonSeries>(); |
42 } | 32 } |
43 | 33 |
44 public void handleRings( | 34 public void handleRings( |
45 List<Edge> rings, | 35 List<Edge> rings, |
51 return; | 41 return; |
52 } | 42 } |
53 | 43 |
54 Integer v = Integer.valueOf(value); | 44 Integer v = Integer.valueOf(value); |
55 | 45 |
56 PolygonSeries ps = (PolygonSeries)polygonSeries.get(v); | 46 PolygonSeries ps = polygonSeries.get(v); |
57 | 47 |
58 if (ps == null) { | 48 if (ps == null) { |
59 polygonSeries.put(v, ps = new PolygonSeries()); | 49 polygonSeries.put(v, ps = new PolygonSeries()); |
60 ps.setAttribute("fill", v); | 50 ps.setAttribute("fill", v); |
61 } | 51 } |