|
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 the License "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 _POINTARRAY_H_ |
|
20 #define _POINTARRAY_H_ |
|
21 |
|
22 #include <e32std.h> |
|
23 |
|
24 namespace RT_GestureHelper |
|
25 { |
|
26 |
|
27 /** |
|
28 * Represents a single point given at certain time |
|
29 */ |
|
30 struct TPointEntry |
|
31 { |
|
32 /** constructor */ |
|
33 inline TPointEntry( const TPoint& aPos, const TTime& aTime ) |
|
34 : iPos( aPos ), iTime( aTime ) |
|
35 { |
|
36 } |
|
37 |
|
38 TPoint iPos; |
|
39 TTime iTime; |
|
40 }; |
|
41 |
|
42 /** |
|
43 * Array of points that wraps another point array |
|
44 * The purpose of this class is to allow deriving classes to override [] |
|
45 * and in that member function adjust the point, e.g., by setting one |
|
46 * axis to always a constant value. This allows providing a sequence of |
|
47 * points to the recogniser in which the other axis is ignored. |
|
48 */ |
|
49 NONSHARABLE_CLASS( TPointArray ) |
|
50 { |
|
51 public: |
|
52 /** |
|
53 * @param aPoints points array to wrap (and filter) |
|
54 */ |
|
55 TPointArray( const RArray< TPointEntry >& aPoints ); |
|
56 /** @returns length of the array */ |
|
57 TInt Count() const; |
|
58 /** |
|
59 * @returns a filtered point at aIndex. Default implementation same |
|
60 * as Raw(...) |
|
61 * virtual so deriving classes can modify the point (e.g., filter one axis) |
|
62 */ |
|
63 virtual TPoint operator[]( TInt aIndex ) const; |
|
64 /** @returns an raw, non-filtered point at aIndex */ |
|
65 TPoint Raw( TInt aIndex ) const; |
|
66 |
|
67 private: |
|
68 const RArray< TPointEntry >& iPoints; |
|
69 }; |
|
70 |
|
71 } // namespace GestureHelper |
|
72 |
|
73 #endif // _POINTARRAY_H_ |