Class TLcdTouchPoint

java.lang.Object
com.luciad.input.touch.TLcdTouchPoint

public class TLcdTouchPoint extends Object

This class describes the (change in) state of a single touch point. It is used in TLcdTouchEvent instances to describe the state of every touch point of that particular event.

A touch point can have four different states which are grouped in the TLcdTouchPoint.State enumeration. When touch points change state, the application is warned by means of a TLcdTouchEvent. This event contains TLcdTouchPoint instances for every touch point, both the one that has changed state as well as the ones which remained unchanged.

Every touch point can be identified by an identifier that is unique for a given touch event ID. It is assigned when a finger is put down and remains the same until it is lifted and no more double click events can be generated for it.

Since:
10.0
See Also:
  • Field Details

    • UNKNOWN_TOUCH_POINT_TYPE

      public static final String UNKNOWN_TOUCH_POINT_TYPE
      String indicating the type of touch point is not known.
      See Also:
    • HAND_PALM_TOUCH_POINT_TYPE

      public static final String HAND_PALM_TOUCH_POINT_TYPE
      String indicating the touch point was made by a hand palm.
      See Also:
    • FINGER_TIP_TOUCH_POINT_TYPE

      public static final String FINGER_TIP_TOUCH_POINT_TYPE
      String indicating the touch point was made by the tip of a finger.
      See Also:
  • Constructor Details

    • TLcdTouchPoint

      public TLcdTouchPoint(TLcdTouchPoint.State aState, long aID, Point aLocation, int aTapCount, String aType, boolean aConsumed)
      Create a new TLcdTouchPoint.
      Parameters:
      aState - the state of the touch point
      aID - unique ID allowing to determine of which touch point this event describes the change in state
      aLocation - the location of the touch. See getLocation() for more information on how this location is specified
      aTapCount - the number of times the user touched the touch device for this touch point. See getTapCount() for more information.
      aType - the type of the touch point (e.g. fingertip, hand palm, stylus,
      aConsumed - indicates whether this touch point is consumed. See isConsumed() for more information
    • TLcdTouchPoint

      public TLcdTouchPoint(TLcdTouchPoint.State aState, long aID, Point aLocation, int aTapCount, String aType, boolean aConsumed, long aCxContact, long aCyContact)
      Create a new TLcdTouchPoint.
      Parameters:
      aState - the state of the touch point
      aID - unique ID allowing to determine of which touch point this event describes the change in state
      aLocation - the location of the touch. See getLocation() for more information on how this location is specified
      aTapCount - the number of times the user touched the touch device for this touch point. See getTapCount() for more information.
      aType - the type of the touch point (e.g. fingertip, hand palm, stylus,
      aConsumed - indicates whether this touch point is consumed. See isConsumed() for more information
      aCxContact - the width of the touched area in pixels
      aCyContact - the width of the touched area in pixels
  • Method Details

    • getID

      public long getID()

      Returns the unique ID of the touch point.

      From the creation of the touch point (see TLcdTouchPoint.State.DOWN) until the removal (see TLcdTouchPoint.State.UP) of the touch point, this ID will be the same for all TLcdTouchPoint instances describing a change in state of this particular touch point.

      Other touch points originating from the same device and same user which are active at the same time must have another ID. This allows to track the movements and/or state of multiple touch points simultaneously.

      As soon as a touch point is removed (TLcdTouchPoint.State.UP) and the tap count for this point could no longer increase, this ID becomes available and may be reused to describe the state of a new touch point.

      Returns:
      the unique ID of the touch point
      See Also:
    • getState

      public TLcdTouchPoint.State getState()
      The state of the touch point which is described by this TLcdTouchPoint.
      Returns:
      the state of the touch point which is described by this TLcdTouchPoint
    • getLocation

      public Point getLocation()

      The location of the touch point. Depending on the state of the touch point, it is defined as:

      • TLcdTouchPoint.State.DOWN: the location where the touch point is created.
      • TLcdTouchPoint.State.MOVED: the new location of the touch point. In order to be able to determine the actual move, the location should be compared to the location of the previous TLcdTouchPoint of the same touch point.
      • TLcdTouchPoint.State.STATIONARY: the location of the touch point. It should always be the same as the location received in the previous TLcdTouchPoint since the touch point remained stationary.
      • TLcdTouchPoint.State.UP: the last location of the touch point before it was removed.

      The location is expressed relative to the source component of the TLcdTouchEvent containing this TLcdTouchPoint.

      Returns:
      the location of the touch point
    • getTapCount

      public int getTapCount()

      Returns the number of times the user touched the touch device for this touch point.

      The tap count is only valid when the touch point is TLcdTouchPoint.State.DOWN created, and will be at least one. For all other states, this method returns 0.

      Returns:
      the number of times the user touched the touch device for this touch point
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getType

      public String getType()

      Returns the type of the touch point (e.g. fingertip, hand palm, stylus, ...).

      Some predefined values are available as static fields of this class.

      Returns:
      the type of the touch point
    • isConsumed

      public boolean isConsumed()

      Returns whether this touch point is consumed or not. Classes which handle TLcdTouchEvents can use this state to determine whether they handle this touch point or not.

      Note: it is left to the concrete handlers of TLcdTouchEvents to decide whether and how they use this property.

      Returns:
      true when this touch point is consumed, false otherwise
    • cloneAs

      public TLcdTouchPoint cloneAs(TLcdTouchPoint.State aState, long aTouchPointID, Point aLocation, int aTapCount, String aTouchPointType, boolean aConsumed, long aCxContact, long aCyContact)

      Create a new instance of this class based on the information passed as parameters to this method.

      This method should be overridden by extensions of this class if they want to include their info in the newly created touch point.

      Parameters:
      aState - the touch point state for the new TLcdTouchPoint
      aTouchPointID - the ID for the new TLcdTouchPoint
      aLocation - the location for the new TLcdTouchPoint
      aTapCount - the tap count for the new TLcdTouchPoint
      aTouchPointType - the touch point type for the new TLcdTouchPoint
      aConsumed - the consumed state for the new TLcdTouchPoint
      aCxContact - the width of the touched area for the new TLcdTouchPoint
      aCyContact - the height of the touched area for the new TLcdTouchPoint
      Returns:
      a new TLcdTouchPoint
      See Also:
    • getDisplayName

      public static String getDisplayName(TLcdTouchPoint.State aState)
      Returns a String representation of aState.
      Parameters:
      aState - the state
      Returns:
      a String representation of aState
    • getContactAreaWidth

      public long getContactAreaWidth()
      Returns the width of the contact area in pixels. A value of 0 means that the information is not available.
      Returns:
      the width of the contact area.
    • getContactAreaHeight

      public long getContactAreaHeight()
      Returns the height of the contact area in pixels. A value of 0 means that the information is not available.
      Returns:
      the height of the contact area.