Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+69
@@ -0,0 +1,69 @@
|
||||
/**
|
||||
* CES Point Helpers
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Gerlinde Rudolphus, SLTE, 2016-04-14
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QtCore/QPointF>
|
||||
#include <QString>
|
||||
#include <LtsCoordTrans/lts_coord_trans.h>
|
||||
#include <DDS/Core/core.hpp>
|
||||
|
||||
namespace CentralEffectSimulation
|
||||
{
|
||||
|
||||
inline QPointF geographic2Utm(double lon, double lat, int *zone = nullptr)
|
||||
{
|
||||
const int zoneToUse = zone ? *zone : -1;
|
||||
auto utm = LtsCoordTrans::UtmCoordinate::fromGeographic(lon, lat, zoneToUse);
|
||||
if (zone)
|
||||
*zone = utm.zone;
|
||||
return QPointF(utm.x, utm.y);
|
||||
}
|
||||
|
||||
inline QPointF geographic2Utm(const Core::GeoPosition2D &geoPos, int *zone = nullptr)
|
||||
{
|
||||
const int zoneToUse = zone ? *zone : -1;
|
||||
auto utm = LtsCoordTrans::UtmCoordinate::fromGeographic(geoPos.lon(), geoPos.lat(), zoneToUse);
|
||||
if (zone)
|
||||
*zone = utm.zone;
|
||||
return QPointF(utm.x, utm.y);
|
||||
}
|
||||
|
||||
inline QPointF geographic2Utm(const Core::GeoPosition &geoPos, int *zone = nullptr)
|
||||
{
|
||||
const int zoneToUse = zone ? *zone : -1;
|
||||
auto utm = LtsCoordTrans::UtmCoordinate::fromGeographic(geoPos.lon(), geoPos.lat(), zoneToUse);
|
||||
if (zone)
|
||||
*zone = utm.zone;
|
||||
return QPointF(utm.x, utm.y);
|
||||
}
|
||||
|
||||
inline QString geographic2mgrs(const Core::GeoPosition2D &geoPos, int zone)
|
||||
{
|
||||
auto utm = LtsCoordTrans::UtmCoordinate::fromGeographic(geoPos.lon(), geoPos.lat(), zone);
|
||||
return utm.mgrs();
|
||||
}
|
||||
|
||||
inline QPointF geographic2Utm(const Core::GeoPosition2D &geoPos, int zone)
|
||||
{
|
||||
auto utm = LtsCoordTrans::UtmCoordinate::fromGeographic(geoPos.lon(), geoPos.lat(), zone);
|
||||
return QPointF(utm.x, utm.y);
|
||||
}
|
||||
|
||||
inline QString debug(const QPointF &p)
|
||||
{
|
||||
return QString::number(qRound(p.x())) + QLatin1Char('/') + QString::number(qRound(p.y()));
|
||||
}
|
||||
|
||||
inline double getSquareDistance(const QPointF ¢erUtm, const QPointF &pointUtm)
|
||||
{
|
||||
QPointF p(pointUtm - centerUtm);
|
||||
return p.x() * p.x() + p.y() * p.y();
|
||||
} // getSquareDistance
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user