Views
Maps Package API Reference Guide
Product Documentation:
Views Documentation Home
List of all members | Public Member Functions | Protected Member Functions
IlvTransverseMercatorProjection Class Reference

Defines the Transverse Mercator projection. More...

#include <ilviews/maps/projection/tranmerc.h>

Inheritance diagram for IlvTransverseMercatorProjection:
IlvProjection IlvUniversalTransverseMercatorProjection

Public Member Functions

 IlvTransverseMercatorProjection (IlDouble latitudeOfTrueScale=0.)
 This constructor initializes a new IlvTransverseMercatorProjection instance and sets the latitude of the true scale. More...
 
virtual IlvMapsError forward (const IlvCoordinate &llIn, IlvCoordinate &xyOut) const
 Converts a latitude and a longitude to Cartesian coordinates (x, y). More...
 
virtual IlvMapsError forward (const IlvCoordinate &llIn, IlvCoordinate &xyOut) const
 Converts a latitude and a longitude to Cartesian coordinates (x, y). More...
 
virtual IlvMapsError forward (IlvCoordinate &coords) const
 Projects a latitude and a longitude pair to Cartesian coordinates. More...
 
IlDouble getScaleFactor () const
 Returns the scale factor applied to the central meridian. More...
 
virtual IlvMapsError inverse (const IlvCoordinate &xyIn, IlvCoordinate &llOut) const
 Converts the specified coordinate to a latitude and a longitude. More...
 
virtual IlvMapsError inverse (const IlvCoordinate &xyIn, IlvCoordinate &llOut) const
 Converts the specified coordinate to a latitude and a longitude. More...
 
virtual IlvMapsError inverse (IlvCoordinate &coords) const
 Invserse-projects Cartesian coordinates to a latitude and a longitude. More...
 
virtual IlvMapsError setEllipsoid (const IlvEllipsoid &)
 Sets the ellipsoid used for the projection. More...
 
virtual void setLLCenter (IlDouble, IlDouble)
 Specifies the central meridian and the central parallel (in radian) associated with the projection. More...
 
virtual void setScaleFactor (IlDouble k0)
 Sets the scale factor applied to the central meridian. More...
 
virtual void setXYOffset (IlDouble x0, IlDouble y0)
 Specifies the false easting and the false northing. More...
 
virtual void write (IlvOutputFile &) const
 Saves the parameters of a projection to the specified output file. More...
 
- Public Member Functions inherited from IlvProjection
virtual IlvProjectioncopy () const =0
 Returns a copy of the projection. More...
 
virtual IlvMapsError forward (IlvCoordinate &coords) const
 Projects a latitude and a longitude pair to Cartesian coordinates. More...
 
IlDouble getCentralMeridian () const
 Returns the central meridian of the projection. More...
 
IlDouble getCentralParallel () const
 Returns the central parallel of the projection. More...
 
virtual IlvProjectionClassInfogetClassInfo () const
 Returns the class information for the projection. More...
 
const IlvHorizontalDatumgetDatum (void) const
 Returns the horizontal datum used for the projection. More...
 
const IlvEllipsoidgetEllipsoid () const
 Returns the ellipsoid used for the projection. More...
 
IlvMapsError getError () const
 Returns the status of the projection. More...
 
IlDouble getFalseEasting () const
 Returns the false easting of the projection. More...
 
IlDouble getFalseNorthing () const
 Returns the false northing of the projection. More...
 
IlvProjectionInterfacegetInterface ()
 Returns the interface of the projection. More...
 
IlvCoordinate getLLCenter (void) const
 Returns the central meridian and the central parallel associated with the projection (0-0 by default). More...
 
IlvProjectionGeometricProperty getProperty () const
 Returns the geometric property of the projection. More...
 
const IlvUnitConvertergetUnitConverter () const
 Returns the unit converter. More...
 
IlvCoordinate getXYOffset () const
 Returns the false easting and the false northing of the projection. More...
 
virtual IlvMapsError inverse (IlvCoordinate &coords) const
 Invserse-projects Cartesian coordinates to a latitude and a longitude. More...
 
IlBoolean isBad () const
 Checks for an inconsistent state of the projection. More...
 
IlBoolean isEllipsoidEnabled () const
 Indicates if non spherical ellipsoids can be used for the projection. More...
 
IlBoolean isGeocentric () const
 Checks if the projection uses geocentric latitudes. More...
 
IlBoolean isInverseEnabled () const
 Indicates if the inverse function is supported by the projection. More...
 
IlBoolean isShared () const
 Indicates that the projection is shared. More...
 
IlBoolean isUsingLongitudeReduction () const
 Returns IlTrue if the projection uses range reduction for longitudes. More...
 
void lock ()
 Locks the projection.
 
virtual std::ostream & printPROJ4Descriptor (std::ostream &ostr, IlvMapsError *status=0) const
 This virtual member function converts the projection to a string in the PROJ4 format. More...
 
void save (IlvOutputFile &outputFile) const
 Saves an instance of a subclass of IlvProjection to the specified output file. More...
 
void setCentralMeridian (IlDouble lon)
 Sets the central meridian of the projection. More...
 
void setCentralParallel (IlDouble lat)
 Sets the central parallel of the projection. More...
 
virtual IlvMapsError setDatum (const IlvHorizontalDatum *datum)
 Sets the datum used for the projection. More...
 
void setFalseEasting (IlDouble falseEasting)
 Sets the false easting of the projection. More...
 
void setFalseNorthing (IlDouble falseNorthing)
 Sets the false northing of the projection. More...
 
void setGeocentric (IlBoolean geoc)
 Specifies whether the projection uses geocentric or geodetic latitudes. More...
 
void setShared ()
 Specifies that the projection will be shared. More...
 
void setUnitConverter (const IlvUnitConverter &converter)
 Sets the unit converter of the projection. More...
 
void setUsingLongitudeReduction (IlBoolean use)
 Specifies whether the projection uses longitude reduction. More...
 
void unLock ()
 Unlocks the object. More...
 

Protected Member Functions

virtual IlvMapsError eForward (IlvCoordinate &) const
 Must be redefined in subclasses to implement the projection for a non spherical ellipsoid. More...
 
virtual IlvMapsError eInverse (IlvCoordinate &) const
 Implements the inverse projection for a non spherical ellipsoid. More...
 
virtual bool isUsingProj4 () const
 Are we using proj4 implementation. More...
 
virtual IlvMapsError sForward (IlvCoordinate &) const
 Must be redefined in subclasses to implement the projection for a sphere. More...
 
virtual IlvMapsError sInverse (IlvCoordinate &) const
 Must be redefined in subclasses to implement the inverse projection for a sphere. More...
 
- Protected Member Functions inherited from IlvProjection
 IlvProjection (IlBoolean ellipsoidEnabled, IlBoolean inverseEnabled, IlvProjectionGeometricProperty property)
 Initializes a new IlvProjection instance. More...
 
void addError (IlvMapsError error)
 Used by the constructors of subclasses if an error occurs during an object initialization. More...
 
void setError (IlvMapsError error)
 Sets the status of this projection. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from IlvProjection
static IlvProjectionClassInfoClassInfo ()
 Returns the class information of the class. More...
 
static IlvClassInfo ** ClassInfoRef ()
 Returns the address of the class information of the class. More...
 
static IlvMapsError InputError ()
 Indicates that the coordinates passed to the forward function are not in a valid range for radian angles.
 
static IlvMapsError InvalidEllipsoidError ()
 Indicates that you attempt to set a non spherical ellipsoid to a projection that does not support non spherical ellipsoids.
 
static IlvProjectionLoad (IlvInputFile &inputFile)
 Loads a projection from the specified file. More...
 
static IlvProjectionPROJ4ToIlvProjection (const char *proj4Descriptor, IlvMapsError *status=0)
 Creates the projection from a PROJ4 descriptor. More...
 
static IlvMapsError ToleranceConditionError ()
 Indicates that an internal projection computation failed. More...
 
static IlvMapsError UnsupportedFeatureError ()
 Indicates that an unsupported projection feature is requested, like inverse projection for a projection that does not support inverse projection.
 

Detailed Description

Defines the Transverse Mercator projection.

Library: ilvmaps

This type of projection is generally used for large scale maps of predominantly north-south extension. The Transverse Mercator projection is the projection of a sphere on a cylinder that is tangent to a meridian. This projection is also known as:

This class implements the forward and inverse functions and is available for spheres and ellipsoids.

The projection is Conformal.

Transverse Mercator Projection

See also
IlvMercatorProjection, IlvUniversalTransverseMercatorProjection.

Constructor & Destructor Documentation

◆ IlvTransverseMercatorProjection()

IlvTransverseMercatorProjection::IlvTransverseMercatorProjection ( IlDouble  latitudeOfTrueScale = 0.)

This constructor initializes a new IlvTransverseMercatorProjection instance and sets the latitude of the true scale.

Parameters
latitudeOfTrueScaleThe latitude of the true scale.

Member Function Documentation

◆ eForward()

virtual IlvMapsError IlvTransverseMercatorProjection::eForward ( IlvCoordinate ll) const
protectedvirtual

Must be redefined in subclasses to implement the projection for a non spherical ellipsoid.

The default implementation returns IlvProjection::UnsupportedFeatureError().

Parameters
llContains the longitude and latitude coordinates in radian (x = longitude, y = latitude).
Returns
An error code.

Reimplemented from IlvProjection.

◆ eInverse()

virtual IlvMapsError IlvTransverseMercatorProjection::eInverse ( IlvCoordinate xy) const
protectedvirtual

Implements the inverse projection for a non spherical ellipsoid.

The default implementation returns IlvProjection::UnsupportedFeatureError().

Parameters
xyContains the Cartesian coordinates to inverse.
Returns
An error code.

Reimplemented from IlvProjection.

◆ forward() [1/3]

virtual IlvMapsError IlvProjection::forward

Converts a latitude and a longitude to Cartesian coordinates (x, y).

The forward projection is computed either by the sForward() or by the eForward() method, depending on whether the ellipsoid is a sphere or not. The implementation of one of these methods depends on the projection. The result is then converted to the appropriate measurement unit.

This method returns IlvMaps::NoError() if the conversion is successful. Otherwise, it returns an error status.

Note
The variables llIn and xyOut can be identical. For example, you can write: projection.forward(coords, coords). If an error status is returned, the coordinates returned are not correct. Therefore, it is strongly recommended to pay attention to the error flag status.
Parameters
llInIn Represents the longitude and latitude expressed in radian.
The longitude must be in the range [-PI; PI] and the latitude must be in the range [-PI/2; PI/2]. If required, the function converts the latitude to a geocentric latitude. Then it centers the longitude and adjusts it.
xyOutThe resulting projected coordinates.
Returns
An IlvMapsError different from IlvMaps::NoError() if the conversion fails.

◆ forward() [2/3]

virtual IlvMapsError IlvTransverseMercatorProjection::forward ( const IlvCoordinate llIn,
IlvCoordinate xyOut 
) const
virtual

Converts a latitude and a longitude to Cartesian coordinates (x, y).

The forward projection is computed either by the sForward() or by the eForward() method, depending on whether the ellipsoid is a sphere or not. The implementation of one of these methods depends on the projection. The result is then converted to the appropriate measurement unit.

This method returns IlvMaps::NoError() if the conversion is successful. Otherwise, it returns an error status.

Note
The variables llIn and xyOut can be identical. For example, you can write: projection.forward(coords, coords). If an error status is returned, the coordinates returned are not correct. Therefore, it is strongly recommended to pay attention to the error flag status.
Parameters
llInIn Represents the longitude and latitude expressed in radian.
The longitude must be in the range [-PI; PI] and the latitude must be in the range [-PI/2; PI/2]. If required, the function converts the latitude to a geocentric latitude. Then it centers the longitude and adjusts it.
xyOutThe resulting projected coordinates.
Returns
An IlvMapsError different from IlvMaps::NoError() if the conversion fails.

Reimplemented from IlvProjection.

◆ forward() [3/3]

virtual IlvMapsError IlvProjection::forward

Projects a latitude and a longitude pair to Cartesian coordinates.

This is equivalent to forward(coords, coords).

Parameters
coordsThe coordinates to be converted.
Returns
IlvMapsError different from IlvMaps::NoError() if the conversion fails.
See also
IlvProjection::forward().

◆ getScaleFactor()

IlDouble IlvTransverseMercatorProjection::getScaleFactor ( ) const

Returns the scale factor applied to the central meridian.

Returns
The scale factor applied to the central meridian.

◆ inverse() [1/3]

virtual IlvMapsError IlvProjection::inverse

Converts the specified coordinate to a latitude and a longitude.

This method converts the xyIn parameter, which represents Cartesian coordinates expressed in the measurement unit of the projection, to a latitude and a longitude.

This method returns IlvMaps::NoError() if the conversion is successful. Otherwise, it returns an error status.

Note
The variables llIn and xyOut can be identical. For example, you can write: projection.inverse(coords, coords).
Warning
If an error status is returned, the coordinates returned are not correct. Therefore, it is strongly recommended to pay attention to the error flag status.
Parameters
xyInThe coordinates to be converted.
llOutThe converted coordinates.
Returns
An IlvMapsError different from IlvMaps::NoError() if the conversion fails.

◆ inverse() [2/3]

virtual IlvMapsError IlvTransverseMercatorProjection::inverse ( const IlvCoordinate xyIn,
IlvCoordinate llOut 
) const
virtual

Converts the specified coordinate to a latitude and a longitude.

This method converts the xyIn parameter, which represents Cartesian coordinates expressed in the measurement unit of the projection, to a latitude and a longitude.

This method returns IlvMaps::NoError() if the conversion is successful. Otherwise, it returns an error status.

Note
The variables llIn and xyOut can be identical. For example, you can write: projection.inverse(coords, coords).
Warning
If an error status is returned, the coordinates returned are not correct. Therefore, it is strongly recommended to pay attention to the error flag status.
Parameters
xyInThe coordinates to be converted.
llOutThe converted coordinates.
Returns
An IlvMapsError different from IlvMaps::NoError() if the conversion fails.

Reimplemented from IlvProjection.

◆ inverse() [3/3]

virtual IlvMapsError IlvProjection::inverse

Invserse-projects Cartesian coordinates to a latitude and a longitude.

This is equivalent to inverse(coords, coords).

Parameters
coordsThe coordinates to be converted before the call and the result after the call.
Returns
An IlvMapsError different from IlvMaps::NoError() if the conversion fails.
See also
IlvProjection::inverse().

◆ isUsingProj4()

virtual bool IlvTransverseMercatorProjection::isUsingProj4 ( ) const
protectedvirtual

Are we using proj4 implementation.

Returns
Returns true if we are using proj4 implementation, false otherwise

Reimplemented from IlvProjection.

◆ setEllipsoid()

virtual IlvMapsError IlvTransverseMercatorProjection::setEllipsoid ( const IlvEllipsoid ellipsoid)
virtual

Sets the ellipsoid used for the projection.

This virtual member function sets the ellipsoid used for the projection. Most of the projections are initialized with a spherical ellipsoid with a radius of 6,370,997 meters.

This function returns IlvMaps::NoError() if the operation is successful or an error status if you specify a non spherical ellipsoid and your type does not support non spherical.

Parameters
ellipsoidThe ellipsoid used for the projection.
Returns
IlvMapsError if the ellipsoid does not match the projection.

Reimplemented from IlvProjection.

◆ setLLCenter()

virtual void IlvTransverseMercatorProjection::setLLCenter ( IlDouble  lon,
IlDouble  lat 
)
virtual

Specifies the central meridian and the central parallel (in radian) associated with the projection.

By default, theses values are set to 0.

This function is virtual because it can be overridden by subclasses of IlvProjection to update the internal parameters when the center is changed.

Parameters
lonThe central meridian in radian.
latThe central parallel in radian.

Reimplemented from IlvProjection.

Reimplemented in IlvUniversalTransverseMercatorProjection.

◆ setScaleFactor()

virtual void IlvTransverseMercatorProjection::setScaleFactor ( IlDouble  k0)
virtual

Sets the scale factor applied to the central meridian.

By default, the scale factor is 1.

Parameters
k0The scale factor applied to the central meridian.

Reimplemented in IlvUniversalTransverseMercatorProjection.

◆ setXYOffset()

virtual void IlvTransverseMercatorProjection::setXYOffset ( IlDouble  x0,
IlDouble  y0 
)
virtual

Specifies the false easting and the false northing.

The default value is (0, 0). The false easting is an offset that is added to the x coordinate of the projected data, and the false northing is an offset that is added to the y coordinate of the projected data. Both offset should be expressed in meters.

Parameters
x0The false easting.
y0The false northing.

Reimplemented from IlvProjection.

◆ sForward()

virtual IlvMapsError IlvTransverseMercatorProjection::sForward ( IlvCoordinate ll) const
protectedvirtual

Must be redefined in subclasses to implement the projection for a sphere.

Parameters
llContains the longitude and latitude coordinates in radian.
Returns
An error code.

Implements IlvProjection.

◆ sInverse()

virtual IlvMapsError IlvTransverseMercatorProjection::sInverse ( IlvCoordinate xy) const
protectedvirtual

Must be redefined in subclasses to implement the inverse projection for a sphere.

The default implementation returns IlvProjection::UnsupportedFeatureError().

Parameters
xyContains the Cartesian coordinates to inverse.
Returns
An error code.

Reimplemented from IlvProjection.

◆ write()

virtual void IlvTransverseMercatorProjection::write ( IlvOutputFile outputFile) const
virtual

Saves the parameters of a projection to the specified output file.

It must be overridden by subclasses of IlvProjection that need to save additional parameters.

This function should not be directly called; use the save() function instead.

Parameters
outputFileThe file to write the projection parameters to.

Reimplemented from IlvProjection.

Reimplemented in IlvUniversalTransverseMercatorProjection.