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 / DefaultLayoutControl.java @ 144
History | View | Annotate | Download (20.5 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.Color; |
25 |
import java.awt.Cursor; |
26 |
import java.awt.Graphics; |
27 |
import java.awt.Graphics2D; |
28 |
import java.awt.Image; |
29 |
import java.awt.Point; |
30 |
import java.awt.Rectangle; |
31 |
import java.awt.Toolkit; |
32 |
import java.awt.geom.AffineTransform; |
33 |
import java.awt.geom.Rectangle2D; |
34 |
import java.awt.image.BufferedImage; |
35 |
import java.awt.image.MemoryImageSource; |
36 |
import java.util.HashMap; |
37 |
|
38 |
import javax.swing.JComponent; |
39 |
|
40 |
import org.gvsig.app.project.documents.layout.fframes.IFFrame; |
41 |
import org.gvsig.app.project.documents.layout.fframes.IFFrameEditableVertex; |
42 |
import org.gvsig.app.project.documents.layout.fframes.IFFrameUseFMap; |
43 |
import org.gvsig.app.project.documents.layout.geometryadapters.GeometryAdapter; |
44 |
import org.gvsig.app.project.documents.layout.geometryadapters.PolyLineAdapter; |
45 |
import org.gvsig.app.project.documents.layout.gui.LayoutPanel; |
46 |
import org.gvsig.app.project.documents.layout.tools.LayoutAddBoxListenerImpl; |
47 |
import org.gvsig.app.project.documents.layout.tools.LayoutAddCircleListenerImpl; |
48 |
import org.gvsig.app.project.documents.layout.tools.LayoutAddLegendListenerImpl; |
49 |
import org.gvsig.app.project.documents.layout.tools.LayoutAddLineListenerImpl; |
50 |
import org.gvsig.app.project.documents.layout.tools.LayoutAddNorthListenerImpl; |
51 |
import org.gvsig.app.project.documents.layout.tools.LayoutAddOverViewListenerImpl; |
52 |
import org.gvsig.app.project.documents.layout.tools.LayoutAddPictureListenerImpl; |
53 |
import org.gvsig.app.project.documents.layout.tools.LayoutAddPointListenerImpl; |
54 |
import org.gvsig.app.project.documents.layout.tools.LayoutAddPolygonListenerImpl; |
55 |
import org.gvsig.app.project.documents.layout.tools.LayoutAddPolylineListenerImpl; |
56 |
import org.gvsig.app.project.documents.layout.tools.LayoutAddRectangleListenerImpl; |
57 |
import org.gvsig.app.project.documents.layout.tools.LayoutAddScaleListenerImpl; |
58 |
import org.gvsig.app.project.documents.layout.tools.LayoutAddTextListenerImpl; |
59 |
import org.gvsig.app.project.documents.layout.tools.LayoutAddViewListenerImpl; |
60 |
import org.gvsig.app.project.documents.layout.tools.LayoutEditGraphicsListenerImpl; |
61 |
import org.gvsig.app.project.documents.layout.tools.LayoutPanListenerImpl; |
62 |
import org.gvsig.app.project.documents.layout.tools.LayoutSelectListenerImpl; |
63 |
import org.gvsig.app.project.documents.layout.tools.LayoutViewPanListenerImpl; |
64 |
import org.gvsig.app.project.documents.layout.tools.LayoutViewZoomInListenerImpl; |
65 |
import org.gvsig.app.project.documents.layout.tools.LayoutViewZoomOutListenerImpl; |
66 |
import org.gvsig.app.project.documents.layout.tools.LayoutZoomInListenerImpl; |
67 |
import org.gvsig.app.project.documents.layout.tools.LayoutZoomOutListenerImpl; |
68 |
import org.gvsig.app.project.documents.layout.tools.behavior.LayoutBehavior; |
69 |
import org.gvsig.app.project.documents.layout.tools.behavior.LayoutEditBehavior; |
70 |
import org.gvsig.app.project.documents.layout.tools.behavior.LayoutMoveBehavior; |
71 |
import org.gvsig.app.project.documents.layout.tools.behavior.LayoutPointBehavior; |
72 |
import org.gvsig.app.project.documents.layout.tools.behavior.LayoutRectangleBehavior; |
73 |
import org.gvsig.app.project.documents.layout.tools.behavior.LayoutSelectBehavior; |
74 |
import org.gvsig.app.project.documents.layout.tools.behavior.LayoutViewMoveBehavior; |
75 |
import org.gvsig.app.project.documents.layout.tools.behavior.LayoutViewZoomBehavior; |
76 |
import org.gvsig.app.project.documents.layout.tools.behavior.LayoutZoomBehavior; |
77 |
import org.gvsig.app.project.documents.layout.tools.listener.ILayoutGraphicListener; |
78 |
import org.gvsig.fmap.dal.exception.ReadException; |
79 |
import org.gvsig.tools.observer.Observable; |
80 |
|
81 |
/**
|
82 |
* Control of Layout.
|
83 |
*
|
84 |
* @author Vicente Caballero Navarro
|
85 |
*/
|
86 |
public class DefaultLayoutControl extends JComponent implements LayoutControl { |
87 |
private static final int DESACTUALIZADO = 4; |
88 |
private static final int ACTUALIZADO = 5; |
89 |
|
90 |
private static final long serialVersionUID = -8290006366669291510L; |
91 |
|
92 |
public static final String PERSISTENCE_DEFINITION_NAME = "LayoutControl"; |
93 |
|
94 |
private int status = DESACTUALIZADO; |
95 |
private Rectangle2D rectVisible; |
96 |
private BufferedImage img = null; |
97 |
private BufferedImage imgRuler = null; |
98 |
private boolean initial = true; |
99 |
private LayoutContext layoutContext;
|
100 |
private Point origin = new Point(50, 50); |
101 |
private Point rectOrigin = new Point(origin); |
102 |
private Rectangle2D.Double rect = new Rectangle2D.Double(rectOrigin.x, |
103 |
rectOrigin.y, 400, 300); |
104 |
private FLayoutDraw layoutDraw = null; |
105 |
private FLayoutFunctions layoutFunctions = null; |
106 |
private LayoutBehavior currentLayoutTool = null; |
107 |
private Image imageCursor = null; |
108 |
private HashMap namesLayoutTools = new HashMap(); |
109 |
private Point m_FirstPoint = new Point(0, 0); |
110 |
private Point m_PointAnt = new Point(0, 0); |
111 |
private Point m_LastPoint = new Point(0, 0); |
112 |
private LayoutEvents layoutEvents;
|
113 |
private Point position; |
114 |
private GeometryAdapter geometryAdapter = new PolyLineAdapter(); |
115 |
|
116 |
// private String prevTool;
|
117 |
private String currentTool; |
118 |
private boolean m_bCancelDrawing = false; |
119 |
private Rectangle reSel = null; |
120 |
private boolean isReSel = true; |
121 |
private FLayoutZooms layoutZooms;
|
122 |
private LayoutPanel layoutPanel;
|
123 |
|
124 |
private static Cursor transparentCursor = Toolkit.getDefaultToolkit() |
125 |
.createCustomCursor( |
126 |
Toolkit.getDefaultToolkit().createImage(
|
127 |
new MemoryImageSource(16, 16, new int[16 * 16], 0, 16)), |
128 |
new Point(0, 0), "invisiblecursor"); |
129 |
|
130 |
/**
|
131 |
* Create a new object of LayoutControl.
|
132 |
*
|
133 |
* @param layout
|
134 |
*/
|
135 |
public DefaultLayoutControl() {
|
136 |
|
137 |
} |
138 |
|
139 |
public void initialize(LayoutPanel layoutPanel){ |
140 |
this.layoutPanel = layoutPanel;
|
141 |
layoutDraw = new FLayoutDraw(layoutPanel);
|
142 |
layoutEvents = new LayoutEvents(layoutPanel);
|
143 |
layoutZooms = new FLayoutZooms(layoutPanel);
|
144 |
layoutFunctions = new FLayoutFunctions(layoutPanel);
|
145 |
addComponentListener(layoutEvents); |
146 |
addMouseMotionListener(layoutEvents); |
147 |
addMouseListener(layoutEvents); |
148 |
|
149 |
LayoutPanListenerImpl lpl = new LayoutPanListenerImpl(layoutPanel);
|
150 |
addLayoutTool("layoutpan", new LayoutMoveBehavior(lpl)); |
151 |
|
152 |
LayoutZoomInListenerImpl lzil = new LayoutZoomInListenerImpl(layoutPanel);
|
153 |
addLayoutTool("layoutzoomin", new LayoutZoomBehavior(lzil)); |
154 |
|
155 |
LayoutZoomOutListenerImpl lzol = new LayoutZoomOutListenerImpl(layoutPanel);
|
156 |
addLayoutTool("layoutzoomout", new LayoutZoomBehavior(lzol)); |
157 |
|
158 |
LayoutAddViewListenerImpl lavl = new LayoutAddViewListenerImpl(layoutPanel);
|
159 |
addLayoutTool("layoutaddview", new LayoutRectangleBehavior(lavl)); |
160 |
|
161 |
LayoutAddOverViewListenerImpl laovl = |
162 |
new LayoutAddOverViewListenerImpl(layoutPanel);
|
163 |
addLayoutTool("layoutaddoverview", new LayoutRectangleBehavior(laovl)); |
164 |
|
165 |
LayoutAddPictureListenerImpl lapl = |
166 |
new LayoutAddPictureListenerImpl(layoutPanel);
|
167 |
addLayoutTool("layoutaddpicture", new LayoutRectangleBehavior(lapl)); |
168 |
|
169 |
LayoutAddNorthListenerImpl lanorthl = |
170 |
new LayoutAddNorthListenerImpl(layoutPanel);
|
171 |
addLayoutTool("layoutaddnorth", new LayoutRectangleBehavior(lanorthl)); |
172 |
|
173 |
LayoutAddScaleListenerImpl lasl = |
174 |
new LayoutAddScaleListenerImpl(layoutPanel);
|
175 |
addLayoutTool("layoutaddscale", new LayoutRectangleBehavior(lasl)); |
176 |
|
177 |
LayoutAddLegendListenerImpl lall = |
178 |
new LayoutAddLegendListenerImpl(layoutPanel);
|
179 |
addLayoutTool("layoutaddlegend", new LayoutRectangleBehavior(lall)); |
180 |
|
181 |
LayoutAddTextListenerImpl latl = new LayoutAddTextListenerImpl(layoutPanel);
|
182 |
addLayoutTool("layoutaddtext", new LayoutRectangleBehavior(latl)); |
183 |
|
184 |
LayoutAddBoxListenerImpl labl = new LayoutAddBoxListenerImpl(layoutPanel);
|
185 |
addLayoutTool("layoutaddbox", new LayoutRectangleBehavior(labl)); |
186 |
|
187 |
LayoutAddPointListenerImpl lapointl = |
188 |
new LayoutAddPointListenerImpl(layoutPanel);
|
189 |
addLayoutTool("layoutaddpoint", new LayoutPointBehavior(lapointl)); |
190 |
|
191 |
LayoutAddLineListenerImpl lalinel = |
192 |
new LayoutAddLineListenerImpl(layoutPanel);
|
193 |
addLayoutTool("layoutaddline", new LayoutPointBehavior(lalinel)); |
194 |
|
195 |
LayoutAddPolygonListenerImpl lapolygonl = |
196 |
new LayoutAddPolygonListenerImpl(layoutPanel);
|
197 |
addLayoutTool("layoutaddpolygon", new LayoutPointBehavior(lapolygonl)); |
198 |
|
199 |
LayoutAddPolylineListenerImpl lapolylinel = |
200 |
new LayoutAddPolylineListenerImpl(layoutPanel);
|
201 |
addLayoutTool("layoutaddpolyline", new LayoutPointBehavior(lapolylinel)); |
202 |
|
203 |
LayoutAddCircleListenerImpl lacirclel = |
204 |
new LayoutAddCircleListenerImpl(layoutPanel);
|
205 |
addLayoutTool("layoutaddcircle", new LayoutPointBehavior(lacirclel)); |
206 |
|
207 |
LayoutAddRectangleListenerImpl larectanglel = |
208 |
new LayoutAddRectangleListenerImpl(layoutPanel);
|
209 |
addLayoutTool("layoutaddrectangle", new LayoutPointBehavior( |
210 |
larectanglel)); |
211 |
|
212 |
LayoutViewPanListenerImpl lvpl = new LayoutViewPanListenerImpl(layoutPanel);
|
213 |
addLayoutTool("layoutviewpan", new LayoutViewMoveBehavior(lvpl)); |
214 |
|
215 |
LayoutViewZoomInListenerImpl lvzil = |
216 |
new LayoutViewZoomInListenerImpl(layoutPanel);
|
217 |
addLayoutTool("layoutviewzoomin", new LayoutViewZoomBehavior(lvzil)); |
218 |
|
219 |
LayoutViewZoomOutListenerImpl lvzol = |
220 |
new LayoutViewZoomOutListenerImpl(layoutPanel);
|
221 |
addLayoutTool("layoutviewzoomout", new LayoutViewZoomBehavior(lvzol)); |
222 |
|
223 |
LayoutSelectListenerImpl lselectl = |
224 |
new LayoutSelectListenerImpl(layoutPanel);
|
225 |
addLayoutTool("layoutselect", new LayoutSelectBehavior(lselectl)); |
226 |
|
227 |
LayoutEditGraphicsListenerImpl leditl = |
228 |
new LayoutEditGraphicsListenerImpl(layoutPanel);
|
229 |
addLayoutTool("layoutedit", new LayoutEditBehavior(leditl)); |
230 |
} |
231 |
|
232 |
public String getCurrentTool() { |
233 |
return currentTool;
|
234 |
} |
235 |
|
236 |
public void addLayoutTool(String name, LayoutBehavior tool) { |
237 |
namesLayoutTools.put(name, tool); |
238 |
tool.setLayoutControl(this);
|
239 |
} |
240 |
|
241 |
public void setLayoutContext(LayoutContext lc) { |
242 |
layoutContext = lc; |
243 |
layoutContext.addObserver(this);
|
244 |
fullRect(); |
245 |
} |
246 |
|
247 |
/**
|
248 |
* paintComponent of Layout.
|
249 |
*
|
250 |
* @param g
|
251 |
* Graphics of Layout.
|
252 |
*/
|
253 |
protected void paintComponent(Graphics g) { |
254 |
clipVisibleRect((Graphics2D) g);
|
255 |
|
256 |
Rectangle rClip = g.getClipBounds();
|
257 |
|
258 |
if (rClip == null) { |
259 |
System.err.println("clip = null"); |
260 |
} |
261 |
|
262 |
switch (status) {
|
263 |
case DESACTUALIZADO:
|
264 |
if (getWidth() == 0) { |
265 |
return;
|
266 |
} |
267 |
|
268 |
img = |
269 |
new BufferedImage(getWidth(), getHeight(), |
270 |
BufferedImage.TYPE_INT_ARGB);
|
271 |
imgRuler = |
272 |
new BufferedImage(getWidth(), getHeight(), |
273 |
BufferedImage.TYPE_INT_ARGB);
|
274 |
|
275 |
Graphics gimag = img.getGraphics();
|
276 |
Graphics gimgRuler = imgRuler.getGraphics();
|
277 |
clipVisibleRect((Graphics2D) gimag);
|
278 |
|
279 |
// moved to initialize()
|
280 |
// if (initial) {
|
281 |
// fullRect();
|
282 |
// initial = false;
|
283 |
// }
|
284 |
|
285 |
try {
|
286 |
layoutDraw.drawLayout((Graphics2D) gimag, img);
|
287 |
} catch (ReadException e) {
|
288 |
e.printStackTrace(); |
289 |
} |
290 |
|
291 |
g.setClip(rClip); |
292 |
layoutDraw.drawRectangle((Graphics2D) g);
|
293 |
|
294 |
g.drawImage(img, 0, 0, this); |
295 |
g.setClip(rClip); |
296 |
|
297 |
layoutDraw.drawGrid((Graphics2D) gimgRuler);
|
298 |
layoutDraw.drawRuler((Graphics2D) gimgRuler, Color.black); |
299 |
setStatus(ACTUALIZADO); |
300 |
repaint(); |
301 |
|
302 |
break;
|
303 |
|
304 |
case ACTUALIZADO:
|
305 |
layoutDraw.drawRectangle((Graphics2D) g);
|
306 |
|
307 |
if (currentLayoutTool != null) { |
308 |
currentLayoutTool.paintComponent(g); |
309 |
} else {
|
310 |
g.drawImage(img, 0, 0, this); |
311 |
|
312 |
layoutDraw.drawHandlers((Graphics2D) g, Color.black); |
313 |
} |
314 |
|
315 |
g.setClip(rClip); |
316 |
drawCursor(g); |
317 |
} |
318 |
} |
319 |
|
320 |
private void setStatus(int s) { |
321 |
status = s; |
322 |
} |
323 |
|
324 |
/**
|
325 |
* Clip on visible rectangle.
|
326 |
*
|
327 |
* @param g2d
|
328 |
* Graphics.
|
329 |
*/
|
330 |
private void clipVisibleRect(Graphics2D g2d) { |
331 |
rectVisible = this.getVisibleRect();
|
332 |
g2d.clipRect((int) rectVisible.getMinX(), (int) rectVisible.getMinY(), |
333 |
(int) rectVisible.getWidth(), (int) rectVisible.getHeight()); |
334 |
} |
335 |
|
336 |
public BufferedImage getImgRuler() { |
337 |
return imgRuler;
|
338 |
} |
339 |
|
340 |
public void fullRect() { |
341 |
rect.setRect(origin.x, origin.y, getWidth() - (origin.x * 2),
|
342 |
getHeight() - (origin.x * 2));
|
343 |
|
344 |
if (layoutContext.getAttributes().isLandscape()) {
|
345 |
rect = |
346 |
layoutContext.getAttributes().getRectangleLandscape(rect, |
347 |
getWidth(), getHeight()); |
348 |
} else {
|
349 |
rect = |
350 |
layoutContext.getAttributes().getRectanglePortrait(rect, |
351 |
getWidth(), getHeight()); |
352 |
} |
353 |
|
354 |
refresh(); |
355 |
} |
356 |
|
357 |
public Rectangle2D.Double getRect() { |
358 |
return rect;
|
359 |
} |
360 |
|
361 |
public void setRect(Rectangle2D r) { |
362 |
rect.setRect(r); |
363 |
} |
364 |
|
365 |
public BufferedImage getImage() { |
366 |
return img;
|
367 |
} |
368 |
|
369 |
/**
|
370 |
* Draw the cursor on the Graphics.
|
371 |
*
|
372 |
* @param g
|
373 |
* Graphics.
|
374 |
*/
|
375 |
private void drawCursor(Graphics g) { |
376 |
if ((imageCursor != null) && (position != null)) { |
377 |
Point pAdjusted = position;
|
378 |
g.drawImage(imageCursor, (int) pAdjusted.getX() - 16, |
379 |
(int) pAdjusted.getY() - 16, this); |
380 |
} |
381 |
} |
382 |
|
383 |
public void setMapCursor(Image image) { |
384 |
imageCursor = image; |
385 |
} |
386 |
|
387 |
public void setTool(String toolName) { |
388 |
// prevTool=getCurrentTool();
|
389 |
LayoutBehavior layoutTool = |
390 |
(LayoutBehavior) namesLayoutTools.get(toolName); |
391 |
currentLayoutTool = layoutTool; |
392 |
currentLayoutTool.setLayoutControl(this);
|
393 |
currentTool = toolName; |
394 |
this.setMapCursor(layoutTool.getImageCursor());
|
395 |
|
396 |
if (getCurrentLayoutTool().getListener() instanceof ILayoutGraphicListener) { |
397 |
geometryAdapter = |
398 |
((ILayoutGraphicListener) getCurrentLayoutTool().getListener()) |
399 |
.createGeometryAdapter(); |
400 |
} |
401 |
|
402 |
if (getCurrentTool().equals("layoutedit")) { |
403 |
startEdit(); |
404 |
} else {
|
405 |
stopEdit(); |
406 |
} |
407 |
} |
408 |
|
409 |
public void startEdit() { |
410 |
IFFrame[] fframes = layoutContext.getFFrames();
|
411 |
|
412 |
for (int i = 0; i < fframes.length; i++) { |
413 |
IFFrame frame = fframes[i]; |
414 |
|
415 |
if (frame instanceof IFFrameEditableVertex) { |
416 |
if (frame.getSelected() != IFFrame.NOSELECT) {
|
417 |
((IFFrameEditableVertex) frame).startEditing(); |
418 |
} else {
|
419 |
((IFFrameEditableVertex) frame).stopEditing(); |
420 |
} |
421 |
} |
422 |
} |
423 |
|
424 |
refresh(); |
425 |
} |
426 |
|
427 |
public void stopEdit() { |
428 |
boolean refresh = false; |
429 |
IFFrame[] fframes = layoutContext.getFFrames();
|
430 |
|
431 |
for (int i = 0; i < fframes.length; i++) { |
432 |
IFFrame frame = fframes[i]; |
433 |
|
434 |
if (frame instanceof IFFrameEditableVertex) { |
435 |
if (((IFFrameEditableVertex) frame).isEditing()) {
|
436 |
((IFFrameEditableVertex) fframes[i]).stopEditing(); |
437 |
refresh = true;
|
438 |
} |
439 |
} |
440 |
} |
441 |
|
442 |
if (refresh) {
|
443 |
refresh(); |
444 |
} |
445 |
} |
446 |
|
447 |
public Point getRectOrigin() { |
448 |
return rectOrigin;
|
449 |
} |
450 |
|
451 |
public FLayoutDraw getLayoutDraw() {
|
452 |
return layoutDraw;
|
453 |
} |
454 |
|
455 |
public LayoutBehavior getCurrentLayoutTool() {
|
456 |
return currentLayoutTool;
|
457 |
} |
458 |
|
459 |
public Point getFirstPoint() { |
460 |
return m_FirstPoint;
|
461 |
} |
462 |
|
463 |
public Point getPointAnt() { |
464 |
return m_PointAnt;
|
465 |
} |
466 |
|
467 |
public Point getLastPoint() { |
468 |
return m_LastPoint;
|
469 |
} |
470 |
|
471 |
public void setFirstPoint() { |
472 |
m_FirstPoint = position; |
473 |
} |
474 |
|
475 |
public void setPointAnt() { |
476 |
m_PointAnt = position; |
477 |
} |
478 |
|
479 |
public void setLastPoint() { |
480 |
m_LastPoint = position; |
481 |
} |
482 |
|
483 |
public void setPosition(Point point2) { |
484 |
if (layoutContext.isAdjustingToGrid()
|
485 |
&& getCurrentLayoutTool().isAdjustable()) { |
486 |
position = |
487 |
FLayoutUtilities.getPointGrid(point2, layoutContext |
488 |
.getAttributes().getNumUnitsX(), layoutContext |
489 |
.getAttributes().getNumUnitsY(), layoutContext.getAT()); |
490 |
} else {
|
491 |
position = point2; |
492 |
} |
493 |
} |
494 |
|
495 |
public Point getPosition() { |
496 |
return position;
|
497 |
} |
498 |
|
499 |
public AffineTransform getAT() { |
500 |
return layoutContext.getAT();
|
501 |
} |
502 |
|
503 |
public GeometryAdapter getGeometryAdapter() {
|
504 |
return geometryAdapter;
|
505 |
} |
506 |
|
507 |
public void delLastPoint() { |
508 |
getGeometryAdapter().delLastPoint(); |
509 |
} |
510 |
|
511 |
public int addGeometryAdapterPoint() { |
512 |
return getGeometryAdapter().addPoint(
|
513 |
FLayoutUtilities.toSheetPoint(getPosition(), getAT())); |
514 |
} |
515 |
|
516 |
public void setGeometryAdapterPoinPosition() { |
517 |
getGeometryAdapter().pointPosition( |
518 |
FLayoutUtilities.toSheetPoint(getPosition(), getAT())); |
519 |
} |
520 |
|
521 |
public void clearMouseImage() { |
522 |
setCursor(transparentCursor); |
523 |
} |
524 |
|
525 |
public void refresh() { |
526 |
setStatus(DESACTUALIZADO); |
527 |
repaint(); |
528 |
} |
529 |
|
530 |
public synchronized boolean isDrawingCancelled() { |
531 |
return m_bCancelDrawing;
|
532 |
} |
533 |
|
534 |
public synchronized void setCancelDrawing(boolean b) { |
535 |
m_bCancelDrawing = b; |
536 |
|
537 |
for (int i = 0; i < layoutContext.getFFrames().length; i++) { |
538 |
IFFrame fframe = layoutContext.getFFrame(i); |
539 |
|
540 |
if (fframe instanceof IFFrameUseFMap |
541 |
&& (((IFFrameUseFMap) fframe).getMapContext() != null)) {
|
542 |
// //TODO((FFrameView)
|
543 |
// getFFrames().get(i)).getFMap().setCancelDrawing(b);
|
544 |
} |
545 |
} |
546 |
} |
547 |
|
548 |
public Rectangle getReSel() { |
549 |
return reSel;
|
550 |
} |
551 |
|
552 |
public boolean isReSel() { |
553 |
return isReSel;
|
554 |
} |
555 |
|
556 |
public void setIsReSel(boolean b) { |
557 |
isReSel = b; |
558 |
} |
559 |
|
560 |
public void viewFull() throws ReadException { |
561 |
IFFrame[] fframes = layoutContext.getSelectedFFrames();
|
562 |
|
563 |
for (int i = 0; i < fframes.length; i++) { |
564 |
if (fframes[i] instanceof IFFrameUseFMap) { |
565 |
IFFrameUseFMap fframe = (IFFrameUseFMap) fframes[i]; |
566 |
|
567 |
if (fframe.getMapContext() != null) { |
568 |
fframe.fullExtent(); |
569 |
} |
570 |
|
571 |
fframe.refresh(); |
572 |
} |
573 |
} |
574 |
|
575 |
refresh(); |
576 |
} |
577 |
|
578 |
public FLayoutZooms getLayoutZooms() {
|
579 |
return layoutZooms;
|
580 |
} |
581 |
|
582 |
public FLayoutFunctions getLayoutFunctions() {
|
583 |
return layoutFunctions;
|
584 |
} |
585 |
|
586 |
public LayoutContext getLayoutContext() {
|
587 |
return layoutContext;
|
588 |
} |
589 |
|
590 |
public void setGeometryAdapter(GeometryAdapter adapter) { |
591 |
geometryAdapter = adapter; |
592 |
} |
593 |
|
594 |
public JComponent getComponent() { |
595 |
return this; |
596 |
} |
597 |
|
598 |
public void update(Observable observable, Object notification) { |
599 |
if ((notification != null) && (notification instanceof LayoutNotification)){ |
600 |
LayoutNotification layoutNotification = (LayoutNotification)notification; |
601 |
if (LayoutNotification.LAYOUT_VALIDATED.equals(layoutNotification.getType())){
|
602 |
status = ACTUALIZADO; |
603 |
}else if (LayoutNotification.LAYOUT_INVALIDATED.equals(layoutNotification.getType())){ |
604 |
status = DESACTUALIZADO; |
605 |
}else if (LayoutNotification.LAYOUT_REFRESH.equals(layoutNotification.getType())){ |
606 |
refresh(); |
607 |
} |
608 |
} |
609 |
} |
610 |
} |