svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / project / documents / layout / fframes / IFFrame.java @ 10626
History | View | Annotate | Download (10.1 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 java.awt.Graphics2D; |
48 |
import java.awt.Image; |
49 |
import java.awt.event.MouseEvent; |
50 |
import java.awt.geom.AffineTransform; |
51 |
import java.awt.geom.Point2D; |
52 |
import java.awt.geom.Rectangle2D; |
53 |
import java.awt.image.BufferedImage; |
54 |
|
55 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
56 |
import com.iver.cit.gvsig.fmap.core.FShape; |
57 |
import com.iver.cit.gvsig.fmap.core.IPrintable; |
58 |
import com.iver.cit.gvsig.fmap.layers.XMLException; |
59 |
import com.iver.cit.gvsig.project.documents.exceptions.SaveException; |
60 |
import com.iver.cit.gvsig.project.documents.layout.fframes.gui.dialogs.IFFrameDialog; |
61 |
import com.iver.cit.gvsig.project.documents.layout.gui.Layout; |
62 |
import com.iver.utiles.XMLEntity; |
63 |
|
64 |
|
65 |
/**
|
66 |
* Interface que implementa FFrame.
|
67 |
*
|
68 |
* @author Vicente Caballero Navarro
|
69 |
*/
|
70 |
public interface IFFrame extends IPrintable{ |
71 |
public static final int N = 1; |
72 |
public static final int NE = 2; |
73 |
public static final int E = 3; |
74 |
public static final int SE = 4; |
75 |
public static final int S = 5; |
76 |
public static final int SO = 6; |
77 |
public static final int O = 7; |
78 |
public static final int NO = 8; |
79 |
public static final int RECT = 9; |
80 |
/** FFrame no selecccionado. */
|
81 |
public static final int NOSELECT = 0; |
82 |
|
83 |
/**
|
84 |
* Devuelve el boundingBox del fframe en funci?n de la transformada af?n
|
85 |
* que se pasa como par?metro. Si se pasa como par?metro null, devuelve el
|
86 |
* ?ltimo boundingbox que se calcul?.
|
87 |
*
|
88 |
* @param at Transformada af?n
|
89 |
*
|
90 |
* @return Rect?ngulo que representa el BoundingBox del fframe.
|
91 |
*/
|
92 |
public Rectangle2D.Double getBoundingBox(AffineTransform at); |
93 |
|
94 |
/**
|
95 |
* Devuelve el rect?ngulo que representa el fframe en cent?metros.
|
96 |
*
|
97 |
* @return Rect?ngulo en centimetros.
|
98 |
*/
|
99 |
public Rectangle2D.Double getBoundBox(); |
100 |
|
101 |
/**
|
102 |
* Rellena con el rect?ngulo que se pasa como par?metro el boundBox(en
|
103 |
* cent?metros) del fframe del cual con una transformaci?n se podr?
|
104 |
* calcular el BoundingBox (en pixels).
|
105 |
*
|
106 |
* @param rect Rect?ngulo en cent?metros.
|
107 |
*/
|
108 |
public void setBoundBox(Rectangle2D rect); |
109 |
|
110 |
/**
|
111 |
* Este m?todo se implementa en cada una de las fframe, ya que cada una se
|
112 |
* dibuja de una forma diferente sobre el graphics. M?todo que dibuja
|
113 |
* sobre el graphics que se le pasa como par?metro, seg?n la transformada
|
114 |
* afin que se debe de aplicar y el rect?ngulo que se debe de dibujar.
|
115 |
*
|
116 |
* @param g Graphics
|
117 |
* @param at Transformada afin.
|
118 |
* @param r rect?ngulo sobre el que hacer un clip.
|
119 |
* @param imgBase Imagen para acelerar el dibujado.
|
120 |
* @throws ReadDriverException TODO
|
121 |
*/
|
122 |
public void draw(Graphics2D g, AffineTransform at, Rectangle2D r, |
123 |
BufferedImage imgBase) throws ReadDriverException; |
124 |
|
125 |
/**
|
126 |
* Implementado para imprimir.
|
127 |
*
|
128 |
* @param g Graphics2D de la impresora sobre el que dibujar.
|
129 |
* @param at DOCUMENT ME!
|
130 |
*/
|
131 |
public void print(Graphics2D g, AffineTransform at, FShape shape) |
132 |
throws ReadDriverException;
|
133 |
|
134 |
/**
|
135 |
* Devuelve el nombre que representa al fframe.
|
136 |
*
|
137 |
* @return String nombre del FFrame.
|
138 |
*/
|
139 |
public String getName(); |
140 |
|
141 |
/**
|
142 |
* Rellena el String que representa al nombre del fframe.
|
143 |
*
|
144 |
* @param n nombre del fframe.
|
145 |
*/
|
146 |
public void setName(String n); |
147 |
|
148 |
/**
|
149 |
* Devuelve true, si el punto que se pasa como par?metro esta contenido
|
150 |
* dentro del boundingbox del fframe.
|
151 |
*
|
152 |
* @param p punto a comprobar.
|
153 |
*
|
154 |
* @return true si el punto esta dentro del boundingbox.
|
155 |
*/
|
156 |
public boolean contains(Point2D p); |
157 |
|
158 |
/**
|
159 |
* Dibuja los handlers sobre el boundingBox en el graphics que se pasa como
|
160 |
* par?metro.
|
161 |
*
|
162 |
* @param g Graphics sobre el que dibujar.
|
163 |
*/
|
164 |
public void drawHandlers(Graphics2D g); |
165 |
|
166 |
/**
|
167 |
* Pasando como par?metro true, se toma como que est? seleccionado el
|
168 |
* fframe y si es false como que esta sin seleccionar, de esta forma se
|
169 |
* selecciona un fframe directamente sin comprobar si un punto est?
|
170 |
* contenido en ?l.
|
171 |
*
|
172 |
* @param b true si se quiere seleccionar y false si se quiere
|
173 |
* deseleccionar.
|
174 |
*/
|
175 |
public void setSelected(Point2D b, MouseEvent e); |
176 |
|
177 |
/**
|
178 |
* Establece que tipo de selecci?n se realiza sobre el fframe.
|
179 |
*
|
180 |
* @param b punto sobre el que se debe de establecer si se selecciona o no
|
181 |
* el fframe.
|
182 |
*/
|
183 |
public void setSelected(boolean b); |
184 |
|
185 |
/**
|
186 |
* Devuelve un entero que representa el tipo de selecci?n que se ha
|
187 |
* realizado sobre el fframe.
|
188 |
*
|
189 |
* @return tipo de selecci?n que se ha realizado.
|
190 |
*/
|
191 |
public int getSelected(); |
192 |
|
193 |
/**
|
194 |
* Devuelve un entero que representa donde esta contenido el punto que se
|
195 |
* pasa como par?metro.
|
196 |
*
|
197 |
* @param p punto a comparar.
|
198 |
*
|
199 |
* @return entero que representa como esta contenido el punto.
|
200 |
*/
|
201 |
public int getContains(Point2D p); |
202 |
|
203 |
/**
|
204 |
* Devuelve el Cursor adecuado seg?n como est? contenido el punto, si es
|
205 |
* para desplazamiento, o cambio de tama?o.
|
206 |
*
|
207 |
* @param p punto a comprobar.
|
208 |
*
|
209 |
* @return Cursor adecuado a la posici?n.
|
210 |
*/
|
211 |
public Image getMapCursor(Point2D p); |
212 |
|
213 |
/**
|
214 |
* Devuelve el rect?ngulo a partir del desplazamiento en el eje x y el
|
215 |
* desplazamiento en el eje y.
|
216 |
*
|
217 |
* @param difx desplazamiento sobre el eje x.
|
218 |
* @param dify desplazamiento sobre el eje y.
|
219 |
*
|
220 |
* @return rect?ngulo modificado en funci?n del desplazamiento realizado.
|
221 |
*/
|
222 |
public Rectangle2D getMovieRect(int difx, int dify); |
223 |
|
224 |
/**
|
225 |
* Devuelve un Objeto XMLEntity con la informaci?n los atributos necesarios
|
226 |
* para poder despu?s volver a crear el objeto original.
|
227 |
*
|
228 |
* @return XMLEntity.
|
229 |
*
|
230 |
* @throws XMLException
|
231 |
*/
|
232 |
public XMLEntity getXMLEntity() throws SaveException; |
233 |
|
234 |
/**
|
235 |
* Dibuja un rect?ngulo de color gris, con el nombre en el centro y
|
236 |
* escalado en forma de borrador.
|
237 |
*
|
238 |
* @param g Graphics sobre el que se dibuja.
|
239 |
*/
|
240 |
public void drawDraft(Graphics2D g); |
241 |
|
242 |
/**
|
243 |
* Actualiza el BoundBox del FFrame a partir de su rect?ngulo en pixels y
|
244 |
* la matriz de transformaci?n.
|
245 |
*
|
246 |
* @param r Rect?ngulo.
|
247 |
* @param at Matriz de transformaci?n.
|
248 |
*/
|
249 |
public void updateRect(Rectangle2D r, AffineTransform at); |
250 |
|
251 |
/**
|
252 |
* Devuelve true si el rect?ngulo primero es null o si es distinto de null
|
253 |
* e intersecta.
|
254 |
*
|
255 |
* @param rv Rect?ngulo
|
256 |
* @param r Rect?ngulo
|
257 |
*
|
258 |
* @return True si intersecta o es null.
|
259 |
*/
|
260 |
public boolean intersects(Rectangle2D rv, Rectangle2D r); |
261 |
|
262 |
/**
|
263 |
* Introduce el n?mero de FFrame en el que de que se trata.
|
264 |
*
|
265 |
* @param i n?mero de FFrame
|
266 |
*/
|
267 |
public void setNum(int i); |
268 |
|
269 |
/**
|
270 |
* A partir del xml y de Project inicia el objeto.
|
271 |
*
|
272 |
* @param xml XMLEntity
|
273 |
*/
|
274 |
public void setXMLEntity(XMLEntity xml); |
275 |
|
276 |
/**
|
277 |
* A partir del xml y de Project inicia el objeto.
|
278 |
*
|
279 |
* @param xml XMLEntity
|
280 |
* @param l Project
|
281 |
*/
|
282 |
public void setXMLEntity03(XMLEntity xml, Layout l); |
283 |
|
284 |
/**
|
285 |
* Devuelve el nombre que representa al tipo de FFrame.
|
286 |
*
|
287 |
* @return nombre del elemento.
|
288 |
*/
|
289 |
public String getNameFFrame(); |
290 |
|
291 |
/**
|
292 |
* Abre la ventana para modificar el tag.
|
293 |
*/
|
294 |
public void openTag(); |
295 |
|
296 |
/**
|
297 |
* Rellena el tag.
|
298 |
*
|
299 |
* @param s valor del tag.
|
300 |
*/
|
301 |
public void setTag(String s); |
302 |
|
303 |
/**
|
304 |
* Devuelve el valor del tag.
|
305 |
*
|
306 |
* @return String del valor del tag.
|
307 |
*/
|
308 |
public String getTag(); |
309 |
|
310 |
/**
|
311 |
* Dibuja el s?mbolo que indica que el FFrame contiene un tag.
|
312 |
*
|
313 |
* @param g Graphics sobre el que dibujar.
|
314 |
*/
|
315 |
public void drawSymbolTag(Graphics2D g); |
316 |
|
317 |
/**
|
318 |
* Rellena la rotaci?n del BoundingBox.
|
319 |
*
|
320 |
* @param rotation rotaci?n que se quiere aplicar.
|
321 |
*/
|
322 |
public void setRotation(double rotation); |
323 |
|
324 |
/**
|
325 |
* Devuelve la rotaci?n del BoundingBox.
|
326 |
*
|
327 |
* @return Rotaci?n del BoundingBox.
|
328 |
*/
|
329 |
public double getRotation(); |
330 |
|
331 |
/**
|
332 |
* Devuelve el nivel al que se encuentra el FFrame en el Layout.
|
333 |
*
|
334 |
* @return nivel.
|
335 |
*/
|
336 |
public int getLevel(); |
337 |
|
338 |
/**
|
339 |
* Inserta el nivel de dibujado del FFrame respecto del resto de fframes
|
340 |
* del Layout.
|
341 |
*
|
342 |
* @param l nivel.
|
343 |
*/
|
344 |
public void setLevel(int l); |
345 |
public IFFrame cloneFFrame(Layout layout);
|
346 |
public Rectangle2D getLastMoveRect(); |
347 |
/**
|
348 |
* Operaciones necesarias para finalizar correctamente el clonado de un frame, por ejemplo los listeners.
|
349 |
*
|
350 |
* @param frame IFFrame del cual copiar los listeners.
|
351 |
*/
|
352 |
public void cloneActions(IFFrame frame); |
353 |
public IFFrameDialog getPropertyDialog();
|
354 |
public void setLayout(Layout layout); |
355 |
public Layout getLayout();
|
356 |
|
357 |
public void setFrameLayoutFactory(FrameFactory flf); |
358 |
public FrameFactory getFrameLayoutFactory();
|
359 |
} |