Class TLspTouchNavigateController
- All Implemented Interfaces:
ILcdAWTEventListener,ILspController
Touch controller to navigate on a 2D or 3D map. It supports:
- Panning by dragging with a single finger
- Zooming by pinching with two fingers
- Rotating by twisting with two fingers
- In 3D, rotating the camera up/down (pitching) by dragging two fingers
close to each otherup and down - In 2D, panning the camera by dragging two fingers
close to each otherin any direction
By default, the controller uses heuristics to automatically determine the principal navigation action (pan, zoom, or rotate)
for a gesture, restricting the effect of the gesture to that action only.
You can disable this and combine gestures.
This controller only tries to handle TLcdTouchPoints which are not-consumed, and marks the
TLcdTouchPoints it uses as consumed, similar to the
ALspTouchController.
- Since:
- 2012.0
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new navigation controller that performs all supported navigation actions.TLspTouchNavigateController(boolean aShouldRotate, boolean aShouldZoom, boolean aShouldPan) Creates a new navigation controller that offers rotating, zooming and panning based on the passed arguments. -
Method Summary
Modifier and TypeMethodDescriptionReturns the current locations of the touch points this controller is tracking.final intReturns the maximum number of touch points this controller should handle, as specified in the constructor.final intReturns the minimum number of touch points this controller should handle, as specified in the constructor.Returns the original locations of the touch points this controller is tracking (= the location of the point when it was passed to thetouchPointAvailablemethod).intReturns how close fingers should be to interpret two-finger movements in a 2D view as a pan gesture.intReturns how close fingers should be to interpret two-finger movements in a 3D view as a pitch gesture.Returns the locations of the touch points this controller is tracking during the previous event.Returns a list containing the touch point IDs of the touch points used by this controller.booleanReturns whether a single two-finger gesture can trigger different navigation actions (pan, zoom, rotate).booleanReturns whether or not this controller should animate the gestures.booleanReturns whether or not this controller should pan the view.booleanReturns whether or not this controller should rotate the view.booleanReturns whether or not this controller should zoom the view.booleanReturns whether or not this controller should zoom the view after double tapping.voidsetCombineGestures(boolean aCombineGestures) Sets whether a single two-finger gesture can trigger different navigation actions (pan, zoom, rotate).voidsetEnableInertia(boolean aEnableInertia) Sets whether or not this controller should animate the gestures.voidsetPanDistanceThreshold(int aPanDistanceThreshold) Sets how close fingers should be to interpret two-finger movements in a 2D view as a pan gesture.voidsetPitchDistanceThreshold(int aPitchDistanceThreshold) Returns how close fingers should be to interpret two-finger movements in a 3D view as a pitch gesture.voidsetShouldPan(boolean aShouldPan) Sets whether or not this controller should pan the view.voidsetShouldRotate(boolean aShouldRotate) Sets whether or not this controller should rotate the view.voidsetShouldZoom(boolean aShouldZoom) Sets whether or not this controller should zoom the view.voidsetZoomOnDoubleTap(boolean aShouldDoubleTap) Sets whether or not this controller should zoom the view after double tapping.protected final List<TLcdTouchPoint> touchPointAvailable(List<TLcdTouchPoint> aTouchPoints, TLcdTouchPoint aTouchDown) This method is called every time a new touch point is created or becomes available and allows to react accordingly.protected final List<TLcdTouchPoint> touchPointMoved(List<TLcdTouchPoint> aTrackedTouchPoints, TLcdTouchPoint aTouchMoved) This method is called when one of the touch points, used by this controller, is moved beyond the threshold and allows to react accordingly.protected final List<TLcdTouchPoint> touchPointWithdrawn(List<TLcdTouchPoint> aTouchPoints, TLcdTouchPoint aTouchUp) This methods is called every time a tracked touch point is removed or consumed and allows to react accordingly.Methods inherited from class com.luciad.view.lightspeed.controller.touch.ALspTouchController
getMoveThreshold, handleAWTEvent, handleAWTEventImpl, handleEventImpl, handleFXEvent, isDrawTouchPoints, paintImpl, setDrawTouchPoints, setMoveThresholdMethods inherited from class com.luciad.view.lightspeed.controller.ALspController
addPropertyChangeListener, addStatusListener, appendController, firePropertyChange, fireStatusEvent, getAWTFilter, getCursor, getFXCursor, getFXFilter, getIcon, getLayered, getName, getNextController, getShortDescription, getView, handleFXEventImpl, paint, registerViewPropertyNameForReset, removePropertyChangeListener, removeStatusListener, setAWTFilter, setCursor, setFXCursor, setFXFilter, setIcon, setName, setShortDescription, startInteraction, startInteractionImpl, terminateInteraction, terminateInteractionImpl
-
Constructor Details
-
TLspTouchNavigateController
public TLspTouchNavigateController()Creates a new navigation controller that performs all supported navigation actions. -
TLspTouchNavigateController
public TLspTouchNavigateController(boolean aShouldRotate, boolean aShouldZoom, boolean aShouldPan) Creates a new navigation controller that offers rotating, zooming and panning based on the passed arguments.- Parameters:
aShouldRotate- boolean indicating whether this controller should rotate the viewaShouldZoom- boolean indicating whether this controller should zoom the viewaShouldPan- boolean indicating whether this controller should pan the view
-
-
Method Details
-
isShouldRotate
public boolean isShouldRotate()Returns whether or not this controller should rotate the view.- Returns:
trueif this controller should rotate the view,falseotherwise.
-
setShouldRotate
public void setShouldRotate(boolean aShouldRotate) Sets whether or not this controller should rotate the view.- Parameters:
aShouldRotate-trueif this controller should rotate the view,falseotherwise.
-
isShouldPan
public boolean isShouldPan()Returns whether or not this controller should pan the view.- Returns:
trueif this controller should pan the view,falseotherwise.
-
setShouldPan
public void setShouldPan(boolean aShouldPan) Sets whether or not this controller should pan the view.- Parameters:
aShouldPan-trueif this controller should pan the view,falseotherwise.
-
isShouldZoom
public boolean isShouldZoom()Returns whether or not this controller should zoom the view.- Returns:
trueif this controller should zoom the view,falseotherwise.
-
setShouldZoom
public void setShouldZoom(boolean aShouldZoom) Sets whether or not this controller should zoom the view.- Parameters:
aShouldZoom-trueif this controller should zoom the view,falseotherwise.
-
isZoomOnDoubleTap
public boolean isZoomOnDoubleTap()Returns whether or not this controller should zoom the view after double tapping.- Returns:
trueif this controller should zoom the view after double tapping,falseotherwise.
-
setZoomOnDoubleTap
public void setZoomOnDoubleTap(boolean aShouldDoubleTap) Sets whether or not this controller should zoom the view after double tapping.- Parameters:
aShouldDoubleTap-trueif this controller should zoom the view after double tapping,falseotherwise.
-
isEnableInertia
public boolean isEnableInertia()Returns whether or not this controller should animate the gestures.- Returns:
trueif this controller should animate the gestures,falseotherwise.
-
setEnableInertia
public void setEnableInertia(boolean aEnableInertia) Sets whether or not this controller should animate the gestures.- Parameters:
aEnableInertia-trueif this controller should animate the gestures,falseotherwise.
-
isCombineGestures
public boolean isCombineGestures()Returns whether a single two-finger gesture can trigger different navigation actions (pan, zoom, rotate). If disabled, the controller will assign a single navigation action to each gesture and stick with it for as long as the gesture is ongoing. This filters out unintentional navigation actions and jitter.- Returns:
trueif this controller performs gestures together,falseif the controller handles them separately.
-
setCombineGestures
public void setCombineGestures(boolean aCombineGestures) Sets whether a single two-finger gesture can trigger different navigation actions (pan, zoom, rotate). If disabled, the controller will assign a single navigation action to each gesture and stick with it for as long as the gesture is ongoing. This filters out unintentional navigation actions and jitter.For example, if the user starts a pinch gesture, the controller will zoom (and only zoom) until the user lifts his fingers. It won't try to rotate or pan the view.
- Parameters:
aCombineGestures-trueif this controller should perform gestures together,falseif the controller needs to handle them separately.
-
setPitchDistanceThreshold
public void setPitchDistanceThreshold(int aPitchDistanceThreshold) Returns how close fingers should be to interpret two-finger movements in a 3D view as a pitch gesture. If the distance between two fingers is lower than this threshold, the controller will pitch the view. Otherwise this controller will pan, zoom and/or rotate the view.The default value is 100.
- Parameters:
aPitchDistanceThreshold- the threshold value between two fingers, in pixels- Since:
- 2019.1
-
getPitchDistanceThreshold
public int getPitchDistanceThreshold()Returns how close fingers should be to interpret two-finger movements in a 3D view as a pitch gesture. If the distance between two fingers is lower than this threshold, the controller will pitch the view. Otherwise this controller will pan, zoom and/or rotate the view.- Returns:
- the threshold value between two fingers, in pixels
- Since:
- 2019.1
-
setPanDistanceThreshold
public void setPanDistanceThreshold(int aPanDistanceThreshold) Sets how close fingers should be to interpret two-finger movements in a 2D view as a pan gesture. If the distance between two fingers is lower than this threshold, the controller will pan the view. Otherwise this controller will zoom and/or rotate the view.The default value is 100.
- Parameters:
aPanDistanceThreshold- the threshold value between two fingers, in pixels- Since:
- 2019.1
-
getPanDistanceThreshold
public int getPanDistanceThreshold()Returns how close fingers should be to interpret two-finger movements in a 2D view as a pan gesture. If the distance between two fingers is lower than this threshold, the controller will pan the view. Otherwise this controller will zoom and/or rotate the view.- Returns:
- the threshold value between two fingers, in pixels
- Since:
- 2019.1
-
touchPointAvailable
protected final List<TLcdTouchPoint> touchPointAvailable(List<TLcdTouchPoint> aTouchPoints, TLcdTouchPoint aTouchDown) Description copied from class:ALspTouchControllerThis method is called every time a new touch point is created or becomes available and allows to react accordingly.
aTouchDownis theTLcdTouchPointwhich has been created, whileaTouchPointscontains all availableTLcdTouchPoints (includingaTouchDown). All of these points are non-consumed.This method allows to indicate which points should be tracked by this controller by returning them in a
List. If aTLcdTouchPointwhich is currently tracked is omitted from theList, that touch point will be made available to the rest of the chain as explained in the class javadoc.- Overrides:
touchPointAvailablein classALspConfinedTouchController- Parameters:
aTouchPoints- AListcontaining all availableTLcdTouchPointinstances. This list will includeaTouchDown. Note that some of theseTLcdTouchPoints can already be tracked by this controller (seegetTouchPointIDs). It is possible to modify thisListand return it instead of creating a newList.aTouchDown- The descriptor of the touch point which has been created or removed. The state of the descriptor will always be DOWN. Note that this descriptor is included inaTouchPoints.- Returns:
- a
Listcontaining allTLcdTouchPointinstances which should be tracked by this controller. AllTLcdTouchPointinstances contained in thisListmust be contained inaTouchPoints. May be an emptyList, but notnull.
-
touchPointWithdrawn
protected final List<TLcdTouchPoint> touchPointWithdrawn(List<TLcdTouchPoint> aTouchPoints, TLcdTouchPoint aTouchUp) Description copied from class:ALspTouchControllerThis methods is called every time a tracked touch point is removed or consumed and allows to react accordingly.
aTouchUpis theTLcdTouchPointwhich has been removed, whileaTouchPointscontains all availableTLcdTouchPoints (includingaTouchUp). All of these points are non-consumed.This method allows to indicate that certain touch points should no longer be tracked by this controller. It does so by returning a
Listcontaining allTLcdTouchPointinstances which should be tracked by this controller. If aTLcdTouchPointwhich is currently tracked is omitted from theList, that touch point will be made available to the rest of the chain as explained in the class javadoc.- Overrides:
touchPointWithdrawnin classALspConfinedTouchController- Parameters:
aTouchPoints- AListcontaining all availableTLcdTouchPointinstances, includingaTouchUp. It is possible to modify thisListand return it instead of creating a newList.aTouchUp- The touch point which has been removed. The state of the descriptor will always be UP. Note that this descriptor is included inaTouchPoints.- Returns:
- a
Listcontaining allTLcdTouchPoints this controller should keep tracking. AllTLcdTouchPointinstances contained in thisListmust be contained inaTrackedTouchPoints. May be an emptyList, but notnull. - See Also:
-
touchPointMoved
protected final List<TLcdTouchPoint> touchPointMoved(List<TLcdTouchPoint> aTrackedTouchPoints, TLcdTouchPoint aTouchMoved) Description copied from class:ALspTouchControllerThis method is called when one of the touch points, used by this controller, is moved beyond the threshold and allows to react accordingly.
aTouchMovedis theTLcdTouchPointwhich has moved, whileaTrackedTouchPointscontains allTLcdTouchPoints this controller is currently tracking (includingaTouchMoved). All of these points will be non-consumed.This method allows to indicate that certain touch points should no longer be tracked by this controller. It does so by returning a
Listcontaining allTLcdTouchPointinstances which should be tracked by this controller. If aTLcdTouchPointwhich is currently tracked is omitted from theList, that touch point will be made available to the rest of the chain as explained in the class javadoc.A possible use case is a select controller, which does not expect move events. The select controller can claim the touch point when it is created, but when the point starts moving it can decide it cannot handle it.
- Specified by:
touchPointMovedin classALspTouchController- Parameters:
aTrackedTouchPoints-Listcontaining allTLcdTouchPoints currently tracked by this controller. It is possible to modify thisListand return it instead of creating a newList.aTouchMoved- theTLcdTouchPointthat has moved- Returns:
- a
Listcontaining allTLcdTouchPoints this controller should keep tracking. AllTLcdTouchPointinstances contained in thisListmust be contained inaTrackedTouchPoints. May be an emptyList, but notnull. - See Also:
-
getMaximumNumberOfPoints
public final int getMaximumNumberOfPoints()Description copied from class:ALspConfinedTouchControllerReturns the maximum number of touch points this controller should handle, as specified in the constructor.
- Overrides:
getMaximumNumberOfPointsin classALspConfinedTouchController- Returns:
- the maximum number of touch points this controller should handle.
- See Also:
-
getMinimumNumberOfPoints
public final int getMinimumNumberOfPoints()Description copied from class:ALspConfinedTouchControllerReturns the minimum number of touch points this controller should handle, as specified in the constructor.
- Overrides:
getMinimumNumberOfPointsin classALspConfinedTouchController- Returns:
- the minimum number of touch points this controller should handle.
- See Also:
-
getOriginalLocations
Description copied from class:ALspTouchControllerReturns the original locations of the touch points this controller is tracking (= the location of the point when it was passed to the
touchPointAvailablemethod). The locations are expressed in view AWT coordinates. In case the view is moved after the touch down of the touch point (for example, due to a pan operation), these coordinates will not be altered. Hence the corresponding world coordinates will no longer match the world coordinates of the point during thetouchPointAvailablemethod call.The order of the points in the returned list matches the order of the lists returned in
getPreviousLocationsandgetCurrentLocations. The same order is applied ongetTouchPointIDs.- Overrides:
getOriginalLocationsin classALspTouchController- Returns:
- the original locations of the touch points this controller is tracking. The
Listis empty when no points are currently tracked.
-
getPreviousLocations
Description copied from class:ALspTouchControllerReturns the locations of the touch points this controller is tracking during the previous event. The locations are expressed in view AWT coordinates. In case the view is moved after the touch down or last move of the touch point (for example, due to a pan operation), these coordinates will not be altered. Hence the corresponding world coordinates will no longer match the world coordinates of the point during the touch down or the move.
The order of the points in the returned list matches the order of the lists returned in
getOriginalLocationsandgetCurrentLocations. The same order is applied ongetTouchPointIDs.- Overrides:
getPreviousLocationsin classALspTouchController- Returns:
- the previous locations of the touch points this controller is tracking. The
Listis empty when no points are currently tracked.
-
getCurrentLocations
Description copied from class:ALspTouchControllerReturns the current locations of the touch points this controller is tracking. Locations are expressed in view AWT coordinates.
The order of the points in the returned list matches the order of the lists returned in
getOriginalLocationsandgetPreviousLocations. The same order is applied ongetTouchPointIDs.- Overrides:
getCurrentLocationsin classALspTouchController- Returns:
- the current locations of the touch points this controller is tracking. The
Listis empty when no points are currently tracked.
-
getTouchPointIDs
Description copied from class:ALspTouchControllerReturns a list containing the touch point IDs of the touch points used by this controller.
The order of the IDs is the order in which the points were passed to the touchPointAvailable method.
- Overrides:
getTouchPointIDsin classALspTouchController- Returns:
- a list containing the touch
point IDs of the touch points this controller is using. The
Listis empty when no points are currently tracked.
-