#pragma once

#include <QPointF>
#include <QGeoCoordinate>
#include <QVector3D>
#include <QGeoCoordinate>
#include <QtMath>

#include "PolygonCalculus.h"


namespace GeoUtilities {

    typedef QList<QVector3D>        QVector3DList;
    typedef QList<QPointF>          QPointFList;
    typedef QVector<QPointF>        QPointFVector;
    typedef QList<QGeoCoordinate>   QGeoList;
    typedef QVector<QGeoCoordinate> QGeoVector;

    const double earthRadius = 6378137; // meter

    QGeoCoordinate  toGeo         (const QVector3D &point, const QGeoCoordinate &origin);
    QGeoVector      toGeo         (const QVector3DList &points, const QGeoCoordinate &origin);
    QGeoCoordinate  toGeo         (const QPointF &point, const QGeoCoordinate &origin);
    QGeoVector      toGeo         (const QPointFList &points, const QGeoCoordinate &origin);
    QGeoVector      toGeo         (const QPointFVector &points, const QGeoCoordinate &origin);
    QVector3D       toCartesian   (const QGeoCoordinate &coordinate, const QGeoCoordinate &origin);
    QVector3DList   toCartesian   (const QGeoList &coordinates, const QGeoCoordinate &origin);
    QVector3DList   toCartesian   (const QGeoVector &coordinates, const QGeoCoordinate &origin);
    QPointF         toCartesian2D (const QGeoCoordinate &point, const QGeoCoordinate &origin);
    QPointFList     toCartesian2D (const QGeoList &coordinates, const QGeoCoordinate &origin);
    QPointFList     toCartesian2D (const QGeoVector &coordinates, const QGeoCoordinate &origin);
}

