19 # define PI_OVER_2 ( M_PI / 2.0) 22 # define TWO_PI (2.0 * M_PI) 25 #define MAX_LAT (-33.5 * M_PI / 180.0) 26 #define MIN_LAT (-48.5 * M_PI / 180.0) 27 #define MAX_LON (180.0 * M_PI / 180.0) 28 #define MIN_LON (165.5 * M_PI / 180.0) 30 #define NZMG_NO_ERROR 0x0000 31 #define NZMG_LAT_ERROR 0x0001 32 #define NZMG_LON_ERROR 0x0002 33 #define NZMG_EASTING_ERROR 0x0004 34 #define NZMG_NORTHING_ERROR 0x0008 35 #define NZMG_ELLIPSOID_ERROR 0x0010 43 static double A[] = { 0.6399175073, -0.1358797613, 0.063294409,
44 -0.02526853, 0.0117879, -0.0055161,
45 0.0026906, -0.001333, 0.00067, -0.00034 };
47 static Complex B[] = { { 0.7557853228, 0.0 },
48 { 0.249204646, 0.003371507 },
49 { -0.001541739, 0.041058560 },
50 { -0.10162907, 0.01727609 },
51 { -0.26623489, -0.36249218 },
52 { -0.6870983, -1.1651967 } };
54 static Complex C[] = { { 1.3231270439, 0.0 },
55 { -0.577245789, -0.007809598 },
56 { 0.508307513, -0.112208952 },
57 { -0.15094762, 0.18200602 },
58 { 1.01418179, 1.64497696 },
59 { 1.9660549, 2.5127645 } };
61 static double D[] = { 1.5627014243, 0.5185406398, -0.03333098,
62 -0.1052906, -0.0368594, 0.007317,
63 0.01220, 0.00394, -0.0013 };
202 double easting = 0.0;
203 double northing = 0.0;
223 const char* prefix)
const 263 double *Northing)
const 298 for (
n = 8;
n >= 0;
n--)
299 du = du * dphi +
A[
n];
309 for (
n = 4;
n >= 0;
n--)
311 z = Multiply(z, Zeta);
314 z = Multiply(z, Zeta);
331 double *Longitude)
const 349 Complex z, Zeta, Zeta_Numer, Zeta_Denom, Zeta_sqr;
369 for (
n = 4;
n >= 0;
n--)
371 Zeta = Multiply(Zeta, z);
372 Zeta = Add(C[
n], Zeta);
374 Zeta = Multiply(Zeta, z);
376 for (i = 0; i < 2; i++)
382 for (
n = 4;
n >= 1;
n--)
384 Zeta_Numer = Multiply(Zeta_Numer, Zeta);
387 Zeta_Numer = Add(coeff, Zeta_Numer);
389 Zeta_Denom = Multiply(Zeta_Denom, Zeta);
390 coeff.
real = (
n+1) * B[
n].real;
391 coeff.
imag = (
n+1) * B[
n].imag;
392 Zeta_Denom = Add(coeff, Zeta_Denom);
394 Zeta_sqr = Multiply(Zeta, Zeta);
396 Zeta_Numer = Multiply(Zeta_Numer, Zeta_sqr);
397 Zeta_Numer = Add(z, Zeta_Numer);
399 Zeta_Denom = Multiply(Zeta_Denom, Zeta);
400 Zeta_Denom = Add(B[0], Zeta_Denom);
402 Zeta = Divide(Zeta_Numer, Zeta_Denom);
405 for (
n = 7;
n >= 0;
n--)
406 dphi = dphi * Zeta.
real + D[
n];
410 *Latitude *=
M_PI / 180.0;
virtual const ossimDatum * create(const ossimString &code) const
create method
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
~ossimNewZealandMapGridProjection()
static const char * DATUM_KW
double lond() const
Will convert the radian measure to degrees.
static const char * CENTRAL_MERIDIAN_KW
Represents serializable keyword/value map.
double NZMG_False_Northing
void setFalseEastingNorthing(double falseEasting, double falseNorthing)
virtual const ossimString & code() const
double latd() const
Will convert the radian measure to degrees.
void changeDatum(const ossimDatum *datum)
This will actually perform a shift.
const ossimDatum * datum() const
datum().
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
long Convert_Geodetic_To_NZMG(double Latitude, double Longitude, double *Easting, double *Northing) const
os2<< "> n<< " > nendobj n
const double & getA() const
double lonr() const
Returns the longitude in radian measure.
void setFalseEasting(double falseEasting)
virtual const ossimEllipsoid * ellipsoid() const
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
static ossimDatumFactory * instance()
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.
virtual ossimGpt inverse(const ossimDpt &eastingNorthing) const
Will take a point in meters and convert it to ground.
static const char * ORIGIN_LATITUDE_KW
ossimNewZealandMapGridProjection()
virtual ossimDpt forward(const ossimGpt &latLon) const
All map projections will convert the world coordinate to an easting northing (Meters).
struct ComplexNumber Complex
double latr() const
latr().
double NZMG_False_Easting
ossimEllipsoid theEllipsoid
This method verifies that the projection parameters match the current pcs code.
#define RTTI_DEF1(cls, name, b1)
ossimDpt theFalseEastingNorthing
Hold the false easting northing.
long Convert_NZMG_To_Geodetic(double Easting, double Northing, double *Latitude, double *Longitude) const
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
void setFalseNorthing(double falseNorthing)
const ossimDatum * theDatum
This is only set if we want to have built in datum shifting.