1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-07-07 16:02:51 +02:00

Fixed broken radius-rect computation

Always use the double type for coordinate related data
This commit is contained in:
2018-04-13 21:14:12 +02:00
parent f8009b0151
commit 3f71775101
12 changed files with 84 additions and 90 deletions

View File

@ -2,7 +2,6 @@
#define RECTC_H
#include <QDebug>
#include <QSizeF>
#include "coordinates.h"
class RectC
@ -11,6 +10,7 @@ public:
RectC() {}
RectC(const Coordinates &topLeft, const Coordinates &bottomRight)
: _tl(topLeft), _br(bottomRight) {}
RectC(const Coordinates &center, double radius);
bool isNull() const
{return _tl.isNull() && _br.isNull();}
@ -19,14 +19,9 @@ public:
Coordinates topLeft() const {return _tl;}
Coordinates bottomRight() const {return _br;}
Coordinates center() const
{return Coordinates((_tl.lon() + _br.lon()) / 2.0,
(_tl.lat() + _br.lat()) / 2.0);}
qreal width() const {return _br.lon() - _tl.lon();}
qreal height() const {return _br.lat() - _tl.lat();}
QSizeF size() const {return QSizeF(width(), height());}
RectC operator|(const RectC &r) const;
RectC &operator|=(const RectC &r) {*this = *this | r; return *this;}