Revision 29097 branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/primitive/impl/Spline2D.java
Spline2D.java | ||
---|---|---|
45 | 45 |
import java.util.ArrayList; |
46 | 46 |
|
47 | 47 |
import org.cresques.cts.IProjection; |
48 |
import org.gvsig.fmap.geom.GeometryLocator; |
|
49 |
import org.gvsig.fmap.geom.Geometry.SUBTYPES; |
|
50 | 48 |
import org.gvsig.fmap.geom.handler.AbstractHandler; |
51 | 49 |
import org.gvsig.fmap.geom.handler.FinalHandler; |
52 | 50 |
import org.gvsig.fmap.geom.handler.Handler; |
... | ... | |
64 | 62 |
*/ |
65 | 63 |
public class Spline2D extends Curve2D implements Spline { |
66 | 64 |
private static final long serialVersionUID = -8109393343595560984L; |
67 |
|
|
68 |
private static GeometryType geomType = GeometryLocator.getGeometryManager() |
|
69 |
.registerGeometryType(Spline2D.class, null, TYPES.SPLINE, SUBTYPES.GEOM2D); |
|
70 |
|
|
71 | 65 |
private ArrayList points; |
72 | 66 |
|
73 | 67 |
/** |
74 |
* Constructor without arguments. It is necessary to create |
|
75 |
* geometries using the {@link GeometryType}{@link #create()} |
|
76 |
* method |
|
68 |
* The constructor with the GeometryType like and argument |
|
69 |
* is used by the {@link GeometryType}{@link #create()} |
|
70 |
* to create the geometry |
|
71 |
* @param type |
|
72 |
* The geometry type |
|
77 | 73 |
*/ |
78 |
public Spline2D() { |
|
79 |
super(); |
|
74 |
public Spline2D(GeometryType geometryType) {
|
|
75 |
super(geometryType);
|
|
80 | 76 |
points = new ArrayList(); |
81 | 77 |
gp = new GeneralPathX(); |
82 |
} |
|
83 |
/** |
|
84 |
* Crea un nuevo FPolyline2D. |
|
85 |
* |
|
86 |
* @param gpx GeneralPathX. |
|
87 |
*/ |
|
88 |
public Spline2D(String id, IProjection projection, Point2D[] ps) { |
|
89 |
super(id, projection, getGeneralPathX(ps)); |
|
78 |
} |
|
79 |
|
|
80 |
Spline2D(GeometryType geometryType, String id, IProjection projection, Point2D[] ps) { |
|
81 |
super(geometryType, id, projection, getGeneralPathX(ps)); |
|
90 | 82 |
for (int i=0 ; i<ps.length ; i++){ |
91 | 83 |
points.add(ps[i]); |
92 | 84 |
} |
... | ... | |
138 | 130 |
* @see com.iver.cit.gvsig.fmap.core.FShape#cloneFShape() |
139 | 131 |
*/ |
140 | 132 |
public FShape cloneFShape() { |
141 |
Spline2D curve = new Spline2D(); |
|
133 |
Spline2D curve = new Spline2D(getGeometryType());
|
|
142 | 134 |
for (int i=0;i<points.size();i++){ |
143 | 135 |
curve.addVertex(new org.gvsig.fmap.geom.primitive.impl.Point2D((Point2D)points.get(i))); |
144 | 136 |
} |
Also available in: Unified diff