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.
TLcdTouchEvent
Modifier and Type | Class and Description |
---|---|
static class |
TLcdTouchPoint.State
Enumeration of the supported states of touch points.
|
Modifier and Type | Field and Description |
---|---|
static String |
FINGER_TIP_TOUCH_POINT_TYPE
String indicating the touch point was made by the tip of a finger.
|
static String |
HAND_PALM_TOUCH_POINT_TYPE
String indicating the touch point was made by a hand palm.
|
static String |
UNKNOWN_TOUCH_POINT_TYPE
String indicating the type of touch point is not known.
|
Constructor and Description |
---|
TLcdTouchPoint(TLcdTouchPoint.State aState,
long aID,
Point aLocation,
int aTapCount,
String aType,
boolean aConsumed)
Create a new
TLcdTouchPoint . |
TLcdTouchPoint(TLcdTouchPoint.State aState,
long aID,
Point aLocation,
int aTapCount,
String aType,
boolean aConsumed,
long aCxContact,
long aCyContact)
Create a new
TLcdTouchPoint . |
Modifier and Type | Method and Description |
---|---|
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.
|
long |
getContactAreaHeight()
Returns the height of the contact area in pixels.
|
long |
getContactAreaWidth()
Returns the width of the contact area in pixels.
|
static String |
getDisplayName(TLcdTouchPoint.State aState)
Returns a String representation of
aState . |
long |
getID()
Returns the unique ID of the touch point.
|
Point |
getLocation()
The location of the touch point.
|
TLcdTouchPoint.State |
getState()
The state of the touch point which is described by this
TLcdTouchPoint . |
int |
getTapCount()
Returns the number of times the user touched the touch device for this touch point.
|
String |
getType()
Returns the type of the touch point (e.g. fingertip, hand palm, stylus, ...).
|
boolean |
isConsumed()
Returns whether this touch point is consumed or not.
|
String |
toString() |
public static final String UNKNOWN_TOUCH_POINT_TYPE
getType()
,
Constant Field Valuespublic static final String HAND_PALM_TOUCH_POINT_TYPE
getType()
,
Constant Field Valuespublic static final String FINGER_TIP_TOUCH_POINT_TYPE
getType()
,
Constant Field Valuespublic TLcdTouchPoint(TLcdTouchPoint.State aState, long aID, Point aLocation, int aTapCount, String aType, boolean aConsumed)
TLcdTouchPoint
.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. See getLocation()
for more
information on how this location is specifiedaTapCount
- 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 informationpublic TLcdTouchPoint(TLcdTouchPoint.State aState, long aID, Point aLocation, int aTapCount, String aType, boolean aConsumed, long aCxContact, long aCyContact)
TLcdTouchPoint
.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. See getLocation()
for more
information on how this location is specifiedaTapCount
- 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 informationaCxContact
- the width of the touched area in pixelsaCyContact
- the width of the touched area in pixelspublic 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.
TLcdTouchEvent.getTouchDeviceID()
,
TLcdTouchEvent.getUserID()
public TLcdTouchPoint.State getState()
TLcdTouchPoint
.TLcdTouchPoint
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
.
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.
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.
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.
true
when this touch point is consumed, false
otherwisepublic 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.
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
TLcdTouchPoint
TLcdTouchEvent.cloneAs(long, Object, java.util.List,
long, String, long)
public static String getDisplayName(TLcdTouchPoint.State aState)
aState
.aState
- the stateaState
public long getContactAreaWidth()
public long getContactAreaHeight()