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