mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-24 11:45:53 +01:00
Limit the map bounds properly based on projection, not a magic height
This commit is contained in:
parent
cbe312d9c8
commit
c1584f30d2
@ -222,3 +222,14 @@ Coordinates AlbersEqual::xy2ll(const PointD &p) const
|
|||||||
|
|
||||||
return Coordinates(rad2deg(lon), rad2deg(lat));
|
return Coordinates(rad2deg(lon), rad2deg(lat));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AlbersEqual::operator==(const CT &ct) const
|
||||||
|
{
|
||||||
|
const AlbersEqual *other = dynamic_cast<const AlbersEqual*>(&ct);
|
||||||
|
return (other != 0 && _latitudeOrigin == other->_latitudeOrigin
|
||||||
|
&& _longitudeOrigin == other->_longitudeOrigin
|
||||||
|
&& _falseEasting == other->_falseEasting
|
||||||
|
&& _falseNorthing == other->_falseNorthing && _a2 == other->_a2
|
||||||
|
&& _es == other->_es && _rho0 == other->_rho0 && _c == other->_c
|
||||||
|
&& _n == other->_n);
|
||||||
|
}
|
||||||
|
@ -13,6 +13,7 @@ public:
|
|||||||
double falseEasting, double falseNorthing);
|
double falseEasting, double falseNorthing);
|
||||||
|
|
||||||
virtual CT *clone() const {return new AlbersEqual(*this);}
|
virtual CT *clone() const {return new AlbersEqual(*this);}
|
||||||
|
virtual bool operator==(const CT &ct) const;
|
||||||
|
|
||||||
virtual PointD ll2xy(const Coordinates &c) const;
|
virtual PointD ll2xy(const Coordinates &c) const;
|
||||||
virtual Coordinates xy2ll(const PointD &p) const;
|
virtual Coordinates xy2ll(const PointD &p) const;
|
||||||
|
@ -10,13 +10,15 @@ public:
|
|||||||
AngularUnits() : _code(0), _f(NAN) {}
|
AngularUnits() : _code(0), _f(NAN) {}
|
||||||
AngularUnits(int code);
|
AngularUnits(int code);
|
||||||
|
|
||||||
|
bool operator==(const AngularUnits &other) const
|
||||||
|
{return (_code == other._code && _f == other._f);}
|
||||||
|
|
||||||
bool isNull() const {return std::isnan(_f);}
|
bool isNull() const {return std::isnan(_f);}
|
||||||
bool isValid() const {return !std::isnan(_f);}
|
bool isValid() const {return !std::isnan(_f);}
|
||||||
|
|
||||||
double toDegrees(double val) const;
|
double toDegrees(double val) const;
|
||||||
double fromDegrees(double val) const;
|
double fromDegrees(double val) const;
|
||||||
|
|
||||||
friend bool operator==(const AngularUnits &au1, const AngularUnits &au2);
|
|
||||||
#ifndef QT_NO_DEBUG
|
#ifndef QT_NO_DEBUG
|
||||||
friend QDebug operator<<(QDebug dbg, const AngularUnits &au);
|
friend QDebug operator<<(QDebug dbg, const AngularUnits &au);
|
||||||
#endif // QT_NO_DEBUG
|
#endif // QT_NO_DEBUG
|
||||||
@ -25,9 +27,6 @@ private:
|
|||||||
double _f;
|
double _f;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool operator==(const AngularUnits &au1, const AngularUnits &au2)
|
|
||||||
{return (au1._f == au2._f);}
|
|
||||||
|
|
||||||
#ifndef QT_NO_DEBUG
|
#ifndef QT_NO_DEBUG
|
||||||
QDebug operator<<(QDebug dbg, const AngularUnits &au);
|
QDebug operator<<(QDebug dbg, const AngularUnits &au);
|
||||||
#endif // QT_NO_DEBUG
|
#endif // QT_NO_DEBUG
|
||||||
|
@ -12,6 +12,9 @@ public:
|
|||||||
CoordinateSystem(AxisOrder axisOrder) : _axisOrder(axisOrder) {}
|
CoordinateSystem(AxisOrder axisOrder) : _axisOrder(axisOrder) {}
|
||||||
CoordinateSystem(int code);
|
CoordinateSystem(int code);
|
||||||
|
|
||||||
|
bool operator==(const CoordinateSystem &other) const
|
||||||
|
{return (_axisOrder == other._axisOrder);}
|
||||||
|
|
||||||
bool isNull() const {return (_axisOrder == Unknown);}
|
bool isNull() const {return (_axisOrder == Unknown);}
|
||||||
bool isValid() const {return (_axisOrder != Unknown);}
|
bool isValid() const {return (_axisOrder != Unknown);}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ public:
|
|||||||
virtual ~CT() {}
|
virtual ~CT() {}
|
||||||
|
|
||||||
virtual CT *clone() const = 0;
|
virtual CT *clone() const = 0;
|
||||||
|
virtual bool operator==(const CT &ct) const = 0;
|
||||||
|
|
||||||
virtual PointD ll2xy(const Coordinates &c) const = 0;
|
virtual PointD ll2xy(const Coordinates &c) const = 0;
|
||||||
virtual Coordinates xy2ll(const PointD &p) const = 0;
|
virtual Coordinates xy2ll(const PointD &p) const = 0;
|
||||||
|
@ -14,6 +14,12 @@ public:
|
|||||||
const AngularUnits &angularUnits) : _datum(datum),
|
const AngularUnits &angularUnits) : _datum(datum),
|
||||||
_primeMeridian(primeMeridian), _angularUnits(angularUnits) {}
|
_primeMeridian(primeMeridian), _angularUnits(angularUnits) {}
|
||||||
|
|
||||||
|
bool operator==(const GCS &other) const
|
||||||
|
{
|
||||||
|
return (_datum == other._datum && _primeMeridian == other._primeMeridian
|
||||||
|
&& _angularUnits == other._angularUnits);
|
||||||
|
}
|
||||||
|
|
||||||
const PrimeMeridian &primeMeridian() const {return _primeMeridian;}
|
const PrimeMeridian &primeMeridian() const {return _primeMeridian;}
|
||||||
const AngularUnits &angularUnits() const {return _angularUnits;}
|
const AngularUnits &angularUnits() const {return _angularUnits;}
|
||||||
const Datum &datum() const {return _datum;}
|
const Datum &datum() const {return _datum;}
|
||||||
@ -47,11 +53,6 @@ private:
|
|||||||
static QList<Entry> _gcss;
|
static QList<Entry> _gcss;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool operator==(const GCS &gcs1, const GCS &gcs2)
|
|
||||||
{return (gcs1.datum() == gcs2.datum()
|
|
||||||
&& gcs1.primeMeridian() == gcs2.primeMeridian()
|
|
||||||
&& gcs1.angularUnits() == gcs2.angularUnits());}
|
|
||||||
|
|
||||||
#ifndef QT_NO_DEBUG
|
#ifndef QT_NO_DEBUG
|
||||||
QDebug operator<<(QDebug dbg, const GCS &gcs);
|
QDebug operator<<(QDebug dbg, const GCS &gcs);
|
||||||
#endif // QT_NO_DEBUG
|
#endif // QT_NO_DEBUG
|
||||||
|
@ -245,11 +245,7 @@ IMGMap::IMGMap(const QString &fileName, QObject *parent)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Limit world maps bounds so that the maps can be projected using
|
_dataBounds = _data->bounds() & OSM::BOUNDS;
|
||||||
// the default Web Mercator projection
|
|
||||||
_dataBounds = (_data->bounds().height() > 120)
|
|
||||||
? _data->bounds() & OSM::BOUNDS : _data->bounds();
|
|
||||||
|
|
||||||
_zoom = _data->zooms().min();
|
_zoom = _data->zooms().min();
|
||||||
updateTransform();
|
updateTransform();
|
||||||
|
|
||||||
@ -631,7 +627,16 @@ void IMGMap::draw(QPainter *painter, const QRectF &rect, Flags flags)
|
|||||||
|
|
||||||
void IMGMap::setProjection(const Projection &projection)
|
void IMGMap::setProjection(const Projection &projection)
|
||||||
{
|
{
|
||||||
|
if (projection == _projection)
|
||||||
|
return;
|
||||||
|
|
||||||
_projection = projection;
|
_projection = projection;
|
||||||
|
// Limit the bounds for some well known Mercator projections
|
||||||
|
// (GARMIN world maps have N/S bounds up to 90/-90!)
|
||||||
|
_dataBounds = (_projection == PCS::pcs(3857)
|
||||||
|
|| _projection == PCS::pcs(3395))
|
||||||
|
? _data->bounds() & OSM::BOUNDS : _data->bounds();
|
||||||
|
|
||||||
updateTransform();
|
updateTransform();
|
||||||
QPixmapCache::clear();
|
QPixmapCache::clear();
|
||||||
}
|
}
|
||||||
|
@ -68,3 +68,18 @@ Coordinates Krovak::xy2ll(const PointD &p) const
|
|||||||
|
|
||||||
return Coordinates(rad2deg(_lambda0 - V/_b), rad2deg(phi));
|
return Coordinates(rad2deg(_lambda0 - V/_b), rad2deg(phi));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Krovak::operator==(const CT &ct) const
|
||||||
|
{
|
||||||
|
const Krovak *other = dynamic_cast<const Krovak*>(&ct);
|
||||||
|
return (other != 0 && _e == other->_e && _a == other->_a && _b == other->_b
|
||||||
|
&& _t0 == other->_t0 && _r0 == other->_r0 && _phiP == other->_phiP
|
||||||
|
&& _cosAlphaC == other->_cosAlphaC && _sinAlphaC == other->_sinAlphaC
|
||||||
|
&& _lambda0 == other->_lambda0 && _fe == other->_fe && _fn == other->_fn);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool KrovakNE::operator==(const CT &ct) const
|
||||||
|
{
|
||||||
|
const KrovakNE *other = dynamic_cast<const KrovakNE*>(&ct);
|
||||||
|
return (other != 0 && _k == other->_k);
|
||||||
|
}
|
||||||
|
@ -13,6 +13,7 @@ public:
|
|||||||
double longitudeOrigin, double falseEasting, double falseNorthing);
|
double longitudeOrigin, double falseEasting, double falseNorthing);
|
||||||
|
|
||||||
virtual CT *clone() const {return new Krovak(*this);}
|
virtual CT *clone() const {return new Krovak(*this);}
|
||||||
|
virtual bool operator==(const CT &ct) const;
|
||||||
|
|
||||||
virtual PointD ll2xy(const Coordinates &c) const;
|
virtual PointD ll2xy(const Coordinates &c) const;
|
||||||
virtual Coordinates xy2ll(const PointD &p) const;
|
virtual Coordinates xy2ll(const PointD &p) const;
|
||||||
@ -32,6 +33,7 @@ public:
|
|||||||
longitudeOrigin, falseEasting, falseNorthing) {}
|
longitudeOrigin, falseEasting, falseNorthing) {}
|
||||||
|
|
||||||
virtual CT *clone() const {return new KrovakNE(*this);}
|
virtual CT *clone() const {return new KrovakNE(*this);}
|
||||||
|
virtual bool operator==(const CT &ct) const;
|
||||||
|
|
||||||
virtual PointD ll2xy(const Coordinates &c) const
|
virtual PointD ll2xy(const Coordinates &c) const
|
||||||
{PointD p(_k.ll2xy(c)); return PointD(-p.x(), -p.y());}
|
{PointD p(_k.ll2xy(c)); return PointD(-p.x(), -p.y());}
|
||||||
|
@ -68,3 +68,11 @@ Coordinates LambertAzimuthal::xy2ll(const PointD &p) const
|
|||||||
|
|
||||||
return Coordinates(rad2deg(lon), rad2deg(lat));
|
return Coordinates(rad2deg(lon), rad2deg(lat));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool LambertAzimuthal::operator==(const CT &ct) const
|
||||||
|
{
|
||||||
|
const LambertAzimuthal *other = dynamic_cast<const LambertAzimuthal*>(&ct);
|
||||||
|
return (other != 0 && _lon0 == other->_lon0 && _fn == other->_fn
|
||||||
|
&& _fe == other->_fe && _a == other->_a && _es == other->_es
|
||||||
|
&& _beta0 == other->_beta0 && _rq == other->_rq && _d == other->_d);
|
||||||
|
}
|
||||||
|
@ -12,6 +12,7 @@ public:
|
|||||||
double longitudeOrigin, double falseEasting, double falseNorthing);
|
double longitudeOrigin, double falseEasting, double falseNorthing);
|
||||||
|
|
||||||
virtual CT *clone() const {return new LambertAzimuthal(*this);}
|
virtual CT *clone() const {return new LambertAzimuthal(*this);}
|
||||||
|
virtual bool operator==(const CT &ct) const;
|
||||||
|
|
||||||
virtual PointD ll2xy(const Coordinates &c) const;
|
virtual PointD ll2xy(const Coordinates &c) const;
|
||||||
virtual Coordinates xy2ll(const PointD &p) const;
|
virtual Coordinates xy2ll(const PointD &p) const;
|
||||||
|
@ -194,6 +194,16 @@ Coordinates LambertConic1::xy2ll(const PointD &p) const
|
|||||||
return Coordinates(rad2deg(lon), rad2deg(lat));
|
return Coordinates(rad2deg(lon), rad2deg(lat));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool LambertConic1::operator==(const CT &ct) const
|
||||||
|
{
|
||||||
|
const LambertConic1 *other = dynamic_cast<const LambertConic1*>(&ct);
|
||||||
|
return (other != 0 && _longitudeOrigin == other->_longitudeOrigin
|
||||||
|
&& _falseEasting == other->_falseEasting
|
||||||
|
&& _falseNorthing == other->_falseNorthing && _e == other->_e
|
||||||
|
&& _n == other->_n && _rho0 == other->_rho0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
LambertConic2::LambertConic2(const Ellipsoid *ellipsoid,
|
LambertConic2::LambertConic2(const Ellipsoid *ellipsoid,
|
||||||
double standardParallel1, double standardParallel2, double latitudeOrigin,
|
double standardParallel1, double standardParallel2, double latitudeOrigin,
|
||||||
double longitudeOrigin, double falseEasting, double falseNorthing)
|
double longitudeOrigin, double falseEasting, double falseNorthing)
|
||||||
@ -264,3 +274,9 @@ Coordinates LambertConic2::xy2ll(const PointD &p) const
|
|||||||
{
|
{
|
||||||
return _lc1.xy2ll(p);
|
return _lc1.xy2ll(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool LambertConic2::operator==(const CT &ct) const
|
||||||
|
{
|
||||||
|
const LambertConic2 *other = dynamic_cast<const LambertConic2*>(&ct);
|
||||||
|
return (other != 0 && _lc1 == other->_lc1);
|
||||||
|
}
|
||||||
|
@ -14,6 +14,7 @@ public:
|
|||||||
double falseNorthing);
|
double falseNorthing);
|
||||||
|
|
||||||
virtual CT *clone() const {return new LambertConic1(*this);}
|
virtual CT *clone() const {return new LambertConic1(*this);}
|
||||||
|
virtual bool operator==(const CT &ct) const;
|
||||||
|
|
||||||
virtual PointD ll2xy(const Coordinates &c) const;
|
virtual PointD ll2xy(const Coordinates &c) const;
|
||||||
virtual Coordinates xy2ll(const PointD &p) const;
|
virtual Coordinates xy2ll(const PointD &p) const;
|
||||||
@ -39,6 +40,7 @@ public:
|
|||||||
double falseEasting, double falseNorthing);
|
double falseEasting, double falseNorthing);
|
||||||
|
|
||||||
virtual CT *clone() const {return new LambertConic2(*this);}
|
virtual CT *clone() const {return new LambertConic2(*this);}
|
||||||
|
virtual bool operator==(const CT &ct) const;
|
||||||
|
|
||||||
virtual PointD ll2xy(const Coordinates &c) const;
|
virtual PointD ll2xy(const Coordinates &c) const;
|
||||||
virtual Coordinates xy2ll(const PointD &p) const;
|
virtual Coordinates xy2ll(const PointD &p) const;
|
||||||
|
@ -10,6 +10,11 @@ public:
|
|||||||
LatLon(const AngularUnits &au) : _au(au) {}
|
LatLon(const AngularUnits &au) : _au(au) {}
|
||||||
|
|
||||||
virtual CT *clone() const {return new LatLon(*this);}
|
virtual CT *clone() const {return new LatLon(*this);}
|
||||||
|
virtual bool operator==(const CT &ct) const
|
||||||
|
{
|
||||||
|
const LatLon *other = dynamic_cast<const LatLon*>(&ct);
|
||||||
|
return (other != 0 && _au == other->_au);
|
||||||
|
}
|
||||||
|
|
||||||
virtual PointD ll2xy(const Coordinates &c) const
|
virtual PointD ll2xy(const Coordinates &c) const
|
||||||
{return PointD(_au.fromDegrees(c.lon()), _au.fromDegrees(c.lat()));}
|
{return PointD(_au.fromDegrees(c.lon()), _au.fromDegrees(c.lat()));}
|
||||||
|
@ -11,6 +11,9 @@ public:
|
|||||||
LinearUnits() : _f(NAN) {}
|
LinearUnits() : _f(NAN) {}
|
||||||
LinearUnits(int code);
|
LinearUnits(int code);
|
||||||
|
|
||||||
|
bool operator==(const LinearUnits &other) const
|
||||||
|
{return (_f == other._f);}
|
||||||
|
|
||||||
bool isNull() const {return std::isnan(_f);}
|
bool isNull() const {return std::isnan(_f);}
|
||||||
bool isValid() const {return !std::isnan(_f);}
|
bool isValid() const {return !std::isnan(_f);}
|
||||||
|
|
||||||
@ -21,7 +24,6 @@ public:
|
|||||||
PointD fromMeters(const PointD &p) const
|
PointD fromMeters(const PointD &p) const
|
||||||
{return PointD(p.x() / _f, p.y() /_f);}
|
{return PointD(p.x() / _f, p.y() /_f);}
|
||||||
|
|
||||||
friend bool operator==(const LinearUnits &lu1, const LinearUnits &lu2);
|
|
||||||
#ifndef QT_NO_DEBUG
|
#ifndef QT_NO_DEBUG
|
||||||
friend QDebug operator<<(QDebug dbg, const LinearUnits &lu);
|
friend QDebug operator<<(QDebug dbg, const LinearUnits &lu);
|
||||||
#endif // QT_NO_DEBUG
|
#endif // QT_NO_DEBUG
|
||||||
@ -30,9 +32,6 @@ private:
|
|||||||
double _f;
|
double _f;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool operator==(const LinearUnits &lu1, const LinearUnits &lu2)
|
|
||||||
{return (lu1._f == lu2._f);}
|
|
||||||
|
|
||||||
#ifndef QT_NO_DEBUG
|
#ifndef QT_NO_DEBUG
|
||||||
QDebug operator<<(QDebug dbg, const LinearUnits &lu);
|
QDebug operator<<(QDebug dbg, const LinearUnits &lu);
|
||||||
#endif // QT_NO_DEBUG
|
#endif // QT_NO_DEBUG
|
||||||
|
@ -121,3 +121,13 @@ Coordinates Mercator::xy2ll(const PointD &p) const
|
|||||||
|
|
||||||
return Coordinates(rad2deg(lon), rad2deg(lat));
|
return Coordinates(rad2deg(lon), rad2deg(lat));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Mercator::operator==(const CT &ct) const
|
||||||
|
{
|
||||||
|
const Mercator *other = dynamic_cast<const Mercator*>(&ct);
|
||||||
|
return (other != 0 && _a == other->_a && _e == other->_e
|
||||||
|
&& _latitudeOrigin == other->_latitudeOrigin
|
||||||
|
&& _longitudeOrigin == other->_longitudeOrigin
|
||||||
|
&& _falseNorthing == other->_falseNorthing
|
||||||
|
&& _falseEasting == other->_falseEasting);
|
||||||
|
}
|
||||||
|
@ -12,6 +12,7 @@ public:
|
|||||||
double longitudeOrigin, double falseEasting, double falseNorthing);
|
double longitudeOrigin, double falseEasting, double falseNorthing);
|
||||||
|
|
||||||
virtual CT *clone() const {return new Mercator(*this);}
|
virtual CT *clone() const {return new Mercator(*this);}
|
||||||
|
virtual bool operator==(const CT &ct) const;
|
||||||
|
|
||||||
virtual PointD ll2xy(const Coordinates &c) const;
|
virtual PointD ll2xy(const Coordinates &c) const;
|
||||||
virtual Coordinates xy2ll(const PointD &p) const;
|
virtual Coordinates xy2ll(const PointD &p) const;
|
||||||
|
@ -80,3 +80,13 @@ Coordinates ObliqueStereographic::xy2ll(const PointD &p) const
|
|||||||
return Coordinates(rad2deg((lambda - _lambda0) / _n + _lambda0),
|
return Coordinates(rad2deg((lambda - _lambda0) / _n + _lambda0),
|
||||||
rad2deg(phi));
|
rad2deg(phi));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ObliqueStereographic::operator==(const CT &ct) const
|
||||||
|
{
|
||||||
|
const ObliqueStereographic *other
|
||||||
|
= dynamic_cast<const ObliqueStereographic*>(&ct);
|
||||||
|
return (other != 0 && _es == other->_es && _chi0 == other->_chi0
|
||||||
|
&& _sinChi0 == other->_sinChi0 && _cosChi0 == other->_cosChi0
|
||||||
|
&& _lambda0 == other->_lambda0 && _n == other->_n && _c == other->_c
|
||||||
|
&& _fe == other->_fe && _fn == other->_fn && _twoRk0 == other->_twoRk0);
|
||||||
|
}
|
||||||
|
@ -11,7 +11,9 @@ public:
|
|||||||
ObliqueStereographic(const Ellipsoid *ellipsoid, double latitudeOrigin,
|
ObliqueStereographic(const Ellipsoid *ellipsoid, double latitudeOrigin,
|
||||||
double longitudeOrigin, double scale, double falseEasting,
|
double longitudeOrigin, double scale, double falseEasting,
|
||||||
double falseNorthing);
|
double falseNorthing);
|
||||||
|
|
||||||
virtual CT *clone() const {return new ObliqueStereographic(*this);}
|
virtual CT *clone() const {return new ObliqueStereographic(*this);}
|
||||||
|
virtual bool operator==(const CT &ct) const;
|
||||||
|
|
||||||
virtual PointD ll2xy(const Coordinates &c) const;
|
virtual PointD ll2xy(const Coordinates &c) const;
|
||||||
virtual Coordinates xy2ll(const PointD &p) const;
|
virtual Coordinates xy2ll(const PointD &p) const;
|
||||||
|
@ -190,3 +190,14 @@ Coordinates PolarStereographic::xy2ll(const PointD &p) const
|
|||||||
|
|
||||||
return Coordinates(rad2deg(Longitude), rad2deg(Latitude));
|
return Coordinates(rad2deg(Longitude), rad2deg(Latitude));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PolarStereographic::operator==(const CT &ct) const
|
||||||
|
{
|
||||||
|
const PolarStereographic *other
|
||||||
|
= dynamic_cast<const PolarStereographic*>(&ct);
|
||||||
|
return (other != 0 && _originLatitude == other->_originLatitude
|
||||||
|
&& _originLongitude == other->_originLongitude
|
||||||
|
&& _falseEasting == other->_falseEasting
|
||||||
|
&& _falseNorthing == other->_falseNorthing && _two_a == other->_two_a
|
||||||
|
&& _es == other->_es);
|
||||||
|
}
|
||||||
|
@ -10,7 +10,9 @@ class PolarStereographic : public CT
|
|||||||
public:
|
public:
|
||||||
PolarStereographic(const Ellipsoid *ellipsoid, double latitudeOrigin,
|
PolarStereographic(const Ellipsoid *ellipsoid, double latitudeOrigin,
|
||||||
double longitudeOrigin, double falseEasting, double falseNorthing);
|
double longitudeOrigin, double falseEasting, double falseNorthing);
|
||||||
|
|
||||||
virtual CT *clone() const {return new PolarStereographic(*this);}
|
virtual CT *clone() const {return new PolarStereographic(*this);}
|
||||||
|
virtual bool operator==(const CT &ct) const;
|
||||||
|
|
||||||
virtual PointD ll2xy(const Coordinates &c) const;
|
virtual PointD ll2xy(const Coordinates &c) const;
|
||||||
virtual Coordinates xy2ll(const PointD &p) const;
|
virtual Coordinates xy2ll(const PointD &p) const;
|
||||||
|
@ -36,9 +36,15 @@ Projection::Method::Method(int id)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Projection::Projection(const PCS *pcs) : _gcs(pcs->gcs()), _units(pcs->units()),
|
Projection::Projection(const PCS *pcs) : _gcs(0), _ct(0), _geographic(false)
|
||||||
_cs(pcs->coordinateSystem()), _geographic(false)
|
|
||||||
{
|
{
|
||||||
|
if (!pcs)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_gcs = pcs->gcs();
|
||||||
|
_units = pcs->units();
|
||||||
|
_cs = pcs->coordinateSystem();
|
||||||
|
|
||||||
const Ellipsoid *ellipsoid = _gcs->datum().ellipsoid();
|
const Ellipsoid *ellipsoid = _gcs->datum().ellipsoid();
|
||||||
const Projection::Setup &setup = pcs->setup();
|
const Projection::Setup &setup = pcs->setup();
|
||||||
|
|
||||||
@ -109,6 +115,8 @@ Projection::Projection(const PCS *pcs) : _gcs(pcs->gcs()), _units(pcs->units()),
|
|||||||
Projection::Projection(const GCS *gcs, const CoordinateSystem &cs)
|
Projection::Projection(const GCS *gcs, const CoordinateSystem &cs)
|
||||||
: _gcs(gcs), _units(LinearUnits(9001)), _cs(cs), _geographic(true)
|
: _gcs(gcs), _units(LinearUnits(9001)), _cs(cs), _geographic(true)
|
||||||
{
|
{
|
||||||
|
if (!gcs)
|
||||||
|
return;
|
||||||
_ct = new LatLon(gcs->angularUnits());
|
_ct = new LatLon(gcs->angularUnits());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,6 +149,15 @@ Projection &Projection::operator=(const Projection &p)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Projection::operator==(const Projection &p) const
|
||||||
|
{
|
||||||
|
if (!isValid() || !p.isValid())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return (*_ct == *p._ct && *_gcs == *p._gcs && _units == p._units
|
||||||
|
&& _cs == p._cs && _geographic == p._geographic);
|
||||||
|
}
|
||||||
|
|
||||||
PointD Projection::ll2xy(const Coordinates &c) const
|
PointD Projection::ll2xy(const Coordinates &c) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(isValid());
|
Q_ASSERT(isValid());
|
||||||
|
@ -78,6 +78,7 @@ public:
|
|||||||
~Projection();
|
~Projection();
|
||||||
|
|
||||||
Projection &operator=(const Projection &p);
|
Projection &operator=(const Projection &p);
|
||||||
|
bool operator==(const Projection &p) const;
|
||||||
|
|
||||||
bool isNull() const {return (_gcs == 0 && _ct == 0 && _units.isNull());}
|
bool isNull() const {return (_gcs == 0 && _ct == 0 && _units.isNull());}
|
||||||
bool isValid() const {return !(_gcs == 0 || _ct == 0 || _units.isNull());}
|
bool isValid() const {return !(_gcs == 0 || _ct == 0 || _units.isNull());}
|
||||||
|
@ -252,3 +252,14 @@ Coordinates TransverseMercator::xy2ll(const PointD &p) const
|
|||||||
|
|
||||||
return Coordinates(rad2deg(lon), rad2deg(lat));
|
return Coordinates(rad2deg(lon), rad2deg(lat));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TransverseMercator::operator==(const CT &ct) const
|
||||||
|
{
|
||||||
|
const TransverseMercator *other
|
||||||
|
= dynamic_cast<const TransverseMercator*>(&ct);
|
||||||
|
return (other != 0 && _longitudeOrigin == other->_longitudeOrigin
|
||||||
|
&& _latitudeOrigin == other->_latitudeOrigin && _scale == other->_scale
|
||||||
|
&& _falseEasting == other->_falseEasting
|
||||||
|
&& _falseNorthing == other->_falseNorthing && _a == other->_a
|
||||||
|
&& _es == other->_es);
|
||||||
|
}
|
||||||
|
@ -13,6 +13,7 @@ public:
|
|||||||
double falseNorthing);
|
double falseNorthing);
|
||||||
|
|
||||||
virtual CT *clone() const {return new TransverseMercator(*this);}
|
virtual CT *clone() const {return new TransverseMercator(*this);}
|
||||||
|
virtual bool operator==(const CT &ct) const;
|
||||||
|
|
||||||
virtual PointD ll2xy(const Coordinates &c) const;
|
virtual PointD ll2xy(const Coordinates &c) const;
|
||||||
virtual Coordinates xy2ll(const PointD &p) const;
|
virtual Coordinates xy2ll(const PointD &p) const;
|
||||||
|
@ -14,3 +14,9 @@ Coordinates WebMercator::xy2ll(const PointD &p) const
|
|||||||
return Coordinates(rad2deg(p.x() / WGS84_RADIUS),
|
return Coordinates(rad2deg(p.x() / WGS84_RADIUS),
|
||||||
rad2deg(2.0 * atan(exp(p.y() / WGS84_RADIUS)) - M_PI_2));
|
rad2deg(2.0 * atan(exp(p.y() / WGS84_RADIUS)) - M_PI_2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool WebMercator::operator==(const CT &ct) const
|
||||||
|
{
|
||||||
|
const WebMercator *other = dynamic_cast<const WebMercator*>(&ct);
|
||||||
|
return (other != 0);
|
||||||
|
}
|
||||||
|
@ -7,6 +7,7 @@ class WebMercator : public CT
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual CT *clone() const {return new WebMercator(*this);}
|
virtual CT *clone() const {return new WebMercator(*this);}
|
||||||
|
virtual bool operator==(const CT &ct) const;
|
||||||
|
|
||||||
virtual PointD ll2xy(const Coordinates &c) const;
|
virtual PointD ll2xy(const Coordinates &c) const;
|
||||||
virtual Coordinates xy2ll(const PointD &p) const;
|
virtual Coordinates xy2ll(const PointD &p) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user