c844e261754de0fc94ee9c80a9a125a814974105
[occt.git] / samples / qt / AndroidQt / src / AndroidQt_TouchParameters.cxx
1 // Copyright (c) 2014 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14 #include <AndroidQt_TouchParameters.h>
15
16 // =======================================================================
17 // function : AndroidQt_TouchParameters
18 // purpose  :
19 // =======================================================================
20 AndroidQt_TouchParameters::AndroidQt_TouchParameters()
21 : myXStart (0.0),
22   myXEnd   (0.0),
23   myYStart (0.0),
24   myYEnd   (0.0)
25 {
26 }
27
28 // =======================================================================
29 // function : AndroidQt_TouchParameters
30 // purpose  :
31 // =======================================================================
32 AndroidQt_TouchParameters::AndroidQt_TouchParameters (const double theX,
33                                                       const double theY)
34 : myXStart (theX),
35   myXEnd   (theX),
36   myYStart (theY),
37   myYEnd   (theY)
38 {
39 }
40
41 // =======================================================================
42 // function : X
43 // purpose  :
44 // =======================================================================
45 QPair<double, double> AndroidQt_TouchParameters::X() const
46 {
47   return qMakePair(myXStart, myXEnd);
48 }
49
50 // =======================================================================
51 // function : DevX
52 // purpose  :
53 // =======================================================================
54 double AndroidQt_TouchParameters::DevX() const
55 {
56   return myXEnd - myXStart;
57 }
58
59 // =======================================================================
60 // function : Y
61 // purpose  :
62 // =======================================================================
63 QPair<double, double> AndroidQt_TouchParameters::Y() const
64 {
65   return qMakePair(myYStart, myYEnd);
66 }
67
68 // =======================================================================
69 // function : DevY
70 // purpose  :
71 // =======================================================================
72 double AndroidQt_TouchParameters::DevY() const
73 {
74   return myYEnd - myYStart;
75 }
76
77 // =======================================================================
78 // function : SetStarts
79 // purpose  :
80 // =======================================================================
81 void AndroidQt_TouchParameters::SetStarts (const double theXStart,
82                                            const double theYStart)
83 {
84   myXStart = theXStart;
85   myYStart = theYStart;
86 }
87
88 // =======================================================================
89 // function : SetEnds
90 // purpose  :
91 // =======================================================================
92 void AndroidQt_TouchParameters::SetEnds (const double theXEnd,
93                                          const double theYEnd)
94 {
95   myXEnd = theXEnd;
96   myYEnd = theYEnd;
97 }
98
99 // =======================================================================
100 // function : ClearDev
101 // purpose  :
102 // =======================================================================
103 void AndroidQt_TouchParameters::ClearDev()
104 {
105   myXStart = myXEnd;
106   myYStart = myYEnd;
107 }