Skip to content
SphereCalculus.h 1.33 KiB
Newer Older
#ifndef SphereCalculus_H
#define SphereCalculus_H

#include <QObject>
#include <QGeoCoordinate>
#include <QPointF>
#include <QLineF>

#include "QGCGeo.h"

// Abstract class providing methods to do calculations on objects located on a sphere (e.g. earth)
class SphereCalculus : public QObject
{
    Q_OBJECT
public:
    SphereCalculus(QObject *parent = nullptr);
    SphereCalculus(const SphereCalculus &other, QObject *parent = nullptr);
    SphereCalculus &operator=(const SphereCalculus &other);

    typedef QPair<QGeoCoordinate, QGeoCoordinate> Line;


    enum JoinPolygonError { NotSimplePolygon1, PolygonJoined, NotSimplePolygon2, Disjoint, PathSizeLow};
    enum IntersectionType { NoIntersection, EdgeIntersection, InteriorIntersection, Error};
    enum DijkstraError    { NoPathFound, PathFound, NotSimplePolygon};

    // Property setters
    void setEpsilonMeter(double epsilon);

    // Property getters
    double epsilonMeter() const;

    // Member Methodes
    DijkstraError           dijkstraPath        (const QList<QGeoCoordinate> &polygon, const QGeoCoordinate& start,
                                                    const QGeoCoordinate& end, QList<QGeoCoordinate>& dijkstraPath);

    double _epsilonMeter; // The accuracy used for distance calculations (unit: m).

};

#endif // SphereCalculus_H