public class TLcdGXYOverviewController extends ALcdGXYSmartController implements MouseListener, MouseMotionListener
ILcdGXYController
allows to fit one "slave"
ILcdGXYView
into a rectangle painted on the ILcdGXYView
this ILcdGXYController
is interacting with (the "master"
ILcdGXYView
).
Each time the rectangle is moved or reshaped on the master
ILcdGXYView
, this TLcdGXYOverviewController
tries to
make the area visible in the slave ILcdGXYView
corresponding to
the area that the rectangle covers.
If the scale or the origin of the slave ILcdGXYView
changes
(after a zoom or a pan for example), this TLcdGXYOverviewController
will redraw the rectangle on its ILcdGXYView
, to make it match
the area covered by the slave ILcdGXYView
.
When the slave view is modified to display the specified rectangle, the necessary
TLcdUndoableEvent
objects are fired to make this modification undoable. All
listeners registered with the addUndoableListener
method will be notified of these
events.
To use this ILcdGXYController
properly, you must set a valid
ILcdXYWorldXYWorldTransformation
, that can transform a
XYWorld bounds in the master ILcdGXYView
into a XYWorld bounds
in the slave ILcdGXYView
.
ILcdXYWorldXYWorldTransformation
,
Serialized FormConstructor and Description |
---|
TLcdGXYOverviewController() |
TLcdGXYOverviewController(boolean aRegisterInstance)
Deprecated.
use one of the constructors without the aRegisterInstance parameter.
|
TLcdGXYOverviewController(ILcdGXYView aSlaveView) |
TLcdGXYOverviewController(ILcdGXYView aSlaveView,
boolean aRegisterInstance)
Deprecated.
use one of the constructors without the aRegisterInstance parameter.
|
Modifier and Type | Method and Description |
---|---|
void |
adjustSlaveView(EventObject aEventObject,
Rectangle aRectangleDragged)
Adjusts the "slave"
ILcdGXYView to fit into aRectangleDragged
painted on the ILcdGXYView this ILcdGXYController
is interacting with. |
protected void |
cleanGhost() |
protected void |
drawGhost(Graphics aGraphics)
Draws the dragged
Rectangle on getGXYView().getGraphics() . |
protected void |
drawGhost(Rectangle aRectangle,
Graphics aGraphics)
Draws the dragged
Rectangle on aGraphics. |
Rectangle |
getCurrentRectangle() |
Color |
getFillColor()
Returns the color with which to fill the master view's rectangle.
|
Color |
getGhostColor()
Gets the
Color used when dragging the rectangle on the "master"
ILcdGXYView , i.e. the ILcdGXYView this
ILcdGXYController is interacting with. |
int |
getLineWidth()
Gets the line width used when dragging the rectangle on the "master"
ILcdGXYView , i.e. the ILcdGXYView this
ILcdGXYController is interacting with. |
ILcdGXYView |
getSlaveView()
Gets the current "slave"
ILcdGXYView . |
ILcdXYWorldXYWorldTransformation |
getXYWorldXYWorldTransformation()
Gets the current
ILcdXYWorldXYWorldTransformation . |
boolean |
isDragCentered() |
boolean |
isFilled()
Returns whether the master view's rectangle is filled.
|
boolean |
isForceToSquare() |
boolean |
isRepaintOnReleased() |
boolean |
isTraceOn()
Deprecated.
This method has been deprecated. It is recommended to use the
standard Java logging framework directly.
|
void |
mouseClicked(MouseEvent me) |
void |
mouseDragged(MouseEvent me) |
void |
mouseEntered(MouseEvent me) |
void |
mouseExited(MouseEvent me)
Will perform a pan depending on the values of isDragging,
isPanOnMouseDragExit and isPanOnMouseMoveExit properties
|
void |
mouseMoved(MouseEvent me) |
void |
mousePressed(MouseEvent me) |
void |
mouseReleased(MouseEvent me) |
void |
paint(Graphics aGraphics)
Enables the controller to give visual feedback on the current user interactions.
|
void |
setDragCentered(boolean aDragCentered) |
void |
setFillColor(Color aFillColor)
Sets the color with which to fill the master view's rectangle to
aFillColor . |
void |
setFilled(boolean aFilled)
Sets whether the master view's rectangle should be filled.
|
void |
setForceToSquare(boolean aForceToSquare)
Forces the dragged rectangle to be square or not.
|
void |
setGhostColor(Color aGhostColor)
Sets the
Color to use when dragging the rectangle on the "master"
ILcdGXYView , i.e. the ILcdGXYView this
ILcdGXYController is interacting with. |
void |
setLineWidth(int aLineWidth)
Sets the line width to use when dragging the rectangle on the "master"
ILcdGXYView , i.e. the ILcdGXYView this
ILcdGXYController is interacting with. |
void |
setRepaintOnReleased(boolean aRepaintOnReleased) |
void |
setSlaveView(ILcdGXYView aSlaveView)
Sets a "slave"
ILcdGXYView . |
void |
setTraceOn(boolean aTraceOn)
Deprecated.
This method has been deprecated. It is recommended to use the
standard Java logging framework directly.
|
void |
setXYWorldXYWorldTransformation(ILcdXYWorldXYWorldTransformation newXYWorldXYWorldTransformation)
Sets an
ILcdXYWorldXYWorldTransformation . |
void |
startInteraction(ILcdGXYView aGXYView)
Sets up the controller to receive input through the view passed.
|
void |
terminateInteraction(ILcdGXYView aGXYView)
Releases a few items.
|
void |
viewRepaint(ILcdGXYView aGXYView)
Empty implementation.
|
addUndoableListener, doPanGXYView, doZoomGXYView, fireUndoableEvent, getDownPanChars, getDownPanCodes, getLeftPanChars, getLeftPanCodes, getPanAbsDelta, getPanAbsDelta, getRightPanChars, getRightPanCodes, getUndoableListenerCount, getUpPanChars, getUpPanCodes, getZoomInChars, getZoomInCodes, getZoomOutChars, getZoomOutCodes, isDragging, isPanOnMouseDragExit, isPanOnMouseMoveExit, isPanUndoable, isRequestFocusOnMouseEntered, isRequestFocusOnMousePressed, isZoomUndoable, keyPressed, keyReleased, keyTyped, removeUndoableListener, setDownPanChars, setDownPanCodes, setIsDragging, setLeftPanChars, setLeftPanCodes, setPanAbsDelta, setPanOnMouseDragExit, setPanOnMouseMoveExit, setPanUndoable, setRequestFocusOnMouseEntered, setRequestFocusOnMousePressed, setRightPanChars, setRightPanCodes, setUpPanChars, setUpPanCodes, setZoomInChars, setZoomInCodes, setZoomOutChars, setZoomOutCodes, setZoomUndoable, updateViewLocationAfterZoomSFCT
addStatusListener, asGXYController, fireStatusEvent, getCursor, getGXYView, getIcon, getName, getShortDescription, registerInstance, removeStatusListener, retrieveGXYViewXYWorldTransformation, setClassTraceOn, setCursor, setGXYView, setIcon, setName, setShortDescription
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getLayered
public TLcdGXYOverviewController()
public TLcdGXYOverviewController(ILcdGXYView aSlaveView)
public TLcdGXYOverviewController(boolean aRegisterInstance)
public TLcdGXYOverviewController(ILcdGXYView aSlaveView, boolean aRegisterInstance)
public void setTraceOn(boolean aTraceOn)
true
or false
as argument automatically turns
off tracing for all other class instances for which
setTraceOn
has not been called.
If the argument is false
then only the informative, warning
and error log messages are recorded.setTraceOn
in class ALcdGXYSmartController
aTraceOn
- if true then all log messages are recorded for this
instance. If false, then only the informative, warning and
error log messages are recorded.public boolean isTraceOn()
true
if tracing is enabled for this class.isTraceOn
in class ALcdGXYSmartController
public void startInteraction(ILcdGXYView aGXYView)
ALcdGXYController
All ILcdGXYView
implementations that support interaction call this method when the controller
has been made active with setGXYController
on the view,
so this method shouldn't normally be called directly.
Note that most view implementations add the controller as listener if appropriate before calling
this method.
Sets the cursor on the view and sets the view for which this controller is now active.
Sends out a status event based on the short description
.
startInteraction
in interface ILcdGXYController
startInteraction
in class ALcdGXYSmartController
aGXYView
- the ILcdGXYView
this ILcdGXYController
will interact with.ILcdGXYView.setGXYController(com.luciad.view.gxy.ILcdGXYController)
,
ILcdGXYController.terminateInteraction(com.luciad.view.gxy.ILcdGXYView)
public void terminateInteraction(ILcdGXYView aGXYView)
ALcdGXYController
terminateInteraction
in interface ILcdGXYController
terminateInteraction
in class ALcdGXYSmartController
aGXYView
- the ILcdGXYView
this ILcdGXYController
interacted with.ILcdGXYView.setGXYController(com.luciad.view.gxy.ILcdGXYController)
,
ILcdGXYController.startInteraction(com.luciad.view.gxy.ILcdGXYView)
public void setSlaveView(ILcdGXYView aSlaveView)
ILcdGXYView
.public ILcdGXYView getSlaveView()
ILcdGXYView
.public void setGhostColor(Color aGhostColor)
Color
to use when dragging the rectangle on the "master"
ILcdGXYView
, i.e. the ILcdGXYView
this
ILcdGXYController
is interacting with.public Color getGhostColor()
Color
used when dragging the rectangle on the "master"
ILcdGXYView
, i.e. the ILcdGXYView
this
ILcdGXYController
is interacting with.public void setLineWidth(int aLineWidth)
ILcdGXYView
, i.e. the ILcdGXYView
this
ILcdGXYController
is interacting with.public int getLineWidth()
ILcdGXYView
, i.e. the ILcdGXYView
this
ILcdGXYController
is interacting with.public void setFilled(boolean aFilled)
aFilled
- true to fill the master view rectangle with the set fill color.isFilled()
,
setFillColor(java.awt.Color)
public boolean isFilled()
true
if the master view rectangle is filled with the set fill colorsetFilled(boolean)
,
getFillColor()
public void setFillColor(Color aFillColor)
aFillColor
.aFillColor
- the color to be used when filling the master view rectanglegetFillColor()
,
setFilled(boolean)
public Color getFillColor()
setFillColor(java.awt.Color)
,
isFilled()
public void setForceToSquare(boolean aForceToSquare)
public boolean isForceToSquare()
setForceToSquare(boolean)
public void setDragCentered(boolean aDragCentered)
aDragCentered
- if true
, the center of the dragged rectangle will
stay where the mouse has been pressed. If false
, it will be at the center
of the rectangle defined by where the mouse has been pressed, and it current
location. Default value if true
.public boolean isDragCentered()
setDragCentered(boolean)
public void setRepaintOnReleased(boolean aRepaintOnReleased)
aRepaintOnReleased
- if true
, this TLcdGXYDragRectangleController
will repaint the ILcdGXYView
on mouseReleased. Default if
true
.public boolean isRepaintOnReleased()
setRepaintOnReleased(boolean)
public Rectangle getCurrentRectangle()
public void paint(Graphics aGraphics)
ALcdGXYController
Empty implementation. Redefine this method to render on the Graphics on which the view is rendered.
paint
in interface ILcdGXYController
paint
in class ALcdGXYController
aGraphics
- the Graphics on which the view was rendered.public void viewRepaint(ILcdGXYView aGXYView)
ALcdGXYController
viewRepaint
in interface ILcdGXYController
viewRepaint
in class ALcdGXYController
aGXYView
- the ILcdGXYView
to draw on.protected void drawGhost(Graphics aGraphics)
Rectangle
on getGXYView().getGraphics()
.protected void drawGhost(Rectangle aRectangle, Graphics aGraphics)
Rectangle
on aGraphics.protected void cleanGhost()
public void mousePressed(MouseEvent me)
mousePressed
in interface MouseListener
mousePressed
in class ALcdGXYSmartController
public void mouseMoved(MouseEvent me)
mouseMoved
in interface MouseMotionListener
mouseMoved
in class ALcdGXYSmartController
public void mouseDragged(MouseEvent me)
mouseDragged
in interface MouseMotionListener
mouseDragged
in class ALcdGXYSmartController
public void mouseClicked(MouseEvent me)
mouseClicked
in interface MouseListener
mouseClicked
in class ALcdGXYSmartController
public void mouseEntered(MouseEvent me)
mouseEntered
in interface MouseListener
mouseEntered
in class ALcdGXYSmartController
public void mouseExited(MouseEvent me)
ALcdGXYSmartController
mouseExited
in interface MouseListener
mouseExited
in class ALcdGXYSmartController
public void mouseReleased(MouseEvent me)
mouseReleased
in interface MouseListener
mouseReleased
in class ALcdGXYSmartController
public void adjustSlaveView(EventObject aEventObject, Rectangle aRectangleDragged)
ILcdGXYView
to fit into aRectangleDragged
painted on the ILcdGXYView
this ILcdGXYController
is interacting with.NullPointerException
- if no
ILcdXYWorldXYWorldTransformation
has been set.public void setXYWorldXYWorldTransformation(ILcdXYWorldXYWorldTransformation newXYWorldXYWorldTransformation)
ILcdXYWorldXYWorldTransformation
. A non null
value must be set.public ILcdXYWorldXYWorldTransformation getXYWorldXYWorldTransformation()
ILcdXYWorldXYWorldTransformation
.