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 @ 145
History | View | Annotate | Download (9.54 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.app.project.documents.layout.LayoutContext; |
33 |
import org.gvsig.app.project.documents.layout.LayoutControl; |
34 |
import org.gvsig.app.project.documents.layout.gui.LayoutPanel; |
35 |
import org.gvsig.fmap.mapcontext.rendering.symbols.IPrintable; |
36 |
import org.gvsig.tools.dispose.Disposable; |
37 |
import org.gvsig.tools.lang.Cloneable; |
38 |
import org.gvsig.tools.observer.Observable; |
39 |
import org.gvsig.tools.observer.Observer; |
40 |
import org.gvsig.tools.persistence.Persistent; |
41 |
|
42 |
/**
|
43 |
* Interface que implementa FFrame.
|
44 |
*
|
45 |
* @author Vicente Caballero Navarro
|
46 |
*/
|
47 |
public interface IFFrame extends IPrintable, Persistent, Cloneable, Observable, Disposable, Observer { |
48 |
|
49 |
public static final int N = 1; |
50 |
public static final int NE = 2; |
51 |
public static final int E = 3; |
52 |
public static final int SE = 4; |
53 |
public static final int S = 5; |
54 |
public static final int SO = 6; |
55 |
public static final int O = 7; |
56 |
public static final int NO = 8; |
57 |
public static final int RECT = 9; |
58 |
/** FFrame no selecccionado. */
|
59 |
public static final int NOSELECT = 0; |
60 |
|
61 |
/**
|
62 |
* Devuelve el boundingBox del fframe en funci?n de la transformada af?n
|
63 |
* que se pasa como par?metro. Si se pasa como par?metro null, devuelve el
|
64 |
* ?ltimo boundingbox que se calcul?.
|
65 |
*
|
66 |
* @param at
|
67 |
* Transformada af?n
|
68 |
*
|
69 |
* @return Rect?ngulo que representa el BoundingBox del fframe.
|
70 |
*/
|
71 |
public Rectangle2D.Double getBoundingBox(AffineTransform at); |
72 |
|
73 |
/**
|
74 |
* Devuelve el rect?ngulo que representa el fframe en cent?metros.
|
75 |
*
|
76 |
* @return Rect?ngulo en centimetros.
|
77 |
*/
|
78 |
public Rectangle2D.Double getBoundBox(); |
79 |
|
80 |
/**
|
81 |
* Rellena con el rect?ngulo que se pasa como par?metro el boundBox(en
|
82 |
* cent?metros) del fframe del cual con una transformaci?n se podr?
|
83 |
* calcular el BoundingBox (en pixels).
|
84 |
*
|
85 |
* @param rect
|
86 |
* Rect?ngulo en cent?metros.
|
87 |
*/
|
88 |
public void setBoundBox(Rectangle2D rect); |
89 |
|
90 |
/**
|
91 |
* Este m?todo se implementa en cada una de las fframe, ya que cada una se
|
92 |
* dibuja de una forma diferente sobre el graphics. M?todo que dibuja
|
93 |
* sobre el graphics que se le pasa como par?metro, seg?n la transformada
|
94 |
* afin que se debe de aplicar y el rect?ngulo que se debe de dibujar.
|
95 |
*
|
96 |
* @param g
|
97 |
* Graphics
|
98 |
* @param at
|
99 |
* Transformada afin.
|
100 |
* @param r
|
101 |
* rect?ngulo sobre el que hacer un clip.
|
102 |
* @param imgBase
|
103 |
* Imagen para acelerar el dibujado.
|
104 |
* @throws ReadDriverException
|
105 |
* TODO
|
106 |
*/
|
107 |
public void draw(Graphics2D g, AffineTransform at, Rectangle2D r, |
108 |
BufferedImage imgBase);
|
109 |
|
110 |
// /**
|
111 |
// * Implementado para imprimir.
|
112 |
// *
|
113 |
// * @param g Graphics2D de la impresora sobre el que dibujar.
|
114 |
// * @param at DOCUMENT ME!
|
115 |
// */
|
116 |
// public void print(Graphics2D g, AffineTransform at, FShape shape)
|
117 |
// throws ReadDriverException;
|
118 |
|
119 |
/**
|
120 |
* Devuelve el nombre que representa al fframe.
|
121 |
*
|
122 |
* @return String nombre del FFrame.
|
123 |
*/
|
124 |
public String getName(); |
125 |
|
126 |
/**
|
127 |
* Devuelve true, si el punto que se pasa como par?metro esta contenido
|
128 |
* dentro del boundingbox del fframe.
|
129 |
*
|
130 |
* @param p
|
131 |
* punto a comprobar.
|
132 |
*
|
133 |
* @return true si el punto esta dentro del boundingbox.
|
134 |
*/
|
135 |
public boolean contains(Point2D p); |
136 |
|
137 |
/**
|
138 |
* Dibuja los handlers sobre el boundingBox en el graphics que se pasa como
|
139 |
* par?metro.
|
140 |
*
|
141 |
* @param g
|
142 |
* Graphics sobre el que dibujar.
|
143 |
*/
|
144 |
public void drawHandlers(Graphics2D g); |
145 |
|
146 |
/**
|
147 |
* Pasando como par?metro true, se toma como que est? seleccionado el
|
148 |
* fframe y si es false como que esta sin seleccionar, de esta forma se
|
149 |
* selecciona un fframe directamente sin comprobar si un punto est?
|
150 |
* contenido en ?l.
|
151 |
*
|
152 |
* @param b
|
153 |
* true si se quiere seleccionar y false si se quiere
|
154 |
* deseleccionar.
|
155 |
*/
|
156 |
public void setSelected(Point2D b, MouseEvent e); |
157 |
|
158 |
/**
|
159 |
* Establece que tipo de selecci?n se realiza sobre el fframe.
|
160 |
*
|
161 |
* @param b
|
162 |
* punto sobre el que se debe de establecer si se selecciona o no
|
163 |
* el fframe.
|
164 |
*/
|
165 |
public void setSelected(boolean b); |
166 |
|
167 |
/**
|
168 |
* Devuelve un entero que representa el tipo de selecci?n que se ha
|
169 |
* realizado sobre el fframe.
|
170 |
*
|
171 |
* @return tipo de selecci?n que se ha realizado.
|
172 |
*/
|
173 |
public int getSelected(); |
174 |
|
175 |
/**
|
176 |
* Returns true if the frame is selected, false otherwise
|
177 |
* @return true if the frame is selected, false otherwise
|
178 |
*/
|
179 |
public boolean isSelected(); |
180 |
|
181 |
/**
|
182 |
* Devuelve un entero que representa donde esta contenido el punto que se
|
183 |
* pasa como par?metro.
|
184 |
*
|
185 |
* @param p
|
186 |
* punto a comparar.
|
187 |
*
|
188 |
* @return entero que representa como esta contenido el punto.
|
189 |
*/
|
190 |
public int getContains(Point2D p); |
191 |
|
192 |
/**
|
193 |
* Devuelve el Cursor adecuado seg?n como est? contenido el punto, si es
|
194 |
* para desplazamiento, o cambio de tama?o.
|
195 |
*
|
196 |
* @param p
|
197 |
* punto a comprobar.
|
198 |
*
|
199 |
* @return Cursor adecuado a la posici?n.
|
200 |
*/
|
201 |
public Image getMapCursor(Point2D p); |
202 |
|
203 |
/**
|
204 |
* Devuelve el rect?ngulo a partir del desplazamiento en el eje x y el
|
205 |
* desplazamiento en el eje y.
|
206 |
*
|
207 |
* @param difx
|
208 |
* desplazamiento sobre el eje x.
|
209 |
* @param dify
|
210 |
* desplazamiento sobre el eje y.
|
211 |
*
|
212 |
* @return rect?ngulo modificado en funci?n del desplazamiento realizado.
|
213 |
*/
|
214 |
public Rectangle2D getMovieRect(int difx, int dify); |
215 |
|
216 |
/**
|
217 |
* Dibuja un rect?ngulo de color gris, con el nombre en el centro y
|
218 |
* escalado en forma de borrador.
|
219 |
*
|
220 |
* @param g
|
221 |
* Graphics sobre el que se dibuja.
|
222 |
*/
|
223 |
public void drawDraft(Graphics2D g); |
224 |
|
225 |
/**
|
226 |
* Actualiza el BoundBox del FFrame a partir de su rect?ngulo en pixels y
|
227 |
* la matriz de transformaci?n.
|
228 |
*
|
229 |
* @param r
|
230 |
* Rect?ngulo.
|
231 |
* @param at
|
232 |
* Matriz de transformaci?n.
|
233 |
*/
|
234 |
public void updateRect(Rectangle2D r, AffineTransform at); |
235 |
|
236 |
/**
|
237 |
* Devuelve true si el rect?ngulo primero es null o si es distinto de null
|
238 |
* e intersecta.
|
239 |
*
|
240 |
* @param rv
|
241 |
* Rect?ngulo
|
242 |
* @param r
|
243 |
* Rect?ngulo
|
244 |
*
|
245 |
* @return True si intersecta o es null.
|
246 |
*/
|
247 |
public boolean intersects(Rectangle2D rv, Rectangle2D r); |
248 |
|
249 |
/**
|
250 |
* Introduce el n?mero de FFrame en el que de que se trata.
|
251 |
*
|
252 |
* @param i
|
253 |
* n?mero de FFrame
|
254 |
*/
|
255 |
public void setNum(int i); |
256 |
|
257 |
/**
|
258 |
* Devuelve el nombre que representa al tipo de FFrame.
|
259 |
*
|
260 |
* @return nombre del elemento.
|
261 |
*/
|
262 |
public String getNameFFrame(); |
263 |
|
264 |
/**
|
265 |
* Rellena el tag.
|
266 |
*
|
267 |
* @param s
|
268 |
* valor del tag.
|
269 |
*/
|
270 |
public void setTag(String s); |
271 |
|
272 |
/**
|
273 |
* Devuelve el valor del tag.
|
274 |
*
|
275 |
* @return String del valor del tag.
|
276 |
*/
|
277 |
public String getTag(); |
278 |
|
279 |
/**
|
280 |
* Dibuja el s?mbolo que indica que el FFrame contiene un tag.
|
281 |
*
|
282 |
* @param g
|
283 |
* Graphics sobre el que dibujar.
|
284 |
*/
|
285 |
public void drawSymbolTag(Graphics2D g); |
286 |
|
287 |
/**
|
288 |
* Rellena la rotaci?n del BoundingBox.
|
289 |
*
|
290 |
* @param rotation
|
291 |
* rotaci?n que se quiere aplicar.
|
292 |
*/
|
293 |
public void setRotation(double rotation); |
294 |
|
295 |
/**
|
296 |
* Devuelve la rotaci?n del BoundingBox.
|
297 |
*
|
298 |
* @return Rotaci?n del BoundingBox.
|
299 |
*/
|
300 |
public double getRotation(); |
301 |
|
302 |
/**
|
303 |
* Devuelve el nivel al que se encuentra el FFrame en el Layout.
|
304 |
*
|
305 |
* @return nivel.
|
306 |
*/
|
307 |
public int getLevel(); |
308 |
|
309 |
/**
|
310 |
* Inserta el nivel de dibujado del FFrame respecto del resto de fframes
|
311 |
* del Layout.
|
312 |
*
|
313 |
* @param l
|
314 |
* nivel.
|
315 |
*/
|
316 |
public void setLevel(int l); |
317 |
|
318 |
public Rectangle2D getLastMoveRect(); |
319 |
|
320 |
public void setFrameFactory(FrameFactory frameFactory); |
321 |
|
322 |
public FrameFactory getFrameFactory();
|
323 |
|
324 |
public LayoutPanel getLayoutPanel();
|
325 |
|
326 |
public void setLayoutPanel(LayoutPanel layoutPanel); |
327 |
|
328 |
public LayoutContext getLayoutContext();
|
329 |
|
330 |
public void setLayoutContext(LayoutContext layoutContext); |
331 |
|
332 |
public LayoutControl getLayoutControl();
|
333 |
|
334 |
public void setLayoutControl(LayoutControl layoutControl); |
335 |
} |