2017-03-29 22:51:32 +02:00
|
|
|
#ifndef LATLON_H
|
|
|
|
#define LATLON_H
|
|
|
|
|
2021-09-17 23:45:12 +02:00
|
|
|
#include "map/ct.h"
|
|
|
|
#include "map/angularunits.h"
|
2017-03-29 22:51:32 +02:00
|
|
|
|
2018-01-25 00:19:11 +01:00
|
|
|
class LatLon : public CT
|
2017-03-29 22:51:32 +02:00
|
|
|
{
|
|
|
|
public:
|
2018-01-20 20:13:56 +01:00
|
|
|
LatLon(const AngularUnits &au) : _au(au) {}
|
|
|
|
|
2018-01-25 00:19:11 +01:00
|
|
|
virtual CT *clone() const {return new LatLon(*this);}
|
2020-04-21 23:26:35 +02:00
|
|
|
virtual bool operator==(const CT &ct) const
|
|
|
|
{
|
|
|
|
const LatLon *other = dynamic_cast<const LatLon*>(&ct);
|
|
|
|
return (other != 0 && _au == other->_au);
|
|
|
|
}
|
2018-01-25 00:19:11 +01:00
|
|
|
|
2018-04-15 16:27:47 +02:00
|
|
|
virtual PointD ll2xy(const Coordinates &c) const
|
|
|
|
{return PointD(_au.fromDegrees(c.lon()), _au.fromDegrees(c.lat()));}
|
|
|
|
virtual Coordinates xy2ll(const PointD &p) const
|
2018-01-20 20:13:56 +01:00
|
|
|
{return Coordinates(_au.toDegrees(p.x()), _au.toDegrees(p.y()));}
|
|
|
|
|
|
|
|
private:
|
|
|
|
AngularUnits _au;
|
2017-03-29 22:51:32 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // LATLON_H
|