Update copyright year to 2015 for public api: core
[platform/core/uifw/dali-core.git] / dali / public-api / events / pan-gesture.cpp
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/public-api/events/pan-gesture.h>
20
21 // INTERNAL INCLUDES
22 #include <dali/public-api/common/dali-common.h>
23
24 namespace Dali
25 {
26
27 PanGesture::PanGesture()
28 : Gesture(Gesture::Pan, Gesture::Clear),
29   numberOfTouches(1)
30 {
31 }
32
33 PanGesture::PanGesture(Gesture::State state)
34 : Gesture(Gesture::Pan, state),
35   numberOfTouches(1)
36 {
37 }
38
39 PanGesture::PanGesture( const PanGesture& rhs )
40 : Gesture( rhs ),
41   velocity( rhs.velocity ),
42   displacement( rhs.displacement ),
43   position( rhs.position ),
44   screenVelocity( rhs.screenVelocity ),
45   screenDisplacement( rhs.screenDisplacement ),
46   screenPosition( rhs.screenPosition ),
47   numberOfTouches( rhs.numberOfTouches )
48 {
49 }
50
51 PanGesture& PanGesture::operator=( const PanGesture& rhs )
52 {
53   Gesture::operator=(rhs);
54   velocity = rhs.velocity;
55   displacement = rhs.displacement;
56   position = rhs.position;
57   screenVelocity = rhs.screenVelocity;
58   screenDisplacement = rhs.screenDisplacement;
59   screenPosition = rhs.screenPosition;
60   numberOfTouches = rhs.numberOfTouches;
61
62   return *this;
63 }
64
65 PanGesture::~PanGesture()
66 {
67 }
68
69 float PanGesture::GetSpeed() const
70 {
71   return velocity.Length();
72 }
73
74 float PanGesture::GetDistance() const
75 {
76   return displacement.Length();
77 }
78
79 float PanGesture::GetScreenSpeed() const
80 {
81   return screenVelocity.Length();
82 }
83
84 float PanGesture::GetScreenDistance() const
85 {
86   return screenDisplacement.Length();
87 }
88
89 } // namespace Dali