2017-04-03 20:29:35 +02:00
|
|
|
#include "ellipsoid.h"
|
2017-04-01 16:25:33 +02:00
|
|
|
#include "utm.h"
|
|
|
|
|
2018-01-08 23:47:45 +01:00
|
|
|
Projection::Setup UTM::setup(int zone)
|
2017-04-03 20:29:35 +02:00
|
|
|
{
|
2018-01-08 23:47:45 +01:00
|
|
|
return Projection::Setup(0, (qAbs(zone) - 1)*6 - 180 + 3, 0.9996, 500000,
|
|
|
|
zone < 0 ? 10000000 : 0, 0, 0);
|
2017-04-03 20:29:35 +02:00
|
|
|
}
|
|
|
|
|
2017-11-26 18:54:03 +01:00
|
|
|
int UTM::zone(const Coordinates &c)
|
2017-04-01 16:25:33 +02:00
|
|
|
{
|
|
|
|
int zone = int((c.lon() + 180)/6) + 1;
|
|
|
|
|
|
|
|
if (c.lat() >= 56.0 && c.lat() < 64.0 && c.lon() >= 3.0 && c.lon() < 12.0)
|
|
|
|
zone = 32;
|
|
|
|
if (c.lat() >= 72.0 && c.lat() < 84.0) {
|
|
|
|
if (c.lon() >= 0.0 && c.lon() < 9.0)
|
|
|
|
zone = 31;
|
|
|
|
else if (c.lon() >= 9.0 && c.lon() < 21.0)
|
|
|
|
zone = 33;
|
|
|
|
else if (c.lon() >= 21.0 && c.lon() < 33.0)
|
|
|
|
zone = 35;
|
|
|
|
else if (c.lon() >= 33.0 && c.lon() < 42.0)
|
|
|
|
zone = 37;
|
|
|
|
}
|
|
|
|
|
2017-11-26 18:54:03 +01:00
|
|
|
return zone;
|
2017-04-01 16:25:33 +02:00
|
|
|
}
|