Class TLcdTouchPoint
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:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Enumeration of the supported states of touch points. -
Field Summary
-
Constructor Summary
ConstructorDescriptionTLcdTouchPoint
(TLcdTouchPoint.State aState, long aID, Point aLocation, int aTapCount, String aType, boolean aConsumed) Create a newTLcdTouchPoint
.TLcdTouchPoint
(TLcdTouchPoint.State aState, long aID, Point aLocation, int aTapCount, String aType, boolean aConsumed, long aCxContact, long aCyContact) Create a newTLcdTouchPoint
. -
Method Summary
Modifier and TypeMethodDescriptioncloneAs
(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.long
Returns the height of the contact area in pixels.long
Returns the width of the contact area in pixels.static String
getDisplayName
(TLcdTouchPoint.State aState) Returns a String representation ofaState
.long
getID()
Returns the unique ID of the touch point.The location of the touch point.getState()
The state of the touch point which is described by thisTLcdTouchPoint
.int
Returns the number of times the user touched the touch device for this touch point.getType()
Returns the type of the touch point (e.g. fingertip, hand palm, stylus, ...).boolean
Returns whether this touch point is consumed or not.toString()
-
Field Details
-
UNKNOWN_TOUCH_POINT_TYPE
String indicating the type of touch point is not known.- See Also:
-
HAND_PALM_TOUCH_POINT_TYPE
String indicating the touch point was made by a hand palm.- See Also:
-
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 newTLcdTouchPoint
.- Parameters:
aState
- the state of the touch pointaID
- unique ID allowing to determine of which touch point this event describes the change in stateaLocation
- the location of the touch. SeegetLocation()
for more information on how this location is specifiedaTapCount
- the number of times the user touched the touch device for this touch point. SeegetTapCount()
for more information.aType
- the type of the touch point (e.g. fingertip, hand palm, stylus,aConsumed
- indicates whether this touch point is consumed. SeeisConsumed()
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 newTLcdTouchPoint
.- Parameters:
aState
- the state of the touch pointaID
- unique ID allowing to determine of which touch point this event describes the change in stateaLocation
- the location of the touch. SeegetLocation()
for more information on how this location is specifiedaTapCount
- the number of times the user touched the touch device for this touch point. SeegetTapCount()
for more information.aType
- the type of the touch point (e.g. fingertip, hand palm, stylus,aConsumed
- indicates whether this touch point is consumed. SeeisConsumed()
for more informationaCxContact
- the width of the touched area in pixelsaCyContact
- 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 (seeTLcdTouchPoint.State.UP
) of the touch point, this ID will be the same for allTLcdTouchPoint
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
The state of the touch point which is described by thisTLcdTouchPoint
.- Returns:
- the state of the touch point which is described by this
TLcdTouchPoint
-
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 previousTLcdTouchPoint
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 previousTLcdTouchPoint
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 thisTLcdTouchPoint
.- 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
-
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
TLcdTouchEvent
s can use this state to determine whether they handle this touch point or not.Note: it is left to the concrete handlers of
TLcdTouchEvent
s 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 newTLcdTouchPoint
aTouchPointID
- the ID for the newTLcdTouchPoint
aLocation
- the location for the newTLcdTouchPoint
aTapCount
- the tap count for the newTLcdTouchPoint
aTouchPointType
- the touch point type for the newTLcdTouchPoint
aConsumed
- the consumed state for the newTLcdTouchPoint
aCxContact
- the width of the touched area for the newTLcdTouchPoint
aCyContact
- the height of the touched area for the newTLcdTouchPoint
- Returns:
- a new
TLcdTouchPoint
- See Also:
-
getDisplayName
Returns a String representation ofaState
.- 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.
-