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
ConstructorsConstructorDescriptionTLcdGXYOverviewController(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 TypeMethodDescriptionvoidadjustSlaveView(EventObject aEventObject, Rectangle aRectangleDragged) Adjusts the "slave"ILcdGXYViewto fit into aRectangleDragged painted on theILcdGXYViewthisILcdGXYControlleris interacting with.protected voidprotected voidDraws the draggedRectangleongetGXYView().getGraphics().protected voidDraws the draggedRectangleon aGraphics.Returns the color with which to fill the master view's rectangle.Gets theColorused when dragging the rectangle on the "master"ILcdGXYView, i.e. theILcdGXYViewthisILcdGXYControlleris interacting with.intGets the line width used when dragging the rectangle on the "master"ILcdGXYView, i.e. theILcdGXYViewthisILcdGXYControlleris interacting with.Gets the current "slave"ILcdGXYView.Gets the currentILcdXYWorldXYWorldTransformation.booleanbooleanisFilled()Returns whether the master view's rectangle is filled.booleanbooleanbooleanDeprecated.This method has been deprecated.voidvoidvoidvoidWill perform a pan depending on the values of isDragging, isPanOnMouseDragExit and isPanOnMouseMoveExit propertiesvoidmouseMoved(MouseEvent me) voidvoidvoidEnables the controller to give visual feedback on the current user interactions.voidsetDragCentered(boolean aDragCentered) voidsetFillColor(Color aFillColor) Sets the color with which to fill the master view's rectangle toaFillColor.voidsetFilled(boolean aFilled) Sets whether the master view's rectangle should be filled.voidsetForceToSquare(boolean aForceToSquare) Forces the dragged rectangle to be square or not.voidsetGhostColor(Color aGhostColor) Sets theColorto use when dragging the rectangle on the "master"ILcdGXYView, i.e. theILcdGXYViewthisILcdGXYControlleris interacting with.voidsetLineWidth(int aLineWidth) Sets the line width to use when dragging the rectangle on the "master"ILcdGXYView, i.e. theILcdGXYViewthisILcdGXYControlleris interacting with.voidsetRepaintOnReleased(boolean aRepaintOnReleased) voidsetSlaveView(ILcdGXYView aSlaveView) Sets a "slave"ILcdGXYView.voidsetTraceOn(boolean aTraceOn) Deprecated.This method has been deprecated.voidsetXYWorldXYWorldTransformation(ILcdXYWorldXYWorldTransformation newXYWorldXYWorldTransformation) Sets anILcdXYWorldXYWorldTransformation.voidstartInteraction(ILcdGXYView aGXYView) Sets up the controller to receive input through the view passed.voidterminateInteraction(ILcdGXYView aGXYView) Releases a few items.voidviewRepaint(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, updateViewLocationAfterZoomSFCTMethods 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, setShortDescriptionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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 eithertrueorfalseas argument automatically turns off tracing for all other class instances for whichsetTraceOnhas not been called. If the argument isfalsethen only the informative, warning and error log messages are recorded.- Overrides:
setTraceOnin 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.Returnstrueif tracing is enabled for this class.- Overrides:
isTraceOnin classALcdGXYSmartController- Returns:
- true if tracing is enabled for this class, false otherwise.
-
startInteraction
Description copied from class:ALcdGXYControllerSets up the controller to receive input through the view passed.All
ILcdGXYViewimplementations that support interaction call this method when the controller has been made active withsetGXYControlleron 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:
startInteractionin interfaceILcdGXYController- Overrides:
startInteractionin classALcdGXYSmartController- Parameters:
aGXYView- theILcdGXYViewthisILcdGXYControllerwill interact with.- See Also:
-
terminateInteraction
Description copied from class:ALcdGXYControllerReleases a few items. Can be redefined but this 'super' method should be called too.- Specified by:
terminateInteractionin interfaceILcdGXYController- Overrides:
terminateInteractionin classALcdGXYSmartController- Parameters:
aGXYView- theILcdGXYViewthisILcdGXYControllerinteracted with.- See Also:
-
setSlaveView
Sets a "slave"ILcdGXYView. -
getSlaveView
Gets the current "slave"ILcdGXYView. -
setGhostColor
Sets theColorto use when dragging the rectangle on the "master"ILcdGXYView, i.e. theILcdGXYViewthisILcdGXYControlleris interacting with. -
getGhostColor
Gets theColorused when dragging the rectangle on the "master"ILcdGXYView, i.e. theILcdGXYViewthisILcdGXYControlleris interacting with. -
setLineWidth
public void setLineWidth(int aLineWidth) Sets the line width to use when dragging the rectangle on the "master"ILcdGXYView, i.e. theILcdGXYViewthisILcdGXYControlleris interacting with. -
getLineWidth
public int getLineWidth()Gets the line width used when dragging the rectangle on the "master"ILcdGXYView, i.e. theILcdGXYViewthisILcdGXYControlleris 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:
trueif 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, thisTLcdGXYDragRectangleControllerwill repaint theILcdGXYViewon 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:ALcdGXYControllerEnables 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:
paintin interfaceILcdGXYController- Overrides:
paintin classALcdGXYController- Parameters:
aGraphics- the Graphics on which the view was rendered.
-
viewRepaint
Description copied from class:ALcdGXYControllerEmpty implementation.- Specified by:
viewRepaintin interfaceILcdGXYController- Overrides:
viewRepaintin classALcdGXYController- Parameters:
aGXYView- theILcdGXYViewto draw on.
-
drawGhost
Draws the draggedRectangleongetGXYView().getGraphics(). -
drawGhost
Draws the draggedRectangleon aGraphics. -
cleanGhost
protected void cleanGhost() -
mousePressed
- Specified by:
mousePressedin interfaceMouseListener- Overrides:
mousePressedin classALcdGXYSmartController
-
mouseMoved
- Specified by:
mouseMovedin interfaceMouseMotionListener- Overrides:
mouseMovedin classALcdGXYSmartController
-
mouseDragged
- Specified by:
mouseDraggedin interfaceMouseMotionListener- Overrides:
mouseDraggedin classALcdGXYSmartController
-
mouseClicked
- Specified by:
mouseClickedin interfaceMouseListener- Overrides:
mouseClickedin classALcdGXYSmartController
-
mouseEntered
- Specified by:
mouseEnteredin interfaceMouseListener- Overrides:
mouseEnteredin classALcdGXYSmartController
-
mouseExited
Description copied from class:ALcdGXYSmartControllerWill perform a pan depending on the values of isDragging, isPanOnMouseDragExit and isPanOnMouseMoveExit properties- Specified by:
mouseExitedin interfaceMouseListener- Overrides:
mouseExitedin classALcdGXYSmartController
-
mouseReleased
- Specified by:
mouseReleasedin interfaceMouseListener- Overrides:
mouseReleasedin classALcdGXYSmartController
-
adjustSlaveView
Adjusts the "slave"ILcdGXYViewto fit into aRectangleDragged painted on theILcdGXYViewthisILcdGXYControlleris interacting with.- Throws:
NullPointerException- if noILcdXYWorldXYWorldTransformationhas been set.
-
setXYWorldXYWorldTransformation
public void setXYWorldXYWorldTransformation(ILcdXYWorldXYWorldTransformation newXYWorldXYWorldTransformation) Sets anILcdXYWorldXYWorldTransformation. A nonnullvalue must be set. -
getXYWorldXYWorldTransformation
Gets the currentILcdXYWorldXYWorldTransformation.
-