Revision 47432 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/primitive/surface/filledspline/FilledSpline2D.java
FilledSpline2D.java | ||
---|---|---|
24 | 24 |
|
25 | 25 |
|
26 | 26 |
import com.vividsolutions.jts.geom.Coordinate; |
27 |
|
|
28 | 27 |
import org.cresques.cts.ICoordTrans; |
29 |
|
|
30 | 28 |
import org.gvsig.fmap.geom.Geometry; |
29 |
import org.gvsig.fmap.geom.jts.mgeom.MCoordinate; |
|
31 | 30 |
import org.gvsig.fmap.geom.jts.primitive.curve.spline.BaseSpline2D; |
32 | 31 |
import org.gvsig.fmap.geom.jts.primitive.surface.split.SurfaceSplitOperation; |
32 |
import org.gvsig.fmap.geom.jts.util.ArrayListCoordinateSequence; |
|
33 | 33 |
import org.gvsig.fmap.geom.jts.util.JTSUtils; |
34 | 34 |
import org.gvsig.fmap.geom.operation.GeometryOperationException; |
35 | 35 |
import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException; |
... | ... | |
66 | 66 |
closePrimitive(); |
67 | 67 |
} |
68 | 68 |
|
69 |
/* (non-Javadoc) |
|
70 |
* @see org.gvsig.fmap.geom.primitive.Surface#setSurfaceAppearance(org.gvsig.fmap.geom.primitive.SurfaceAppearance) |
|
71 |
*/ |
|
69 |
public FilledSpline2D(ArrayListCoordinateSequence coordinates) { |
|
70 |
super(Geometry.TYPES.FILLEDSPLINE, coordinates); |
|
71 |
closePrimitive(); |
|
72 |
} |
|
73 |
|
|
72 | 74 |
public void setSurfaceAppearance(SurfaceAppearance app) { |
73 | 75 |
// TODO Auto-generated method stub |
74 | 76 |
|
75 | 77 |
} |
76 | 78 |
|
77 |
/* (non-Javadoc) |
|
78 |
* @see org.gvsig.fmap.geom.primitive.Surface#getSurfaceAppearance() |
|
79 |
*/ |
|
80 | 79 |
public SurfaceAppearance getSurfaceAppearance() { |
81 | 80 |
// TODO Auto-generated method stub |
82 | 81 |
return null; |
83 | 82 |
} |
84 | 83 |
|
85 |
/* (non-Javadoc) |
|
86 |
* @see org.gvsig.fmap.geom.primitive.Surface#getNumInteriorRings() |
|
87 |
*/ |
|
88 | 84 |
public int getNumInteriorRings() { |
89 | 85 |
String message = "Calling deprecated method getNumInteriorRings of a filled spline"; |
90 | 86 |
notifyDeprecated(message); |
91 | 87 |
throw new UnsupportedOperationException(message); |
92 | 88 |
} |
93 | 89 |
|
94 |
/* (non-Javadoc) |
|
95 |
* @see org.gvsig.fmap.geom.primitive.Surface#getInteriorRing(int) |
|
96 |
*/ |
|
97 | 90 |
public Ring getInteriorRing(int index) { |
98 | 91 |
String message = "Calling deprecated method getInteriorRing of a filled spline"; |
99 | 92 |
notifyDeprecated(message); |
100 | 93 |
throw new UnsupportedOperationException(message); |
101 | 94 |
} |
102 | 95 |
|
103 |
/* (non-Javadoc) |
|
104 |
* @see org.gvsig.fmap.geom.primitive.Surface#addInteriorRing(org.gvsig.fmap.geom.primitive.Ring) |
|
105 |
*/ |
|
106 | 96 |
public void addInteriorRing(Ring ring) { |
107 | 97 |
String message = "Calling deprecated method addInteriorRing of a filled spline"; |
108 | 98 |
notifyDeprecated(message); |
109 | 99 |
throw new UnsupportedOperationException(message); |
110 | 100 |
} |
111 | 101 |
|
112 |
/* (non-Javadoc) |
|
113 |
* @see org.gvsig.fmap.geom.primitive.Surface#addInteriorRing(org.gvsig.fmap.geom.primitive.Line) |
|
114 |
*/ |
|
115 | 102 |
public void addInteriorRing(Line line) { |
116 | 103 |
String message = "Calling deprecated method addInteriorRing of a filled spline"; |
117 | 104 |
notifyDeprecated(message); |
118 | 105 |
throw new UnsupportedOperationException(message); |
119 | 106 |
} |
120 | 107 |
|
121 |
/* (non-Javadoc) |
|
122 |
* @see org.gvsig.fmap.geom.primitive.Surface#addInteriorRing(org.gvsig.fmap.geom.primitive.Polygon) |
|
123 |
*/ |
|
124 | 108 |
public void addInteriorRing(Polygon polygon) { |
125 | 109 |
String message = "Calling deprecated method addInteriorRing of a filled spline"; |
126 | 110 |
notifyDeprecated(message); |
127 | 111 |
throw new UnsupportedOperationException(message); |
128 | 112 |
} |
129 | 113 |
|
130 |
/* (non-Javadoc) |
|
131 |
* @see org.gvsig.fmap.geom.primitive.Surface#removeInteriorRing(int) |
|
132 |
*/ |
|
133 | 114 |
public void removeInteriorRing(int index) { |
134 | 115 |
String message = "Calling deprecated method removeInteriorRing of a circle"; |
135 | 116 |
notifyDeprecated(message); |
136 | 117 |
throw new UnsupportedOperationException(message); |
137 | 118 |
} |
138 | 119 |
|
139 |
/* (non-Javadoc) |
|
140 |
* @see org.gvsig.fmap.geom.Geometry#cloneGeometry() |
|
141 |
*/ |
|
142 | 120 |
@Override |
143 | 121 |
public Geometry cloneGeometry() { |
144 | 122 |
FilledSpline2D clone = new FilledSpline2D(cloneCoordinates().toCoordinateArray()); |
... | ... | |
146 | 124 |
return clone; |
147 | 125 |
} |
148 | 126 |
|
149 |
/* |
|
150 |
* (non-Javadoc) |
|
151 |
* |
|
152 |
* @see org.gvsig.fmap.geom.jts.GeometryJTS#getJTS() |
|
153 |
*/ |
|
154 | 127 |
public com.vividsolutions.jts.geom.Geometry getJTS() { |
155 | 128 |
return JTSUtils.createJTSPolygon(getSplineCoordinates()); |
156 | 129 |
} |
157 | 130 |
|
158 |
/* (non-Javadoc) |
|
159 |
* @see org.gvsig.fmap.geom.Geometry#offset(double) |
|
160 |
*/ |
|
161 | 131 |
public Geometry offset(double distance) throws GeometryOperationNotSupportedException, GeometryOperationException { |
162 | 132 |
return JTSUtils.createGeometry(this.getProjection(), getJTS().buffer(distance)); |
163 | 133 |
} |
164 | 134 |
|
165 |
/* (non-Javadoc) |
|
166 |
* @see org.gvsig.fmap.geom.Geometry#offset(double) |
|
167 |
*/ |
|
168 | 135 |
public Geometry offset(int jointStyle, double distance) throws GeometryOperationNotSupportedException, GeometryOperationException { |
169 | 136 |
return JTSUtils.createGeometry(this.getProjection(), getJTS().buffer(distance, JTSUtils.calculateQuadrantSegments(jointStyle))); |
170 | 137 |
} |
171 | 138 |
|
172 |
/* (non-Javadoc) |
|
173 |
* @see org.gvsig.fmap.geom.jts.primitive.curve.spline.AbstractSpline#reProject(org.cresques.cts.ICoordTrans) |
|
174 |
*/ |
|
175 | 139 |
@Override |
176 | 140 |
public void reProject(ICoordTrans ct) { |
177 | 141 |
super.reProject(ct); |
... | ... | |
185 | 149 |
SurfaceSplitOperation op = new SurfaceSplitOperation(); |
186 | 150 |
return op.split(this, splitter); |
187 | 151 |
} |
152 |
|
|
153 |
@Override |
|
154 |
public Geometry force2D() throws GeometryOperationNotSupportedException, GeometryOperationException { |
|
155 |
Geometry geom = this.cloneGeometry(); |
|
156 |
return geom; |
|
157 |
} |
|
158 |
|
|
159 |
@Override |
|
160 |
public Geometry force2DM() throws GeometryOperationNotSupportedException, GeometryOperationException { |
|
161 |
ArrayListCoordinateSequence coordinates2DM = new ArrayListCoordinateSequence(coordinates.size()); |
|
162 |
for (Coordinate coordinate : this.coordinates) { |
|
163 |
coordinates2DM.add(MCoordinate.create2dWithMeasure( |
|
164 |
coordinate.x, |
|
165 |
coordinate.y, |
|
166 |
0 |
|
167 |
)); |
|
168 |
} |
|
169 |
FilledSpline2DM s = new FilledSpline2DM(coordinates2DM); |
|
170 |
s.setProjection(this.getProjection()); |
|
171 |
return s; |
|
172 |
} |
|
173 |
|
|
174 |
@Override |
|
175 |
public Geometry force3D() throws GeometryOperationNotSupportedException, GeometryOperationException { |
|
176 |
ArrayListCoordinateSequence coordinates3D = new ArrayListCoordinateSequence(coordinates.size()); |
|
177 |
for (Coordinate coordinate : this.coordinates) { |
|
178 |
coordinates3D.add(new Coordinate( |
|
179 |
coordinate.x, |
|
180 |
coordinate.y, |
|
181 |
0 |
|
182 |
)); |
|
183 |
} |
|
184 |
FilledSpline3D s = new FilledSpline3D(coordinates3D); |
|
185 |
s.setProjection(this.getProjection()); |
|
186 |
return s; |
|
187 |
} |
|
188 |
|
|
189 |
@Override |
|
190 |
public Geometry force3DM() throws GeometryOperationNotSupportedException, GeometryOperationException { |
|
191 |
ArrayListCoordinateSequence coordinates3DM = new ArrayListCoordinateSequence(coordinates.size()); |
|
192 |
for (Coordinate coordinate : this.coordinates) { |
|
193 |
coordinates3DM.add(MCoordinate.create3dWithMeasure( |
|
194 |
coordinate.x, |
|
195 |
coordinate.y, |
|
196 |
0, |
|
197 |
0 |
|
198 |
)); |
|
199 |
} |
|
200 |
FilledSpline3DM s = new FilledSpline3DM(coordinates3DM); |
|
201 |
s.setProjection(this.getProjection()); |
|
202 |
return s; |
|
203 |
} |
|
204 |
|
|
188 | 205 |
} |
Also available in: Unified diff