ChromiumTouch
Attachment 'axis.h'
Download 1 #ifndef UI_BASE_TOUCH_AXIS_H
2 #define UI_BASE_TOUCH_AXIS_H
3
4 #include "base/property_bag.h"
5
6 #include <iostream>
7 #include <limits>
8 #include <string>
9
10 namespace ui {
11
12 class Axis {
13 public:
14
15 enum Type {
16 AXIS_TYPE_X = 0, /**< X coordinate */
17 AXIS_TYPE_Y, /**< Y coordinate */
18 AXIS_TYPE_TOUCH_MAJOR, /**< Width along major axis of contact area of touch */
19 AXIS_TYPE_TOUCH_MINOR, /**< Width along minor axis of contact area of touch */
20 AXIS_TYPE_WIDTH_MAJOR, /**< Width along major axis of touch tool */
21 AXIS_TYPE_WIDTH_MINOR, /**< Width along minor axis of touch tool */
22 AXIS_TYPE_ORIENTATION, /**< Orientation of major axis of contact ellipse */
23 AXIS_TYPE_TOOL, /**< Tool type */
24 AXIS_TYPE_BLOB_ID, /**< Blob ID of group of touches */
25 AXIS_TYPE_TRACKING_ID, /**< Tracking ID */
26 AXIS_TYPE_PRESSURE, /**< Pressure */
27 AXIS_TYPE_HOVER_DISTANCE, /**< Hover distance */
28 AXIS_TYPE_UNKNOWN,
29 AXIS_TYPE_LAST
30 };
31
32 Axis()
33 : id_(-1),
34 type_(AXIS_TYPE_UNKNOWN),
35 name_("Unknown axis"),
36 min_(-std::numeric_limits<float>::max()),
37 max_(std::numeric_limits<float>::max()),
38 resolution_(0.f),
39 value_(0.f),
40 payload_(NULL) {
41 }
42
43 ~Axis() {
44 delete(payload_);
45 }
46
47 int id() const { return id_; }
48 void set_id(int id) { id_ = id; }
49
50 Type type() const { return type_; }
51 void set_type(Type type) { type_ = type; }
52
53 const std::string & name() const { return name_; }
54 void set_name(const std::string& name) { name_ = name; }
55
56 float min() const { return min_; }
57 void set_min(float min) { min_ = min; }
58
59 float max() const { return max_; }
60 void set_max(float max) { max_ = max; }
61
62 float resolution() const { return resolution_; }
63 void set_resolution(float res) { resolution_ = res; }
64
65 float value() const { return value_; }
66 void set_value(float value) { value_ = value; }
67
68 base::PropertyBag * payload() {
69 if(payload_ == NULL)
70 payload_ = new base::PropertyBag();
71
72 return payload_;
73 }
74
75 private:
76 int id_;
77 Type type_;
78 std::string name_;
79 float min_;
80 float max_;
81 float resolution_;
82 float value_;
83 base::PropertyBag* payload_;
84 };
85
86 std::ostream & operator<<(std::ostream& out, const Axis& axis);
87
88 }
89
90 #endif // UI_BASE_TOUCH_AXIS_H
91
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.