Package com.luciad.view.gxy.controller
Class TLcdGXYZoomController
java.lang.Object
com.luciad.view.gxy.controller.ALcdGXYController
com.luciad.view.gxy.controller.ALcdGXYSmartController
com.luciad.view.gxy.controller.TLcdGXYDragRectangleController
com.luciad.view.gxy.controller.TLcdGXYZoomController
- All Implemented Interfaces:
ILcdUndoableSource
,ILcdStatusSource
,ILcdGXYController
,KeyListener
,MouseListener
,MouseMotionListener
,Serializable
,EventListener
public class TLcdGXYZoomController
extends TLcdGXYDragRectangleController
implements MouseListener, MouseMotionListener, ILcdUndoableSource
The
TLcdGXYZoomController
can be used for performing a zoom in
or zoom out on an ILcdGXYView
. The mode property indicate
if a zoom in or out shall be performed. If the mode "MIXED" has been set,
a zoom in ( respectively zoom out ) will be performed when using the right
mouse button ( respectively left mouse button).
This controller supports the undo/redo mechanism. An ILcdUndoableListener
can
be added using ALcdGXYSmartController.addUndoableListener(com.luciad.gui.ILcdUndoableListener)
.- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final int
When zooming in/out dragging a rectangle the ratio of the new scale to the old scale is equal to the average of the width and height ratio's of the view and the rectangle.static final int
When zooming in/out dragging a rectangle the new scale is chosen so that the new views height agrees with the height of the rectangle.static final int
When zooming in/out dragging a rectangle the new scale will be computed so that the view contains at most the rectangle.static final int
When zooming in/out dragging a rectangle the new scale will be computed so that the view contains at least the rectangle and possibly some borders to fill the view when zooming in, and the current view is not completely contained in the dragged rectangle.static final int
When zooming in/out dragging a rectangle the new scale is chosen so that the new views width agrees with the width of the rectangle.Fields inherited from class com.luciad.view.gxy.controller.TLcdGXYDragRectangleController
fXPressed, fXReleased, fYPressed, fYReleased
-
Constructor Summary
ConstructorDescriptionTLcdGXYZoomController
(String aMode) TLcdGXYZoomController
(String aMode, boolean aRegisterInstance) Deprecated.use one of the constructors without the aRegisterInstance parameter. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPropertyChangeListener
(PropertyChangeListener aPropertyChangeListener) getMode()
int
Returns the mode to calculate the new zoom level depending on the rectangle dragged and the dimension of the view.int
Deprecated.UseALcdGXYSmartController.addUndoableListener(com.luciad.gui.ILcdUndoableListener)
for undo/redo support.int
Deprecated.UseALcdGXYSmartController.addUndoableListener(com.luciad.gui.ILcdUndoableListener)
for undo/redo support.float
boolean
Returns whether or not the controller will explicitly request a repaint after every zoom operation.boolean
Deprecated.This method has been deprecated.void
redo()
Deprecated.UseALcdGXYSmartController.addUndoableListener(com.luciad.gui.ILcdUndoableListener)
for undo/redo support.void
removePropertyChangeListener
(PropertyChangeListener aPropertyChangeListener) void
Deprecated.UseALcdGXYSmartController.addUndoableListener(com.luciad.gui.ILcdUndoableListener)
for undo/redo support.void
setAutoRepaintView
(boolean aAutoRepaintView) Sets whether or not the controller will explicitly request a view repaint after every zoom operation.void
void
setRectangleZoomMode
(int aRectangleZoomMode) Sets the mode to calculate the new zoom level depending on the rectangle dragged and the dimension of the view.void
setTraceOn
(boolean aTraceOn) Deprecated.This method has been deprecated.void
setZoomFactor
(float aZoomFactor) Sets the propertyZoomFactor
toaZoomFactor
, ifaZoomFactor > 0
.void
startInteraction
(ILcdGXYView aGXYView) Sets up the controller to receive input through the view passed.void
terminateInteraction
(ILcdGXYView aGXYView) Releases a few items.void
trigger
(MouseEvent me, Rectangle aRectangleDragged) This method is called on mouseReleased.void
undo()
Deprecated.UseALcdGXYSmartController.addUndoableListener(com.luciad.gui.ILcdUndoableListener)
for undo/redo support.void
Unzooms thisILcdGXYView
to fit in the given AWT Rectangle.void
Zooms thisILcdGXYView
to fit in the given AWT Rectangle.Methods inherited from class com.luciad.view.gxy.controller.TLcdGXYDragRectangleController
adaptRectangle, doPanGXYView, doZoomGXYView, drawGhost, getCurrentRectangle, getGhostColor, getGhostLineWidth, getHaloColor, getHaloThickness, getMouseDraggedSensitivity, getXORModelColor, isDragCentered, isForceToSquare, isHaloEnabled, isRepaintOnReleased, isXORMode, lastXPressed, lastXReleased, lastYPressed, lastYReleased, mouseDragged, mouseMoved, mousePressed, mouseReleased, paint, setDragCentered, setForceToSquare, setGhostColor, setGhostLineWidth, setHaloColor, setHaloEnabled, setHaloThickness, setMouseDraggedSensitivity, setRepaintOnReleased, setXORMode, setXORModeColor
Methods inherited from class com.luciad.view.gxy.controller.ALcdGXYSmartController
addUndoableListener, 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, mouseClicked, mouseEntered, mouseExited, 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, viewRepaint
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
Methods inherited from interface com.luciad.gui.ILcdUndoableSource
addUndoableListener, removeUndoableListener
Methods inherited from interface java.awt.event.MouseListener
mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleased
Methods inherited from interface java.awt.event.MouseMotionListener
mouseDragged, mouseMoved
-
Field Details
-
ZOOM_IN
- See Also:
-
ZOOM_OUT
- See Also:
-
MIXED
- See Also:
-
ZOOM_RECTANGLE_MAX
public static final int ZOOM_RECTANGLE_MAXWhen zooming in/out dragging a rectangle the new scale will be computed so that the view contains at most the rectangle. Parts of the rectangle may be outside the view when zooming in, the current view is contained completely in the rectangle when zooming out. This is aggressive zooming.- See Also:
-
ZOOM_RECTANGLE_MIN
public static final int ZOOM_RECTANGLE_MINWhen zooming in/out dragging a rectangle the new scale will be computed so that the view contains at least the rectangle and possibly some borders to fill the view when zooming in, and the current view is not completely contained in the dragged rectangle. This is non aggressive zooming.- See Also:
-
ZOOM_RECTANGLE_AVERAGE
public static final int ZOOM_RECTANGLE_AVERAGEWhen zooming in/out dragging a rectangle the ratio of the new scale to the old scale is equal to the average of the width and height ratio's of the view and the rectangle.- See Also:
-
ZOOM_RECTANGLE_WIDTH
public static final int ZOOM_RECTANGLE_WIDTHWhen zooming in/out dragging a rectangle the new scale is chosen so that the new views width agrees with the width of the rectangle.- See Also:
-
ZOOM_RECTANGLE_HEIGHT
public static final int ZOOM_RECTANGLE_HEIGHTWhen zooming in/out dragging a rectangle the new scale is chosen so that the new views height agrees with the height of the rectangle.- See Also:
-
-
Constructor Details
-
TLcdGXYZoomController
public TLcdGXYZoomController() -
TLcdGXYZoomController
- Parameters:
aMode
-TLcdGXYPanController.ZOOM_IN
orTLcdGXYPanController.ZOOM_OUT
-
TLcdGXYZoomController
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 classTLcdGXYDragRectangleController
- 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 classTLcdGXYDragRectangleController
- Returns:
- true if tracing is enabled for this class, false otherwise.
-
getZoomFactor
public float getZoomFactor()- Returns:
ZoomFactor
- See Also:
-
setZoomFactor
public void setZoomFactor(float aZoomFactor) Sets the propertyZoomFactor
toaZoomFactor
, ifaZoomFactor > 0
. Does nothing otherwise- Parameters:
aZoomFactor
- the ratio that is used to zoom in (if larger than 1) or to zoom out (if smaller than 1) when the mouse is clicked. Must be non-zero and positive.
-
getMode
- See Also:
-
setMode
- Parameters:
aMode
- one of [TLcdGXYPanController.ZOOM_IN
, "-", "out", "unzoom", "un_zoom", "zoom_out", "zoomout" ] for zoomout, any other for zoomin. The mode sets the icon and the cursor of the controller.
-
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:
-
trigger
Description copied from class:TLcdGXYDragRectangleController
This method is called on mouseReleased. It can be redefined to implement specific behavior with the "created" java.awt.Rectangle given as argument. Extensions might want to verify if the given rectangle is larger as the drag sensitivity, e.g.:aRectangleDragged.width >= getMouseDraggedSensitivity() || aRectangleDragged.height >= getMouseDraggedSensitivity()
- Overrides:
trigger
in classTLcdGXYDragRectangleController
- Parameters:
me
- theMouseEvent
received on mouseReleased.aRectangleDragged
- the dragged java.awt.Rectangle. Do not reuse this instance directly, make a copy instead.
-
zoom
Zooms thisILcdGXYView
to fit in the given AWT Rectangle.- Parameters:
aRectangleDragged
- the rectangle to zoom to. If the mouse is not dragged,getZoomFactor()
is used to calculate the zoom factor.
-
unzoom
Unzooms thisILcdGXYView
to fit in the given AWT Rectangle.- Parameters:
aRectangleDragged
- the rectangle to zoom out from. If the mouse is not dragged,getZoomFactor()
is used to calculate the zoom factor.
-
getRectangleZoomMode
public int getRectangleZoomMode()Returns the mode to calculate the new zoom level depending on the rectangle dragged and the dimension of the view. The default mode isZOOM_RECTANGLE_AVERAGE
.- Returns:
- the mode to calculate the new zoom level depending on the rectangle dragged and the dimension
of the view, one of
ZOOM_RECTANGLE_AVERAGE
,ZOOM_RECTANGLE_HEIGHT
,ZOOM_RECTANGLE_MAX
,ZOOM_RECTANGLE_MIN
,ZOOM_RECTANGLE_WIDTH
. - See Also:
-
setRectangleZoomMode
public void setRectangleZoomMode(int aRectangleZoomMode) Sets the mode to calculate the new zoom level depending on the rectangle dragged and the dimension of the view. The mode should be one ofZOOM_RECTANGLE_AVERAGE
,ZOOM_RECTANGLE_HEIGHT
,ZOOM_RECTANGLE_MAX
,ZOOM_RECTANGLE_MIN
,ZOOM_RECTANGLE_WIDTH
.- Parameters:
aRectangleZoomMode
- the mode to calculate the new zoom level depending on the rectangle dragged and the dimension of the view.- See Also:
-
getUndoLeft
public int getUndoLeft()Deprecated.UseALcdGXYSmartController.addUndoableListener(com.luciad.gui.ILcdUndoableListener)
for undo/redo support. -
getRedoLeft
public int getRedoLeft()Deprecated.UseALcdGXYSmartController.addUndoableListener(com.luciad.gui.ILcdUndoableListener)
for undo/redo support. -
resetUndoHistory
public void resetUndoHistory()Deprecated.UseALcdGXYSmartController.addUndoableListener(com.luciad.gui.ILcdUndoableListener)
for undo/redo support. -
undo
public void undo()Deprecated.UseALcdGXYSmartController.addUndoableListener(com.luciad.gui.ILcdUndoableListener)
for undo/redo support.- Overrides:
undo
in classTLcdGXYDragRectangleController
-
redo
public void redo()Deprecated.UseALcdGXYSmartController.addUndoableListener(com.luciad.gui.ILcdUndoableListener)
for undo/redo support. -
addPropertyChangeListener
-
removePropertyChangeListener
-
setAutoRepaintView
public void setAutoRepaintView(boolean aAutoRepaintView) Sets whether or not the controller will explicitly request a view repaint after every zoom operation.- Parameters:
aAutoRepaintView
- if true, the controller will repaint the view after every zoom operation.
-
isAutoRepaintOnView
public boolean isAutoRepaintOnView()Returns whether or not the controller will explicitly request a repaint after every zoom operation.- See Also:
-