Revision 34140 branches/v2_0_0_prep/libraries/libFMap_geometries/src/org/gvsig/fmap/geom/primitive/impl/Curve2DZ.java
Curve2DZ.java | ||
---|---|---|
41 | 41 |
package org.gvsig.fmap.geom.primitive.impl; |
42 | 42 |
|
43 | 43 |
import org.cresques.cts.IProjection; |
44 |
|
|
44 | 45 |
import org.gvsig.fmap.geom.Geometry; |
45 | 46 |
import org.gvsig.fmap.geom.primitive.Curve; |
46 | 47 |
import org.gvsig.fmap.geom.primitive.FShape; |
... | ... | |
53 | 54 |
* @author Vicente Caballero Navarro |
54 | 55 |
*/ |
55 | 56 |
public class Curve2DZ extends Curve2D implements Curve { |
56 |
private static final long serialVersionUID = 3431077088722464314L;
|
|
57 |
double[] pZ = null;
|
|
57 |
private static final long serialVersionUID = 3431077088722464314L;
|
|
58 |
double[] pZ = null;
|
|
58 | 59 |
|
59 |
/**
|
|
60 |
* The constructor with the GeometryType like and argument
|
|
61 |
* is used by the {@link GeometryType}{@link #create()}
|
|
62 |
* to create the geometry
|
|
63 |
* @param type
|
|
64 |
* The geometry type
|
|
65 |
*/
|
|
66 |
public Curve2DZ(GeometryType geometryType) {
|
|
67 |
super(geometryType);
|
|
68 |
}
|
|
60 |
/**
|
|
61 |
* The constructor with the GeometryType like and argument
|
|
62 |
* is used by the {@link GeometryType}{@link #create()}
|
|
63 |
* to create the geometry
|
|
64 |
* @param type
|
|
65 |
* The geometry type
|
|
66 |
*/
|
|
67 |
public Curve2DZ(GeometryType geometryType) {
|
|
68 |
super(geometryType);
|
|
69 |
}
|
|
69 | 70 |
|
70 |
/**
|
|
71 |
* Constructor used in the {@link Geometry#cloneGeometry()} method
|
|
72 |
* @param id
|
|
73 |
* @param projection
|
|
74 |
* @param gpx
|
|
75 |
* @param pZ
|
|
76 |
*/
|
|
77 |
Curve2DZ(GeometryType geometryType, String id, IProjection projection, GeneralPathX gpx,
|
|
78 |
double[] pZ) {
|
|
79 |
super(geometryType, id, projection, gpx);
|
|
80 |
this.pZ = pZ;
|
|
81 |
}
|
|
71 |
/**
|
|
72 |
* Constructor used in the {@link Geometry#cloneGeometry()} method
|
|
73 |
* @param id
|
|
74 |
* @param projection
|
|
75 |
* @param gpx
|
|
76 |
* @param pZ
|
|
77 |
*/
|
|
78 |
Curve2DZ(GeometryType geometryType, String id, IProjection projection, GeneralPathX gpx,
|
|
79 |
double[] pZ) {
|
|
80 |
super(geometryType, id, projection, gpx);
|
|
81 |
this.pZ = pZ;
|
|
82 |
}
|
|
82 | 83 |
|
83 |
/*
|
|
84 |
* (non-Javadoc)
|
|
85 |
* @see org.gvsig.fmap.geom.primitive.impl.Curve2D#setGeneralPath(org.gvsig.fmap.geom.primitive.GeneralPathX)
|
|
86 |
*/
|
|
87 |
public void setGeneralPath(GeneralPathX generalPathX) {
|
|
88 |
super.setGeneralPath(generalPathX);
|
|
89 |
pZ = new double[generalPathX.getNumCoords()];
|
|
90 |
}
|
|
84 |
/*
|
|
85 |
* (non-Javadoc)
|
|
86 |
* @see org.gvsig.fmap.geom.primitive.impl.Curve2D#setGeneralPath(org.gvsig.fmap.geom.primitive.GeneralPathX)
|
|
87 |
*/
|
|
88 |
public void setGeneralPath(GeneralPathX generalPathX) {
|
|
89 |
super.setGeneralPath(generalPathX);
|
|
90 |
pZ = new double[generalPathX.getNumCoords()];
|
|
91 |
}
|
|
91 | 92 |
|
92 |
/*
|
|
93 |
* (non-Javadoc)
|
|
94 |
* @see org.gvsig.fmap.geom.primitive.impl.Curve2D#getShapeType()
|
|
95 |
*/
|
|
96 |
public int getShapeType() {
|
|
97 |
return TYPES.CURVE;
|
|
98 |
}
|
|
93 |
/*
|
|
94 |
* (non-Javadoc)
|
|
95 |
* @see org.gvsig.fmap.geom.primitive.impl.Curve2D#getShapeType()
|
|
96 |
*/
|
|
97 |
public int getShapeType() {
|
|
98 |
return TYPES.CURVE;
|
|
99 |
}
|
|
99 | 100 |
|
100 |
/*
|
|
101 |
* (non-Javadoc)
|
|
102 |
* @see org.gvsig.fmap.geom.primitive.impl.Curve2D#cloneFShape()
|
|
103 |
*/
|
|
104 |
public FShape cloneFShape() {
|
|
105 |
return new Curve2DZ(getGeometryType(), id, projection, (GeneralPathX) gp.clone(),
|
|
106 |
(double[]) pZ);
|
|
107 |
}
|
|
101 |
/*
|
|
102 |
* (non-Javadoc)
|
|
103 |
* @see org.gvsig.fmap.geom.primitive.impl.Curve2D#cloneFShape()
|
|
104 |
*/
|
|
105 |
public FShape cloneFShape() {
|
|
106 |
return new Curve2DZ(getGeometryType(), id, projection, (GeneralPathX) gp.clone(),
|
|
107 |
(double[]) pZ);
|
|
108 |
}
|
|
108 | 109 |
|
109 |
/* |
|
110 |
* (non-Javadoc) |
|
111 |
* @see org.gvsig.fmap.geom.primitive.impl.Curve2D#setCoordinateAt(int, int, double) |
|
112 |
*/ |
|
113 |
public void setCoordinateAt(int index, int dimension, double value) { |
|
114 |
if (dimension == 2){ |
|
115 |
pZ[index] = value; |
|
116 |
}else{ |
|
117 |
super.setCoordinateAt(index, dimension, value); |
|
118 |
} |
|
119 |
} |
|
110 |
/* |
|
111 |
* (non-Javadoc) |
|
112 |
* @see org.gvsig.fmap.geom.primitive.impl.Curve2D#setCoordinateAt(int, int, double) |
|
113 |
*/ |
|
114 |
public void setCoordinateAt(int index, int dimension, double value) { |
|
115 |
if (dimension == 2){ |
|
116 |
pZ[index] = value; |
|
117 |
}else{ |
|
118 |
super.setCoordinateAt(index, dimension, value); |
|
119 |
} |
|
120 |
} |
|
121 |
|
|
122 |
public double getCoordinateAt(int index, int dimension) { |
|
123 |
if (dimension == 2){ |
|
124 |
return pZ[index]; |
|
125 |
}else{ |
|
126 |
return super.getCoordinateAt(index, dimension); |
|
127 |
} |
|
128 |
} |
|
120 | 129 |
} |
Also available in: Unified diff