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
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final intWhen 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 intWhen 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 intWhen zooming in/out dragging a rectangle the new scale will be computed so that the view contains at most the rectangle.static final intWhen 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 intWhen 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
ConstructorsConstructorDescriptionTLcdGXYZoomController(String aMode) TLcdGXYZoomController(String aMode, boolean aRegisterInstance) Deprecated.use one of the constructors without the aRegisterInstance parameter. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPropertyChangeListener(PropertyChangeListener aPropertyChangeListener) getMode()intReturns the mode to calculate the new zoom level depending on the rectangle dragged and the dimension of the view.intDeprecated.UseALcdGXYSmartController.addUndoableListener(com.luciad.gui.ILcdUndoableListener)for undo/redo support.intDeprecated.UseALcdGXYSmartController.addUndoableListener(com.luciad.gui.ILcdUndoableListener)for undo/redo support.floatbooleanReturns whether or not the controller will explicitly request a repaint after every zoom operation.booleanDeprecated.This method has been deprecated.voidredo()Deprecated.UseALcdGXYSmartController.addUndoableListener(com.luciad.gui.ILcdUndoableListener)for undo/redo support.voidremovePropertyChangeListener(PropertyChangeListener aPropertyChangeListener) voidDeprecated.UseALcdGXYSmartController.addUndoableListener(com.luciad.gui.ILcdUndoableListener)for undo/redo support.voidsetAutoRepaintView(boolean aAutoRepaintView) Sets whether or not the controller will explicitly request a view repaint after every zoom operation.voidvoidsetRectangleZoomMode(int aRectangleZoomMode) Sets the mode to calculate the new zoom level depending on the rectangle dragged and the dimension of the view.voidsetTraceOn(boolean aTraceOn) Deprecated.This method has been deprecated.voidsetZoomFactor(float aZoomFactor) Sets the propertyZoomFactortoaZoomFactor, ifaZoomFactor > 0.voidstartInteraction(ILcdGXYView aGXYView) Sets up the controller to receive input through the view passed.voidterminateInteraction(ILcdGXYView aGXYView) Releases a few items.voidtrigger(MouseEvent me, Rectangle aRectangleDragged) This method is called on mouseReleased.voidundo()Deprecated.UseALcdGXYSmartController.addUndoableListener(com.luciad.gui.ILcdUndoableListener)for undo/redo support.voidUnzooms thisILcdGXYViewto fit in the given AWT Rectangle.voidZooms thisILcdGXYViewto 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, setXORModeColorMethods 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, 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, setShortDescription, viewRepaintMethods 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
getLayeredMethods inherited from interface com.luciad.gui.ILcdUndoableSource
addUndoableListener, removeUndoableListenerMethods inherited from interface java.awt.event.MouseListener
mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleasedMethods 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_INorTLcdGXYPanController.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 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 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.Returnstrueif tracing is enabled for this class.- Overrides:
isTraceOnin 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 propertyZoomFactortoaZoomFactor, 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: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:
-
trigger
Description copied from class:TLcdGXYDragRectangleControllerThis 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:
triggerin classTLcdGXYDragRectangleController- Parameters:
me- theMouseEventreceived on mouseReleased.aRectangleDragged- the dragged java.awt.Rectangle. Do not reuse this instance directly, make a copy instead.
-
zoom
Zooms thisILcdGXYViewto 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 thisILcdGXYViewto 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:
undoin 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:
-