svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libFMap_geometries / src / org / gvsig / fmap / geom / Geometry.java @ 21047
History | View | Annotate | Download (6.96 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*
|
19 |
* For more information, contact:
|
20 |
*
|
21 |
* Generalitat Valenciana
|
22 |
* Conselleria d'Infraestructures i Transport
|
23 |
* Av. Blasco Ib??ez, 50
|
24 |
* 46010 VALENCIA
|
25 |
* SPAIN
|
26 |
*
|
27 |
* +34 963862235
|
28 |
* gvsig@gva.es
|
29 |
* www.gvsig.gva.es
|
30 |
*
|
31 |
* or
|
32 |
*
|
33 |
* IVER T.I. S.A
|
34 |
* Salamanca 50
|
35 |
* 46005 Valencia
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 963163400
|
39 |
* dac@iver.es
|
40 |
*/
|
41 |
package org.gvsig.fmap.geom; |
42 |
|
43 |
|
44 |
import java.awt.Shape; |
45 |
import java.awt.geom.AffineTransform; |
46 |
import java.awt.geom.PathIterator; |
47 |
import java.awt.geom.Rectangle2D; |
48 |
import java.io.Serializable; |
49 |
|
50 |
import org.cresques.cts.ICoordTrans; |
51 |
import org.gvsig.fmap.geom.handler.Handler; |
52 |
import org.gvsig.fmap.geom.operation.GeometryOperationContext; |
53 |
import org.gvsig.fmap.geom.operation.GeometryOperationException; |
54 |
import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException; |
55 |
import org.gvsig.fmap.geom.type.GeometryType; |
56 |
|
57 |
/**
|
58 |
* Root interface in the geometry model.
|
59 |
*/
|
60 |
public interface Geometry extends Shape, Serializable { |
61 |
|
62 |
/**
|
63 |
* Predefined geometry types in the model
|
64 |
*/
|
65 |
public interface TYPES { |
66 |
/**
|
67 |
* Unknown or not defined type.
|
68 |
*/
|
69 |
public final static int NULL = 0; |
70 |
/**
|
71 |
* A geometric element that has zero dimensions and a location determinable by an ordered set
|
72 |
* of coordinates
|
73 |
*/
|
74 |
public final static int POINT = 1; |
75 |
/**
|
76 |
* A straight or curved geometric element that is generated by a moving point and that has extension
|
77 |
* only along the path of the point.
|
78 |
*/
|
79 |
public final static int CURVE = 2; |
80 |
/**
|
81 |
* A closed plane figure bounded by straight lines.
|
82 |
*/
|
83 |
public final static int SURFACE = 4; |
84 |
/**
|
85 |
* Solids in 3D
|
86 |
*/
|
87 |
public final static int SOLID = 8; |
88 |
/**
|
89 |
* Words, symbols and form of a written or printed work.
|
90 |
*/
|
91 |
public final static int TEXT = 16; |
92 |
/**
|
93 |
* A set that can contain points, lines and polygons. This is usual in <i>CAD</i> layers <i>(dxf, dgn, dwg)</i>.
|
94 |
*/
|
95 |
public final static int AGGREGATE = 32; |
96 |
/**
|
97 |
* A set of points.
|
98 |
*/
|
99 |
public final static int MULTIPOINT = 64; |
100 |
/**
|
101 |
* A set of lines.
|
102 |
*/
|
103 |
public final static int MULTICURVE = 128; |
104 |
/**
|
105 |
* A set of polygons.
|
106 |
*/
|
107 |
public final static int MULTISURFACE = 256; |
108 |
/**
|
109 |
* A set of solids.
|
110 |
*/
|
111 |
public final static int MULTISOLID = 512; |
112 |
/**
|
113 |
* A closed plane curve every point of which is equidistant from a fixed point within the curve.
|
114 |
*/
|
115 |
public final static int CIRCLE = 1024; |
116 |
/**
|
117 |
* A continuous portion (as of a circle or ellipse) of a curved line.
|
118 |
*/
|
119 |
public final static int ARC = 2048; |
120 |
/**
|
121 |
* A closed plane curve generated by a point moving in such a way that the sums of its distances
|
122 |
* from two fixed points is a constant : a plane section of a right circular cone that is a closed
|
123 |
* curve.
|
124 |
*
|
125 |
*/
|
126 |
public final static int ELLIPSE=4096; |
127 |
/**
|
128 |
* Indicates third coordinate. And can be combined with other geometries via the bits enabled.
|
129 |
*/
|
130 |
public final static int Z=8192; |
131 |
} |
132 |
|
133 |
public static int BEST = 0; |
134 |
public static int N = 1; |
135 |
public static int NE = 2; |
136 |
public static int E = 3; |
137 |
public static int SE = 4; |
138 |
public static int S = 5; |
139 |
public static int SW = 6; |
140 |
public static int W = 7; |
141 |
public static int NW = 8; |
142 |
|
143 |
public static int SELECTHANDLER=0; |
144 |
public static int STRETCHINGHANDLER=1; |
145 |
|
146 |
/**
|
147 |
* Returns the FShape type of the geometry.
|
148 |
*
|
149 |
* @return One FShape constant: {@link FShape}
|
150 |
* @deprecated Use {@link getType} instead
|
151 |
*/
|
152 |
public int getShapeType(); |
153 |
|
154 |
/**
|
155 |
* If this geometry is a predefined interface then this method returns one of {@link Geometry.TYPES} contants.<br>
|
156 |
* If this geometry is an extended type then this method returns a runtime constant that identifies its type.
|
157 |
* By convention this value is stored in a constant called GEOM_TYPE within the geometry class, for instance: Point2D.GEOM_TYPE.
|
158 |
*
|
159 |
* @return If this geometry is a predefined interface then one of {@link Geometry.TYPES} or a runtime constant if
|
160 |
* it is an extended type.
|
161 |
*/
|
162 |
public int getType(); |
163 |
|
164 |
/**
|
165 |
* Creates a clone of this geometry
|
166 |
*
|
167 |
* @return A clone of this geometry.
|
168 |
*/
|
169 |
public Geometry cloneGeometry();
|
170 |
|
171 |
/**
|
172 |
* Returns true if this geometry intersects the rectangle passed as parameter
|
173 |
*
|
174 |
* @param r Rectangle.
|
175 |
*
|
176 |
* @return True, if <code>this</code> intersects <code>r</code>.
|
177 |
*/
|
178 |
public boolean intersects(Rectangle2D r); |
179 |
|
180 |
/**
|
181 |
* Used by the drawing strategies to quickly test whether this geometry
|
182 |
* intersects with the visible rectangle.
|
183 |
*
|
184 |
* @param x
|
185 |
* @param y
|
186 |
* @param w Width
|
187 |
* @param h Height
|
188 |
* @return true if <code>this</code> intersects the rectangle defined by the parameters
|
189 |
*/
|
190 |
public boolean fastIntersects(double x, double y, double w, double h); |
191 |
|
192 |
/**
|
193 |
* Returns this geometry's boundary rectangle.
|
194 |
*
|
195 |
* @return Boundary rectangle.
|
196 |
*/
|
197 |
public Rectangle2D getBounds2D(); |
198 |
|
199 |
/**
|
200 |
* Reprojects this geometry by the coordinate transformer passed as parameter.
|
201 |
*
|
202 |
* @param ct Coordinate Transformer.
|
203 |
*/
|
204 |
public void reProject(ICoordTrans ct); |
205 |
|
206 |
/**
|
207 |
* Returns the GeneralPathXIterator with this geometry's information
|
208 |
* @param at AffineTransform
|
209 |
*
|
210 |
* @return PathIterator.
|
211 |
*/
|
212 |
public PathIterator getPathIterator(AffineTransform at); |
213 |
|
214 |
/**
|
215 |
* It returns the handlers of the geometry,
|
216 |
* these they can be of two types is straightening and of selection.
|
217 |
*
|
218 |
* @param type Type of handlers
|
219 |
*
|
220 |
* @return Handlers.
|
221 |
*/
|
222 |
public Handler[] getHandlers(int type); |
223 |
|
224 |
public void transform(AffineTransform at); |
225 |
|
226 |
PathIterator getPathIterator(AffineTransform at, double flatness); |
227 |
|
228 |
/**
|
229 |
* Useful to have the real shape behind the scenes.
|
230 |
* May be uses to edit it knowing it it is a Circle, Ellipse, etc
|
231 |
* @return
|
232 |
*/
|
233 |
public Shape getInternalShape(); |
234 |
|
235 |
public int getCoordinateDimension(); |
236 |
|
237 |
public boolean isSimple(); |
238 |
|
239 |
/**
|
240 |
* Invokes a geometry operation given its index and context
|
241 |
* @param index unique index of the operation. Operation code.
|
242 |
* @return object returned by the operation.
|
243 |
*/
|
244 |
public Object invokeOperation(int index, GeometryOperationContext ctx) throws GeometryOperationNotSupportedException, GeometryOperationException; |
245 |
|
246 |
/**
|
247 |
* Instance of the GeometryType associated to this geometry
|
248 |
* @return
|
249 |
*/
|
250 |
public GeometryType getGeometryType();
|
251 |
|
252 |
} |