Revision 29097 branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/primitive/impl/Ellipse2D.java
Ellipse2D.java | ||
---|---|---|
47 | 47 |
import java.util.ArrayList; |
48 | 48 |
|
49 | 49 |
import org.cresques.cts.IProjection; |
50 |
import org.gvsig.fmap.geom.GeometryLocator; |
|
51 |
import org.gvsig.fmap.geom.Geometry.TYPES; |
|
50 |
import org.gvsig.fmap.geom.Geometry; |
|
52 | 51 |
import org.gvsig.fmap.geom.handler.AbstractHandler; |
53 | 52 |
import org.gvsig.fmap.geom.handler.CuadrantHandler; |
54 | 53 |
import org.gvsig.fmap.geom.handler.Handler; |
... | ... | |
67 | 66 |
public class Ellipse2D extends Surface2D implements Ellipse { |
68 | 67 |
private static final long serialVersionUID = 7624230115118134004L; |
69 | 68 |
|
70 |
private static GeometryType geomType = GeometryLocator.getGeometryManager() |
|
71 |
.registerGeometryType(Ellipse2D.class, null, TYPES.ELLIPSE, SUBTYPES.GEOM2D); |
|
72 |
|
|
73 | 69 |
private Point2D init; |
74 | 70 |
private Point2D end; |
75 | 71 |
private double ydist; |
76 | 72 |
|
77 | 73 |
/** |
78 |
* Constructor without arguments. It is necessary to create |
|
79 |
* geometries using the {@link GeometryType}{@link #create()} |
|
80 |
* method |
|
74 |
* The constructor with the GeometryType like and argument |
|
75 |
* is used by the {@link GeometryType}{@link #create()} |
|
76 |
* to create the geometry |
|
77 |
* @param type |
|
78 |
* The geometry type |
|
81 | 79 |
*/ |
82 |
public Ellipse2D() { |
|
83 |
super(); |
|
80 |
public Ellipse2D(GeometryType geometryType) {
|
|
81 |
super(geometryType);
|
|
84 | 82 |
} |
85 | 83 |
|
86 | 84 |
/** |
87 |
* DOCUMENT ME! |
|
88 |
* |
|
85 |
* Constructor used in the {@link Geometry#cloneGeometry()} method |
|
86 |
* @param id |
|
87 |
* @param projection |
|
89 | 88 |
* @param gpx |
89 |
* @param i |
|
90 |
* @param e |
|
91 |
* @param d |
|
90 | 92 |
*/ |
91 |
public Ellipse2D(String id, IProjection projection, GeneralPathX gpx,
|
|
93 |
Ellipse2D(GeometryType geometryType,String id, IProjection projection, GeneralPathX gpx,
|
|
92 | 94 |
Point2D i, Point2D e, double d) { |
93 |
super(id, projection, gpx); |
|
95 |
super(geometryType, id, projection, gpx);
|
|
94 | 96 |
init = i; |
95 | 97 |
end = e; |
96 | 98 |
ydist = d; |
... | ... | |
101 | 103 |
* @see org.gvsig.fmap.geom.primitive.impl.Surface2D#cloneFShape() |
102 | 104 |
*/ |
103 | 105 |
public FShape cloneFShape() { |
104 |
return new Ellipse2D(id, projection, (GeneralPathX) gp.clone(), init, |
|
106 |
return new Ellipse2D(getGeometryType(), id, projection, (GeneralPathX) gp.clone(), init,
|
|
105 | 107 |
end, ydist); |
106 | 108 |
} |
107 | 109 |
|
... | ... | |
530 | 532 |
* @see org.gvsig.fmap.geom.primitive.Ellipse#getAxis1End() |
531 | 533 |
*/ |
532 | 534 |
public Point getAxis1End() { |
533 |
return new org.gvsig.fmap.geom.primitive.impl.Point2D(end); |
|
535 |
try { |
|
536 |
return new org.gvsig.fmap.geom.primitive.impl.Point2D(end); |
|
537 |
} catch (Exception e){ |
|
538 |
return null; |
|
539 |
} |
|
534 | 540 |
} |
535 | 541 |
|
536 | 542 |
/* (non-Javadoc) |
537 | 543 |
* @see org.gvsig.fmap.geom.primitive.Ellipse#getAxis1Start() |
538 | 544 |
*/ |
539 | 545 |
public Point getAxis1Start() { |
540 |
return new org.gvsig.fmap.geom.primitive.impl.Point2D(init); |
|
546 |
try { |
|
547 |
return new org.gvsig.fmap.geom.primitive.impl.Point2D(init); |
|
548 |
} catch (Exception e){ |
|
549 |
return null; |
|
550 |
} |
|
541 | 551 |
} |
542 | 552 |
|
543 | 553 |
/* (non-Javadoc) |
Also available in: Unified diff