svn-gvsig-desktop / tags / v1_0_2_Build_894 / libraries / libFMap / src / com / iver / cit / gvsig / fmap / core / IGeometry.java @ 10309
History | View | Annotate | Download (5.83 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 com.iver.cit.gvsig.fmap.core; |
42 |
|
43 |
import java.awt.Graphics2D; |
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.IOException; |
49 |
import java.io.Serializable; |
50 |
|
51 |
import org.cresques.cts.ICoordTrans; |
52 |
|
53 |
import com.iver.cit.gvsig.fmap.ViewPort; |
54 |
import com.iver.cit.gvsig.fmap.core.v02.FLabel; |
55 |
import com.iver.cit.gvsig.fmap.rendering.FStyledShapePainter; |
56 |
import com.iver.cit.gvsig.fmap.rendering.styling.FStyle2D; |
57 |
import com.vividsolutions.jts.geom.Geometry; |
58 |
|
59 |
|
60 |
/**
|
61 |
* Interfaz de Geometr?a.
|
62 |
*
|
63 |
* @author $author$
|
64 |
*/
|
65 |
public interface IGeometry extends Shape, Serializable { |
66 |
public static int BEST = 0; |
67 |
public static int N = 1; |
68 |
public static int NE = 2; |
69 |
public static int E = 3; |
70 |
public static int SE = 4; |
71 |
public static int S = 5; |
72 |
public static int SW = 6; |
73 |
public static int W = 7; |
74 |
public static int NW = 8; |
75 |
|
76 |
public static int SELECTHANDLER=0; |
77 |
public static int STRETCHINGHANDLER=1; |
78 |
public final static FStyledShapePainter shpPainter = new FStyledShapePainter(); |
79 |
|
80 |
/**
|
81 |
* Dibujar? esta Shape en el Graphics con el s?mbolo que se pasa como
|
82 |
* par?metro y despues de aplicarle la transformaci?n que se pasa tambi?n
|
83 |
* como par?metro. El parametro image que recibe es la imagen de la cual
|
84 |
* se obtuvo el graphics que tambi?n se pasa como par?metro. Dibujar? la
|
85 |
* geometria en caso de que la IGeometry intersecte o est? contenida en el
|
86 |
* rect?ngulo que se pasa como par?metro
|
87 |
*
|
88 |
* @param g DOCUMENT ME!
|
89 |
* @param vp TODO
|
90 |
* @param symbol DOCUMENT ME!
|
91 |
*/
|
92 |
void draw(Graphics2D g, ViewPort vp, FStyle2D symbol); |
93 |
|
94 |
/**
|
95 |
* Dibuja la geometr?a sobre el Graphics2D que se pasa como par?metro.
|
96 |
*
|
97 |
* @param g Graphics2D.
|
98 |
* @param vp ViewPort.
|
99 |
* @param symbol S?mbolo.
|
100 |
*/
|
101 |
void draw(Graphics2D g, ViewPort vp, ISymbol symbol); |
102 |
|
103 |
/**
|
104 |
* You can use this function if you are going to draw into
|
105 |
* a bitmap. (With ints coords). It will do a decimation,
|
106 |
* drawing a shape with less coords (faster draw)
|
107 |
* @param g
|
108 |
* @param vp
|
109 |
* @param symbol
|
110 |
*/
|
111 |
void drawInts(Graphics2D g, ViewPort vp, ISymbol symbol); |
112 |
/**
|
113 |
* Transforma esta Shape en un Geometry de JTS
|
114 |
*
|
115 |
* @return Geometr?a.
|
116 |
*/
|
117 |
Geometry toJTSGeometry(); |
118 |
|
119 |
/**
|
120 |
* Obtiene las posiciones donde se debe situar la etiqueta para esta
|
121 |
* IGeometry. Es un array porque si una geometria es un multipunto por
|
122 |
* ejemplo puede quererse etiquetar todos sus puntos. El par?metro que se
|
123 |
* pasa indica como debe de colocar la geometria la etiqueta
|
124 |
*
|
125 |
* @param position TODO: POR AHORA NO SE HACE CASO A ESTO
|
126 |
* @param duplicates TODO: POR AHORA NO SE HACE CASO A ESTO
|
127 |
*
|
128 |
* @return DOCUMENT ME!
|
129 |
*/
|
130 |
FLabel[] createLabels(int position, boolean duplicates); |
131 |
|
132 |
/**
|
133 |
* Obtiene el tipo de la geometr?a
|
134 |
*
|
135 |
* @return una de las constantes de FShape: POINT, LINE, POLIGON
|
136 |
*/
|
137 |
int getGeometryType();
|
138 |
|
139 |
/**
|
140 |
* Clona la Geometr?a.
|
141 |
*
|
142 |
* @return Geometr?a clonada.
|
143 |
*/
|
144 |
IGeometry cloneGeometry(); |
145 |
|
146 |
/**
|
147 |
* Devuelve true si la geometr?a intersecta con el rect?ngulo que se pasa
|
148 |
* como par?metro.
|
149 |
*
|
150 |
* @param r Rect?ngulo.
|
151 |
*
|
152 |
* @return True, si intersecta.
|
153 |
*/
|
154 |
boolean intersects(Rectangle2D r); |
155 |
/**
|
156 |
* Devuelve true si la geometr?a contiene al rect?ngulo que se pasa
|
157 |
* como par?metro.
|
158 |
*
|
159 |
* @param r Rect?ngulo.
|
160 |
*
|
161 |
* @return True, si intersecta.
|
162 |
*/
|
163 |
//boolean contains(IGeometry g);
|
164 |
|
165 |
/**
|
166 |
* Se usa en las strategies de dibujo para comprobar de manera r?pida
|
167 |
* si intersecta con el rect?ngulo visible
|
168 |
* @param x
|
169 |
* @param y
|
170 |
* @param w
|
171 |
* @param h
|
172 |
* @return
|
173 |
*/
|
174 |
public boolean fastIntersects(double x, double y, double w, double h); |
175 |
|
176 |
/**
|
177 |
* Devuelve el Rect?ngulo que ocupa la geometr?a.
|
178 |
*
|
179 |
* @return Rect?ngulo.
|
180 |
*/
|
181 |
Rectangle2D getBounds2D();
|
182 |
|
183 |
/**
|
184 |
* Reproyecta la geometr?a a partir del transformador de coordenadas.
|
185 |
*
|
186 |
* @param ct Coordinate Transformer.
|
187 |
*/
|
188 |
void reProject(ICoordTrans ct);
|
189 |
|
190 |
/**
|
191 |
* Devuelve el GeneralPathXIterator con la informaci?n relativa a la geometr?a.
|
192 |
* @param at TODO
|
193 |
*
|
194 |
* @return PathIterator.
|
195 |
*/
|
196 |
PathIterator getPathIterator(AffineTransform at); |
197 |
|
198 |
public byte[] toWKB() throws IOException; |
199 |
/**
|
200 |
* It returns the handlers of the geomety,
|
201 |
* these they can be of two types is straightening and of seleccion.
|
202 |
*
|
203 |
* @param type Type of handlers
|
204 |
*
|
205 |
* @return Handlers.
|
206 |
*/
|
207 |
public Handler[] getHandlers(int type); |
208 |
|
209 |
public void transform(AffineTransform at); |
210 |
|
211 |
PathIterator getPathIterator(AffineTransform at, double flatness); |
212 |
|
213 |
/**
|
214 |
* Useful to have the real shape behind the scenes.
|
215 |
* May be uses to edit it knowing it it is a Circle, Ellipse, etc
|
216 |
* @return
|
217 |
*/
|
218 |
Shape getInternalShape();
|
219 |
|
220 |
//boolean intersects(IGeometry geom);
|
221 |
} |