Statistics
| Revision:

svn-document-layout / trunk / org.gvsig.app.document.layout2.app / org.gvsig.app.document.layout2.app.mainplugin / src / main / java / org / gvsig / app / project / documents / layout / LayoutControl.java @ 1757

History | View | Annotate | Download (8.42 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;
23

    
24
import java.awt.Image;
25
import java.awt.Point;
26
import java.awt.Rectangle;
27
import java.awt.geom.AffineTransform;
28
import java.awt.geom.Rectangle2D;
29
import java.awt.image.BufferedImage;
30
import javax.swing.JComponent;
31
import org.gvsig.app.project.documents.layout.geometryadapters.GeometryAdapter;
32
import org.gvsig.app.project.documents.layout.tools.behavior.LayoutBehavior;
33
import org.gvsig.fmap.dal.exception.ReadException;
34
import org.gvsig.tools.observer.Observer;
35

    
36
/**
37
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
38
 */
39
public interface LayoutControl extends Observer {
40

    
41
    /**
42
     * <p>Returns a copy of the rectangle that represents the size
43
     * and position of the layout sheet (in pixels), relative to
44
     * the containing LayoutControl.</p>
45
     * 
46
     * <p>Note: you must use {@link #setRect(Rectangle2D)} to update
47
     * the rectangle, as this method only returns a copy of it.</p>
48
     * @return Rectangle2D.Double Rectangle that represents the sheet.
49
     * @see LayoutControl#setRect(Rectangle2D)
50
     */
51
    public Rectangle2D.Double getRect();
52

    
53
    /**
54
     * <p>Sets the size and position of the layout sheet in screen coordinates
55
     * (pixels), relative to the LayoutControl.</p>
56
     * 
57
     * <p>The size of the sheet is usually different from the
58
     * bounds of the underlying UI control, for instance if we have zoomed in
59
     * an area of the sheet then the paper size in pixels will be bigger than
60
     * the actual control size.</p>
61
     * 
62
     */
63
    public void setRect(Rectangle2D r);
64
    
65
    /**
66
     * Returns the name of the current selected tool on this Layout
67
     * 
68
     * @return A tool name.
69
     */
70
    public String getCurrentTool();
71

    
72
    /**
73
     * Add a new Layout tool.
74
     * 
75
     * @param name
76
     *            Name of tool.
77
     * @param tool
78
     *            LayoutBehavior
79
     */
80
    public void addLayoutTool(String name, LayoutBehavior tool);
81
    
82
    public LayoutBehavior getLayoutTool(String name);
83

    
84
    /**
85
     * Inserts the LayoutContext.
86
     * 
87
     * @param lc
88
     *            LayoutContext.
89
     */
90
    public void setLayoutContext(LayoutContext lc);
91

    
92
    /**
93
     * Returns the image with the ruler.
94
     * 
95
     * @return Ruler image.
96
     */
97
    public BufferedImage getImgRuler();
98

    
99
    /**
100
     * It obtains the rect that is adjusted to the size of the window,
101
     * to see the full extent of layout.
102
     */
103
    public void fullRect();
104

    
105
    /**
106
     * Returns the current image of Layout.
107
     * 
108
     * @return Current image of Layout.
109
     */
110
    public BufferedImage getImage();
111

    
112
    /**
113
     * Changes the pointer of the mouse by the image of parameter.
114
     * 
115
     * @param image
116
     *            Image
117
     */
118
    public void setMapCursor(Image image);
119

    
120
    /**
121
     * It establishes as selected to the tool from its name of identification.
122
     * 
123
     * @param toolName
124
     *            Name of identification tool.
125
     */
126
    public void setTool(String toolName);
127
    
128
    /**
129
     * Changes the currently selected tool to the default tool
130
     */
131
    public void setDefaultTool();
132

    
133
    /**
134
     * Start the vertex edition of graphics.
135
     * 
136
     */
137
    public void startEdit();
138

    
139
    /**
140
     * Stop the vertex edition of graphics.
141
     * 
142
     */
143
    public void stopEdit();
144

    
145
    /**
146
     * It returns the point that represents the northwest corner of the Layout.
147
     * 
148
     * @return Point.
149
     */
150
    public Point getRectOrigin();
151

    
152
    /**
153
     * Returns the object to draw the Layout.
154
     * 
155
     * @return FLayoutDraw.
156
     */
157
    public FLayoutDraw getLayoutDraw();
158

    
159
    /**
160
     * Returns the current Layout tool.
161
     * 
162
     * @return LayoutBehavior Current Layout Tool.
163
     */
164
    public LayoutBehavior getCurrentLayoutTool();
165

    
166
    /**
167
     * It returns the first click point of mouse.
168
     * 
169
     * @return Point.
170
     */
171
    public Point getFirstPoint();
172

    
173
    /**
174
     * Returns the previous click of mouse.
175
     * 
176
     * @return Point.
177
     */
178
    public Point getPointAnt();
179

    
180
    /**
181
     * Returns the last click point of mouse.
182
     * 
183
     * @return Point.
184
     */
185
    public Point getLastPoint();
186

    
187
    /**
188
     * Inserts the first click point of mouse.
189
     * 
190
     * @param p
191
     *            Point.
192
     */
193
    public void setFirstPoint();
194

    
195
    /**
196
     * Inserts the previous click point of mouse.
197
     * 
198
     * @param p
199
     *            Point.
200
     */
201
    public void setPointAnt();
202

    
203
    /**
204
     * Inserts the last click point of mouse.
205
     * 
206
     * @param p
207
     *            Point.
208
     */
209
    public void setLastPoint();
210

    
211
    /**
212
     * Insert the position point and calculate the new position if the grid is
213
     * actived.
214
     * 
215
     * @param point2
216
     *            Position.
217
     */
218
    public void setPosition(Point point2);
219

    
220
    /**
221
     * Returns the position adjusted point.
222
     * 
223
     * @return
224
     */
225
    public Point getPosition();
226

    
227
    /**
228
     * Returns the AffineTransform that is applying in the Layout.
229
     * 
230
     * @return AffineTransform
231
     */
232
    public AffineTransform getAT();
233

    
234
    /**
235
     * It returns the current GeometryAdapter.
236
     * 
237
     * @return Current GeometryAdapter.
238
     */
239
    public GeometryAdapter getGeometryAdapter();
240

    
241
    /**
242
     * Remove last point of geometryAdapter.
243
     * 
244
     */
245
    public void delLastPoint();
246

    
247
    /**
248
     * Add a new point to geometryAdapter.
249
     * 
250
     * @return Number of points in the geometryAdapter.
251
     */
252
    public int addGeometryAdapterPoint();
253

    
254
    /**
255
     * Change the position of mousemoved point of geometryAdapter.
256
     */
257
    public void setGeometryAdapterPoinPosition();
258

    
259
    /**
260
     * Clear the image of pointer of mouse.
261
     */
262
    public void clearMouseImage();
263

    
264
    /**
265
     * Refres the Layout.
266
     */
267
    public void refresh();
268

    
269
    /**
270
     * It returns true if the drawing has been canceled.
271
     * 
272
     * @return true if the drawn has been canceled.
273
     */
274
    public boolean isDrawingCancelled();
275

    
276
    /**
277
     * It cancels the drawing if the parameter is true.
278
     * 
279
     * @param b
280
     *            true if the drawing wants to be canceled
281
     */
282
    public void setCancelDrawing(boolean b);
283

    
284
    /**
285
     * Returns the rectangle of selection.
286
     * 
287
     * @return Rectangle of selection.
288
     */
289
    public Rectangle getReSel();
290

    
291
    /**
292
     * It returns true if should draw the rectangle of selection and does the
293
     * selection.
294
     * 
295
     * @return true if should draw the rectangle of selection.
296
     */
297
    public boolean isReSel();
298

    
299
    /**
300
     * Insert true if should draw the rectangle of selection and does the
301
     * selection.
302
     * 
303
     * @param b
304
     *            boolean.
305
     */
306
    public void setIsReSel(boolean b);
307

    
308
    /**
309
     * It does a full extent of the layers that contains the view of the
310
     * FFrameView selected.
311
     * 
312
     * @throws ReadDriverException
313
     */
314
    public void viewFull() throws ReadException;
315

    
316
    /**
317
     * Returns the object to make zooms.
318
     * 
319
     * @return FLayoutZooms.
320
     */
321
    public FLayoutZooms getLayoutZooms();
322

    
323
    /**
324
     * Returns the object of FLayoutFunctions.
325
     * 
326
     * @return FLayoutFunctions
327
     */
328
    public FLayoutFunctions getLayoutFunctions();
329

    
330
    /**
331
     * Returns the LayoutContext.
332
     * 
333
     * @return LayoutContext.
334
     */
335
    public LayoutContext getLayoutContext();
336

    
337
    /**
338
     * Inserts the geometryAdapter.
339
     * 
340
     * @param adapter
341
     *            GeometryAdapter.
342
     */
343
    public void setGeometryAdapter(GeometryAdapter adapter);
344

    
345
    public JComponent getComponent();
346

    
347
    public int getWidth();
348

    
349
    public int getHeight();
350

    
351
    public void repaint();
352
}