Revision 29001 branches/v2_0_0_prep/libraries/libDwg/src/org/gvsig/dwg/lib/objects/DwgText.java
DwgText.java | ||
---|---|---|
47 | 47 |
import org.gvsig.dwg.lib.IDwgExtrusionable; |
48 | 48 |
import org.gvsig.dwg.lib.util.AcadExtrusionCalculator; |
49 | 49 |
import org.gvsig.fmap.geom.Geometry; |
50 |
import org.gvsig.fmap.geom.GeometryFactory;
|
|
50 |
import org.gvsig.fmap.geom.GeometryLocator;
|
|
51 | 51 |
import org.gvsig.fmap.geom.GeometryManager; |
52 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
|
53 |
import org.gvsig.fmap.geom.primitive.Point; |
|
52 | 54 |
|
53 | 55 |
|
54 | 56 |
/** |
... | ... | |
281 | 283 |
public double getZ() { |
282 | 284 |
return getElevation(); |
283 | 285 |
} |
284 |
public Geometry toFMapGeometry(boolean is3DFile) { |
|
285 |
GeometryFactory gFactory = GeometryManager.getInstance().getGeometryFactory(); |
|
286 |
public Geometry toFMapGeometry(boolean is3DFile) |
|
287 |
throws CreateGeometryException { |
|
288 |
GeometryManager gMan = GeometryLocator.getGeometryManager(); |
|
286 | 289 |
Point2D p = getInsertionPoint(); |
287 | 290 |
double elev = 0.0; |
288 |
if ((getDataFlag() & 0x1) == 0) |
|
291 |
if ((getDataFlag() & 0x1) == 0) {
|
|
289 | 292 |
elev = getElevation(); |
293 |
} |
|
294 |
Point point = (Point) gMan.create(getGeometryType(), |
|
295 |
getGeometrySubType(is3DFile)); |
|
296 |
point.setX(p.getX()); |
|
297 |
point.setX(p.getY()); |
|
290 | 298 |
if (is3DFile) { |
291 |
return gFactory.createPoint3D(p.getX(), p.getY(), elev);
|
|
299 |
point.setCoordinateAt(2, elev);
|
|
292 | 300 |
|
293 |
} else { |
|
294 |
return gFactory.createPoint2D(p.getX(), p.getY()); |
|
295 | 301 |
} |
302 |
return point; |
|
296 | 303 |
} |
297 | 304 |
|
298 | 305 |
public String toFMapString(boolean is3DFile) { |
299 |
if(is3DFile) |
|
306 |
if(is3DFile) {
|
|
300 | 307 |
return "FPoint3D"; |
301 |
else
|
|
308 |
} else {
|
|
302 | 309 |
return "FPoint2D"; |
310 |
} |
|
303 | 311 |
} |
304 | 312 |
public String toString(){ |
305 | 313 |
return "Text"; |
... | ... | |
364 | 372 |
//altura, etc. |
365 | 373 |
} |
366 | 374 |
|
375 |
public int getGeometrySubType(boolean is3DFile) { |
|
376 |
if (is3DFile) { |
|
377 |
return Geometry.SUBTYPES.GEOM3D; |
|
378 |
} else { |
|
379 |
return Geometry.SUBTYPES.GEOM2D; |
|
380 |
} |
|
381 |
} |
|
382 |
|
|
383 |
public int getGeometryType() { |
|
384 |
return Geometry.TYPES.POINT; |
|
385 |
} |
|
386 |
|
|
367 | 387 |
} |
Also available in: Unified diff