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 isUpdateInterval
milliseconds. -
LAZY_UPDATE_MODE
: the magnifier window is updated whenever the mouse is not moved forUpdateInterval
milliseconds. -
ADAPTIVE_UPDATE_MODE
: the magnifier window behaves likeIMMEDIATE_UPDATE_MODE
if its first update takes less thanUpdateDurationThreshold
milliseconds, and likeLAZY_UPDATE_MODE
otherwise. This is the default value.
Width
andHeight
to 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). TheUpdateInterval
must 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
Width
andHeight
of the magnifier window. - typing '-' decreases the
Width
andHeight
of the magnifier window. - typing '*' increases the
ScaleFactor
of the magnifier window. - typing '/' decreases the
ScaleFactor
of the magnifier window.
UserAdjustable
.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
The possible modes are consecutive int values, starting from0
toLAST_MODE
.static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ILcdGXYView
Returns theILcdGXYView
that 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.int
double
double
int
int
int
getWidth()
boolean
boolean
boolean
boolean
boolean
Deprecated.This method has been deprecated.boolean
Deprecated.This property is never taken into account and may be removed in the future.void
void
When the mouse is dragged with the left-button pressed, a magnifier window is shown whose center is the location below the mouse.void
void
Will perform a pan depending on the values of isDragging, isPanOnMouseDragExit and isPanOnMouseMoveExit propertiesvoid
void
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.void
When the left-button of the mouse is released, the magnifier window disappears.void
setGXYLayerFilter
(ILcdFilter aFilter) Sets a filter that determines if a layer of the original view is visible in the magnifier window.void
setHeight
(int aHeight) SetsaHeight
as the height of the magnifier window.void
setMode
(int aMode) Set the mode of the magnifier window.void
setScaleAccelerator
(double aScaleAccelerator) SetsaScaleAccelerator
as the scale accelerator of the magnifier window.void
setScaleFactor
(double aScaleFactor) SetsaScaleFactor
as the scale factor of the magnifier window.void
setTraceOn
(boolean aTraceOn) Deprecated.This method has been deprecated.void
setUpdateDurationTreshold
(int aUpdateDurationThreshold) Set the update duration threshold of the magnifier window toaUpdateDurationThreshold
void
setUpdateInterval
(int aUpdateInterval) Set the update interval of the magnifier window toaUpdateInterval
void
setUserAdjustable
(boolean aUserAdjustable) Deprecated.This property is never taken into account and may be removed in the future.void
setWidth
(int aWidth) SetsaWidth
as the width of the magnifier window.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, paint, 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
-
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 from0
toLAST_MODE
.- See Also:
-
-
Constructor Details
-
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:
-
createGlassGXYView
Returns theILcdGXYView
that will be used as a magnifier on top of this controllersILcdGXYView
. This method shall return an instance ofComponent
or anIllegalArgumentException
will 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:ALcdGXYController
Empty implementation.- Specified by:
viewRepaint
in interfaceILcdGXYController
- Overrides:
viewRepaint
in classALcdGXYController
- Parameters:
aGXYView
- theILcdGXYView
to 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:
mouseDragged
in interfaceMouseMotionListener
- Overrides:
mouseDragged
in classALcdGXYSmartController
- See Also:
-
mouseMoved
- Specified by:
mouseMoved
in interfaceMouseMotionListener
- Overrides:
mouseMoved
in classALcdGXYSmartController
-
mouseClicked
- Specified by:
mouseClicked
in interfaceMouseListener
- Overrides:
mouseClicked
in 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
ILcdGXYView
on which thisMagnifierController
operates, 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
SHIFT
key is held when pressing the mouse, the scale accelerator of the magnifier is activated.- Specified by:
mousePressed
in interfaceMouseListener
- Overrides:
mousePressed
in 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:
mouseReleased
in interfaceMouseListener
- Overrides:
mouseReleased
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
-
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 toaUpdateInterval
The 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 toaUpdateDurationThreshold
The 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) SetsaWidth
as the width of the magnifier window. -
getWidth
public int getWidth()- Returns:
- the width of the magnifier window.
-
setHeight
public void setHeight(int aHeight) SetsaHeight
as the height of the magnifier window. -
getHeight
public int getHeight()- Returns:
- the height of the magnifier window.
-
setScaleFactor
public void setScaleFactor(double aScaleFactor) SetsaScaleFactor
as 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) SetsaScaleAccelerator
as 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:
true
if and only if the mode of the magnifier window isINTERVAL_UPDATE_MODE
-
isImmediateUpdateMode
public boolean isImmediateUpdateMode()- Returns:
true
if and only if the mode of the magnifier window isIMMEDIATE_UPDATE_MODE
-
isAdaptiveUpdateMode
public boolean isAdaptiveUpdateMode()- Returns:
true
if and only if the mode of the magnifier window isADAPTIVE_UPDATE_MODE
-
isLazyUpdateMode
public boolean isLazyUpdateMode()- Returns:
true
if and only if the mode of the magnifier window isLAZY_UPDATE_MODE
-