#ifndef SphereCalculus_H #define SphereCalculus_H #include #include // 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); enum JoinPolygonError { NotSimplePolygon, Disjoint, NoError, PathSizeLow}; enum IntersectionType { NoIntersection, EdgeIntersection, Inside}; // Property setters void setEpsilonMeter(double epsilon); // Property getters double epsilonMeter() const; // Member Methodes int closestVertexIndex (const QList &path, const QGeoCoordinate &coordinate) const; QGeoCoordinate closestVertex (const QList &path, const QGeoCoordinate &coordinate) const; int nextVertexIndex (int index) const; int previousVertexIndex (int index) const; JoinPolygonError joinPolygon (const QList &polygon1, const QList &polygon2, QList &joinedPolygon) const; IntersectionType intersects (const QList &line1, const QList &line2, QGeoCoordinate &intersectionPt)const; IntersectionType intersects (const QList &polygon, const QList &line, QList &intersectionList, QList> &neighbourList)const; IntersectionType intersects (const QList &polygon, const QList &line) const; bool dijkstraPath (const QList &polygon, const QGeoCoordinate& c1, const QGeoCoordinate& c2, QList& dijkstraPath) const; bool isSelfIntersecting (const QList &path); signals: public slots: private: double distInsidePoly (const QGeoCoordinate& c1, const QGeoCoordinate& c2, QList polygon); double _epsilonMeter; // The accuracy used for distance calculations (unit: m). }; #endif // SphereCalculus_H