Revision 43907
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/Geometry.java | ||
---|---|---|
21 | 21 |
* For any additional information, do not hesitate to contact us |
22 | 22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
23 | 23 |
*/ |
24 |
|
|
25 | 24 |
package org.gvsig.fmap.geom; |
26 | 25 |
|
27 | 26 |
import java.awt.Shape; |
... | ... | |
69 | 68 |
* This class extends of the {@link Shape} class by historical reasons but this |
70 | 69 |
* inheritance will disappear in future versions. |
71 | 70 |
* </p> |
71 |
* |
|
72 | 72 |
* @see <a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012" |
73 |
* >ISO 19107< /a>
|
|
73 |
* >ISO 19107< /a> |
|
74 | 74 |
*/ |
75 | 75 |
public interface Geometry extends Shape, Serializable, Comparable { |
76 | 76 |
|
77 |
/**
|
|
78 |
* Predefined geometry types in the model.
|
|
79 |
*/
|
|
80 |
public interface TYPES {
|
|
77 |
/**
|
|
78 |
* Predefined geometry types in the model.
|
|
79 |
*/
|
|
80 |
public interface TYPES {
|
|
81 | 81 |
|
82 |
/** |
|
83 |
* Any geometry. |
|
84 |
*/ |
|
82 |
/** |
|
83 |
* Any geometry. |
|
84 |
*/ |
|
85 |
public final static int GEOMETRY = 0; |
|
85 | 86 |
|
86 |
public final static int GEOMETRY = 0; |
|
87 |
/** |
|
88 |
* A geometric element that has zero dimensions and a location |
|
89 |
* determinable by an ordered set of coordinates. |
|
90 |
*/ |
|
91 |
public final static int POINT = 1; |
|
87 | 92 |
|
88 |
/**
|
|
89 |
* A geometric element that has zero dimensions and a location
|
|
90 |
* determinable by an ordered set of coordinates.
|
|
91 |
*/
|
|
92 |
public final static int POINT = 1;
|
|
93 |
/**
|
|
94 |
* A straight or curved geometric element that is generated by a moving
|
|
95 |
* point and that has extension only along the path of the point.
|
|
96 |
*/
|
|
97 |
public final static int CURVE = 2;
|
|
93 | 98 |
|
94 |
/** |
|
95 |
* A straight or curved geometric element that is generated by a moving |
|
96 |
* point and that has extension only along the path of the point. |
|
97 |
*/ |
|
98 |
public final static int CURVE = 2; |
|
99 |
/** |
|
100 |
* A closed plane figure bounded by straight lines. |
|
101 |
*/ |
|
102 |
public final static int SURFACE = 3; |
|
99 | 103 |
|
100 |
/**
|
|
101 |
* A closed plane figure bounded by straight lines.
|
|
102 |
*/
|
|
103 |
public final static int SURFACE = 3;
|
|
104 |
/**
|
|
105 |
* Solids in 3D.
|
|
106 |
*/
|
|
107 |
public final static int SOLID = 4;
|
|
104 | 108 |
|
105 |
/** |
|
106 |
* Solids in 3D. |
|
107 |
*/ |
|
108 |
public final static int SOLID = 4; |
|
109 |
/** |
|
110 |
* A set that can contain points, lines and polygons. This is usual in |
|
111 |
* <i>CAD</i> layers <i>(dxf, dgn, dwg)</i>. |
|
112 |
*/ |
|
113 |
public final static int AGGREGATE = 6; |
|
114 |
/** |
|
115 |
* A set of points. |
|
116 |
*/ |
|
117 |
public final static int MULTIPOINT = 7; |
|
109 | 118 |
|
110 |
/** |
|
111 |
* A set that can contain points, lines and polygons. This is usual in |
|
112 |
* <i>CAD</i> layers <i>(dxf, dgn, dwg)</i>. |
|
113 |
*/ |
|
114 |
public final static int AGGREGATE = 6; |
|
115 |
/** |
|
116 |
* A set of points. |
|
117 |
*/ |
|
118 |
public final static int MULTIPOINT = 7; |
|
119 |
/** |
|
120 |
* A set of lines. |
|
121 |
*/ |
|
122 |
public final static int MULTICURVE = 8; |
|
119 | 123 |
|
120 |
/**
|
|
121 |
* A set of lines.
|
|
122 |
*/
|
|
123 |
public final static int MULTICURVE = 8;
|
|
124 |
/**
|
|
125 |
* A set of polygons.
|
|
126 |
*/
|
|
127 |
public final static int MULTISURFACE = 9;
|
|
124 | 128 |
|
125 |
/**
|
|
126 |
* A set of polygons.
|
|
127 |
*/
|
|
128 |
public final static int MULTISURFACE = 9;
|
|
129 |
/**
|
|
130 |
* A set of solids.
|
|
131 |
*/
|
|
132 |
public final static int MULTISOLID = 10;
|
|
129 | 133 |
|
130 |
/** |
|
131 |
* A set of solids. |
|
132 |
*/ |
|
133 |
public final static int MULTISOLID = 10; |
|
134 |
/** |
|
135 |
* A closed plane curve every point of which is equidistant from a fixed |
|
136 |
* point within the curve. |
|
137 |
*/ |
|
138 |
public final static int CIRCLE = 11; |
|
134 | 139 |
|
135 |
/** |
|
136 |
* A closed plane curve every point of which is equidistant from a fixed |
|
137 |
* point within the curve. |
|
138 |
*/ |
|
139 |
public final static int CIRCLE = 11; |
|
140 |
/** |
|
141 |
* A continuous portion (as of a circle or ellipse) of a curved line. |
|
142 |
*/ |
|
143 |
public final static int ARC = 12; |
|
140 | 144 |
|
141 |
/** |
|
142 |
* A continuous portion (as of a circle or ellipse) of a curved line. |
|
143 |
*/ |
|
144 |
public final static int ARC = 12; |
|
145 |
/** |
|
146 |
* A closed plane curve generated by a point moving in such a way that |
|
147 |
* the sums of its distances from two fixed points is a constant : a |
|
148 |
* plane section of a right circular cone that is a closed curve. |
|
149 |
*/ |
|
150 |
public final static int ELLIPSE = 13; |
|
145 | 151 |
|
146 |
/** |
|
147 |
* A closed plane curve generated by a point moving in such a way that |
|
148 |
* the sums of its distances from two fixed points is a constant : a |
|
149 |
* plane section of a right circular cone that is a closed curve. |
|
150 |
*/ |
|
151 |
public final static int ELLIPSE = 13; |
|
152 |
public final static int SPLINE = 14; |
|
152 | 153 |
|
153 |
public final static int SPLINE = 14;
|
|
154 |
public final static int ELLIPTICARC = 15;
|
|
154 | 155 |
|
155 |
public final static int ELLIPTICARC = 15; |
|
156 |
/** |
|
157 |
* NO DATA geometry. |
|
158 |
*/ |
|
159 |
public final static int NULL = 16; |
|
156 | 160 |
|
157 |
/** |
|
158 |
* NO DATA geometry. |
|
159 |
*/ |
|
160 |
public final static int NULL = 16; |
|
161 |
|
|
162 | 161 |
public final static int COMPLEX = 17; |
163 | 162 |
|
164 |
public final static int LINE = 18;
|
|
163 |
public final static int LINE = 18;
|
|
165 | 164 |
|
166 |
public final static int POLYGON = 19;
|
|
165 |
public final static int POLYGON = 19;
|
|
167 | 166 |
|
168 |
public final static int RING = 20;
|
|
167 |
public final static int RING = 20;
|
|
169 | 168 |
|
170 | 169 |
public final static int MULTILINE = 21; |
171 | 170 |
|
... | ... | |
177 | 176 |
|
178 | 177 |
public final static int FILLEDSPLINE = 25; |
179 | 178 |
|
180 |
} |
|
179 |
}
|
|
181 | 180 |
|
182 |
public interface DIMENSIONS { |
|
183 |
public final static int X = 0; |
|
184 |
public final static int Y = 1; |
|
185 |
public final static int Z = 2; |
|
186 |
} |
|
181 |
public interface DIMENSIONS { |
|
187 | 182 |
|
188 |
/** |
|
189 |
* The subtype of a geometry is related with the dimension of the geometry, |
|
190 |
* that is a combination between the spatial dimension (2D, 2ZD, 3D) and the |
|
191 |
* M coordinate or "measure". |
|
192 |
* |
|
193 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
194 |
*/ |
|
195 |
public interface SUBTYPES { |
|
183 |
public final static int X = 0; |
|
184 |
public final static int Y = 1; |
|
185 |
public final static int Z = 2; |
|
186 |
} |
|
196 | 187 |
|
197 |
/** |
|
198 |
* Geometries with two dimensions. |
|
199 |
*/ |
|
200 |
public final static int GEOM2D = 0; |
|
188 |
/** |
|
189 |
* The subtype of a geometry is related with the dimension of the geometry, |
|
190 |
* that is a combination between the spatial dimension (2D, 2ZD, 3D) and the |
|
191 |
* M coordinate or "measure". |
|
192 |
* |
|
193 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
194 |
*/ |
|
195 |
public interface SUBTYPES { |
|
201 | 196 |
|
202 |
/**
|
|
203 |
* Geometries with three dimensions.
|
|
204 |
*/
|
|
205 |
public final static int GEOM3D = 1;
|
|
197 |
/**
|
|
198 |
* Geometries with two dimensions.
|
|
199 |
*/
|
|
200 |
public final static int GEOM2D = 0;
|
|
206 | 201 |
|
207 |
/**
|
|
208 |
* Geometries with two dimensions and with the M coordinate.
|
|
209 |
*/
|
|
210 |
public final static int GEOM2DM = 2;
|
|
202 |
/**
|
|
203 |
* Geometries with three dimensions.
|
|
204 |
*/
|
|
205 |
public final static int GEOM3D = 1;
|
|
211 | 206 |
|
212 |
/**
|
|
213 |
* Geometries with three dimensions and with the M coordinate.
|
|
214 |
*/
|
|
215 |
public final static int GEOM3DM = 3;
|
|
207 |
/**
|
|
208 |
* Geometries with two dimensions and with the M coordinate.
|
|
209 |
*/
|
|
210 |
public final static int GEOM2DM = 2;
|
|
216 | 211 |
|
217 |
/** |
|
218 |
* The subtype us unknown. |
|
219 |
*/ |
|
220 |
public final static int UNKNOWN = 4; |
|
221 |
} |
|
212 |
/** |
|
213 |
* Geometries with three dimensions and with the M coordinate. |
|
214 |
*/ |
|
215 |
public final static int GEOM3DM = 3; |
|
222 | 216 |
|
223 |
/**
|
|
224 |
* Initial value for new geometry types (it must not overlap with the basic
|
|
225 |
* ones defined in TYPES).
|
|
226 |
*/
|
|
227 |
public static final int EXTENDED_GEOMTYPE_OFFSET = 17;
|
|
217 |
/**
|
|
218 |
* The subtype us unknown.
|
|
219 |
*/
|
|
220 |
public final static int UNKNOWN = 4;
|
|
221 |
}
|
|
228 | 222 |
|
229 |
/**
|
|
230 |
* Initial value for new geometry subtypes (it must not overlap with the
|
|
231 |
* basic ones defined in SUBTYPES).
|
|
232 |
*/
|
|
233 |
public static final int EXTENDED_GEOMSUBTYPE_OFFSET = 6;
|
|
223 |
/**
|
|
224 |
* Initial value for new geometry types (it must not overlap with the basic
|
|
225 |
* ones defined in TYPES).
|
|
226 |
*/
|
|
227 |
public static final int EXTENDED_GEOMTYPE_OFFSET = 17;
|
|
234 | 228 |
|
235 |
public interface OPERATIONS { |
|
236 |
public final static String CONVERTTOWKT = "toWKT"; |
|
237 |
public final static String CONVERTTOWKB = "toWKB"; |
|
238 |
public final static String BUFFER = "buffer"; |
|
239 |
public final static String DISTANCE = "Distance"; |
|
240 |
public final static String CONTAINS = "Contains"; |
|
241 |
public final static String OVERLAPS = "OVERLAPS"; |
|
242 |
public final static String CONVEXHULL = "ConvexHull"; |
|
243 |
public final static String COVERS = "Covers"; |
|
244 |
public final static String CROSSES = "Crosses"; |
|
245 |
public final static String DIFFERENCE = "Difference"; |
|
246 |
public final static String DISJOIN = "Disjoin"; |
|
247 |
public final static String INTERSECTION = "Intersaction"; |
|
248 |
public final static String INTERSECTS = "Intersects"; |
|
249 |
public final static String TOUCHES = "Touches"; |
|
250 |
public final static String UNION = "Union"; |
|
251 |
public final static String WITHIN = "Within"; |
|
252 |
public final static String COVEREDBY = "CoveredBy"; |
|
253 |
} |
|
229 |
/** |
|
230 |
* Initial value for new geometry subtypes (it must not overlap with the |
|
231 |
* basic ones defined in SUBTYPES). |
|
232 |
*/ |
|
233 |
public static final int EXTENDED_GEOMSUBTYPE_OFFSET = 6; |
|
254 | 234 |
|
255 |
public interface ValidationStatus {
|
|
235 |
public interface OPERATIONS {
|
|
256 | 236 |
|
257 |
public static final int VALID = 0; |
|
258 |
public static final int CURRUPTED = 1; |
|
259 |
public static final int UNKNOW = 2; |
|
260 |
public static final int DISCONNECTED_INTERIOR = 10; |
|
261 |
public static final int DUPLICATE_RINGS = 11; |
|
262 |
public static final int HOLE_OUTSIDE_SHELL = 12; |
|
263 |
public static final int INVALID_COORDINATE = 13; |
|
264 |
public static final int NESTED_HOLES = 14; |
|
265 |
public static final int NESTED_SHELLS = 15; |
|
266 |
public static final int RING_NOT_CLOSED = 17; |
|
267 |
public static final int RING_SELF_INTERSECTION = 18; |
|
268 |
public static final int SELF_INTERSECTION = 19; |
|
269 |
public static final int TOO_FEW_POINTS = 20; |
|
237 |
public final static String CONVERTTOWKT = "toWKT"; |
|
238 |
public final static String CONVERTTOWKB = "toWKB"; |
|
239 |
public final static String BUFFER = "buffer"; |
|
240 |
public final static String DISTANCE = "Distance"; |
|
241 |
public final static String CONTAINS = "Contains"; |
|
242 |
public final static String OVERLAPS = "OVERLAPS"; |
|
243 |
public final static String CONVEXHULL = "ConvexHull"; |
|
244 |
public final static String COVERS = "Covers"; |
|
245 |
public final static String CROSSES = "Crosses"; |
|
246 |
public final static String DIFFERENCE = "Difference"; |
|
247 |
public final static String DISJOIN = "Disjoin"; |
|
248 |
public final static String INTERSECTION = "Intersaction"; |
|
249 |
public final static String INTERSECTS = "Intersects"; |
|
250 |
public final static String TOUCHES = "Touches"; |
|
251 |
public final static String UNION = "Union"; |
|
252 |
public final static String WITHIN = "Within"; |
|
253 |
public final static String COVEREDBY = "CoveredBy"; |
|
254 |
} |
|
270 | 255 |
|
271 |
/** |
|
272 |
* True if the geoemtry are valid. |
|
273 |
* |
|
274 |
* @return true form valid geometries |
|
275 |
*/ |
|
276 |
public boolean isValid(); |
|
256 |
public interface ValidationStatus { |
|
277 | 257 |
|
278 |
/** |
|
279 |
* Return the status code results of validate the geometry. |
|
280 |
* |
|
281 |
* @return validation code |
|
282 |
*/ |
|
283 |
public int getStatusCode(); |
|
258 |
public static final int VALID = 0; |
|
259 |
public static final int CURRUPTED = 1; |
|
260 |
public static final int UNKNOW = 2; |
|
261 |
public static final int DISCONNECTED_INTERIOR = 10; |
|
262 |
public static final int DUPLICATE_RINGS = 11; |
|
263 |
public static final int HOLE_OUTSIDE_SHELL = 12; |
|
264 |
public static final int INVALID_COORDINATE = 13; |
|
265 |
public static final int NESTED_HOLES = 14; |
|
266 |
public static final int NESTED_SHELLS = 15; |
|
267 |
public static final int RING_NOT_CLOSED = 17; |
|
268 |
public static final int RING_SELF_INTERSECTION = 18; |
|
269 |
public static final int SELF_INTERSECTION = 19; |
|
270 |
public static final int TOO_FEW_POINTS = 20; |
|
284 | 271 |
|
285 |
/** |
|
286 |
* Return the nearest point to the problem when validate the geometry. |
|
287 |
* |
|
288 |
* If the geometry is valid, this return null. |
|
289 |
* |
|
290 |
* @return the nearest point to the problem or null. |
|
291 |
*/ |
|
292 |
public Point getProblemLocation(); |
|
272 |
/** |
|
273 |
* True if the geoemtry are valid. |
|
274 |
* |
|
275 |
* @return true form valid geometries |
|
276 |
*/ |
|
277 |
public boolean isValid(); |
|
293 | 278 |
|
294 |
/** |
|
295 |
* Return a human readable message explaining the cause of the problem. |
|
296 |
* |
|
297 |
* If the geometry is valid this is null. |
|
298 |
* |
|
299 |
* @return the message cause of the problem. |
|
300 |
*/ |
|
301 |
public String getMessage(); |
|
302 |
} |
|
279 |
/** |
|
280 |
* Return the status code results of validate the geometry. |
|
281 |
* |
|
282 |
* @return validation code |
|
283 |
*/ |
|
284 |
public int getStatusCode(); |
|
303 | 285 |
|
304 |
public static int BEST = 0; |
|
305 |
/** |
|
306 |
* North. |
|
307 |
*/ |
|
308 |
public static int N = 1; |
|
286 |
/** |
|
287 |
* Return the nearest point to the problem when validate the geometry. |
|
288 |
* |
|
289 |
* If the geometry is valid, this return null. |
|
290 |
* |
|
291 |
* @return the nearest point to the problem or null. |
|
292 |
*/ |
|
293 |
public Point getProblemLocation(); |
|
309 | 294 |
|
310 |
/** |
|
311 |
* North - East. |
|
312 |
*/ |
|
313 |
public static int NE = 2; |
|
295 |
/** |
|
296 |
* Return a human readable message explaining the cause of the problem. |
|
297 |
* |
|
298 |
* If the geometry is valid this is null. |
|
299 |
* |
|
300 |
* @return the message cause of the problem. |
|
301 |
*/ |
|
302 |
public String getMessage(); |
|
303 |
} |
|
314 | 304 |
|
315 |
/** |
|
316 |
* East. |
|
317 |
*/ |
|
318 |
public static int E = 3; |
|
305 |
public static int BEST = 0; |
|
306 |
/** |
|
307 |
* North. |
|
308 |
*/ |
|
309 |
public static int N = 1; |
|
319 | 310 |
|
320 |
/**
|
|
321 |
* South - East.
|
|
322 |
*/
|
|
323 |
public static int SE = 4;
|
|
311 |
/**
|
|
312 |
* North - East.
|
|
313 |
*/
|
|
314 |
public static int NE = 2;
|
|
324 | 315 |
|
325 |
/**
|
|
326 |
* South.
|
|
327 |
*/
|
|
328 |
public static int S = 5;
|
|
316 |
/**
|
|
317 |
* East.
|
|
318 |
*/
|
|
319 |
public static int E = 3;
|
|
329 | 320 |
|
330 |
/**
|
|
331 |
* South - West.
|
|
332 |
*/
|
|
333 |
public static int SW = 6;
|
|
321 |
/**
|
|
322 |
* South - East.
|
|
323 |
*/
|
|
324 |
public static int SE = 4;
|
|
334 | 325 |
|
335 |
/**
|
|
336 |
* West.
|
|
337 |
*/
|
|
338 |
public static int W = 7;
|
|
326 |
/**
|
|
327 |
* South.
|
|
328 |
*/
|
|
329 |
public static int S = 5;
|
|
339 | 330 |
|
340 |
/**
|
|
341 |
* North - West.
|
|
342 |
*/
|
|
343 |
public static int NW = 8;
|
|
331 |
/**
|
|
332 |
* South - West.
|
|
333 |
*/
|
|
334 |
public static int SW = 6;
|
|
344 | 335 |
|
345 |
public static int SELECTHANDLER = 0; |
|
346 |
public static int STRETCHINGHANDLER = 1; |
|
336 |
/** |
|
337 |
* West. |
|
338 |
*/ |
|
339 |
public static int W = 7; |
|
347 | 340 |
|
348 |
/** |
|
349 |
* If this geometry is a predefined interface then this method returns one |
|
350 |
* of {@link Geometry.TYPES} contants.<br> |
|
351 |
* If this geometry is an extended type then this method returns a runtime |
|
352 |
* constant that identifies its type. By convention this value is stored in |
|
353 |
* a constant called .CODE within the geometry class, for instance: |
|
354 |
* Point2D.CODE. |
|
355 |
* |
|
356 |
* @return If this geometry is a predefined interface then one of |
|
357 |
* {@link Geometry.TYPES} or a runtime constant if it is an extended |
|
358 |
* type. |
|
359 |
*/ |
|
360 |
public int getType(); |
|
341 |
/** |
|
342 |
* North - West. |
|
343 |
*/ |
|
344 |
public static int NW = 8; |
|
361 | 345 |
|
362 |
/** |
|
363 |
* Creates a clone of this geometry. |
|
364 |
* |
|
365 |
* @return A clone of this geometry. |
|
366 |
*/ |
|
367 |
public Geometry cloneGeometry(); |
|
346 |
public static int SELECTHANDLER = 0; |
|
347 |
public static int STRETCHINGHANDLER = 1; |
|
368 | 348 |
|
369 |
/** |
|
370 |
* Returns true if this geometry intersects the rectangle passed as |
|
371 |
* parameter. |
|
372 |
* |
|
373 |
* @param r |
|
374 |
* Rectangle. |
|
375 |
* |
|
376 |
* @return True, if <code>this</code> intersects <code>r</code>. |
|
377 |
*/ |
|
378 |
public boolean intersects(Rectangle2D r); |
|
349 |
/** |
|
350 |
* If this geometry is a predefined interface then this method returns one |
|
351 |
* of {@link Geometry.TYPES} contants.<br> |
|
352 |
* If this geometry is an extended type then this method returns a runtime |
|
353 |
* constant that identifies its type. By convention this value is stored in |
|
354 |
* a constant called .CODE within the geometry class, for instance: |
|
355 |
* Point2D.CODE. |
|
356 |
* |
|
357 |
* @return If this geometry is a predefined interface then one of |
|
358 |
* {@link Geometry.TYPES} or a runtime constant if it is an extended type. |
|
359 |
*/ |
|
360 |
public int getType(); |
|
379 | 361 |
|
380 |
/** |
|
381 |
* Used by the drawing strategies to quickly test whether this geometry |
|
382 |
* intersects with the visible rectangle. |
|
383 |
* |
|
384 |
* @param x |
|
385 |
* The minimum X coordinate. |
|
386 |
* @param y |
|
387 |
* The minimum Y coordinate. |
|
388 |
* @param w |
|
389 |
* The width of the envelope. |
|
390 |
* @param h |
|
391 |
* The height of the envelope. |
|
392 |
* @return true if <code>this</code> intersects the rectangle defined by the |
|
393 |
* parameters. |
|
394 |
*/ |
|
395 |
public boolean fastIntersects(double x, double y, double w, double h); |
|
362 |
/** |
|
363 |
* Creates a clone of this geometry. |
|
364 |
* |
|
365 |
* @return A clone of this geometry. |
|
366 |
*/ |
|
367 |
public Geometry cloneGeometry(); |
|
396 | 368 |
|
397 |
/** |
|
398 |
* <p> |
|
399 |
* Returns the minimum bounding box for this Geometry. This shall be the |
|
400 |
* coordinate region spanning the minimum and maximum value for each |
|
401 |
* ordinate taken on by DirectPositions in this Geometry. The simplest |
|
402 |
* representation for an envelope consists of two DirectPositions, the first |
|
403 |
* one containing all the minimums for each ordinate, and second one |
|
404 |
* containing all the maximums. |
|
405 |
* </p> |
|
406 |
* |
|
407 |
* @return The minimum bounding box for this Geometry. |
|
408 |
*/ |
|
409 |
public Envelope getEnvelope(); |
|
369 |
/** |
|
370 |
* Returns true if this geometry intersects the rectangle passed as |
|
371 |
* parameter. |
|
372 |
* |
|
373 |
* @param r Rectangle. |
|
374 |
* |
|
375 |
* @return True, if <code>this</code> intersects <code>r</code>. |
|
376 |
*/ |
|
377 |
public boolean intersects(Rectangle2D r); |
|
410 | 378 |
|
411 |
/** |
|
412 |
* Reprojects this geometry by the coordinate transformer passed as |
|
413 |
* parameter. |
|
414 |
* |
|
415 |
* @param ct |
|
416 |
* Coordinate Transformer. |
|
417 |
*/ |
|
418 |
public void reProject(ICoordTrans ct); |
|
379 |
/** |
|
380 |
* Used by the drawing strategies to quickly test whether this geometry |
|
381 |
* intersects with the visible rectangle. |
|
382 |
* |
|
383 |
* @param x The minimum X coordinate. |
|
384 |
* @param y The minimum Y coordinate. |
|
385 |
* @param w The width of the envelope. |
|
386 |
* @param h The height of the envelope. |
|
387 |
* @return true if <code>this</code> intersects the rectangle defined by the |
|
388 |
* parameters. |
|
389 |
*/ |
|
390 |
public boolean fastIntersects(double x, double y, double w, double h); |
|
419 | 391 |
|
420 |
/** |
|
421 |
* It applies an affine transformation to the geometry. |
|
422 |
* If parameter value is null, it will be considered an |
|
423 |
* empty transformation, therefore equivalent to the identity |
|
424 |
* transformation. |
|
425 |
* |
|
426 |
* @param at |
|
427 |
* The transformation to apply. |
|
428 |
*/ |
|
429 |
public void transform(AffineTransform at); |
|
430 |
/** |
|
431 |
* Returns the largest number n such that each direct position in a |
|
432 |
* geometric set can be associated with a subset that has the direct |
|
433 |
* position in its interior and is similar (isomorphic) to Rn, Euclidean |
|
434 |
* n-space. |
|
435 |
* |
|
436 |
* @return The dimension. |
|
437 |
*/ |
|
438 |
public int getDimension(); |
|
392 |
/** |
|
393 |
* <p> |
|
394 |
* Returns the minimum bounding box for this Geometry. This shall be the |
|
395 |
* coordinate region spanning the minimum and maximum value for each |
|
396 |
* ordinate taken on by DirectPositions in this Geometry. The simplest |
|
397 |
* representation for an envelope consists of two DirectPositions, the first |
|
398 |
* one containing all the minimums for each ordinate, and second one |
|
399 |
* containing all the maximums. |
|
400 |
* </p> |
|
401 |
* |
|
402 |
* @return The minimum bounding box for this Geometry. |
|
403 |
*/ |
|
404 |
public Envelope getEnvelope(); |
|
439 | 405 |
|
440 |
/** |
|
441 |
* Returns <code>true</code> if this Geometry has no interior point of |
|
442 |
* self-intersection or self-tangency. In mathematical formalisms, this |
|
443 |
* means that every point in the interior of the object must have a metric |
|
444 |
* neighborhood whose intersection with the object is isomorphic to an |
|
445 |
* n-sphere, where n is the dimension of this Geometry. |
|
446 |
* |
|
447 |
* @return If the geometry is simple. |
|
448 |
*/ |
|
449 |
public boolean isSimple(); |
|
406 |
/** |
|
407 |
* Reprojects this geometry by the coordinate transformer passed as |
|
408 |
* parameter. |
|
409 |
* |
|
410 |
* @param ct Coordinate Transformer. |
|
411 |
*/ |
|
412 |
public void reProject(ICoordTrans ct); |
|
450 | 413 |
|
451 |
public boolean isCCW() |
|
452 |
throws GeometryOperationNotSupportedException, |
|
453 |
GeometryOperationException; |
|
414 |
/** |
|
415 |
* It applies an affine transformation to the geometry. If parameter value |
|
416 |
* is null, it will be considered an empty transformation, therefore |
|
417 |
* equivalent to the identity transformation. |
|
418 |
* |
|
419 |
* @param at The transformation to apply. |
|
420 |
*/ |
|
421 |
public void transform(AffineTransform at); |
|
454 | 422 |
|
455 |
/** |
|
456 |
* Invokes a geometry operation given its index and context. |
|
457 |
* |
|
458 |
* @param index |
|
459 |
* Unique index of the operation. Operation code. |
|
460 |
* @param ctx |
|
461 |
* The context of the geometry operation. |
|
462 |
* @return Object returned by the operation. |
|
463 |
* @throws GeometryOperationNotSupportedException |
|
464 |
* It is thrown when the operation has been not registered for |
|
465 |
* this geometry. |
|
466 |
* @throws GeometryOperationException |
|
467 |
* It is thrown when there is an error executing the operation. |
|
468 |
*/ |
|
469 |
public Object invokeOperation(int index, GeometryOperationContext ctx) |
|
470 |
throws GeometryOperationNotSupportedException, |
|
471 |
GeometryOperationException; |
|
423 |
/** |
|
424 |
* Returns the largest number n such that each direct position in a |
|
425 |
* geometric set can be associated with a subset that has the direct |
|
426 |
* position in its interior and is similar (isomorphic) to Rn, Euclidean |
|
427 |
* n-space. |
|
428 |
* |
|
429 |
* @return The dimension. |
|
430 |
*/ |
|
431 |
public int getDimension(); |
|
472 | 432 |
|
473 |
/** |
|
474 |
* Invokes a geometry operation given its name and context. |
|
475 |
* |
|
476 |
* @param opName |
|
477 |
* Operation name. |
|
478 |
* @param ctx |
|
479 |
* The context of the geometry operation. |
|
480 |
* @return Object returned by the operation. |
|
481 |
* @throws GeometryOperationNotSupportedException |
|
482 |
* It is thrown when the operation has been not registered for |
|
483 |
* this geometry. |
|
484 |
* @throws GeometryOperationException |
|
485 |
* It is thrown when there is an error executing the operation. |
|
486 |
*/ |
|
487 |
public Object invokeOperation(String opName, GeometryOperationContext ctx) |
|
488 |
throws GeometryOperationNotSupportedException, |
|
489 |
GeometryOperationException; |
|
433 |
/** |
|
434 |
* Returns <code>true</code> if this Geometry has no interior point of |
|
435 |
* self-intersection or self-tangency. In mathematical formalisms, this |
|
436 |
* means that every point in the interior of the object must have a metric |
|
437 |
* neighborhood whose intersection with the object is isomorphic to an |
|
438 |
* n-sphere, where n is the dimension of this Geometry. |
|
439 |
* |
|
440 |
* @return If the geometry is simple. |
|
441 |
*/ |
|
442 |
public boolean isSimple(); |
|
490 | 443 |
|
491 |
/** |
|
492 |
* Instance of the GeometryType associated to this geometry. |
|
493 |
* |
|
494 |
* @return The geometry type. |
|
495 |
*/ |
|
496 |
public GeometryType getGeometryType(); |
|
444 |
public boolean isCCW() |
|
445 |
throws GeometryOperationNotSupportedException, |
|
446 |
GeometryOperationException; |
|
497 | 447 |
|
498 |
/** |
|
499 |
* Return a byte array with the equivalent in WKB format of the Geometry. |
|
500 |
* |
|
501 |
* Utility method to wrap the invocation to the operation |
|
502 |
* {@link OPERATIONS#CONVERTTOWKB}. |
|
503 |
* |
|
504 |
* @return the WKB version of the geometry |
|
505 |
*/ |
|
506 |
public byte[] convertToWKB() throws GeometryOperationNotSupportedException, |
|
507 |
GeometryOperationException; |
|
448 |
/** |
|
449 |
* Invokes a geometry operation given its index and context. |
|
450 |
* |
|
451 |
* @param index Unique index of the operation. Operation code. |
|
452 |
* @param ctx The context of the geometry operation. |
|
453 |
* @return Object returned by the operation. |
|
454 |
* @throws GeometryOperationNotSupportedException It is thrown when the |
|
455 |
* operation has been not registered for this geometry. |
|
456 |
* @throws GeometryOperationException It is thrown when there is an error |
|
457 |
* executing the operation. |
|
458 |
*/ |
|
459 |
public Object invokeOperation(int index, GeometryOperationContext ctx) |
|
460 |
throws GeometryOperationNotSupportedException, |
|
461 |
GeometryOperationException; |
|
508 | 462 |
|
509 |
public byte[] convertToWKB(int srs) |
|
510 |
throws GeometryOperationNotSupportedException, GeometryOperationException; |
|
463 |
/** |
|
464 |
* Invokes a geometry operation given its name and context. |
|
465 |
* |
|
466 |
* @param opName Operation name. |
|
467 |
* @param ctx The context of the geometry operation. |
|
468 |
* @return Object returned by the operation. |
|
469 |
* @throws GeometryOperationNotSupportedException It is thrown when the |
|
470 |
* operation has been not registered for this geometry. |
|
471 |
* @throws GeometryOperationException It is thrown when there is an error |
|
472 |
* executing the operation. |
|
473 |
*/ |
|
474 |
public Object invokeOperation(String opName, GeometryOperationContext ctx) |
|
475 |
throws GeometryOperationNotSupportedException, |
|
476 |
GeometryOperationException; |
|
511 | 477 |
|
512 |
public byte[] convertToWKBForcingType(int srs, int type) |
|
513 |
throws GeometryOperationNotSupportedException, GeometryOperationException; |
|
478 |
/** |
|
479 |
* Instance of the GeometryType associated to this geometry. |
|
480 |
* |
|
481 |
* @return The geometry type. |
|
482 |
*/ |
|
483 |
public GeometryType getGeometryType(); |
|
514 | 484 |
|
515 |
/** |
|
516 |
* Return a byte array with the equivalent in EWKB format of the Geometry. |
|
517 |
* |
|
518 |
* Utility method to wrap the invocation to the operation |
|
519 |
* {@link OPERATIONS#CONVERTTOEWKB}. |
|
520 |
* |
|
521 |
* @return the EWKB version of the geometry |
|
522 |
*/ |
|
523 |
public byte[] convertToEWKB() throws GeometryOperationNotSupportedException, GeometryOperationException; |
|
485 |
/** |
|
486 |
* Return a byte array with the equivalent in WKB format of the Geometry. |
|
487 |
* |
|
488 |
* Utility method to wrap the invocation to the operation |
|
489 |
* {@link OPERATIONS#CONVERTTOWKB}. |
|
490 |
* |
|
491 |
* @return the WKB version of the geometry |
|
492 |
*/ |
|
493 |
public byte[] convertToWKB() throws GeometryOperationNotSupportedException, |
|
494 |
GeometryOperationException; |
|
524 | 495 |
|
525 |
public byte[] convertToEWKB(int srs)
|
|
526 |
throws GeometryOperationNotSupportedException, GeometryOperationException;
|
|
496 |
public byte[] convertToWKB(int srs) |
|
497 |
throws GeometryOperationNotSupportedException, GeometryOperationException;
|
|
527 | 498 |
|
528 |
public byte[] convertToEWKBForcingType(int srs, int type)
|
|
529 |
throws GeometryOperationNotSupportedException, GeometryOperationException;
|
|
499 |
public byte[] convertToWKBForcingType(int srs, int type) |
|
500 |
throws GeometryOperationNotSupportedException, GeometryOperationException;
|
|
530 | 501 |
|
502 |
/** |
|
503 |
* Return a byte array with the equivalent in EWKB format of the Geometry. |
|
504 |
* |
|
505 |
* Utility method to wrap the invocation to the operation |
|
506 |
* {@link OPERATIONS#CONVERTTOEWKB}. |
|
507 |
* |
|
508 |
* @return the EWKB version of the geometry |
|
509 |
*/ |
|
510 |
public byte[] convertToEWKB() throws GeometryOperationNotSupportedException, GeometryOperationException; |
|
531 | 511 |
|
532 |
/** |
|
533 |
* Return a string with the equivalent in WKT format of the Geometry. |
|
534 |
* |
|
535 |
* This is a utility method to wrap the invocation to the operation |
|
536 |
* {@link OPERATIONS#CONVERTTOWKT}. |
|
537 |
* |
|
538 |
* @return the WKT version of the geometry. |
|
539 |
* |
|
540 |
* @throws GeometryOperationNotSupportedException |
|
541 |
* @throws GeometryOperationException |
|
542 |
*/ |
|
543 |
public String convertToWKT() throws GeometryOperationNotSupportedException, |
|
544 |
GeometryOperationException; |
|
512 |
public byte[] convertToEWKB(int srs) |
|
513 |
throws GeometryOperationNotSupportedException, GeometryOperationException; |
|
545 | 514 |
|
546 |
/** |
|
547 |
* Computes a buffer area around this geometry having the given width |
|
548 |
* |
|
549 |
* This is a utility method to wrap the invocation to the operation |
|
550 |
* {@link OPERATIONS#BUFFER}. |
|
551 |
* |
|
552 |
* @param distance |
|
553 |
* the width of the buffer |
|
554 |
* |
|
555 |
* @return a new Geometry with the computed buffer. |
|
556 |
* |
|
557 |
* @throws GeometryOperationNotSupportedException |
|
558 |
* @throws GeometryOperationException |
|
559 |
*/ |
|
560 |
public Geometry buffer(double distance) |
|
561 |
throws GeometryOperationNotSupportedException, |
|
562 |
GeometryOperationException; |
|
515 |
public byte[] convertToEWKBForcingType(int srs, int type) |
|
516 |
throws GeometryOperationNotSupportedException, GeometryOperationException; |
|
563 | 517 |
|
564 |
public Geometry offset(double distance) |
|
565 |
throws GeometryOperationNotSupportedException, |
|
566 |
GeometryOperationException; |
|
518 |
/** |
|
519 |
* Return a string with the equivalent in WKT format of the Geometry. |
|
520 |
* |
|
521 |
* This is a utility method to wrap the invocation to the operation |
|
522 |
* {@link OPERATIONS#CONVERTTOWKT}. |
|
523 |
* |
|
524 |
* @return the WKT version of the geometry. |
|
525 |
* |
|
526 |
* @throws GeometryOperationNotSupportedException |
|
527 |
* @throws GeometryOperationException |
|
528 |
*/ |
|
529 |
public String convertToWKT() throws GeometryOperationNotSupportedException, |
|
530 |
GeometryOperationException; |
|
567 | 531 |
|
568 |
/** |
|
569 |
* Tests whether this geometry contains the specified geometry. |
|
570 |
* |
|
571 |
* This is a utility method to wrap the invocation to the operation |
|
572 |
* {@link OPERATIONS#CONTAINS}. |
|
573 |
* |
|
574 |
* @param geometry |
|
575 |
* the Geometry with which to compare this Geometry |
|
576 |
* |
|
577 |
* @return if this Geometry contains the specified geometry |
|
578 |
* |
|
579 |
* @throws GeometryOperationNotSupportedException |
|
580 |
* @throws GeometryOperationException |
|
581 |
*/ |
|
582 |
public boolean contains(Geometry geometry) |
|
583 |
throws GeometryOperationNotSupportedException, |
|
584 |
GeometryOperationException; |
|
532 |
/** |
|
533 |
* Computes a buffer area around this geometry having the given width |
|
534 |
* |
|
535 |
* This is a utility method to wrap the invocation to the operation |
|
536 |
* {@link OPERATIONS#BUFFER}. |
|
537 |
* |
|
538 |
* @param distance the width of the buffer |
|
539 |
* |
|
540 |
* @return a new Geometry with the computed buffer. |
|
541 |
* |
|
542 |
* @throws GeometryOperationNotSupportedException |
|
543 |
* @throws GeometryOperationException |
|
544 |
*/ |
|
545 |
public Geometry buffer(double distance) |
|
546 |
throws GeometryOperationNotSupportedException, |
|
547 |
GeometryOperationException; |
|
585 | 548 |
|
586 |
/** |
|
587 |
* Returns the minimum distance between this Geometry and the specified |
|
588 |
* geometry. |
|
589 |
* |
|
590 |
* This is a utility method to wrap the invocation to the operation |
|
591 |
* {@link OPERATIONS#DISTANCE}. |
|
592 |
* |
|
593 |
* @param geometry |
|
594 |
* the Geometry from which to compute the distance |
|
595 |
* |
|
596 |
* @return the distance between the geometries |
|
597 |
* |
|
598 |
* @throws GeometryOperationNotSupportedException |
|
599 |
* @throws GeometryOperationException |
|
600 |
*/ |
|
601 |
public double distance(Geometry other) |
|
602 |
throws GeometryOperationNotSupportedException, |
|
603 |
GeometryOperationException; |
|
549 |
public Geometry offset(double distance) |
|
550 |
throws GeometryOperationNotSupportedException, |
|
551 |
GeometryOperationException; |
|
604 | 552 |
|
605 |
public Geometry[] closestPoints(Geometry other) |
|
606 |
throws GeometryOperationNotSupportedException, |
|
607 |
GeometryOperationException; |
|
553 |
/** |
|
554 |
* Tests whether this geometry contains the specified geometry. |
|
555 |
* |
|
556 |
* This is a utility method to wrap the invocation to the operation |
|
557 |
* {@link OPERATIONS#CONTAINS}. |
|
558 |
* |
|
559 |
* @param geometry the Geometry with which to compare this Geometry |
|
560 |
* |
|
561 |
* @return if this Geometry contains the specified geometry |
|
562 |
* |
|
563 |
* @throws GeometryOperationNotSupportedException |
|
564 |
* @throws GeometryOperationException |
|
565 |
*/ |
|
566 |
public boolean contains(Geometry geometry) |
|
567 |
throws GeometryOperationNotSupportedException, |
|
568 |
GeometryOperationException; |
|
608 | 569 |
|
609 |
boolean isWithinDistance(Geometry other, double distance) |
|
610 |
throws GeometryOperationNotSupportedException, |
|
611 |
GeometryOperationException; |
|
570 |
/** |
|
571 |
* Returns the minimum distance between this Geometry and the specified |
|
572 |
* geometry. |
|
573 |
* |
|
574 |
* This is a utility method to wrap the invocation to the operation |
|
575 |
* {@link OPERATIONS#DISTANCE}. |
|
576 |
* |
|
577 |
* @param geometry the Geometry from which to compute the distance |
|
578 |
* |
|
579 |
* @return the distance between the geometries |
|
580 |
* |
|
581 |
* @throws GeometryOperationNotSupportedException |
|
582 |
* @throws GeometryOperationException |
|
583 |
*/ |
|
584 |
public double distance(Geometry other) |
|
585 |
throws GeometryOperationNotSupportedException, |
|
586 |
GeometryOperationException; |
|
612 | 587 |
|
613 |
/** |
|
614 |
* Tests whether this geometry overlaps the specified geometry. |
|
615 |
* |
|
616 |
* This is a utility method to wrap the invocation to the operation |
|
617 |
* {@link OPERATIONS#OVERLAPS}. |
|
618 |
* |
|
619 |
* @param geometry |
|
620 |
* the Geometry with which to compare this Geometry |
|
621 |
* |
|
622 |
* @return true if the two geometries overlap. |
|
623 |
* |
|
624 |
* @throws GeometryOperationNotSupportedException |
|
625 |
* @throws GeometryOperationException |
|
626 |
*/ |
|
627 |
public boolean overlaps(Geometry geometry) |
|
628 |
throws GeometryOperationNotSupportedException, |
|
629 |
GeometryOperationException; |
|
588 |
public Geometry[] closestPoints(Geometry other) |
|
589 |
throws GeometryOperationNotSupportedException, |
|
590 |
GeometryOperationException; |
|
630 | 591 |
|
631 |
public Geometry convexHull() throws GeometryOperationNotSupportedException, |
|
632 |
GeometryOperationException; |
|
592 |
boolean isWithinDistance(Geometry other, double distance) |
|
593 |
throws GeometryOperationNotSupportedException, |
|
594 |
GeometryOperationException; |
|
633 | 595 |
|
634 |
public boolean coveredBy(Geometry geometry) |
|
635 |
throws GeometryOperationNotSupportedException, |
|
636 |
GeometryOperationException; |
|
596 |
/** |
|
597 |
* Tests whether this geometry overlaps the specified geometry. |
|
598 |
* |
|
599 |
* This is a utility method to wrap the invocation to the operation |
|
600 |
* {@link OPERATIONS#OVERLAPS}. |
|
601 |
* |
|
602 |
* @param geometry the Geometry with which to compare this Geometry |
|
603 |
* |
|
604 |
* @return true if the two geometries overlap. |
|
605 |
* |
|
606 |
* @throws GeometryOperationNotSupportedException |
|
607 |
* @throws GeometryOperationException |
|
608 |
*/ |
|
609 |
public boolean overlaps(Geometry geometry) |
|
610 |
throws GeometryOperationNotSupportedException, |
|
611 |
GeometryOperationException; |
|
637 | 612 |
|
638 |
public boolean covers(Geometry geometry) |
|
639 |
throws GeometryOperationNotSupportedException, |
|
640 |
GeometryOperationException; |
|
613 |
public Geometry convexHull() throws GeometryOperationNotSupportedException, |
|
614 |
GeometryOperationException; |
|
641 | 615 |
|
642 |
public boolean crosses(Geometry geometry)
|
|
643 |
throws GeometryOperationNotSupportedException,
|
|
644 |
GeometryOperationException;
|
|
616 |
public boolean coveredBy(Geometry geometry)
|
|
617 |
throws GeometryOperationNotSupportedException,
|
|
618 |
GeometryOperationException;
|
|
645 | 619 |
|
646 |
public Geometry difference(Geometry other)
|
|
647 |
throws GeometryOperationNotSupportedException,
|
|
648 |
GeometryOperationException;
|
|
620 |
public boolean covers(Geometry geometry)
|
|
621 |
throws GeometryOperationNotSupportedException,
|
|
622 |
GeometryOperationException;
|
|
649 | 623 |
|
650 |
public boolean disjoint(Geometry geometry)
|
|
651 |
throws GeometryOperationNotSupportedException,
|
|
652 |
GeometryOperationException;
|
|
624 |
public boolean crosses(Geometry geometry)
|
|
625 |
throws GeometryOperationNotSupportedException,
|
|
626 |
GeometryOperationException;
|
|
653 | 627 |
|
654 |
public Geometry intersection(Geometry other)
|
|
655 |
throws GeometryOperationNotSupportedException,
|
|
656 |
GeometryOperationException;
|
|
628 |
public Geometry difference(Geometry other)
|
|
629 |
throws GeometryOperationNotSupportedException,
|
|
630 |
GeometryOperationException;
|
|
657 | 631 |
|
658 |
public boolean intersects(Geometry geometry)
|
|
659 |
throws GeometryOperationNotSupportedException,
|
|
660 |
GeometryOperationException;
|
|
632 |
public boolean disjoint(Geometry geometry)
|
|
633 |
throws GeometryOperationNotSupportedException,
|
|
634 |
GeometryOperationException;
|
|
661 | 635 |
|
662 |
public Geometry snapTo(Geometry other, double snapTolerance)
|
|
663 |
throws GeometryOperationNotSupportedException,
|
|
664 |
GeometryOperationException;
|
|
636 |
public Geometry intersection(Geometry other)
|
|
637 |
throws GeometryOperationNotSupportedException,
|
|
638 |
GeometryOperationException;
|
|
665 | 639 |
|
666 |
public boolean touches(Geometry geometry)
|
|
667 |
throws GeometryOperationNotSupportedException,
|
|
668 |
GeometryOperationException;
|
|
640 |
public boolean intersects(Geometry geometry)
|
|
641 |
throws GeometryOperationNotSupportedException,
|
|
642 |
GeometryOperationException;
|
|
669 | 643 |
|
670 |
public Geometry union(Geometry other)
|
|
671 |
throws GeometryOperationNotSupportedException,
|
|
672 |
GeometryOperationException;
|
|
644 |
public Geometry snapTo(Geometry other, double snapTolerance)
|
|
645 |
throws GeometryOperationNotSupportedException,
|
|
646 |
GeometryOperationException;
|
|
673 | 647 |
|
674 |
public boolean within(Geometry geometry)
|
|
675 |
throws GeometryOperationNotSupportedException,
|
|
676 |
GeometryOperationException;
|
|
648 |
public boolean touches(Geometry geometry)
|
|
649 |
throws GeometryOperationNotSupportedException,
|
|
650 |
GeometryOperationException;
|
|
677 | 651 |
|
678 |
public Point centroid() throws GeometryOperationNotSupportedException, GeometryOperationException; |
|
652 |
public Geometry union(Geometry other) |
|
653 |
throws GeometryOperationNotSupportedException, |
|
654 |
GeometryOperationException; |
|
679 | 655 |
|
680 |
/** |
|
681 |
* This method returns a point which is inside the geometry. |
|
682 |
* This is useful for mathematical purposes but it is very unlikely |
|
683 |
* to be a suitable place for a label, for example. |
|
684 |
* |
|
685 |
* |
|
686 |
* @return an interior point |
|
687 |
* @throws GeometryOperationNotSupportedException |
|
688 |
* @throws GeometryOperationException |
|
689 |
*/ |
|
690 |
public Point getInteriorPoint() throws GeometryOperationNotSupportedException, GeometryOperationException; |
|
656 |
public boolean within(Geometry geometry) |
|
657 |
throws GeometryOperationNotSupportedException, |
|
658 |
GeometryOperationException; |
|
691 | 659 |
|
692 |
public double area() throws GeometryOperationNotSupportedException, GeometryOperationException;
|
|
660 |
public Point centroid() throws GeometryOperationNotSupportedException, GeometryOperationException;
|
|
693 | 661 |
|
694 |
public double perimeter() throws GeometryOperationNotSupportedException, GeometryOperationException; |
|
662 |
/** |
|
663 |
* This method returns a point which is inside the geometry. This is useful |
|
664 |
* for mathematical purposes but it is very unlikely to be a suitable place |
|
665 |
* for a label, for example. |
|
666 |
* |
|
667 |
* |
|
668 |
* @return an interior point |
|
669 |
* @throws GeometryOperationNotSupportedException |
|
670 |
* @throws GeometryOperationException |
|
671 |
*/ |
|
672 |
public Point getInteriorPoint() throws GeometryOperationNotSupportedException, GeometryOperationException; |
|
695 | 673 |
|
674 |
public double area() throws GeometryOperationNotSupportedException, GeometryOperationException; |
|
696 | 675 |
|
676 |
public double perimeter() throws GeometryOperationNotSupportedException, GeometryOperationException; |
|
697 | 677 |
|
678 |
/** |
|
679 |
* Rotates the geometry by radAngle radians using the given coordinates as |
|
680 |
* center of rotation. Rotating with a positive angle rotates points on the |
|
681 |
* positive x axis toward the positive y axis. In most cases, we assume x |
|
682 |
* increases rightwards and y increases upwards, so in most cases, a |
|
683 |
* positive angle will mean counter-clockwise rotation. |
|
684 |
* |
|
685 |
* @param radAngle the amount of rotation, in radians |
|
686 |
* @param basex x coordinate of center of rotation |
|
687 |
* @param basey y coordinate of center of rotation |
|
688 |
*/ |
|
689 |
public void rotate(double radAngle, double basex, double basey); |
|
698 | 690 |
|
699 |
/** |
|
700 |
* Rotates the geometry by radAngle radians using the given |
|
701 |
* coordinates as center of rotation. Rotating with a positive |
|
702 |
* angle rotates points on the positive x axis toward the |
|
703 |
* positive y axis. In most cases, we assume x increases |
|
704 |
* rightwards and y increases upwards, so in most cases, |
|
705 |
* a positive angle will mean counter-clockwise rotation. |
|
706 |
* |
|
707 |
* @param radAngle the amount of rotation, in radians |
|
708 |
* @param basex x coordinate of center of rotation |
|
709 |
* @param basey y coordinate of center of rotation |
|
710 |
*/ |
|
711 |
public void rotate(double radAngle, double basex, double basey); |
|
691 |
/** |
|
692 |
* Shifts geometry by given amount in x and y axes |
|
693 |
* |
|
694 |
* @param dx |
|
695 |
* @param dy |
|
696 |
*/ |
|
697 |
public void move(double dx, double dy); |
|
712 | 698 |
|
713 |
/** |
|
714 |
* Shifts geometry by given amount in x and y axes |
|
715 |
* |
|
716 |
* @param dx |
|
717 |
* @param dy |
|
718 |
*/ |
|
719 |
public void move(double dx, double dy); |
|
699 |
/** |
|
700 |
* Scales geometry in x and y axes by given scale factors using the given |
|
701 |
* point as center of projection. |
|
702 |
* |
|
703 |
* @param basePoint |
|
704 |
* @param sx scale factor in x axis |
|
705 |
* @param sy scale factor in y axis |
|
706 |
*/ |
|
707 |
public void scale(Point basePoint, double sx, double sy); |
|
720 | 708 |
|
709 |
/** |
|
710 |
* Check if the geometry is valid. |
|
711 |
* |
|
712 |
* @return true if the geometry is valid. |
|
713 |
*/ |
|
714 |
public boolean isValid(); |
|
721 | 715 |
|
722 |
/** |
|
723 |
* Scales geometry in x and y axes by given scale factors |
|
724 |
* using the given point as center of projection. |
|
725 |
* |
|
726 |
* @param basePoint |
|
727 |
* @param sx scale factor in x axis |
|
728 |
* @param sy scale factor in y axis |
|
729 |
*/ |
|
730 |
public void scale(Point basePoint, double sx, double sy); |
|
716 |
/** |
|
717 |
* Check if the geometry is valid and returns the validation status. |
|
718 |
* |
|
719 |
* @return the ValidationStatus |
|
720 |
*/ |
|
721 |
public ValidationStatus getValidationStatus(); |
|
731 | 722 |
|
732 |
/** |
|
733 |
* Check if the geometry is valid. |
|
734 |
* |
|
735 |
* @return true if the geometry is valid. |
|
736 |
*/ |
|
737 |
public boolean isValid(); |
|
723 |
/** |
|
724 |
* Try to fix the geometry and return the new geometry. If the geometry is |
|
725 |
* valid return the same geometry. If the geometry is corrupt or can't fix |
|
726 |
* it, return null. |
|
727 |
* |
|
728 |
* @return the new fixed geometry |
|
729 |
*/ |
|
730 |
public Geometry makeValid(); |
|
738 | 731 |
|
739 |
/** |
|
740 |
* Check if the geometry is valid and returns the validation status. |
|
741 |
* |
|
742 |
* @return the ValidationStatus |
|
743 |
*/ |
|
744 |
public ValidationStatus getValidationStatus(); |
|
732 |
// |
|
733 |
// =============================================== |
|
734 |
// |
|
735 |
/** |
|
736 |
* @return the awt shape used to display the geometry. It applies a |
|
737 |
* tranformation before to return the coordinates of the shape |
|
738 |
* @deprecated this class inherits of {@link Shape} by historical reasons. |
|
739 |
* This method has been added just to control the usage of the {@link Shape} |
|
740 |
* class but it will removed in a future. |
|
741 |
*/ |
|
742 |
public Shape getShape(AffineTransform affineTransform); |
|
745 | 743 |
|
746 |
/** |
|
747 |
* Try to fix the geometry and return the new geometry. |
|
748 |
* If the geometry is valid return the same geometry. |
|
749 |
* If the geometry is corrupt or can't fix it, return null. |
|
750 |
* |
|
751 |
* @return the new fixed geometry |
|
752 |
*/ |
|
753 |
public Geometry makeValid(); |
|
744 |
/** |
|
745 |
* @return the awt shape used to display the geometry. |
|
746 |
* @deprecated this class inherits of {@link Shape} by historical reasons. |
|
747 |
* This method has been added just to control the usage of the {@link Shape} |
|
748 |
* class but it will removed in a future. |
|
749 |
*/ |
|
750 |
public Shape getShape(); |
|
754 | 751 |
|
755 |
// |
|
756 |
// =============================================== |
|
757 |
// |
|
752 |
/** |
|
753 |
* Returns this geometry's boundary rectangle. |
|
754 |
* |
|
755 |
* @deprecated use getEnvelope. |
|
756 |
* @return Boundary rectangle. |
|
757 |
*/ |
|
758 |
public Rectangle2D getBounds2D(); |
|
758 | 759 |
|
760 |
/** |
|
761 |
* If applies an affine transformation and returns the GeneralPathXIterator |
|
762 |
* with this geometry's information. |
|
763 |
* |
|
764 |
* @param at The transformation to apply. |
|
765 |
* @return The GeneralPathXIterator with this geometry's information. |
|
766 |
* @deprecated don't use PathIterator over geometries, use instead specific |
|
767 |
* API for each operation. If not has API for that operation let the project |
|
768 |
* team. |
|
769 |
* |
|
770 |
*/ |
|
771 |
public PathIterator getPathIterator(AffineTransform at); |
|
759 | 772 |
|
760 |
/** |
|
761 |
* @return the awt shape used to display the geometry. It |
|
762 |
* applies a tranformation before to return the coordinates |
|
763 |
* of the shape |
|
764 |
* @deprecated this class inherits of {@link Shape} by historical |
|
765 |
* reasons. This method has been added just to control the usage of |
|
766 |
* the {@link Shape} class but it will removed in a future. |
|
773 |
/** |
|
774 |
* It returns the handlers of the geometry, these they can be of two types |
|
775 |
* is straightening and of selection. |
|
776 |
* |
|
777 |
* @param type Type of handlers. |
|
778 |
* |
|
779 |
* @deprecated don't use Handlers over geometries, use instead specific API |
|
780 |
* for each operation. If not has API for that operation let the project |
|
781 |
* team. |
|
782 |
* @return The handlers. |
|
767 | 783 |
*/ |
768 |
public Shape getShape(AffineTransform affineTransform);
|
|
784 |
public Handler[] getHandlers(int type);
|
|
769 | 785 |
|
770 |
/** |
|
771 |
* @return the awt shape used to display the geometry. |
|
772 |
* @deprecated this class inherits of {@link Shape} by historical |
|
773 |
* reasons. This method has been added just to control the usage of |
|
774 |
* the {@link Shape} class but it will removed in a future. |
|
786 |
/** |
|
787 |
* If applies an affine transformation and returns the GeneralPathXIterator |
|
788 |
* with this geometry's information. |
|
789 |
* |
|
790 |
* @param at The affine transformation. |
|
791 |
* @param flatness |
|
792 |
* |
|
793 |
* @return The GeneralPathXIterator with this geometry's information. |
|
794 |
* @deprecated don't use PathIterator over geometries, use instead specific |
|
795 |
* API for each operation. If not has API for that operation let the project |
|
796 |
* team. |
|
775 | 797 |
*/ |
776 |
public Shape getShape(); |
|
798 |
@Override |
|
799 |
PathIterator getPathIterator(AffineTransform at, double flatness); |
|
777 | 800 |
|
778 |
/** |
|
779 |
* Returns this geometry's boundary rectangle. |
|
780 |
* |
|
781 |
* @deprecated use getEnvelope. |
|
782 |
* @return Boundary rectangle. |
|
783 |
*/ |
|
784 |
public Rectangle2D getBounds2D(); |
|
801 |
/** |
|
802 |
* Useful to have the real shape behind the scenes. May be uses to edit it |
|
803 |
* knowing it it is a Circle, Ellipse, etc. |
|
804 |
* |
|
805 |
* @return The awt shape |
|
806 |
* @deprecated |
|
807 |
*/ |
|
808 |
public Shape getInternalShape(); |
|
785 | 809 |
|
786 |
/** |
|
787 |
* If applies an affine transformation and returns the GeneralPathXIterator |
|
788 |
* with this geometry's information. |
|
789 |
* |
|
790 |
* @param at |
|
791 |
* The transformation to apply. |
|
792 |
* @return The GeneralPathXIterator with this geometry's information. |
|
793 |
* @deprecated don't use PathIterator over geometries, use instead specific API for each operation. If not has API for that operation let the project team. |
|
794 |
* |
|
795 |
*/ |
|
796 |
public PathIterator getPathIterator(AffineTransform at); |
|
810 |
/** |
|
811 |
* Get GeneralPathIterator, to do registered operations to it. |
|
812 |
* |
|
813 |
* @return The GeneralPathX. |
|
814 |
* @deprecated don't use GeneralPathX over geometries, use instead specific |
|
815 |
* API for each operation. If not has API for that operation let the project |
|
816 |
* team. |
|
817 |
*/ |
|
818 |
public GeneralPathX getGeneralPath(); |
|
797 | 819 |
|
798 |
/** |
|
799 |
* It returns the handlers of the geometry, these they can be of two types |
|
800 |
* is straightening and of selection. |
|
801 |
* |
|
802 |
* @param type |
|
803 |
* Type of handlers. |
|
804 |
* |
|
805 |
* @deprecated don't use Handlers over geometries, use instead specific API for each operation. If not has API for that operation let the project team. |
|
806 |
* @return The handlers. |
|
807 |
*/ |
|
808 |
public Handler[] getHandlers(int type); |
|
809 |
|
|
810 |
|
|
811 |
/** |
|
812 |
* If applies an affine transformation and returns the GeneralPathXIterator |
|
813 |
* with this geometry's information. |
|
814 |
* |
|
815 |
* @param at |
|
816 |
* The affine transformation. |
|
817 |
* @param flatness |
|
818 |
* |
|
819 |
* @return The GeneralPathXIterator with this geometry's information. |
|
820 |
* @deprecated don't use PathIterator over geometries, use instead specific API for each operation. If not has API for that operation let the project team. |
|
821 |
*/ |
|
822 |
@Override |
|
823 |
PathIterator getPathIterator(AffineTransform at, double flatness); |
|
824 |
|
|
825 |
/** |
|
826 |
* Useful to have the real shape behind the scenes. May be uses to edit it |
|
827 |
* knowing it it is a Circle, Ellipse, etc. |
|
828 |
* |
|
829 |
* @return The awt shape |
|
830 |
* @deprecated |
|
831 |
*/ |
|
832 |
public Shape getInternalShape(); |
|
833 |
|
|
834 |
|
|
835 |
/** |
|
836 |
* Get GeneralPathIterator, to do registered operations to it. |
|
837 |
* |
|
838 |
* @return The GeneralPathX. |
|
839 |
* @deprecated don't use GeneralPathX over geometries, use instead specific API for each operation. If not has API for that operation let the project team. |
|
840 |
*/ |
|
841 |
public GeneralPathX getGeneralPath(); |
|
842 |
|
|
843 |
|
|
844 |
/** |
|
845 |
* Converts the geometry to be points and makes with them a multiPoint |
|
846 |
* |
|
847 |
* @return MultiPoint |
|
848 |
* @throws GeometryException |
|
849 |
*/ |
|
820 |
/** |
|
821 |
* Converts the geometry to be points and makes with them a multiPoint |
|
822 |
* |
|
823 |
* @return MultiPoint |
|
824 |
* @throws GeometryException |
|
825 |
*/ |
|
850 | 826 |
public MultiPoint toPoints() throws GeometryException; |
851 | 827 |
|
852 | 828 |
/** |
853 | 829 |
* Converts the geometry to be lines and makes with them a multiLine |
830 |
* |
|
854 | 831 |
* @return |
855 | 832 |
* @throws GeometryException |
856 | 833 |
*/ |
... | ... | |
858 | 835 |
|
859 | 836 |
/** |
860 | 837 |
* Converts the geometry to be polygons and makes with them a multiPolygon |
838 |
* |
|
861 | 839 |
* @return |
862 | 840 |
* @throws GeometryException |
863 | 841 |
*/ |
864 | 842 |
public MultiPolygon toPolygons() throws GeometryException; |
865 | 843 |
|
866 | 844 |
/** |
867 |
* Flip the coordinates of the geometry. |
|
868 |
* If the geometry is aggregate also revert the primitives collection.
|
|
845 |
* Flip the coordinates of the geometry. If the geometry is aggregate also
|
|
846 |
* revert the primitives collection. |
|
869 | 847 |
* |
870 | 848 |
* @throws GeometryOperationNotSupportedException |
871 | 849 |
* @throws GeometryOperationException |
... | ... | |
873 | 851 |
public void flip() throws GeometryOperationNotSupportedException, GeometryOperationException; |
874 | 852 |
|
875 | 853 |
/** |
876 |
* Ensures the orientation of the geometry according to the parameter, flipping it if necessary. |
|
877 |
* If the geometry is a polygon, ensures the orientation of its perimeter |
|
878 |
* and ensures the opposite orientation of their holes. |
|
854 |
* Ensures the orientation of the geometry according to the parameter, |
|
855 |
* flipping it if necessary. If the geometry is a polygon, ensures the |
|
856 |
* orientation of its perimeter and ensures the opposite orientation of |
|
857 |
* their holes. |
|
879 | 858 |
* |
880 | 859 |
* @param ccw |
881 | 860 |
* @return |
... | ... | |
885 | 864 |
public boolean ensureOrientation(boolean ccw) throws GeometryOperationNotSupportedException, GeometryOperationException; |
886 | 865 |
|
887 | 866 |
/** |
888 |
* Returns true if passed as a parameter geometry is completely out of geometry. |
|
867 |
* Returns true if passed as a parameter geometry is completely out of |
|
868 |
* geometry. |
|
889 | 869 |
* |
890 | 870 |
* @param geometry |
891 | 871 |
* @return |
... | ... | |
903 | 883 |
public boolean canBeTransformed(AffineTransform at); |
904 | 884 |
|
905 | 885 |
/** |
906 |
* Return true if the geometry can be reprojected by the coordinate transformation |
|
886 |
* Return true if the geometry can be reprojected by the coordinate |
|
887 |
* transformation |
|
907 | 888 |
* |
908 | 889 |
* @param ct the coordinate transformation |
909 | 890 |
* @return |
... | ... | |
911 | 892 |
public boolean canBeReprojected(ICoordTrans ct); |
912 | 893 |
|
913 | 894 |
public void setProjection(IProjection projection); |
914 |
|
|
895 |
|
|
915 | 896 |
public void setProjectionIffNull(IProjection projection); |
916 | 897 |
|
917 | 898 |
public IProjection getProjection(); |
Also available in: Unified diff