-
Notifications
You must be signed in to change notification settings - Fork 83
/
locpoint.cpp
260 lines (215 loc) · 4.82 KB
/
locpoint.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
/*
Copyright 2012 Benjamin Vedder benjamin@vedder.se
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "locpoint.h"
#include <cmath>
LocPoint::LocPoint(double x, double y, double height, double roll, double pitch, double yaw, double speed,
double radius, double sigma, QColor color, qint32 time, int id, bool drawLine, quint32 attributes) :
mX(x), mY(y), mHeight(height), mRoll(roll), mPitch(pitch), mYaw(yaw), mSpeed(speed),
mRadius(radius), mSigma(sigma), mColor(color), mTime(time), mId(id), mDrawLine(drawLine),
mAttributes(attributes)
{
}
LocPoint::LocPoint(const LocPoint &point)
{
*this = point;
}
double LocPoint::getX() const
{
return mX;
}
double LocPoint::getY() const
{
return mY;
}
double LocPoint::getHeight() const
{
return mHeight;
}
double LocPoint::getRoll() const
{
return mRoll;
}
double LocPoint::getPitch() const
{
return mPitch;
}
double LocPoint::getYaw() const
{
return mYaw;
}
double LocPoint::getSpeed() const
{
return mSpeed;
}
QPointF LocPoint::getPoint() const
{
return QPointF(mX, mY);
}
QPointF LocPoint::getPointMm() const
{
return QPointF(mX * 1000.0, mY * 1000.0);
}
double LocPoint::getRadius() const
{
return mRadius;
}
double LocPoint::getSigma() const
{
return mSigma;
}
void LocPoint::setX(double x)
{
mX = x;
}
void LocPoint::setY(double y)
{
mY = y;
}
void LocPoint::setHeight(double height)
{
mHeight = height;
}
void LocPoint::setXY(double x, double y)
{
mX = x;
mY = y;
}
void LocPoint::setTime(const qint32 &time)
{
mTime = time;
}
void LocPoint::setId(int id)
{
mId = id;
}
QString LocPoint::getInfo() const
{
return mInfo;
}
QColor LocPoint::getColor() const
{
return mColor;
}
qint32 LocPoint::getTime() const
{
return mTime;
}
int LocPoint::getId() const
{
return mId;
}
LocPoint &LocPoint::operator =(const LocPoint &point)
{
mX = point.mX;
mY = point.mY;
mHeight = point.mHeight;
mRoll = point.mRoll;
mPitch = point.mPitch;
mYaw = point.mYaw;
mSpeed = point.mSpeed;
mRadius = point.mRadius;
mSigma = point.mSigma;
mInfo = point.mInfo;
mColor = point.mColor;
mTime = point.mTime;
mId = point.mId;
mDrawLine = point.mDrawLine;
mAttributes = point.mAttributes;
return *this;
}
bool LocPoint::getDrawLine() const
{
return mDrawLine;
}
quint32 LocPoint::getAttributes() const
{
return mAttributes;
}
double LocPoint::getDistanceTo(const LocPoint &point) const
{
return sqrt((point.mX - mX) * (point.mX - mX) +
(point.mY - mY) * (point.mY - mY));
}
double LocPoint::getDistanceTo3d(const LocPoint &point) const
{
return sqrt((point.mX - mX) * (point.mX - mX) +
(point.mY - mY) * (point.mY - mY) +
(point.mHeight - mHeight) * (point.mHeight - mHeight));
}
bool LocPoint::operator ==(const LocPoint &point)
{
if ( mX == point.mX &&
mY == point.mY &&
mHeight == point.mHeight &&
mRoll == point.mRoll &&
mPitch == point.mPitch &&
mYaw == point.mYaw &&
mSpeed == point.mSpeed &&
mRadius == point.mRadius &&
mSigma == point.mSigma &&
mInfo == point.mInfo &&
mColor == point.mColor &&
mTime == point.mTime &&
mId == point.mId &&
mDrawLine == point.mDrawLine &&
mAttributes == point.mAttributes) {
return true;
} else {
return false;
}
}
bool LocPoint::operator !=(const LocPoint &point)
{
return !(operator==(point));
}
void LocPoint::setInfo(const QString &info)
{
mInfo = info;
}
void LocPoint::setRoll(double roll)
{
mRoll = roll;
}
void LocPoint::setPitch(double pitch)
{
mPitch = pitch;
}
void LocPoint::setYaw(double alpha)
{
mYaw = alpha;
}
void LocPoint::setSpeed(double speed)
{
mSpeed = speed;
}
void LocPoint::setRadius(double radius)
{
mRadius = radius;
}
void LocPoint::setSigma(double sigma)
{
mSigma = sigma;
}
void LocPoint::setColor(const QColor &color)
{
mColor = color;
}
void LocPoint::setDrawLine(bool drawLine)
{
mDrawLine = drawLine;
}
void LocPoint::setAttributes(quint32 attributes)
{
mAttributes = attributes;
}