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