74 |
74 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.MouseMovementBehavior;
|
75 |
75 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.MouseWheelBehavior;
|
76 |
76 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.MoveBehavior;
|
|
77 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.MoveWithMiddleButtonBehavior;
|
77 |
78 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.PointBehavior;
|
78 |
79 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.PolygonBehavior;
|
79 |
80 |
import org.gvsig.fmap.mapcontrol.tools.Behavior.PolylineBehavior;
|
... | ... | |
108 |
109 |
* of the View where the user can put some layers which summarizes the view. It
|
109 |
110 |
* is used to make the navigation easier and faster.</li>
|
110 |
111 |
* </ol>
|
111 |
|
*
|
|
112 |
*
|
112 |
113 |
* @author 2005- Vicente Caballero
|
113 |
114 |
* @author 2009- Joaquin del Cerro
|
114 |
|
*
|
|
115 |
*
|
115 |
116 |
*/
|
116 |
117 |
public class DefaultViewPanel extends AbstractViewPanel implements Observer {
|
117 |
118 |
/**
|
118 |
|
*
|
|
119 |
*
|
119 |
120 |
*/
|
120 |
121 |
private static final long serialVersionUID = -4044661458841786519L;
|
121 |
122 |
|
... | ... | |
131 |
132 |
/**
|
132 |
133 |
* Creates a new View object. Before being used, the object must be
|
133 |
134 |
* initialized.
|
134 |
|
*
|
|
135 |
*
|
135 |
136 |
* @see initialize()
|
136 |
137 |
*/
|
137 |
138 |
public DefaultViewPanel() {
|
... | ... | |
406 |
407 |
ZoomOutListener zol = new ZoomOutListener(m_MapControl);
|
407 |
408 |
|
408 |
409 |
m_MapControl.addBehavior("zoomOut", new Behavior[] {
|
409 |
|
new PointBehavior(zol), new MouseMovementBehavior(sbl) });
|
|
410 |
new PointBehavior(zol)});
|
410 |
411 |
|
411 |
412 |
// pan
|
412 |
413 |
|
413 |
414 |
PanListener pl = new PanListener(m_MapControl);
|
414 |
|
m_MapControl.addBehavior("pan", new Behavior[] { new MoveBehavior(pl),
|
415 |
|
new MouseMovementBehavior(sbl) });
|
|
415 |
m_MapControl.addBehavior("pan", new Behavior[] { new MoveBehavior(pl)});
|
416 |
416 |
|
417 |
417 |
// Medir
|
418 |
418 |
|
419 |
419 |
MeasureListener mli = new MeasureListener(m_MapControl);
|
420 |
420 |
m_MapControl.addBehavior("medicion", new Behavior[] {
|
421 |
|
new PolylineBehavior(mli), new MouseMovementBehavior(sbl) });
|
|
421 |
new PolylineBehavior(mli)});
|
422 |
422 |
|
423 |
423 |
// Area
|
424 |
424 |
|
425 |
425 |
AreaListener ali = new AreaListener(m_MapControl);
|
426 |
426 |
m_MapControl.addBehavior("area", new Behavior[] {
|
427 |
|
new PolygonBehavior(ali), new MouseMovementBehavior(sbl) });
|
|
427 |
new PolygonBehavior(ali)});
|
428 |
428 |
|
429 |
429 |
// Seleccion por punto
|
430 |
430 |
PointSelectListener psl = new PointSelectListener(m_MapControl);
|
431 |
431 |
m_MapControl.addBehavior("pointSelection", new Behavior[] {
|
432 |
|
new PointBehavior(psl), new MouseMovementBehavior(sbl) });
|
|
432 |
new PointBehavior(psl)});
|
433 |
433 |
|
434 |
434 |
// Info por punto
|
435 |
435 |
InfoListener il = new InfoListener(m_MapControl);
|
436 |
436 |
m_MapControl.addBehavior("info", new Behavior[] {
|
437 |
|
new PointBehavior(il), new MouseMovementBehavior(sbl) });
|
|
437 |
new PointBehavior(il)});
|
438 |
438 |
|
439 |
439 |
// Selecci?n por rect?ngulo
|
440 |
440 |
RectangleSelectListener rsl = new RectangleSelectListener(m_MapControl);
|
441 |
441 |
m_MapControl.addBehavior("rectSelection", new Behavior[] {
|
442 |
|
new RectangleBehavior(rsl), new MouseMovementBehavior(sbl) });
|
|
442 |
new RectangleBehavior(rsl)});
|
443 |
443 |
|
444 |
444 |
// Selecci?n por pol?gono
|
445 |
445 |
PolygonSelectListener poligSel =
|
446 |
446 |
new PolygonSelectListener(m_MapControl);
|
447 |
447 |
m_MapControl.addBehavior("polSelection", new Behavior[] {
|
448 |
|
new PolygonBehavior(poligSel), new MouseMovementBehavior(sbl) });
|
|
448 |
new PolygonBehavior(poligSel)});
|
449 |
449 |
|
450 |
450 |
// Zoom por rect?ngulo
|
451 |
451 |
ZoomOutRightButtonListener zoil =
|
452 |
452 |
new ZoomOutRightButtonListener(m_MapControl);
|
453 |
453 |
ZoomInListener zil = new ZoomInListener(m_MapControl);
|
454 |
454 |
m_MapControl.addBehavior("zoomIn", new Behavior[] {
|
455 |
|
new RectangleBehavior(zil), new PointBehavior(zoil),
|
456 |
|
new MouseMovementBehavior(sbl) });
|
|
455 |
new RectangleBehavior(zil), new PointBehavior(zoil)});
|
457 |
456 |
|
458 |
457 |
/*
|
459 |
458 |
SelectImageListener sil = new SelectImageListener(m_MapControl);
|
... | ... | |
462 |
461 |
*/
|
463 |
462 |
|
464 |
463 |
m_MapControl.setTool("zoomIn"); // Por defecto
|
|
464 |
m_MapControl.addCombinedBehavior(new MouseMovementBehavior(sbl));
|
465 |
465 |
m_MapControl.addCombinedBehavior(new MouseWheelBehavior());
|
|
466 |
m_MapControl.addCombinedBehavior(new MoveWithMiddleButtonBehavior(pl));
|
466 |
467 |
}
|
467 |
468 |
|
468 |
469 |
public void windowActivated() {
|
469 |
470 |
super.windowActivated();
|
470 |
|
|
|
471 |
|
471 |
472 |
NewStatusBar statusbar = PluginServices.getMainFrame().getStatusBar();
|
472 |
473 |
MapContext mapContext = this.getMapControl().getMapContext();
|
473 |
474 |
|
... | ... | |
536 |
537 |
/**
|
537 |
538 |
* Sets the default map overview background color that will be used in
|
538 |
539 |
* subsequent projects.
|
539 |
|
*
|
|
540 |
*
|
540 |
541 |
* @param color
|
541 |
542 |
* @deprecated use instead
|
542 |
543 |
* Project.getPreferences().setDefaultMapoverViewBackColor
|
... | ... | |
548 |
549 |
/**
|
549 |
550 |
* Returns the current default map overview background color defined which
|
550 |
551 |
* is the color defined when the user does not define any other one
|
551 |
|
*
|
|
552 |
*
|
552 |
553 |
* @return java.awt.Color
|
553 |
554 |
* @deprecated use instead
|
554 |
555 |
* Project.getPreferences().setDefaultMapoverViewBackColor
|
... | ... | |
560 |
561 |
/**
|
561 |
562 |
* Returns the current default view background color defined which is the
|
562 |
563 |
* color defined when the user does not define any other one
|
563 |
|
*
|
|
564 |
*
|
564 |
565 |
* @return java.awt.Color
|
565 |
566 |
* @deprecated use instead Project.getPreferences().getDefaultViewBackColor
|
566 |
567 |
*/
|
... | ... | |
604 |
605 |
}
|
605 |
606 |
}
|
606 |
607 |
}
|
607 |
|
|
|
608 |
|
608 |
609 |
private static boolean disableConsole = false;
|
609 |
|
|
|
610 |
|
610 |
611 |
public static void setDisableConsole(boolean disable){
|
611 |
612 |
disableConsole = disable;
|
612 |
613 |
}
|
613 |
|
|
|
614 |
|
614 |
615 |
}
|