Revision 77
trunk/org.gvsig.dwg/org.gvsig.dwg.provider/src/main/java/org/gvsig/dwg/fmap/dal/store/dwg/DWGStoreProvider.java | ||
---|---|---|
459 | 459 |
.getHeader("MSPACE_EXTMAX"); |
460 | 460 |
if (extMin != null && extMax != null) { |
461 | 461 |
updateEnvelope = false; |
462 |
Point point = (Point) geomManager.create( |
|
463 |
Geometry.TYPES.POINT, envelopeSubType); |
|
464 |
point.setCoordinates(extMin); |
|
462 |
Point point = geomManager.createPoint(extMin[0], extMin[1],envelopeSubType); |
|
465 | 463 |
this.envelope.setLowerCorner(point); |
466 |
point = (Point) geomManager.create(Geometry.TYPES.POINT, |
|
467 |
envelopeSubType); |
|
468 |
point.setCoordinates(extMax); |
|
464 |
point = geomManager.createPoint(extMax[0], extMax[1],envelopeSubType); |
|
469 | 465 |
this.envelope.setUpperCorner(point); |
470 | 466 |
} |
471 | 467 |
|
... | ... | |
497 | 493 |
*/ |
498 | 494 |
continue; |
499 | 495 |
} |
500 |
// FIXME: Estas 6 lineas es por si la geometr�a no se ha |
|
501 |
// creado correctamente |
|
502 |
gEnvelope = null; |
|
503 |
try { |
|
504 |
gEnvelope = geometry.getEnvelope(); |
|
505 |
} catch (Exception e) { |
|
506 |
gEnvelope = null; |
|
507 |
} |
|
508 |
if (gEnvelope == null) { |
|
509 |
count_bad_envelope++; |
|
510 |
/* |
|
511 |
logger.warn("load: entity {}(id:{}) with null envelope", |
|
512 |
new Object[] { entity.getType(), id }); |
|
513 |
*/ |
|
514 |
continue; |
|
515 |
} |
|
496 |
|
|
516 | 497 |
// we check for Region of Interest of the CAD file |
517 | 498 |
if (!this.envelope.intersects(geometry.getEnvelope())) { |
518 | 499 |
count_envelope_out_of_aoi++; |
trunk/org.gvsig.dwg/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgPolyline2D.java | ||
---|---|---|
492 | 492 |
* @see com.iver.cit.jdwglib.dwg.IDwg2FMap#toFMapGeometry(boolean) |
493 | 493 |
*/ |
494 | 494 |
public Geometry toFMapGeometry(boolean is3DFile) throws CreateGeometryException { |
495 |
return FMapUtil.ptsToMultiLine(getPts(), getGeometrySubType(is3DFile));
|
|
495 |
return FMapUtil.ptsToLine(getPts(), getGeometrySubType(is3DFile)); |
|
496 | 496 |
} |
497 | 497 |
/* (non-Javadoc) |
498 | 498 |
* @see com.iver.cit.jdwglib.dwg.IDwg2FMap#toFMapString(boolean) |
trunk/org.gvsig.dwg/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgPolyline3D.java | ||
---|---|---|
391 | 391 |
* @see com.iver.cit.jdwglib.dwg.IDwg2FMap#toFMapGeometry(boolean) |
392 | 392 |
*/ |
393 | 393 |
public Geometry toFMapGeometry(boolean is3DFile) throws CreateGeometryException { |
394 |
return FMapUtil.ptsToMultiLine(getPts(), getGeometrySubType(is3DFile));
|
|
394 |
return FMapUtil.ptsToLine(getPts(), getGeometrySubType(is3DFile)); |
|
395 | 395 |
} |
396 | 396 |
// public Geometry toFMapGeometry_old(boolean is3DFile) { |
397 | 397 |
// FPolyline2D pline = null; |
trunk/org.gvsig.dwg/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/objects/DwgLwPolyline.java | ||
---|---|---|
311 | 311 |
} |
312 | 312 |
|
313 | 313 |
public Geometry toFMapGeometry(boolean is3DFile) throws CreateGeometryException { |
314 |
return FMapUtil.ptsToMultiLine(getVertices(),
|
|
314 |
return FMapUtil.ptsToLine(getVertices(), |
|
315 | 315 |
getGeometrySubType(is3DFile)); |
316 | 316 |
} |
317 | 317 |
|
trunk/org.gvsig.dwg/org.gvsig.dwg.lib/src/main/java/org/gvsig/dwg/lib/util/FMapUtil.java | ||
---|---|---|
29 | 29 |
private static final GeometryManager gManager = GeometryLocator |
30 | 30 |
.getGeometryManager(); |
31 | 31 |
|
32 |
public static MultiCurve ptsToMultiLine(List<double[]> pts, int subType)
|
|
32 |
public static Line ptsToLine(List<double[]> pts, int subType)
|
|
33 | 33 |
throws CreateGeometryException { |
34 | 34 |
|
35 | 35 |
if (pts.size() < 2) { |
36 | 36 |
throw new IllegalArgumentException(); |
37 | 37 |
} |
38 |
|
|
39 |
Point point, prevPoint; |
|
40 |
Line line; |
|
41 |
|
|
42 |
MultiLine multi = gManager.createMultiLine(subType); |
|
43 |
prevPoint = FMapUtil.createPoint(subType, pts.get(0)); |
|
44 |
for (int i = 1; i < pts.size(); i++) { |
|
45 |
point = FMapUtil.createPoint(subType, pts.get(i)); |
|
46 |
line = gManager.createLine(subType); |
|
47 |
line.addVertex(prevPoint); |
|
48 |
line.addVertex(point); |
|
49 |
multi.addPrimitive(line); |
|
50 |
prevPoint = FMapUtil.createPoint(subType, pts.get(i)); |
|
38 |
boolean is3D = subType == Geometry.SUBTYPES.GEOM3D || subType == Geometry.SUBTYPES.GEOM3DM; |
|
39 |
Line line = gManager.createLine(subType); |
|
40 |
for (double[] p : pts) { |
|
41 |
if( is3D ) { |
|
42 |
line.addVertex(p[0],p[1],p[2]); |
|
43 |
} else { |
|
44 |
line.addVertex(p[0],p[1]); |
|
45 |
} |
|
51 | 46 |
} |
52 |
return multi; |
|
53 |
|
|
47 |
return line; |
|
54 | 48 |
} |
55 | 49 |
|
56 | 50 |
public static Surface ptsToPolygon(List<double[]> pts, int subType) |
... | ... | |
60 | 54 |
throw new IllegalArgumentException(); |
61 | 55 |
} |
62 | 56 |
|
57 |
boolean is3D = subType == Geometry.SUBTYPES.GEOM3D || subType == Geometry.SUBTYPES.GEOM3DM; |
|
63 | 58 |
Polygon polygon = gManager.createPolygon(subType); |
64 |
|
|
65 |
Iterator<double[]> iter = pts.iterator(); |
|
66 |
while (iter.hasNext()) { |
|
67 |
Point vertex = createPoint(subType, iter.next()); |
|
68 |
polygon.addVertex(vertex); |
|
59 |
for (double[] p : pts) { |
|
60 |
if( is3D ) { |
|
61 |
polygon.addVertex(p[0],p[1],p[2]); |
|
62 |
} else { |
|
63 |
polygon.addVertex(p[0],p[1]); |
|
64 |
} |
|
69 | 65 |
} |
70 | 66 |
return polygon; |
71 | 67 |
} |
72 | 68 |
Also available in: Unified diff