Class TLcdGXYOverviewController
- All Implemented Interfaces:
ILcdUndoableSource
,ILcdStatusSource
,ILcdGXYController
,KeyListener
,MouseListener
,MouseMotionListener
,Serializable
,EventListener
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
.
- See Also:
-
Constructor Summary
ConstructorDescriptionTLcdGXYOverviewController
(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. -
Method Summary
Modifier and TypeMethodDescriptionvoid
adjustSlaveView
(EventObject aEventObject, Rectangle aRectangleDragged) Adjusts the "slave"ILcdGXYView
to fit into aRectangleDragged painted on theILcdGXYView
thisILcdGXYController
is interacting with.protected void
protected void
Draws the draggedRectangle
ongetGXYView().getGraphics()
.protected void
Draws the draggedRectangle
on aGraphics.Returns the color with which to fill the master view's rectangle.Gets theColor
used when dragging the rectangle on the "master"ILcdGXYView
, i.e. theILcdGXYView
thisILcdGXYController
is interacting with.int
Gets the line width used when dragging the rectangle on the "master"ILcdGXYView
, i.e. theILcdGXYView
thisILcdGXYController
is interacting with.Gets the current "slave"ILcdGXYView
.Gets the currentILcdXYWorldXYWorldTransformation
.boolean
boolean
isFilled()
Returns whether the master view's rectangle is filled.boolean
boolean
boolean
Deprecated.This method has been deprecated.void
void
void
void
Will perform a pan depending on the values of isDragging, isPanOnMouseDragExit and isPanOnMouseMoveExit propertiesvoid
mouseMoved
(MouseEvent me) void
void
void
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 toaFillColor
.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 theColor
to use when dragging the rectangle on the "master"ILcdGXYView
, i.e. theILcdGXYView
thisILcdGXYController
is interacting with.void
setLineWidth
(int aLineWidth) Sets the line width to use when dragging the rectangle on the "master"ILcdGXYView
, i.e. theILcdGXYView
thisILcdGXYController
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.void
setXYWorldXYWorldTransformation
(ILcdXYWorldXYWorldTransformation newXYWorldXYWorldTransformation) Sets anILcdXYWorldXYWorldTransformation
.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.Methods inherited from class com.luciad.view.gxy.controller.ALcdGXYSmartController
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
Methods inherited from class com.luciad.view.gxy.controller.ALcdGXYController
addStatusListener, asGXYController, fireStatusEvent, getCursor, getGXYView, getIcon, getName, getShortDescription, registerInstance, removeStatusListener, retrieveGXYViewXYWorldTransformation, setClassTraceOn, setCursor, setGXYView, setIcon, setName, setShortDescription
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.luciad.view.gxy.ILcdGXYController
getLayered
-
Constructor Details
-
TLcdGXYOverviewController
public TLcdGXYOverviewController() -
TLcdGXYOverviewController
-
TLcdGXYOverviewController
public TLcdGXYOverviewController(boolean aRegisterInstance) Deprecated.use one of the constructors without the aRegisterInstance parameter. -
TLcdGXYOverviewController
Deprecated.use one of the constructors without the aRegisterInstance parameter.
-
-
Method Details
-
setTraceOn
public void setTraceOn(boolean aTraceOn) Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Enables tracing for this class instance. Calling this method with eithertrue
orfalse
as argument automatically turns off tracing for all other class instances for whichsetTraceOn
has not been called. If the argument isfalse
then only the informative, warning and error log messages are recorded.- Overrides:
setTraceOn
in classALcdGXYSmartController
- Parameters:
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.
-
isTraceOn
public boolean isTraceOn()Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Returnstrue
if tracing is enabled for this class.- Overrides:
isTraceOn
in classALcdGXYSmartController
- Returns:
- true if tracing is enabled for this class, false otherwise.
-
startInteraction
Description copied from class:ALcdGXYController
Sets up the controller to receive input through the view passed.All
ILcdGXYView
implementations that support interaction call this method when the controller has been made active withsetGXYController
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
.- Specified by:
startInteraction
in interfaceILcdGXYController
- Overrides:
startInteraction
in classALcdGXYSmartController
- Parameters:
aGXYView
- theILcdGXYView
thisILcdGXYController
will interact with.- See Also:
-
terminateInteraction
Description copied from class:ALcdGXYController
Releases a few items. Can be redefined but this 'super' method should be called too.- Specified by:
terminateInteraction
in interfaceILcdGXYController
- Overrides:
terminateInteraction
in classALcdGXYSmartController
- Parameters:
aGXYView
- theILcdGXYView
thisILcdGXYController
interacted with.- See Also:
-
setSlaveView
Sets a "slave"ILcdGXYView
. -
getSlaveView
Gets the current "slave"ILcdGXYView
. -
setGhostColor
Sets theColor
to use when dragging the rectangle on the "master"ILcdGXYView
, i.e. theILcdGXYView
thisILcdGXYController
is interacting with. -
getGhostColor
Gets theColor
used when dragging the rectangle on the "master"ILcdGXYView
, i.e. theILcdGXYView
thisILcdGXYController
is interacting with. -
setLineWidth
public void setLineWidth(int aLineWidth) Sets the line width to use when dragging the rectangle on the "master"ILcdGXYView
, i.e. theILcdGXYView
thisILcdGXYController
is interacting with. -
getLineWidth
public int getLineWidth()Gets the line width used when dragging the rectangle on the "master"ILcdGXYView
, i.e. theILcdGXYView
thisILcdGXYController
is interacting with. -
setFilled
public void setFilled(boolean aFilled) Sets whether the master view's rectangle should be filled. A filled rectangle can be moved by dragging its contents or its border, whereas an unfilled rectangle can only be moved by dragging its border.- Parameters:
aFilled
- true to fill the master view rectangle with the set fill color.- See Also:
-
isFilled
public boolean isFilled()Returns whether the master view's rectangle is filled.- Returns:
true
if the master view rectangle is filled with the set fill color- See Also:
-
setFillColor
Sets the color with which to fill the master view's rectangle toaFillColor
.- Parameters:
aFillColor
- the color to be used when filling the master view rectangle- See Also:
-
getFillColor
Returns the color with which to fill the master view's rectangle.- Returns:
- the color to be used when filling the master view rectangle
- See Also:
-
setForceToSquare
public void setForceToSquare(boolean aForceToSquare) Forces the dragged rectangle to be square or not. -
isForceToSquare
public boolean isForceToSquare()- See Also:
-
setDragCentered
public void setDragCentered(boolean aDragCentered) - Parameters:
aDragCentered
- iftrue
, the center of the dragged rectangle will stay where the mouse has been pressed. Iffalse
, it will be at the center of the rectangle defined by where the mouse has been pressed, and it current location. Default value iftrue
.
-
isDragCentered
public boolean isDragCentered()- See Also:
-
setRepaintOnReleased
public void setRepaintOnReleased(boolean aRepaintOnReleased) - Parameters:
aRepaintOnReleased
- iftrue
, thisTLcdGXYDragRectangleController
will repaint theILcdGXYView
on mouseReleased. Default iftrue
.
-
isRepaintOnReleased
public boolean isRepaintOnReleased()- See Also:
-
getCurrentRectangle
- Returns:
- the current dragged rectangle as a java.awt.Rectangle. Do not attempt to keep reference or change the returned Rectangle. Make a copy if necessary.
-
paint
Description copied from class:ALcdGXYController
Enables the controller to give visual feedback on the current user interactions. Note that the controller is responsible for repainting the view.Empty implementation. Redefine this method to render on the Graphics on which the view is rendered.
- Specified by:
paint
in interfaceILcdGXYController
- Overrides:
paint
in classALcdGXYController
- Parameters:
aGraphics
- the Graphics on which the view was rendered.
-
viewRepaint
Description copied from class:ALcdGXYController
Empty implementation.- Specified by:
viewRepaint
in interfaceILcdGXYController
- Overrides:
viewRepaint
in classALcdGXYController
- Parameters:
aGXYView
- theILcdGXYView
to draw on.
-
drawGhost
Draws the draggedRectangle
ongetGXYView().getGraphics()
. -
drawGhost
Draws the draggedRectangle
on aGraphics. -
cleanGhost
protected void cleanGhost() -
mousePressed
- Specified by:
mousePressed
in interfaceMouseListener
- Overrides:
mousePressed
in classALcdGXYSmartController
-
mouseMoved
- Specified by:
mouseMoved
in interfaceMouseMotionListener
- Overrides:
mouseMoved
in classALcdGXYSmartController
-
mouseDragged
- Specified by:
mouseDragged
in interfaceMouseMotionListener
- Overrides:
mouseDragged
in classALcdGXYSmartController
-
mouseClicked
- Specified by:
mouseClicked
in interfaceMouseListener
- Overrides:
mouseClicked
in classALcdGXYSmartController
-
mouseEntered
- Specified by:
mouseEntered
in interfaceMouseListener
- Overrides:
mouseEntered
in classALcdGXYSmartController
-
mouseExited
Description copied from class:ALcdGXYSmartController
Will perform a pan depending on the values of isDragging, isPanOnMouseDragExit and isPanOnMouseMoveExit properties- Specified by:
mouseExited
in interfaceMouseListener
- Overrides:
mouseExited
in classALcdGXYSmartController
-
mouseReleased
- Specified by:
mouseReleased
in interfaceMouseListener
- Overrides:
mouseReleased
in classALcdGXYSmartController
-
adjustSlaveView
Adjusts the "slave"ILcdGXYView
to fit into aRectangleDragged painted on theILcdGXYView
thisILcdGXYController
is interacting with.- Throws:
NullPointerException
- if noILcdXYWorldXYWorldTransformation
has been set.
-
setXYWorldXYWorldTransformation
public void setXYWorldXYWorldTransformation(ILcdXYWorldXYWorldTransformation newXYWorldXYWorldTransformation) Sets anILcdXYWorldXYWorldTransformation
. A nonnull
value must be set. -
getXYWorldXYWorldTransformation
Gets the currentILcdXYWorldXYWorldTransformation
.
-