svn-document-layout / branches / usability_v2 / org.gvsig.app.document.layout.app / org.gvsig.app.document.layout.app.mainplugin / src / main / java / org / gvsig / app / project / documents / layout / fframes / IFFrame.java @ 142
History | View | Annotate | Download (9.01 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (CIT)
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 2
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
*/
|
22 |
package org.gvsig.app.project.documents.layout.fframes; |
23 |
|
24 |
import java.awt.Graphics2D; |
25 |
import java.awt.Image; |
26 |
import java.awt.event.MouseEvent; |
27 |
import java.awt.geom.AffineTransform; |
28 |
import java.awt.geom.Point2D; |
29 |
import java.awt.geom.Rectangle2D; |
30 |
import java.awt.image.BufferedImage; |
31 |
|
32 |
import org.gvsig.fmap.mapcontext.rendering.symbols.IPrintable; |
33 |
import org.gvsig.tools.dispose.Disposable; |
34 |
import org.gvsig.tools.lang.Cloneable; |
35 |
import org.gvsig.tools.observer.Observable; |
36 |
import org.gvsig.tools.persistence.Persistent; |
37 |
|
38 |
/**
|
39 |
* Interface que implementa FFrame.
|
40 |
*
|
41 |
* @author Vicente Caballero Navarro
|
42 |
*/
|
43 |
public interface IFFrame extends IPrintable, Persistent, Cloneable, Observable, Disposable { |
44 |
|
45 |
public static final int N = 1; |
46 |
public static final int NE = 2; |
47 |
public static final int E = 3; |
48 |
public static final int SE = 4; |
49 |
public static final int S = 5; |
50 |
public static final int SO = 6; |
51 |
public static final int O = 7; |
52 |
public static final int NO = 8; |
53 |
public static final int RECT = 9; |
54 |
/** FFrame no selecccionado. */
|
55 |
public static final int NOSELECT = 0; |
56 |
|
57 |
/**
|
58 |
* Devuelve el boundingBox del fframe en funci?n de la transformada af?n
|
59 |
* que se pasa como par?metro. Si se pasa como par?metro null, devuelve el
|
60 |
* ?ltimo boundingbox que se calcul?.
|
61 |
*
|
62 |
* @param at
|
63 |
* Transformada af?n
|
64 |
*
|
65 |
* @return Rect?ngulo que representa el BoundingBox del fframe.
|
66 |
*/
|
67 |
public Rectangle2D.Double getBoundingBox(AffineTransform at); |
68 |
|
69 |
/**
|
70 |
* Devuelve el rect?ngulo que representa el fframe en cent?metros.
|
71 |
*
|
72 |
* @return Rect?ngulo en centimetros.
|
73 |
*/
|
74 |
public Rectangle2D.Double getBoundBox(); |
75 |
|
76 |
/**
|
77 |
* Rellena con el rect?ngulo que se pasa como par?metro el boundBox(en
|
78 |
* cent?metros) del fframe del cual con una transformaci?n se podr?
|
79 |
* calcular el BoundingBox (en pixels).
|
80 |
*
|
81 |
* @param rect
|
82 |
* Rect?ngulo en cent?metros.
|
83 |
*/
|
84 |
public void setBoundBox(Rectangle2D rect); |
85 |
|
86 |
/**
|
87 |
* Este m?todo se implementa en cada una de las fframe, ya que cada una se
|
88 |
* dibuja de una forma diferente sobre el graphics. M?todo que dibuja
|
89 |
* sobre el graphics que se le pasa como par?metro, seg?n la transformada
|
90 |
* afin que se debe de aplicar y el rect?ngulo que se debe de dibujar.
|
91 |
*
|
92 |
* @param g
|
93 |
* Graphics
|
94 |
* @param at
|
95 |
* Transformada afin.
|
96 |
* @param r
|
97 |
* rect?ngulo sobre el que hacer un clip.
|
98 |
* @param imgBase
|
99 |
* Imagen para acelerar el dibujado.
|
100 |
* @throws ReadDriverException
|
101 |
* TODO
|
102 |
*/
|
103 |
public void draw(Graphics2D g, AffineTransform at, Rectangle2D r, |
104 |
BufferedImage imgBase);
|
105 |
|
106 |
// /**
|
107 |
// * Implementado para imprimir.
|
108 |
// *
|
109 |
// * @param g Graphics2D de la impresora sobre el que dibujar.
|
110 |
// * @param at DOCUMENT ME!
|
111 |
// */
|
112 |
// public void print(Graphics2D g, AffineTransform at, FShape shape)
|
113 |
// throws ReadDriverException;
|
114 |
|
115 |
/**
|
116 |
* Devuelve el nombre que representa al fframe.
|
117 |
*
|
118 |
* @return String nombre del FFrame.
|
119 |
*/
|
120 |
public String getName(); |
121 |
|
122 |
/**
|
123 |
* Devuelve true, si el punto que se pasa como par?metro esta contenido
|
124 |
* dentro del boundingbox del fframe.
|
125 |
*
|
126 |
* @param p
|
127 |
* punto a comprobar.
|
128 |
*
|
129 |
* @return true si el punto esta dentro del boundingbox.
|
130 |
*/
|
131 |
public boolean contains(Point2D p); |
132 |
|
133 |
/**
|
134 |
* Dibuja los handlers sobre el boundingBox en el graphics que se pasa como
|
135 |
* par?metro.
|
136 |
*
|
137 |
* @param g
|
138 |
* Graphics sobre el que dibujar.
|
139 |
*/
|
140 |
public void drawHandlers(Graphics2D g); |
141 |
|
142 |
/**
|
143 |
* Pasando como par?metro true, se toma como que est? seleccionado el
|
144 |
* fframe y si es false como que esta sin seleccionar, de esta forma se
|
145 |
* selecciona un fframe directamente sin comprobar si un punto est?
|
146 |
* contenido en ?l.
|
147 |
*
|
148 |
* @param b
|
149 |
* true si se quiere seleccionar y false si se quiere
|
150 |
* deseleccionar.
|
151 |
*/
|
152 |
public void setSelected(Point2D b, MouseEvent e); |
153 |
|
154 |
/**
|
155 |
* Establece que tipo de selecci?n se realiza sobre el fframe.
|
156 |
*
|
157 |
* @param b
|
158 |
* punto sobre el que se debe de establecer si se selecciona o no
|
159 |
* el fframe.
|
160 |
*/
|
161 |
public void setSelected(boolean b); |
162 |
|
163 |
/**
|
164 |
* Devuelve un entero que representa el tipo de selecci?n que se ha
|
165 |
* realizado sobre el fframe.
|
166 |
*
|
167 |
* @return tipo de selecci?n que se ha realizado.
|
168 |
*/
|
169 |
public int getSelected(); |
170 |
|
171 |
/**
|
172 |
* Returns true if the frame is selected, false otherwise
|
173 |
* @return true if the frame is selected, false otherwise
|
174 |
*/
|
175 |
public boolean isSelected(); |
176 |
|
177 |
/**
|
178 |
* Devuelve un entero que representa donde esta contenido el punto que se
|
179 |
* pasa como par?metro.
|
180 |
*
|
181 |
* @param p
|
182 |
* punto a comparar.
|
183 |
*
|
184 |
* @return entero que representa como esta contenido el punto.
|
185 |
*/
|
186 |
public int getContains(Point2D p); |
187 |
|
188 |
/**
|
189 |
* Devuelve el Cursor adecuado seg?n como est? contenido el punto, si es
|
190 |
* para desplazamiento, o cambio de tama?o.
|
191 |
*
|
192 |
* @param p
|
193 |
* punto a comprobar.
|
194 |
*
|
195 |
* @return Cursor adecuado a la posici?n.
|
196 |
*/
|
197 |
public Image getMapCursor(Point2D p); |
198 |
|
199 |
/**
|
200 |
* Devuelve el rect?ngulo a partir del desplazamiento en el eje x y el
|
201 |
* desplazamiento en el eje y.
|
202 |
*
|
203 |
* @param difx
|
204 |
* desplazamiento sobre el eje x.
|
205 |
* @param dify
|
206 |
* desplazamiento sobre el eje y.
|
207 |
*
|
208 |
* @return rect?ngulo modificado en funci?n del desplazamiento realizado.
|
209 |
*/
|
210 |
public Rectangle2D getMovieRect(int difx, int dify); |
211 |
|
212 |
/**
|
213 |
* Dibuja un rect?ngulo de color gris, con el nombre en el centro y
|
214 |
* escalado en forma de borrador.
|
215 |
*
|
216 |
* @param g
|
217 |
* Graphics sobre el que se dibuja.
|
218 |
*/
|
219 |
public void drawDraft(Graphics2D g); |
220 |
|
221 |
/**
|
222 |
* Actualiza el BoundBox del FFrame a partir de su rect?ngulo en pixels y
|
223 |
* la matriz de transformaci?n.
|
224 |
*
|
225 |
* @param r
|
226 |
* Rect?ngulo.
|
227 |
* @param at
|
228 |
* Matriz de transformaci?n.
|
229 |
*/
|
230 |
public void updateRect(Rectangle2D r, AffineTransform at); |
231 |
|
232 |
/**
|
233 |
* Devuelve true si el rect?ngulo primero es null o si es distinto de null
|
234 |
* e intersecta.
|
235 |
*
|
236 |
* @param rv
|
237 |
* Rect?ngulo
|
238 |
* @param r
|
239 |
* Rect?ngulo
|
240 |
*
|
241 |
* @return True si intersecta o es null.
|
242 |
*/
|
243 |
public boolean intersects(Rectangle2D rv, Rectangle2D r); |
244 |
|
245 |
/**
|
246 |
* Introduce el n?mero de FFrame en el que de que se trata.
|
247 |
*
|
248 |
* @param i
|
249 |
* n?mero de FFrame
|
250 |
*/
|
251 |
public void setNum(int i); |
252 |
|
253 |
/**
|
254 |
* Devuelve el nombre que representa al tipo de FFrame.
|
255 |
*
|
256 |
* @return nombre del elemento.
|
257 |
*/
|
258 |
public String getNameFFrame(); |
259 |
|
260 |
/**
|
261 |
* Rellena el tag.
|
262 |
*
|
263 |
* @param s
|
264 |
* valor del tag.
|
265 |
*/
|
266 |
public void setTag(String s); |
267 |
|
268 |
/**
|
269 |
* Devuelve el valor del tag.
|
270 |
*
|
271 |
* @return String del valor del tag.
|
272 |
*/
|
273 |
public String getTag(); |
274 |
|
275 |
/**
|
276 |
* Dibuja el s?mbolo que indica que el FFrame contiene un tag.
|
277 |
*
|
278 |
* @param g
|
279 |
* Graphics sobre el que dibujar.
|
280 |
*/
|
281 |
public void drawSymbolTag(Graphics2D g); |
282 |
|
283 |
/**
|
284 |
* Rellena la rotaci?n del BoundingBox.
|
285 |
*
|
286 |
* @param rotation
|
287 |
* rotaci?n que se quiere aplicar.
|
288 |
*/
|
289 |
public void setRotation(double rotation); |
290 |
|
291 |
/**
|
292 |
* Devuelve la rotaci?n del BoundingBox.
|
293 |
*
|
294 |
* @return Rotaci?n del BoundingBox.
|
295 |
*/
|
296 |
public double getRotation(); |
297 |
|
298 |
/**
|
299 |
* Devuelve el nivel al que se encuentra el FFrame en el Layout.
|
300 |
*
|
301 |
* @return nivel.
|
302 |
*/
|
303 |
public int getLevel(); |
304 |
|
305 |
/**
|
306 |
* Inserta el nivel de dibujado del FFrame respecto del resto de fframes
|
307 |
* del Layout.
|
308 |
*
|
309 |
* @param l
|
310 |
* nivel.
|
311 |
*/
|
312 |
public void setLevel(int l); |
313 |
|
314 |
public Rectangle2D getLastMoveRect(); |
315 |
|
316 |
public void setFrameFactory(FrameFactory frameFactory); |
317 |
|
318 |
public FrameFactory getFrameFactory();
|
319 |
} |