|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Array of points |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef _XNPOINTARRAY_H_ |
|
20 #define _XNPOINTARRAY_H_ |
|
21 |
|
22 // System includes |
|
23 #include <e32std.h> |
|
24 |
|
25 /** |
|
26 * XnGestureHelper namespace |
|
27 * Used for the whole gesture family - Gesture recognizer, gesture helper, |
|
28 * Point array |
|
29 */ |
|
30 namespace XnGestureHelper |
|
31 { |
|
32 |
|
33 /** |
|
34 * Represents a single point given at certain time |
|
35 */ |
|
36 struct TXnPointEntry |
|
37 { |
|
38 |
|
39 /** constructor */ |
|
40 inline TXnPointEntry( const TPoint& aPos, const TTime& aTime ); |
|
41 |
|
42 TPoint iPos; |
|
43 TTime iTime; |
|
44 }; |
|
45 |
|
46 /** |
|
47 * Array of points that wraps another point array |
|
48 * The purpose of this class is to allow deriving classes to override [] |
|
49 * and in that member function adjust the point, e.g., by setting one |
|
50 * axis to always a constant value. This allows providing a sequence of |
|
51 * points to the recogniser in which the other axis is ignored. |
|
52 * |
|
53 * @ingroup group_xnlayoutengine |
|
54 */ |
|
55 NONSHARABLE_CLASS( TXnPointArray ) |
|
56 { |
|
57 public: |
|
58 |
|
59 /** |
|
60 * Constructor |
|
61 * |
|
62 * @param aPoints points array to wrap (and filter) |
|
63 */ |
|
64 TXnPointArray( const RArray< TXnPointEntry >& aPoints ); |
|
65 |
|
66 /** |
|
67 * Length of the array |
|
68 * |
|
69 * @return Length of the array |
|
70 */ |
|
71 TInt Count() const; |
|
72 |
|
73 /** |
|
74 * Returns point at position, may be filtered |
|
75 * virtual so deriving classes can modify the point |
|
76 * (e.g., filter one axis) |
|
77 * |
|
78 * @return A filtered point at aIndex. Default implementation same |
|
79 * as Raw(...) |
|
80 */ |
|
81 virtual TPoint operator[]( TInt aIndex ) const; |
|
82 |
|
83 /** |
|
84 * Nonfiltered index |
|
85 * |
|
86 * @return An raw, non-filtered point at aIndex |
|
87 */ |
|
88 const TPoint& Raw( TInt aIndex ) const; |
|
89 |
|
90 private: |
|
91 |
|
92 /** Array of points, Not owned */ |
|
93 const RArray< TXnPointEntry >& iPoints; |
|
94 }; |
|
95 } // namespace XnGestureHelper |
|
96 |
|
97 |
|
98 // Inline functions |
|
99 #include "xnpointarray.inl" |
|
100 |
|
101 #endif // _XNPOINTARRAY_H_ |