| 123456789101112131415161718192021222324252627282930313233343536373839 |
- from geometry import AcceleratedPositionable
- class TouchObject(AcceleratedPositionable):
- """
- Representation of an object touching the screen. The simplest form of a
- touch object is a 'point', represented by an (x, y) position and a unique
- object id. All dimensions are in pixels.
- """
- def __init__(self, x, y):
- super(TouchObject, self).__init__(x, y)
- self.object_id = self.create_object_id()
- def get_id(self):
- return self.object_id
- object_id_count = 0
- @classmethod
- def create_object_id(cls):
- cls.object_id_count += 1
- return cls.object_id_count
- class TouchPoint(TouchObject):
- """
- Simple point touchin the scree, consisting only of an (x, y) position.
- """
- pass
- # TODO: Extend with more complex touch object, e.g.:
- #class TouchFiducial(TouchObject): ...
- OBJECT_NAMES = {
- 'point': TouchPoint,
- #'fiducial': TouchFiducial,
- }
|