root / trunk / libraries / libFMap_geometries / src / org / gvsig / fmap / geom / Geometry.java @ 20895
History | View | Annotate | Download (5.88 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.type.GeometryType; |
55 |
|
56 |
|
57 |
/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
|
58 |
*
|
59 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
60 |
*
|
61 |
* This program is free software; you can redistribute it and/or
|
62 |
* modify it under the terms of the GNU General Public License
|
63 |
* as published by the Free Software Foundation; either version 2
|
64 |
* of the License, or (at your option) any later version.
|
65 |
*
|
66 |
* This program is distributed in the hope that it will be useful,
|
67 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
68 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
69 |
* GNU General Public License for more details.
|
70 |
*
|
71 |
* You should have received a copy of the GNU General Public License
|
72 |
* along with this program; if not, write to the Free Software
|
73 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
74 |
*
|
75 |
* For more information, contact:
|
76 |
*
|
77 |
* Generalitat Valenciana
|
78 |
* Conselleria d'Infraestructures i Transport
|
79 |
* Av. Blasco Ib��ez, 50
|
80 |
* 46010 VALENCIA
|
81 |
* SPAIN
|
82 |
*
|
83 |
* +34 963862235
|
84 |
* gvsig@gva.es
|
85 |
* www.gvsig.gva.es
|
86 |
*
|
87 |
* or
|
88 |
*
|
89 |
* IVER T.I. S.A
|
90 |
* Salamanca 50
|
91 |
* 46005 Valencia
|
92 |
* Spain
|
93 |
*
|
94 |
* +34 963163400
|
95 |
* dac@iver.es
|
96 |
*/
|
97 |
|
98 |
/**
|
99 |
* Interfaz de Geometr�a.
|
100 |
*
|
101 |
* @author $author$
|
102 |
*/
|
103 |
public interface Geometry extends Shape, Serializable { |
104 |
|
105 |
/** Tipo de geometría */
|
106 |
public final static int GEOM_TYPE = 0; |
107 |
|
108 |
public static int BEST = 0; |
109 |
public static int N = 1; |
110 |
public static int NE = 2; |
111 |
public static int E = 3; |
112 |
public static int SE = 4; |
113 |
public static int S = 5; |
114 |
public static int SW = 6; |
115 |
public static int W = 7; |
116 |
public static int NW = 8; |
117 |
|
118 |
public static int SELECTHANDLER=0; |
119 |
public static int STRETCHINGHANDLER=1; |
120 |
|
121 |
/**
|
122 |
* Transforma esta Shape en un Geometry de JTS
|
123 |
*
|
124 |
* @return Geometr�a.
|
125 |
*/
|
126 |
public com.vividsolutions.jts.geom.Geometry toJTSGeometry();
|
127 |
|
128 |
/**
|
129 |
* Obtiene el tipo de la geometr�a
|
130 |
*
|
131 |
* @return una de las constantes de FShape: POINT, LINE, POLIGON
|
132 |
* @deprecated
|
133 |
*/
|
134 |
public int getShapeType(); |
135 |
|
136 |
/**
|
137 |
* Devuelve el valor de la cte del tipo de geometría. Este tipo se define en las interfaces
|
138 |
* mediante GEOM_TYPE
|
139 |
*
|
140 |
* Point.GEOM_TYPE
|
141 |
*
|
142 |
* @return
|
143 |
*/
|
144 |
public int getGeomTypeAsInt(); |
145 |
|
146 |
/**
|
147 |
* Clona la Geometr�a.
|
148 |
*
|
149 |
* @return Geometr�a clonada.
|
150 |
*/
|
151 |
public Geometry cloneGeometry();
|
152 |
|
153 |
/**
|
154 |
* Devuelve true si la geometr�a intersecta con el rect�ngulo que se pasa
|
155 |
* como par�metro.
|
156 |
*
|
157 |
* @param r Rect�ngulo.
|
158 |
*
|
159 |
* @return True, si intersecta.
|
160 |
*/
|
161 |
public boolean intersects(Rectangle2D r); |
162 |
/**
|
163 |
* Devuelve true si la geometr�a contiene al rect�ngulo que se pasa
|
164 |
* como par�metro.
|
165 |
*
|
166 |
* @param r Rect�ngulo.
|
167 |
*
|
168 |
* @return True, si intersecta.
|
169 |
*/
|
170 |
//boolean contains(IGeometry g);
|
171 |
|
172 |
/**
|
173 |
* Se usa en las strategies de dibujo para comprobar de manera r�pida
|
174 |
* si intersecta con el rect�ngulo visible
|
175 |
* @param x
|
176 |
* @param y
|
177 |
* @param w
|
178 |
* @param h
|
179 |
* @return
|
180 |
*/
|
181 |
public boolean fastIntersects(double x, double y, double w, double h); |
182 |
|
183 |
/**
|
184 |
* Devuelve el Rect�ngulo que ocupa la geometr�a.
|
185 |
*
|
186 |
* @return Rect�ngulo.
|
187 |
*/
|
188 |
public Rectangle2D getBounds2D(); |
189 |
|
190 |
/**
|
191 |
* Reproyecta la geometr�a a partir del transformador de coordenadas.
|
192 |
*
|
193 |
* @param ct Coordinate Transformer.
|
194 |
*/
|
195 |
public void reProject(ICoordTrans ct); |
196 |
|
197 |
/**
|
198 |
* Devuelve el GeneralPathXIterator con la informaci�n relativa a la geometr�a.
|
199 |
* @param at TODO
|
200 |
*
|
201 |
* @return PathIterator.
|
202 |
*/
|
203 |
public PathIterator getPathIterator(AffineTransform at); |
204 |
|
205 |
//public byte[] toWKB() throws IOException;
|
206 |
/**
|
207 |
* It returns the handlers of the geomety,
|
208 |
* these they can be of two types is straightening and of seleccion.
|
209 |
*
|
210 |
* @param type Type of handlers
|
211 |
*
|
212 |
* @return Handlers.
|
213 |
*/
|
214 |
public Handler[] getHandlers(int type); |
215 |
|
216 |
public void transform(AffineTransform at); |
217 |
|
218 |
PathIterator getPathIterator(AffineTransform at, double flatness); |
219 |
|
220 |
/**
|
221 |
* Useful to have the real shape behind the scenes.
|
222 |
* May be uses to edit it knowing it it is a Circle, Ellipse, etc
|
223 |
* @return
|
224 |
*/
|
225 |
public Shape getInternalShape(); |
226 |
|
227 |
public int getCoordinateDimension(); |
228 |
|
229 |
public boolean isSimple(); |
230 |
|
231 |
/**
|
232 |
* @param index
|
233 |
* @return
|
234 |
*/
|
235 |
public Object invokeOperation(int index, GeometryOperationContext ctx) throws GeometryOperationException; |
236 |
|
237 |
public GeometryType getGeometryType();
|
238 |
|
239 |
} |