Class TLcdGXYMagnifierController
- All Implemented Interfaces:
ILcdUndoableSource,ILcdStatusSource,ILcdGXYController,KeyListener,MouseListener,MouseMotionListener,Serializable,EventListener
MagnifierController is an ILcdGXYController
to magnify an area of a given ILcdGXYView
around the location where a mouse button is
pressed. The magnified area is shown in a magnifier window.
If the left mouse button is pressed, the magnifier window disappears when the mouse button is released. If the mouse is dragged with the left mouse button pressed, the magnifier window is moved along, such that it always shows the area around the location where the mouse button is pressed.
If the right mouse button is pressed, the magnifier window remains visible, even after releasing the mouse button. The magnifier window can be closed by clicking on it.
If the shift key is pressed at the same time as pressing the mouse, the magnification is accelerated, i.e., made stronger.
The TLcdGXYMagnifierController has several modes of update
(i.e., refresh of what is displayed inside):
-
IMMEDIATE_UPDATE_MODE: the magnifier window is updated whenever it is dragged around. -
INTERVAL_UPDATE_MODE: the magnifier window is updated at fixed intervals. The length of the interval isUpdateIntervalmilliseconds. -
LAZY_UPDATE_MODE: the magnifier window is updated whenever the mouse is not moved forUpdateIntervalmilliseconds. -
ADAPTIVE_UPDATE_MODE: the magnifier window behaves likeIMMEDIATE_UPDATE_MODEif its first update takes less thanUpdateDurationThresholdmilliseconds, and likeLAZY_UPDATE_MODEotherwise. This is the default value.
WidthandHeightto indicate its size (default value: 80x80).ScaleFactor, to indicate the magnification (default value: 5).ScaleAccelerator, to indicate the acceleration of the magnification (default value: 2).UpdateInterval, to indicate at which interval the magnifier window must be updated (in milliseconds). TheUpdateIntervalmust be strictly positive. The default value is 200.UpdateDurationTreshold, to indicate a threshold (in milliseconds) for deciding upon the behavior inADAPTIVE_UPDATE_MODE. The default value is 100.
Scale of the magnifier window always equals
the Scale of the ILcdGXYView multiplied by
the ScaleFactor multiplied by
the ScaleAccelerator.
The Width of the magnifier window is constrained by
half the Width of the ILcdGXYView.
The Height of the magnifier window is constrained by
half the Height of the ILcdGXYView.
The magnifier window can be made UserAdjustable.
When this is the case, the user can adapt some of the above properties with
the keyboard as long as the magnifier window is visible:
- typing '+' increases the
WidthandHeightof the magnifier window. - typing '-' decreases the
WidthandHeightof the magnifier window. - typing '*' increases the
ScaleFactorof the magnifier window. - typing '/' decreases the
ScaleFactorof the magnifier window.
UserAdjustable.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intThe possible modes are consecutive int values, starting from0toLAST_MODE.static final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ILcdGXYViewReturns theILcdGXYViewthat will be used as a magnifier on top of this controllersILcdGXYView.Returns the filter to determine if a layer of the original view is visible in the magnifier window.intdoubledoubleintintintgetWidth()booleanbooleanbooleanbooleanbooleanDeprecated.This method has been deprecated.booleanDeprecated.This property is never taken into account and may be removed in the future.voidvoidWhen the mouse is dragged with the left-button pressed, a magnifier window is shown whose center is the location below the mouse.voidvoidWill perform a pan depending on the values of isDragging, isPanOnMouseDragExit and isPanOnMouseMoveExit propertiesvoidvoidWhen the left-button or right-button of the mouse is pressed, a magnifier window is shown whose center is the location below the mouse.voidWhen the left-button of the mouse is released, the magnifier window disappears.voidsetGXYLayerFilter(ILcdFilter aFilter) Sets a filter that determines if a layer of the original view is visible in the magnifier window.voidsetHeight(int aHeight) SetsaHeightas the height of the magnifier window.voidsetMode(int aMode) Set the mode of the magnifier window.voidsetScaleAccelerator(double aScaleAccelerator) SetsaScaleAcceleratoras the scale accelerator of the magnifier window.voidsetScaleFactor(double aScaleFactor) SetsaScaleFactoras the scale factor of the magnifier window.voidsetTraceOn(boolean aTraceOn) Deprecated.This method has been deprecated.voidsetUpdateDurationTreshold(int aUpdateDurationThreshold) Set the update duration threshold of the magnifier window toaUpdateDurationThresholdvoidsetUpdateInterval(int aUpdateInterval) Set the update interval of the magnifier window toaUpdateIntervalvoidsetUserAdjustable(boolean aUserAdjustable) Deprecated.This property is never taken into account and may be removed in the future.voidsetWidth(int aWidth) SetsaWidthas the width of the magnifier window.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, paint, 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
-
Field Details
-
IMMEDIATE_UPDATE_MODE
public static final int IMMEDIATE_UPDATE_MODE- See Also:
-
INTERVAL_UPDATE_MODE
public static final int INTERVAL_UPDATE_MODE- See Also:
-
ADAPTIVE_UPDATE_MODE
public static final int ADAPTIVE_UPDATE_MODE- See Also:
-
LAZY_UPDATE_MODE
public static final int LAZY_UPDATE_MODE- See Also:
-
LAST_MODE
public static final int LAST_MODEThe possible modes are consecutive int values, starting from0toLAST_MODE.- See Also:
-
-
Constructor Details
-
TLcdGXYMagnifierController
public TLcdGXYMagnifierController()Make a newMagnifierController. ThisMagnifierControllerwon't work until it interacts with anILcdGXYView.- See Also:
-
-
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:
-
createGlassGXYView
Returns theILcdGXYViewthat will be used as a magnifier on top of this controllersILcdGXYView. This method shall return an instance ofComponentor anIllegalArgumentExceptionwill be thrown in the startInteraction method.- Returns:
- returns a new TLcdGXYViewJPanel
-
getGXYLayerFilter
Returns the filter to determine if a layer of the original view is visible in the magnifier window.- Returns:
- the filter to determine if a layer of the original view is visible in the magnifier window
-
setGXYLayerFilter
Sets a filter that determines if a layer of the original view is visible in the magnifier window.- Parameters:
aFilter- the used filter. If the filter returns true for anILcdGXYLayer, that layer will be included in the magnifier window.
-
viewRepaint
Description copied from class:ALcdGXYControllerEmpty implementation.- Specified by:
viewRepaintin interfaceILcdGXYController- Overrides:
viewRepaintin classALcdGXYController- Parameters:
aGXYView- theILcdGXYViewto draw on.
-
mouseDragged
When the mouse is dragged with the left-button pressed, a magnifier window is shown whose center is the location below the mouse.The same constraints apply at the borders as in
mousePressed.If the scale accelerator was activated when the mouse was pressed at the beginning of the drag, it remains activated.
- Specified by:
mouseDraggedin interfaceMouseMotionListener- Overrides:
mouseDraggedin classALcdGXYSmartController- See Also:
-
mouseMoved
- Specified by:
mouseMovedin interfaceMouseMotionListener- Overrides:
mouseMovedin classALcdGXYSmartController
-
mouseClicked
- Specified by:
mouseClickedin interfaceMouseListener- Overrides:
mouseClickedin classALcdGXYSmartController
-
mousePressed
When the left-button or right-button of the mouse is pressed, a magnifier window is shown whose center is the location below the mouse.At the left and right borders of the
ILcdGXYViewon which thisMagnifierControlleroperates, the center of the magnifier window is the location with minimum x (resp. maximum x) such that the magnifier window is still within the borders of theILcdGXYView.Similarly, at the bottom and top borders of the
ILcdGXYView, the center of the magnifier window is the location with minimum y (resp. maximum y) such that the magnifier window is still within the borders of theILcdGXYView.If the
SHIFTkey is held when pressing the mouse, the scale accelerator of the magnifier is activated.- Specified by:
mousePressedin interfaceMouseListener- Overrides:
mousePressedin classALcdGXYSmartController
-
mouseReleased
When the left-button of the mouse is released, the magnifier window disappears. When the right-button of the mouse is released, the magnifier window remains.- Specified by:
mouseReleasedin interfaceMouseListener- Overrides:
mouseReleasedin 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
-
setUserAdjustable
public void setUserAdjustable(boolean aUserAdjustable) Deprecated.This property is never taken into account and may be removed in the future.Set whether or not the magnifier window is user adjustable -
isUserAdjustable
public boolean isUserAdjustable()Deprecated.This property is never taken into account and may be removed in the future.- Returns:
- true if and only if the magnifier window is user adjustable
-
setUpdateInterval
public void setUpdateInterval(int aUpdateInterval) Set the update interval of the magnifier window toaUpdateIntervalThe new value for the update interval is taken into account at the latest after a delay of the old value of update interval.
-
getUpdateInterval
public int getUpdateInterval()- Returns:
- the update interval of the magnifier window
-
setUpdateDurationTreshold
public void setUpdateDurationTreshold(int aUpdateDurationThreshold) Set the update duration threshold of the magnifier window toaUpdateDurationThresholdThe new value for the duration threshold is taken into account at the next mouse drag.
-
getUpdateDurationTreshold
public int getUpdateDurationTreshold()- Returns:
- the update duration threshold of the magnifier window
-
setWidth
public void setWidth(int aWidth) SetsaWidthas the width of the magnifier window. -
getWidth
public int getWidth()- Returns:
- the width of the magnifier window.
-
setHeight
public void setHeight(int aHeight) SetsaHeightas the height of the magnifier window. -
getHeight
public int getHeight()- Returns:
- the height of the magnifier window.
-
setScaleFactor
public void setScaleFactor(double aScaleFactor) SetsaScaleFactoras the scale factor of the magnifier window. -
getScaleFactor
public double getScaleFactor()- Returns:
- the scale factor of the magnifier window.
-
setScaleAccelerator
public void setScaleAccelerator(double aScaleAccelerator) SetsaScaleAcceleratoras the scale accelerator of the magnifier window. -
getScaleAccelerator
public double getScaleAccelerator()- Returns:
- the scale accelerator of the magnifier window.
-
setMode
public void setMode(int aMode) Set the mode of the magnifier window. -
isIntervalUpdateMode
public boolean isIntervalUpdateMode()- Returns:
trueif and only if the mode of the magnifier window isINTERVAL_UPDATE_MODE
-
isImmediateUpdateMode
public boolean isImmediateUpdateMode()- Returns:
trueif and only if the mode of the magnifier window isIMMEDIATE_UPDATE_MODE
-
isAdaptiveUpdateMode
public boolean isAdaptiveUpdateMode()- Returns:
trueif and only if the mode of the magnifier window isADAPTIVE_UPDATE_MODE
-
isLazyUpdateMode
public boolean isLazyUpdateMode()- Returns:
trueif and only if the mode of the magnifier window isLAZY_UPDATE_MODE
-