1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-27 21:24:47 +01:00

Use the CT type for geographic/projected projections distinguishing

This commit is contained in:
Martin Tůma 2024-03-11 23:12:51 +01:00
parent 026ef5854d
commit ff50ffa003
2 changed files with 9 additions and 9 deletions

View File

@ -8,7 +8,6 @@
#include "proj/polarstereographic.h"
#include "proj/obliquestereographic.h"
#include "proj/polyconic.h"
#include "proj/latlon.h"
#include "datum.h"
#include "gcs.h"
#include "pcs.h"
@ -40,7 +39,7 @@ Projection::Method::Method(int id)
Projection::Projection(const PCS &pcs)
: _gcs(pcs.gcs()), _ct(0), _units(pcs.conversion().units()),
_cs(pcs.conversion().cs()), _geographic(false)
_cs(pcs.conversion().cs())
{
const Ellipsoid &ellipsoid = _gcs.datum().ellipsoid();
const Projection::Setup &setup = pcs.conversion().setup();
@ -115,7 +114,7 @@ Projection::Projection(const PCS &pcs)
}
Projection::Projection(const GCS &gcs, const CoordinateSystem &cs)
: _gcs(gcs), _units(LinearUnits(9001)), _cs(cs), _geographic(true)
: _gcs(gcs), _units(LinearUnits(9001)), _cs(cs)
{
_ct = new LatLon(gcs.angularUnits());
}
@ -125,7 +124,6 @@ Projection::Projection(const Projection &p)
_gcs = p._gcs;
_units = p._units;
_ct = p._ct ? p._ct->clone() : 0;
_geographic = p._geographic;
_cs = p._cs;
}
@ -142,7 +140,6 @@ Projection &Projection::operator=(const Projection &p)
_gcs = p._gcs;
_units = p._units;
_ct = p._ct ? p._ct->clone() : 0;
_geographic = p._geographic;
_cs = p._cs;
}
@ -155,7 +152,7 @@ bool Projection::operator==(const Projection &p) const
return false;
return (*_ct == *p._ct && _gcs == p._gcs && _units == p._units
&& _cs == p._cs && _geographic == p._geographic);
&& _cs == p._cs);
}
PointD Projection::ll2xy(const Coordinates &c) const

View File

@ -7,6 +7,7 @@
#include "linearunits.h"
#include "coordinatesystem.h"
#include "gcs.h"
#include "proj/latlon.h"
class PCS;
class CT;
@ -70,7 +71,7 @@ public:
int _id;
};
Projection() : _ct(0), _geographic(false) {}
Projection() : _ct(0) {}
Projection(const Projection &p);
Projection(const PCS &pcs);
Projection(const GCS &gcs, const CoordinateSystem &cs
@ -90,7 +91,10 @@ public:
// and except of WMTS/WMS it is not needed.
return (_gcs.isValid() && _ct != 0 && _units.isValid());
}
bool isGeographic() const {return _geographic;}
bool isGeographic() const
{
return (dynamic_cast<const LatLon*>(_ct) != 0);
}
PointD ll2xy(const Coordinates &c) const;
Coordinates xy2ll(const PointD &p) const;
@ -103,7 +107,6 @@ private:
const CT *_ct;
LinearUnits _units;
CoordinateSystem _cs;
bool _geographic;
};
#ifndef QT_NO_DEBUG