public class TLcdGXYZoomController extends TLcdGXYDragRectangleController implements MouseListener, MouseMotionListener, ILcdUndoableSource
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)
.Modifier and Type | Field and Description |
---|---|
static String |
MIXED |
static String |
ZOOM_IN |
static String |
ZOOM_OUT |
static int |
ZOOM_RECTANGLE_AVERAGE
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 int |
ZOOM_RECTANGLE_HEIGHT
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 int |
ZOOM_RECTANGLE_MAX
When zooming in/out dragging a rectangle the new scale will be computed so that
the view contains at most the rectangle.
|
static int |
ZOOM_RECTANGLE_MIN
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 int |
ZOOM_RECTANGLE_WIDTH
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.
|
fXPressed, fXReleased, fYPressed, fYReleased
Constructor and Description |
---|
TLcdGXYZoomController() |
TLcdGXYZoomController(String aMode) |
TLcdGXYZoomController(String aMode,
boolean aRegisterInstance)
Deprecated.
use one of the constructors without the aRegisterInstance parameter.
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener aPropertyChangeListener) |
String |
getMode() |
int |
getRectangleZoomMode()
Returns the mode to calculate the new zoom level depending on the rectangle dragged and the dimension
of the view.
|
int |
getRedoLeft()
Deprecated.
Use
ALcdGXYSmartController.addUndoableListener(com.luciad.gui.ILcdUndoableListener) for
undo/redo support. |
int |
getUndoLeft()
Deprecated.
Use
ALcdGXYSmartController.addUndoableListener(com.luciad.gui.ILcdUndoableListener) for
undo/redo support. |
float |
getZoomFactor() |
boolean |
isAutoRepaintOnView()
Returns whether or not the controller will explicitly request a repaint after every zoom operation.
|
boolean |
isTraceOn()
Deprecated.
This method has been deprecated. It is recommended to use the
standard Java logging framework directly.
|
void |
redo()
Deprecated.
Use
ALcdGXYSmartController.addUndoableListener(com.luciad.gui.ILcdUndoableListener) for
undo/redo support. |
void |
removePropertyChangeListener(PropertyChangeListener aPropertyChangeListener) |
void |
resetUndoHistory()
Deprecated.
Use
ALcdGXYSmartController.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 |
setMode(String aMode) |
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. It is recommended to use the
standard Java logging framework directly.
|
void |
setZoomFactor(float aZoomFactor)
Sets the property
ZoomFactor to aZoomFactor ,
if aZoomFactor > 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.
Use
ALcdGXYSmartController.addUndoableListener(com.luciad.gui.ILcdUndoableListener) for
undo/redo support. |
void |
unzoom(Rectangle aRectangleDragged)
Unzooms this
ILcdGXYView to fit in the given AWT Rectangle. |
void |
zoom(Rectangle aRectangleDragged)
Zooms this
ILcdGXYView to fit in the given AWT Rectangle. |
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
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
addStatusListener, asGXYController, fireStatusEvent, getCursor, getGXYView, getIcon, getName, getShortDescription, registerInstance, removeStatusListener, retrieveGXYViewXYWorldTransformation, setClassTraceOn, setCursor, setGXYView, setIcon, setName, setShortDescription, viewRepaint
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleased
mouseDragged, mouseMoved
addUndoableListener, removeUndoableListener
getLayered
public static final String ZOOM_IN
public static final String ZOOM_OUT
public static final String MIXED
public static final int ZOOM_RECTANGLE_MAX
public static final int ZOOM_RECTANGLE_MIN
public static final int ZOOM_RECTANGLE_AVERAGE
public static final int ZOOM_RECTANGLE_WIDTH
public static final int ZOOM_RECTANGLE_HEIGHT
public TLcdGXYZoomController()
public TLcdGXYZoomController(String aMode)
aMode
- TLcdGXYPanController.ZOOM_IN
or
TLcdGXYPanController.ZOOM_OUT
public TLcdGXYZoomController(String aMode, boolean aRegisterInstance)
public void setTraceOn(boolean aTraceOn)
true
or false
as argument automatically turns
off tracing for all other class instances for which
setTraceOn
has not been called.
If the argument is false
then only the informative, warning
and error log messages are recorded.setTraceOn
in class TLcdGXYDragRectangleController
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.public boolean isTraceOn()
true
if tracing is enabled for this class.isTraceOn
in class TLcdGXYDragRectangleController
public float getZoomFactor()
ZoomFactor
setZoomFactor(float)
public void setZoomFactor(float aZoomFactor)
ZoomFactor
to aZoomFactor
,
if aZoomFactor > 0
. Does nothing otherwiseaZoomFactor
- 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.public String getMode()
setMode(java.lang.String)
public void setMode(String aMode)
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.public void startInteraction(ILcdGXYView aGXYView)
ALcdGXYController
All ILcdGXYView
implementations that support interaction call this method when the controller
has been made active with setGXYController
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
.
startInteraction
in interface ILcdGXYController
startInteraction
in class ALcdGXYSmartController
aGXYView
- the ILcdGXYView
this ILcdGXYController
will interact with.ILcdGXYView.setGXYController(com.luciad.view.gxy.ILcdGXYController)
,
ILcdGXYController.terminateInteraction(com.luciad.view.gxy.ILcdGXYView)
public void terminateInteraction(ILcdGXYView aGXYView)
ALcdGXYController
terminateInteraction
in interface ILcdGXYController
terminateInteraction
in class ALcdGXYSmartController
aGXYView
- the ILcdGXYView
this ILcdGXYController
interacted with.ILcdGXYView.setGXYController(com.luciad.view.gxy.ILcdGXYController)
,
ILcdGXYController.startInteraction(com.luciad.view.gxy.ILcdGXYView)
public void trigger(MouseEvent me, Rectangle aRectangleDragged)
TLcdGXYDragRectangleController
aRectangleDragged.width >= getMouseDraggedSensitivity() ||
aRectangleDragged.height >= getMouseDraggedSensitivity()
trigger
in class TLcdGXYDragRectangleController
me
- the MouseEvent
received on mouseReleased.aRectangleDragged
- the dragged java.awt.Rectangle. Do not reuse
this instance directly, make a copy instead.public void zoom(Rectangle aRectangleDragged)
ILcdGXYView
to fit in the given AWT Rectangle.aRectangleDragged
- the rectangle to zoom to. If the mouse is not dragged,
getZoomFactor()
is used to calculate the zoom factor.public void unzoom(Rectangle aRectangleDragged)
ILcdGXYView
to fit in the given AWT Rectangle.aRectangleDragged
- the rectangle to zoom out from. If the mouse is not dragged,
getZoomFactor()
is used to calculate the zoom factor.public int getRectangleZoomMode()
ZOOM_RECTANGLE_AVERAGE
.ZOOM_RECTANGLE_AVERAGE
, ZOOM_RECTANGLE_HEIGHT
, ZOOM_RECTANGLE_MAX
,
ZOOM_RECTANGLE_MIN
, ZOOM_RECTANGLE_WIDTH
.setRectangleZoomMode(int)
public void setRectangleZoomMode(int aRectangleZoomMode)
ZOOM_RECTANGLE_AVERAGE
, ZOOM_RECTANGLE_HEIGHT
, ZOOM_RECTANGLE_MAX
,
ZOOM_RECTANGLE_MIN
, ZOOM_RECTANGLE_WIDTH
.aRectangleZoomMode
- the mode to calculate the new zoom level depending on the rectangle dragged and the dimension
of the view.getRectangleZoomMode()
public int getUndoLeft()
ALcdGXYSmartController.addUndoableListener(com.luciad.gui.ILcdUndoableListener)
for
undo/redo support.public int getRedoLeft()
ALcdGXYSmartController.addUndoableListener(com.luciad.gui.ILcdUndoableListener)
for
undo/redo support.public void resetUndoHistory()
ALcdGXYSmartController.addUndoableListener(com.luciad.gui.ILcdUndoableListener)
for
undo/redo support.public void undo()
ALcdGXYSmartController.addUndoableListener(com.luciad.gui.ILcdUndoableListener)
for
undo/redo support.undo
in class TLcdGXYDragRectangleController
public void redo()
ALcdGXYSmartController.addUndoableListener(com.luciad.gui.ILcdUndoableListener)
for
undo/redo support.public void addPropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
public void removePropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
public void setAutoRepaintView(boolean aAutoRepaintView)
aAutoRepaintView
- if true, the controller will repaint the view after every zoom operation.public boolean isAutoRepaintOnView()
setAutoRepaintView(boolean)