Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/raster/JTSMultiLineStringProducer.java @ 802:4abe172be970
Finished Javadoc of the raster package.
gnv-artifacts/trunk@884 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 07 Apr 2010 07:49:12 +0000 |
parents | c4156275c1e1 |
children | feae2f9d6c6f |
comparison
equal
deleted
inserted
replaced
801:d766fe2d917a | 802:4abe172be970 |
---|---|
20 import java.util.List; | 20 import java.util.List; |
21 | 21 |
22 import org.apache.log4j.Logger; | 22 import org.apache.log4j.Logger; |
23 | 23 |
24 /** | 24 /** |
25 * Vectorizer backend to generated iso lines in form of | |
26 * JTS multi linestrings. | |
27 * | |
25 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> | 28 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> |
26 */ | 29 */ |
27 public class JTSMultiLineStringProducer | 30 public class JTSMultiLineStringProducer |
28 extends IsoProducer | 31 extends IsoProducer |
29 { | 32 { |
30 private static Logger log = Logger.getLogger( | 33 private static Logger log = Logger.getLogger( |
31 JTSMultiLineStringProducer.class); | 34 JTSMultiLineStringProducer.class); |
32 | 35 |
36 /** | |
37 * The JTS geometry factory of this producer. | |
38 */ | |
33 protected GeometryFactory geometryFactory; | 39 protected GeometryFactory geometryFactory; |
34 | 40 |
41 /** | |
42 * The polygon used to clip the produced multe line strings. | |
43 */ | |
35 protected Polygon clip; | 44 protected Polygon clip; |
36 | 45 |
46 /** | |
47 * Constructor to create a JTSMultiLineStringProducer with | |
48 * a given clipping polygon and a world bounding box. | |
49 * @param clip The clipping polygon. | |
50 * @param minX Min x coord of the world. | |
51 * @param minY Min y coord of the world. | |
52 * @param maxX Max x coord of the world. | |
53 * @param maxY Max y coord of the world. | |
54 */ | |
37 public JTSMultiLineStringProducer( | 55 public JTSMultiLineStringProducer( |
38 Polygon clip, | 56 Polygon clip, |
39 double minX, double minY, | 57 double minX, double minY, |
40 double maxX, double maxY | 58 double maxX, double maxY |
41 ) { | 59 ) { |
45 JTSMultiPolygonProducer.createDefaultGeometryFactory(3), | 63 JTSMultiPolygonProducer.createDefaultGeometryFactory(3), |
46 minX, minY, | 64 minX, minY, |
47 maxX, maxY); | 65 maxX, maxY); |
48 } | 66 } |
49 | 67 |
68 /** | |
69 * Constructor to create a JTSMultiLineStringProducer with | |
70 * a given clipping polygon, a geometry factory | |
71 * and a world bounding box. | |
72 * @param clip The clipping polygon. | |
73 * @param geometryFactory The geometry factory. | |
74 * @param minX Min x coord of the world. | |
75 * @param minY Min y coord of the world. | |
76 * @param maxX Max x coord of the world. | |
77 * @param maxY Max y coord of the world. | |
78 */ | |
50 public JTSMultiLineStringProducer( | 79 public JTSMultiLineStringProducer( |
51 Polygon clip, | 80 Polygon clip, |
52 GeometryFactory geometryFactory, | 81 GeometryFactory geometryFactory, |
53 double minX, double minY, | 82 double minX, double minY, |
54 double maxX, double maxY | 83 double maxX, double maxY |
56 super(minX, minY, maxX, maxY); | 85 super(minX, minY, maxX, maxY); |
57 this.clip = clip; | 86 this.clip = clip; |
58 this.geometryFactory = geometryFactory; | 87 this.geometryFactory = geometryFactory; |
59 } | 88 } |
60 | 89 |
90 /** | |
91 * Clips a given line string against the clippin polygon. The | |
92 * result is stored in the given list of line strings. | |
93 * @param lineString The line string to be clipped. | |
94 * @param lineStrings The result line string list. | |
95 */ | |
61 protected void clipLineString( | 96 protected void clipLineString( |
62 LineString lineString, | 97 LineString lineString, |
63 ArrayList<LineString> lineStrings | 98 ArrayList<LineString> lineStrings |
64 ) { | 99 ) { |
65 if (clip == null) { | 100 if (clip == null) { |
97 log.error(te.getLocalizedMessage(), te); | 132 log.error(te.getLocalizedMessage(), te); |
98 lineStrings.add(lineString); | 133 lineStrings.add(lineString); |
99 } | 134 } |
100 } | 135 } |
101 | 136 |
137 /** | |
138 * Returns a list of pairs attribute -> multi line string. | |
139 * All line strings produced are grouped by there attribute | |
140 * which is generated with the given attribute generator. | |
141 * @param attributeGenerator The attribute generator. | |
142 * @return The list of attribute/multi line strings. | |
143 */ | |
102 public List<Pair<Object, MultiLineString>> getMultiLineStrings( | 144 public List<Pair<Object, MultiLineString>> getMultiLineStrings( |
103 AttributeGenerator attributeGenerator | 145 AttributeGenerator attributeGenerator |
104 ) { | 146 ) { |
105 ArrayList<Pair<Object, MultiLineString>> multiLineStrings = | 147 ArrayList<Pair<Object, MultiLineString>> multiLineStrings = |
106 new ArrayList<Pair<Object, MultiLineString>>(); | 148 new ArrayList<Pair<Object, MultiLineString>>(); |