svn-gvsig-desktop / tags / v1_0_2_Build_897 / libraries / libFMap / src / com / iver / cit / gvsig / fmap / core / IGeometry.java @ 10444
History | View | Annotate | Download (5.83 KB)
1 | 1100 | fjp | /* 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 | 305 | fjp | package com.iver.cit.gvsig.fmap.core; |
42 | |||
43 | 2183 | fernando | import java.awt.Graphics2D; |
44 | 4879 | fjp | import java.awt.Shape; |
45 | 3904 | fjp | import java.awt.geom.AffineTransform; |
46 | 4799 | fjp | import java.awt.geom.PathIterator; |
47 | 2183 | fernando | import java.awt.geom.Rectangle2D; |
48 | import java.io.IOException; |
||
49 | import java.io.Serializable; |
||
50 | |||
51 | import org.cresques.cts.ICoordTrans; |
||
52 | |||
53 | 324 | fernando | import com.iver.cit.gvsig.fmap.ViewPort; |
54 | 757 | fjp | import com.iver.cit.gvsig.fmap.core.v02.FLabel; |
55 | 324 | fernando | import com.iver.cit.gvsig.fmap.rendering.FStyledShapePainter; |
56 | import com.iver.cit.gvsig.fmap.rendering.styling.FStyle2D; |
||
57 | 703 | fjp | import com.vividsolutions.jts.geom.Geometry; |
58 | 305 | fjp | |
59 | |||
60 | /**
|
||
61 | 1005 | vcaballero | * Interfaz de Geometr?a.
|
62 | 305 | fjp | *
|
63 | * @author $author$
|
||
64 | */
|
||
65 | 4879 | fjp | public interface IGeometry extends Shape, Serializable { |
66 | 1005 | vcaballero | 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 | 3833 | caballero | |
76 | public static int SELECTHANDLER=0; |
||
77 | public static int STRETCHINGHANDLER=1; |
||
78 | 757 | fjp | public final static FStyledShapePainter shpPainter = new FStyledShapePainter(); |
79 | |||
80 | 1005 | vcaballero | /**
|
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 | 305 | fjp | |
94 | 1005 | vcaballero | /**
|
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 | 8765 | jjdelcerro | void draw(Graphics2D g, ViewPort vp, ISymbol symbol); |
102 | 324 | fernando | |
103 | 2859 | fjp | /**
|
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 | 8765 | jjdelcerro | void drawInts(Graphics2D g, ViewPort vp, ISymbol symbol); |
112 | 1005 | vcaballero | /**
|
113 | * Transforma esta Shape en un Geometry de JTS
|
||
114 | *
|
||
115 | * @return Geometr?a.
|
||
116 | */
|
||
117 | Geometry toJTSGeometry(); |
||
118 | 324 | fernando | |
119 | 1005 | vcaballero | /**
|
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 | 3562 | fjp | * @param position TODO: POR AHORA NO SE HACE CASO A ESTO
|
126 | * @param duplicates TODO: POR AHORA NO SE HACE CASO A ESTO
|
||
127 | 1005 | vcaballero | *
|
128 | * @return DOCUMENT ME!
|
||
129 | */
|
||
130 | FLabel[] createLabels(int position, boolean duplicates); |
||
131 | 324 | fernando | |
132 | 1005 | vcaballero | /**
|
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 | 5880 | fjp | |
139 | 1005 | vcaballero | /**
|
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 | 4711 | caballero | /**
|
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 | 4717 | caballero | //boolean contains(IGeometry g);
|
164 | 3833 | caballero | |
165 | 1298 | fjp | /**
|
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 | 1005 | vcaballero | |
176 | /**
|
||
177 | * Devuelve el Rect?ngulo que ocupa la geometr?a.
|
||
178 | *
|
||
179 | * @return Rect?ngulo.
|
||
180 | */
|
||
181 | Rectangle2D getBounds2D();
|
||
182 | |||
183 | /**
|
||
184 | 4863 | fjp | * Reproyecta la geometr?a a partir del transformador de coordenadas.
|
185 | 1005 | vcaballero | *
|
186 | 4863 | fjp | * @param ct Coordinate Transformer.
|
187 | 1005 | vcaballero | */
|
188 | void reProject(ICoordTrans ct);
|
||
189 | 1132 | vcaballero | |
190 | /**
|
||
191 | * Devuelve el GeneralPathXIterator con la informaci?n relativa a la geometr?a.
|
||
192 | 4879 | fjp | * @param at TODO
|
193 | 1132 | vcaballero | *
|
194 | 4879 | fjp | * @return PathIterator.
|
195 | 1132 | vcaballero | */
|
196 | 4879 | fjp | PathIterator getPathIterator(AffineTransform at); |
197 | 2183 | fernando | |
198 | public byte[] toWKB() throws IOException; |
||
199 | 3833 | caballero | /**
|
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 | 4711 | caballero | |
209 | 3904 | fjp | public void transform(AffineTransform at); |
210 | 4711 | caballero | |
211 | 4879 | fjp | PathIterator getPathIterator(AffineTransform at, double flatness); |
212 | 5880 | fjp | |
213 | 5008 | fjp | /**
|
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 | 4799 | fjp | |
220 | 4717 | caballero | //boolean intersects(IGeometry geom);
|
221 | 305 | fjp | } |