Revision 2183 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/shp/write/SHPMultiLine.java
SHPMultiLine.java | ||
---|---|---|
151 | 151 |
int numParts = parts.length; |
152 | 152 |
int npoints = points.length; |
153 | 153 |
|
154 |
///int numParts = polyLine.getNumParts();
|
|
154 |
//int numParts = polyLine.getNumParts(); |
|
155 | 155 |
buffer.putInt(numParts); |
156 | 156 |
|
157 | 157 |
///int npoints = polyLine.getNumPoints(); |
... | ... | |
263 | 263 |
* @see com.iver.cit.gvsig.fmap.shp.SHPShape#obtainsPoints(com.iver.cit.gvsig.fmap.core.GeneralPathXIterator) |
264 | 264 |
*/ |
265 | 265 |
public void obtainsPoints(GeneralPathXIterator iter) { |
266 |
double flatness = 0.8; |
|
267 |
ArrayList arrayLines = new ArrayList(); |
|
268 | 266 |
ArrayList arrayPoints = null; |
269 | 267 |
ArrayList arrayParts = new ArrayList(); |
270 | 268 |
GeneralPathXIterator theIterator = iter; //polyLine.getPathIterator(null, flatness); |
271 | 269 |
double[] theData = new double[6]; |
272 | 270 |
int numParts = 0; |
273 |
|
|
274 | 271 |
while (!theIterator.isDone()) { |
275 | 272 |
//while not done |
276 | 273 |
int theType = theIterator.currentSegment(theData); |
... | ... | |
279 | 276 |
// GeneralPathX object. |
280 | 277 |
//Process the current segment to populate a new |
281 | 278 |
// segment of the new GeneralPathX object. |
279 |
|
|
282 | 280 |
switch (theType) { |
283 | 281 |
case PathIterator.SEG_MOVETO: |
284 | 282 |
|
285 | 283 |
// System.out.println("SEG_MOVETO"); |
286 | 284 |
if (arrayPoints == null) { |
287 | 285 |
arrayPoints = new ArrayList(); |
286 |
arrayParts.add(new Integer(0)); |
|
288 | 287 |
} else { |
289 |
//lin = new GeometryFactory().createLineString(CoordinateArrays.toCoordinateArray( |
|
290 |
// arrayCoords)); |
|
291 |
//arrayLines.add(lin); |
|
292 |
arrayPoints = new ArrayList(); |
|
288 |
arrayParts.add(new Integer(arrayPoints.size())); |
|
293 | 289 |
} |
294 | 290 |
|
295 | 291 |
numParts++; |
296 |
arrayParts.add(new Integer(0)); |
|
292 |
|
|
297 | 293 |
arrayPoints.add(new FPoint2D(theData[0], theData[1])); |
298 | 294 |
|
299 | 295 |
break; |
... | ... | |
327 | 323 |
} //end switch |
328 | 324 |
|
329 | 325 |
theIterator.next(); |
330 |
} //end while loop
|
|
326 |
} |
|
331 | 327 |
|
332 |
//lin = new GeometryFactory().createLineString(CoordinateArrays.toCoordinateArray( |
|
333 |
// arrayCoords)); |
|
334 |
if (numParts > 1) // Generamos una MultiLineString |
|
335 |
{ |
|
336 |
System.out.println("MultiLine"); |
|
337 |
|
|
338 |
//arrayLines.add(lin); |
|
339 |
//geoJTS = new GeometryFactory().createMultiLineString(GeometryFactory.toLineStringArray( |
|
340 |
// arrayLines)); |
|
341 |
} else { |
|
342 |
//geoJTS = lin; |
|
343 |
} |
|
344 |
|
|
345 | 328 |
Integer[] integers = (Integer[]) arrayParts.toArray(new Integer[0]); |
346 | 329 |
parts = new int[integers.length]; |
347 |
|
|
348 | 330 |
for (int i = 0; i < integers.length; i++) { |
349 | 331 |
parts[i] = integers[i].intValue(); |
350 | 332 |
} |
Also available in: Unified diff