root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / project / documents / layout / fframes / IFFrame.java @ 7304
History | View | Annotate | Download (9.46 KB)
1 |
/*
|
---|---|
2 |
* Created on 20-feb-2004
|
3 |
*
|
4 |
*/
|
5 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
6 |
*
|
7 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
8 |
*
|
9 |
* This program is free software; you can redistribute it and/or
|
10 |
* modify it under the terms of the GNU General Public License
|
11 |
* as published by the Free Software Foundation; either version 2
|
12 |
* of the License, or (at your option) any later version.
|
13 |
*
|
14 |
* This program is distributed in the hope that it will be useful,
|
15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
* GNU General Public License for more details.
|
18 |
*
|
19 |
* You should have received a copy of the GNU General Public License
|
20 |
* along with this program; if not, write to the Free Software
|
21 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
22 |
*
|
23 |
* For more information, contact:
|
24 |
*
|
25 |
* Generalitat Valenciana
|
26 |
* Conselleria d'Infraestructures i Transport
|
27 |
* Av. Blasco Ib??ez, 50
|
28 |
* 46010 VALENCIA
|
29 |
* SPAIN
|
30 |
*
|
31 |
* +34 963862235
|
32 |
* gvsig@gva.es
|
33 |
* www.gvsig.gva.es
|
34 |
*
|
35 |
* or
|
36 |
*
|
37 |
* IVER T.I. S.A
|
38 |
* Salamanca 50
|
39 |
* 46005 Valencia
|
40 |
* Spain
|
41 |
*
|
42 |
* +34 963163400
|
43 |
* dac@iver.es
|
44 |
*/
|
45 |
package com.iver.cit.gvsig.project.documents.layout.fframes; |
46 |
|
47 |
import com.iver.cit.gvsig.fmap.DriverException; |
48 |
import com.iver.cit.gvsig.fmap.layers.XMLException; |
49 |
import com.iver.cit.gvsig.gui.layout.Layout; |
50 |
import com.iver.cit.gvsig.project.documents.exceptions.SaveException; |
51 |
|
52 |
import com.iver.utiles.XMLEntity; |
53 |
|
54 |
import java.awt.Cursor; |
55 |
import java.awt.Graphics2D; |
56 |
import java.awt.event.MouseEvent; |
57 |
import java.awt.geom.AffineTransform; |
58 |
import java.awt.geom.Point2D; |
59 |
import java.awt.geom.Rectangle2D; |
60 |
import java.awt.image.BufferedImage; |
61 |
|
62 |
|
63 |
/**
|
64 |
* Interface que implementa FFrame.
|
65 |
*
|
66 |
* @author Vicente Caballero Navarro
|
67 |
*/
|
68 |
public interface IFFrame { |
69 |
public static final int N = 1; |
70 |
public static final int NE = 2; |
71 |
public static final int E = 3; |
72 |
public static final int SE = 4; |
73 |
public static final int S = 5; |
74 |
public static final int SO = 6; |
75 |
public static final int O = 7; |
76 |
public static final int NO = 8; |
77 |
public static final int RECT = 9; |
78 |
/** FFrame no selecccionado. */
|
79 |
public static final int NOSELECT = 0; |
80 |
|
81 |
/**
|
82 |
* Devuelve el boundingBox del fframe en funci?n de la transformada af?n
|
83 |
* que se pasa como par?metro. Si se pasa como par?metro null, devuelve el
|
84 |
* ?ltimo boundingbox que se calcul?.
|
85 |
*
|
86 |
* @param at Transformada af?n
|
87 |
*
|
88 |
* @return Rect?ngulo que representa el BoundingBox del fframe.
|
89 |
*/
|
90 |
public Rectangle2D.Double getBoundingBox(AffineTransform at); |
91 |
|
92 |
/**
|
93 |
* Devuelve el rect?ngulo que representa el fframe en cent?metros.
|
94 |
*
|
95 |
* @return Rect?ngulo en centimetros.
|
96 |
*/
|
97 |
public Rectangle2D.Double getBoundBox(); |
98 |
|
99 |
/**
|
100 |
* Rellena con el rect?ngulo que se pasa como par?metro el boundBox(en
|
101 |
* cent?metros) del fframe del cual con una transformaci?n se podr?
|
102 |
* calcular el BoundingBox (en pixels).
|
103 |
*
|
104 |
* @param rect Rect?ngulo en cent?metros.
|
105 |
*/
|
106 |
public void setBoundBox(Rectangle2D rect); |
107 |
|
108 |
/**
|
109 |
* Este m?todo se implementa en cada una de las fframe, ya que cada una se
|
110 |
* dibuja de una forma diferente sobre el graphics. M?todo que dibuja
|
111 |
* sobre el graphics que se le pasa como par?metro, seg?n la transformada
|
112 |
* afin que se debe de aplicar y el rect?ngulo que se debe de dibujar.
|
113 |
*
|
114 |
* @param g Graphics
|
115 |
* @param at Transformada afin.
|
116 |
* @param r rect?ngulo sobre el que hacer un clip.
|
117 |
* @param imgBase Imagen para acelerar el dibujado.
|
118 |
*
|
119 |
* @throws DriverException
|
120 |
*/
|
121 |
public void draw(Graphics2D g, AffineTransform at, Rectangle2D r, |
122 |
BufferedImage imgBase) throws DriverException; |
123 |
|
124 |
/**
|
125 |
* Implementado para imprimir.
|
126 |
*
|
127 |
* @param g Graphics2D de la impresora sobre el que dibujar.
|
128 |
* @param at DOCUMENT ME!
|
129 |
*
|
130 |
* @throws DriverException
|
131 |
*/
|
132 |
public void print(Graphics2D g, AffineTransform at) |
133 |
throws DriverException;
|
134 |
|
135 |
/**
|
136 |
* Devuelve el nombre que representa al fframe.
|
137 |
*
|
138 |
* @return String nombre del FFrame.
|
139 |
*/
|
140 |
public String getName(); |
141 |
|
142 |
/**
|
143 |
* Rellena el String que representa al nombre del fframe.
|
144 |
*
|
145 |
* @param n nombre del fframe.
|
146 |
*/
|
147 |
public void setName(String n); |
148 |
|
149 |
/**
|
150 |
* Devuelve true, si el punto que se pasa como par?metro esta contenido
|
151 |
* dentro del boundingbox del fframe.
|
152 |
*
|
153 |
* @param p punto a comprobar.
|
154 |
*
|
155 |
* @return true si el punto esta dentro del boundingbox.
|
156 |
*/
|
157 |
public boolean contains(Point2D p); |
158 |
|
159 |
/**
|
160 |
* Dibuja los handlers sobre el boundingBox en el graphics que se pasa como
|
161 |
* par?metro.
|
162 |
*
|
163 |
* @param g Graphics sobre el que dibujar.
|
164 |
*/
|
165 |
public void drawHandlers(Graphics2D g); |
166 |
|
167 |
/**
|
168 |
* Pasando como par?metro true, se toma como que est? seleccionado el
|
169 |
* fframe y si es false como que esta sin seleccionar, de esta forma se
|
170 |
* selecciona un fframe directamente sin comprobar si un punto est?
|
171 |
* contenido en ?l.
|
172 |
*
|
173 |
* @param b true si se quiere seleccionar y false si se quiere
|
174 |
* deseleccionar.
|
175 |
*/
|
176 |
public void setSelected(Point2D b, MouseEvent e); |
177 |
|
178 |
/**
|
179 |
* Establece que tipo de selecci?n se realiza sobre el fframe.
|
180 |
*
|
181 |
* @param b punto sobre el que se debe de establecer si se selecciona o no
|
182 |
* el fframe.
|
183 |
*/
|
184 |
public void setSelected(boolean b); |
185 |
|
186 |
/**
|
187 |
* Devuelve un entero que representa el tipo de selecci?n que se ha
|
188 |
* realizado sobre el fframe.
|
189 |
*
|
190 |
* @return tipo de selecci?n que se ha realizado.
|
191 |
*/
|
192 |
public int getSelected(); |
193 |
|
194 |
/**
|
195 |
* Devuelve un entero que representa donde esta contenido el punto que se
|
196 |
* pasa como par?metro.
|
197 |
*
|
198 |
* @param p punto a comparar.
|
199 |
*
|
200 |
* @return entero que representa como esta contenido el punto.
|
201 |
*/
|
202 |
public int getContains(Point2D p); |
203 |
|
204 |
/**
|
205 |
* Devuelve el Cursor adecuado seg?n como est? contenido el punto, si es
|
206 |
* para desplazamiento, o cambio de tama?o.
|
207 |
*
|
208 |
* @param p punto a comprobar.
|
209 |
*
|
210 |
* @return Cursor adecuado a la posici?n.
|
211 |
*/
|
212 |
public Cursor getMapCursor(Point2D p); |
213 |
|
214 |
/**
|
215 |
* Devuelve el rect?ngulo a partir del desplazamiento en el eje x y el
|
216 |
* desplazamiento en el eje y.
|
217 |
*
|
218 |
* @param difx desplazamiento sobre el eje x.
|
219 |
* @param dify desplazamiento sobre el eje y.
|
220 |
*
|
221 |
* @return rect?ngulo modificado en funci?n del desplazamiento realizado.
|
222 |
*/
|
223 |
public Rectangle2D getMovieRect(int difx, int dify); |
224 |
|
225 |
/**
|
226 |
* Devuelve un Objeto XMLEntity con la informaci?n los atributos necesarios
|
227 |
* para poder despu?s volver a crear el objeto original.
|
228 |
*
|
229 |
* @return XMLEntity.
|
230 |
*
|
231 |
* @throws XMLException
|
232 |
*/
|
233 |
public XMLEntity getXMLEntity() throws SaveException; |
234 |
|
235 |
/**
|
236 |
* Dibuja un rect?ngulo de color gris, con el nombre en el centro y
|
237 |
* escalado en forma de borrador.
|
238 |
*
|
239 |
* @param g Graphics sobre el que se dibuja.
|
240 |
*/
|
241 |
public void drawDraft(Graphics2D g); |
242 |
|
243 |
/**
|
244 |
* Actualiza el BoundBox del FFrame a partir de su rect?ngulo en pixels y
|
245 |
* la matriz de transformaci?n.
|
246 |
*
|
247 |
* @param r Rect?ngulo.
|
248 |
* @param at Matriz de transformaci?n.
|
249 |
*/
|
250 |
public void updateRect(Rectangle2D r, AffineTransform at); |
251 |
|
252 |
/**
|
253 |
* Devuelve true si el rect?ngulo primero es null o si es distinto de null
|
254 |
* e intersecta.
|
255 |
*
|
256 |
* @param rv Rect?ngulo
|
257 |
* @param r Rect?ngulo
|
258 |
*
|
259 |
* @return True si intersecta o es null.
|
260 |
*/
|
261 |
public boolean intersects(Rectangle2D rv, Rectangle2D r); |
262 |
|
263 |
/**
|
264 |
* Introduce el n?mero de FFrame en el que de que se trata.
|
265 |
*
|
266 |
* @param i n?mero de FFrame
|
267 |
*/
|
268 |
public void setNum(int i); |
269 |
|
270 |
/**
|
271 |
* A partir del xml y de Project inicia el objeto.
|
272 |
*
|
273 |
* @param xml XMLEntity
|
274 |
*/
|
275 |
public void setXMLEntity(XMLEntity xml); |
276 |
|
277 |
/**
|
278 |
* A partir del xml y de Project inicia el objeto.
|
279 |
*
|
280 |
* @param xml XMLEntity
|
281 |
* @param l Project
|
282 |
*/
|
283 |
public void setXMLEntity03(XMLEntity xml, Layout l); |
284 |
|
285 |
/**
|
286 |
* Devuelve el nombre que representa al tipo de FFrame.
|
287 |
*
|
288 |
* @return nombre del elemento.
|
289 |
*/
|
290 |
public String getNameFFrame(); |
291 |
|
292 |
/**
|
293 |
* Abre la ventana para modificar el tag.
|
294 |
*/
|
295 |
public void openTag(); |
296 |
|
297 |
/**
|
298 |
* Rellena el tag.
|
299 |
*
|
300 |
* @param s valor del tag.
|
301 |
*/
|
302 |
public void setTag(String s); |
303 |
|
304 |
/**
|
305 |
* Devuelve el valor del tag.
|
306 |
*
|
307 |
* @return String del valor del tag.
|
308 |
*/
|
309 |
public String getTag(); |
310 |
|
311 |
/**
|
312 |
* Dibuja el s?mbolo que indica que el FFrame contiene un tag.
|
313 |
*
|
314 |
* @param g Graphics sobre el que dibujar.
|
315 |
*/
|
316 |
public void drawSymbolTag(Graphics2D g); |
317 |
|
318 |
/**
|
319 |
* Rellena la rotaci?n del BoundingBox.
|
320 |
*
|
321 |
* @param rotation rotaci?n que se quiere aplicar.
|
322 |
*/
|
323 |
public void setRotation(double rotation); |
324 |
|
325 |
/**
|
326 |
* Devuelve la rotaci?n del BoundingBox.
|
327 |
*
|
328 |
* @return Rotaci?n del BoundingBox.
|
329 |
*/
|
330 |
public double getRotation(); |
331 |
|
332 |
/**
|
333 |
* Devuelve el nivel al que se encuentra el FFrame en el Layout.
|
334 |
*
|
335 |
* @return nivel.
|
336 |
*/
|
337 |
public int getLevel(); |
338 |
|
339 |
/**
|
340 |
* Inserta el nivel de dibujado del FFrame respecto del resto de fframes
|
341 |
* del Layout.
|
342 |
*
|
343 |
* @param l nivel.
|
344 |
*/
|
345 |
public void setLevel(int l); |
346 |
public IFFrame cloneFFrame(Layout layout);
|
347 |
public Rectangle2D getLastMoveRect(); |
348 |
} |