Parent class of all projections in the library. More...
#include <ilviews/maps/projection/project.h>
Public Member Functions | |
virtual IlvProjection * | copy () const =0 |
Returns a copy of the projection. 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 | getCentralMeridian () const |
Returns the central meridian of the projection. More... | |
IlDouble | getCentralParallel () const |
Returns the central parallel of the projection. More... | |
virtual IlvProjectionClassInfo * | getClassInfo () const |
Returns the class information for the projection. More... | |
const IlvHorizontalDatum * | getDatum (void) const |
Returns the horizontal datum used for the projection. More... | |
const IlvEllipsoid * | getEllipsoid () 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... | |
IlvProjectionInterface * | getInterface () |
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 IlvUnitConverter * | getUnitConverter () const |
Returns the unit converter. More... | |
IlvCoordinate | getXYOffset () const |
Returns the false easting and the false northing of the projection. 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... | |
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... | |
virtual IlvMapsError | setEllipsoid (const IlvEllipsoid &ellipsoid) |
Sets the ellipsoid 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... | |
virtual void | setLLCenter (IlDouble lon, IlDouble lat) |
Specifies the central meridian and the central parallel (in radian) associated with the projection. 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... | |
virtual void | setXYOffset (IlDouble x0, IlDouble y0) |
Specifies the false easting and the false northing. More... | |
void | unLock () |
Unlocks the object. More... | |
virtual void | write (IlvOutputFile &outputFile) const |
Saves the parameters of a projection to the specified output file. More... | |
Static Public Member Functions | |
static IlvProjectionClassInfo * | ClassInfo () |
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 IlvProjection * | Load (IlvInputFile &inputFile) |
Loads a projection from the specified file. More... | |
static IlvProjection * | PROJ4ToIlvProjection (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. | |
Protected Member Functions | |
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... | |
virtual IlvMapsError | eForward (IlvCoordinate &ll) const |
Must be redefined in subclasses to implement the projection for a non spherical ellipsoid. More... | |
virtual IlvMapsError | eInverse (IlvCoordinate &xy) const |
Implements the inverse projection for a non spherical ellipsoid. More... | |
virtual bool | isUsingProj4 () const |
Are we using proj4 implementation. More... | |
void | setError (IlvMapsError error) |
Sets the status of this projection. More... | |
virtual IlvMapsError | sForward (IlvCoordinate &ll) const =0 |
Must be redefined in subclasses to implement the projection for a sphere. More... | |
virtual IlvMapsError | sInverse (IlvCoordinate &xy) const |
Must be redefined in subclasses to implement the inverse projection for a sphere. More... | |
Parent class of all projections in the library.
Library: ilvmaps
|
protected |
Initializes a new IlvProjection
instance.
ellipsoidEnabled | Set to IlTrue if non spherical ellipsoids can be used for the projection. Projections supporting non spherical ellipsoids should implement the eForward() member function. |
inverseEnabled | Set to IlTrue if the projection implements an inverse function. This type of projections should implement the sInverse() and eInverse() member functions if ellipsoids are supported. |
property | Specifies the geometric property of the projection. |
IlvProjectionGeometricProperty
.
|
protected |
Used by the constructors of subclasses if an error occurs during an object initialization.
This protected method is used by subclasses of IlvProjection
to set the error status of the projection within the constructors and the parameterizing functions if the parameters received are inconsistent.
If the projection status is already different from IlvMaps::NoError()
, this function does nothing.
error | The error. |
|
static |
Returns the class information of the class.
This static function is also available for the subclasses of IlvProjection
.
IlvProjectionClassInfo
of the class.
|
static |
Returns the address of the class information of the class.
This static function is also available for the subclasses of IlvProjection
.
IlvProjectionClassInfo
of the class.
|
pure virtual |
Returns a copy of the projection.
It must be overridden in each subclass.
Implemented in IlvUnknownProjection, and IlvFrenchLambertProjection.
|
protectedvirtual |
Must be redefined in subclasses to implement the projection for a non spherical ellipsoid.
The default implementation returns IlvProjection::UnsupportedFeatureError()
.
ll | Contains the longitude and latitude coordinates in radian (x = longitude, y = latitude). |
Reimplemented in IlvAzimuthalEquidistantProjection, IlvUnknownProjection, IlvTransverseMercatorProjection, IlvStereographicProjection, IlvPolyconicProjection, IlvMercatorProjection, IlvLambertConformalConicProjection, IlvLambertAzimuthalEqualAreaProjection, IlvCylindricalEqualAreaProjection, IlvCassiniProjection, and IlvAlbersEqualAreaProjection.
|
protectedvirtual |
Implements the inverse projection for a non spherical ellipsoid.
The default implementation returns IlvProjection::UnsupportedFeatureError()
.
xy | Contains the Cartesian coordinates to inverse. |
Reimplemented in IlvAzimuthalEquidistantProjection, IlvUnknownProjection, IlvTransverseMercatorProjection, IlvStereographicProjection, IlvPolyconicProjection, IlvMercatorProjection, IlvLambertConformalConicProjection, IlvLambertAzimuthalEqualAreaProjection, IlvCylindricalEqualAreaProjection, IlvCassiniProjection, and IlvAlbersEqualAreaProjection.
|
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.
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.llIn | In 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. |
xyOut | The resulting projected coordinates. |
IlvMapsError
different from IlvMaps::NoError()
if the conversion fails. Reimplemented in IlvTransverseMercatorProjection, and IlvAzimuthalEquidistantProjection.
|
virtual |
Projects a latitude and a longitude pair to Cartesian coordinates.
This is equivalent to forward(coords, coords)
.
coords | The coordinates to be converted. |
IlvMapsError
different from IlvMaps::NoError()
if the conversion fails. IlvProjection::forward()
. IlDouble IlvProjection::getCentralMeridian | ( | ) | const |
Returns the central meridian of the projection.
IlvProjection::getLLCenter()
IlDouble IlvProjection::getCentralParallel | ( | ) | const |
Returns the central parallel of the projection.
IlvProjection::getLLCenter()
.
|
virtual |
Returns the class information for the projection.
Reimplemented in IlvUnknownProjection, IlvFrenchLambertProjection, and IlvConicProjection.
const IlvHorizontalDatum* IlvProjection::getDatum | ( | void | ) | const |
Returns the horizontal datum used for the projection.
IlvHorizontalDatum::copy()
method if you want to reuse this datum after the projection has been destroyed. const IlvEllipsoid* IlvProjection::getEllipsoid | ( | ) | const |
Returns the ellipsoid used for the projection.
IlvEllipsoid::copy()
method if you want to reuse this ellipsoid after the projection has been destroyed. IlvMapsError IlvProjection::getError | ( | ) | const |
Returns the status of the projection.
IlvMapsError::NoError()
, otherwise, it is an error code. See the IlvMaps
class to know how to interpret the error codes. IlDouble IlvProjection::getFalseEasting | ( | ) | const |
Returns the false easting of the projection.
IlvProjection::getXYOffset()
. IlDouble IlvProjection::getFalseNorthing | ( | ) | const |
Returns the false northing of the projection.
IlvProjection::getXYOffset()
. IlvProjectionInterface* IlvProjection::getInterface | ( | ) |
Returns the interface of the projection.
A projection interface gives run-time information about the parameters of a projection, and makes it possible to modify these parameters. It is generally used to build dynamic projection editors.
IlvCoordinate IlvProjection::getLLCenter | ( | void | ) | const |
Returns the central meridian and the central parallel associated with the projection (0-0 by default).
In the returned IlvCoordinate
object, x
is the central meridian while y
is the central parallel of the projection. These values are expressed in radian.
IlvProjectionGeometricProperty IlvProjection::getProperty | ( | ) | const |
Returns the geometric property of the projection.
IlvProjectionGeometricProperty
. const IlvUnitConverter* IlvProjection::getUnitConverter | ( | ) | const |
Returns the unit converter.
IlvUnitConverter::copy()
if you want to reuse this unit converter after the projection has been destroyed IlvCoordinate IlvProjection::getXYOffset | ( | ) | const |
Returns the false easting and the false northing of the projection.
IlvCoordinate
object containing the false easting and the false northing of the projection.
|
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.
projection.inverse(coords, coords)
. xyIn | The coordinates to be converted. |
llOut | The converted coordinates. |
IlvMapsError
different from IlvMaps::NoError()
if the conversion fails. Reimplemented in IlvTransverseMercatorProjection, and IlvAzimuthalEquidistantProjection.
|
virtual |
Invserse-projects Cartesian coordinates to a latitude and a longitude.
This is equivalent to inverse(coords, coords)
.
coords | The coordinates to be converted before the call and the result after the call. |
IlvMapsError
different from IlvMaps::NoError()
if the conversion fails. IlvProjection::inverse()
. IlBoolean IlvProjection::isBad | ( | ) | const |
Checks for an inconsistent state of the projection.
IlTrue
if the projection is in an inconsistent state because wrong parameters have been passed to the constructor. IlBoolean IlvProjection::isEllipsoidEnabled | ( | ) | const |
Indicates if non spherical ellipsoids can be used for the projection.
IlTrue
if non spherical ellipsoids can be used for the projection. IlBoolean IlvProjection::isGeocentric | ( | ) | const |
Checks if the projection uses geocentric latitudes.
IlTrue
if the projection uses geocentric latitudes. IlBoolean IlvProjection::isInverseEnabled | ( | ) | const |
Indicates if the inverse function is supported by the projection.
IlTrue
if the inverse function is supported by the projection, IlFalse
otherwise. IlBoolean IlvProjection::isShared | ( | ) | const |
IlBoolean IlvProjection::isUsingLongitudeReduction | ( | ) | const |
Returns IlTrue
if the projection uses range reduction for longitudes.
IlTrue
if the projection uses range reduction for longitudes, IlFalse
otherwise.
|
protectedvirtual |
Are we using proj4 implementation.
Reimplemented in IlvTransverseMercatorProjection, and IlvAzimuthalEquidistantProjection.
|
static |
Loads a projection from the specified file.
It can be used, for example, within the read method of a subclass of IlvNamedProperty
. If the load operation fails, the function returns a null pointer, otherwise, it returns a pointer to the projection which was read. If the file contained invalid parameters, however, the returned projection can have an error status (see the member function IlvProjection::getError()
).
The returned projection must be deleted by the user.
inputFile | The file to read the projection from. |
IlvProjection
that was read, or 0
if the load operation fails.
|
virtual |
This virtual member function converts the projection to a string in the PROJ4
format.
ostr | The output stream receiving the string. |
status | A potential pointer to an IlvMapsError reporting a write error. |
|
static |
Creates the projection from a PROJ4
descriptor.
It returns a 0
if an error occurs, that is, if proj4Descriptor specifies an unregistered projection or contains syntax errors.
proj4Descriptor | The PROJ4 description. |
status | A potential pointer to an IlvMapsError indicating an invalid string or an unregistered projection. It can be:
|
IlvProjection
or 0
if an error occured, that is, if proj4Descriptor specifies an unregistered projection or contains syntax errors. void IlvProjection::save | ( | IlvOutputFile & | outputFile | ) | const |
Saves an instance of a subclass of IlvProjection
to the specified output file.
It can be used, for example, within the write method of a subclass of IlvNamedProperty
.
outputFile | The file to write the projection to. |
void IlvProjection::setCentralMeridian | ( | IlDouble | lon | ) |
Sets the central meridian of the projection.
lon | The central meridian in radian. |
IlvProjection::setLLCenter()
. void IlvProjection::setCentralParallel | ( | IlDouble | lat | ) |
Sets the central parallel of the projection.
lat | The central parallel in radian. |
IlvProjection::setLLCenter()
.
|
virtual |
Sets the datum used for the projection.
This method sets the datum used for the projection. The specified datum is copied by this projection.
0
if it is not defined.
|
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.
ellipsoid | The ellipsoid used for the projection. |
IlvMapsError
if the ellipsoid does not match the projection. Reimplemented in IlvTransverseMercatorProjection, IlvStereographicProjection, IlvPolyconicProjection, IlvMercatorProjection, IlvLambertConformalConicProjection, IlvLambertAzimuthalEqualAreaProjection, IlvGeographicProjection, IlvCylindricalEqualAreaProjection, IlvCassiniProjection, IlvAzimuthalEquidistantProjection, and IlvAlbersEqualAreaProjection.
|
protected |
Sets the status of this projection.
Subclasses of IlvProjection
should call this method to set the status of the projection. The new error status error replaces the current status of this projection.
error | The new error status. |
IlvProjection::getError()
. void IlvProjection::setFalseEasting | ( | IlDouble | falseEasting | ) |
Sets the false easting of the projection.
falseEasting | The false easting of the projection. |
IlvProjection::setXYOffset()
. void IlvProjection::setFalseNorthing | ( | IlDouble | falseNorthing | ) |
Sets the false northing of the projection.
falseNorthing | The false northing of the projection. |
IlvProjection::setFalseNorthing()
. void IlvProjection::setGeocentric | ( | IlBoolean | geoc | ) |
Specifies whether the projection uses geocentric or geodetic latitudes.
The IlvProjection
constructor sets this parameter to IlFalse
.
geoc | If IlTrue , the projection uses geocentric latitudes. |
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.
lon | The central meridian in radian. |
lat | The central parallel in radian. |
Reimplemented in IlvUniversalTransverseMercatorProjection, IlvUniversalPolarStereographicProjection, IlvTransverseMercatorProjection, IlvStereographicProjection, IlvPolyconicProjection, IlvOrthographicProjection, IlvLambertConformalConicProjection, IlvLambertAzimuthalEqualAreaProjection, IlvGnomonicProjection, IlvCassiniProjection, IlvAzimuthalEquidistantProjection, IlvAlbersEqualAreaProjection, and IlvFrenchLambertProjection.
void IlvProjection::setShared | ( | ) |
void IlvProjection::setUnitConverter | ( | const IlvUnitConverter & | converter | ) |
Sets the unit converter of the projection.
The default unit is meters.
converter | The unit converter. |
void IlvProjection::setUsingLongitudeReduction | ( | IlBoolean | use | ) |
Specifies whether the projection uses longitude reduction.
The normal geographic range for longitude is between 180E and 180W.
By default, the flag is set to IlTrue
, which means that the internal range of longitude is reduced to this range.
use | IlFalse to disable internal range reduction. This should be used with care in applications. |
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.
x0 | The false easting. |
y0 | The false northing. |
Reimplemented in IlvTransverseMercatorProjection.
|
protectedpure virtual |
Must be redefined in subclasses to implement the projection for a sphere.
ll | Contains the longitude and latitude coordinates in radian. |
Implemented in IlvAzimuthalEquidistantProjection, IlvUnknownProjection, IlvTransverseMercatorProjection, IlvStereographicProjection, IlvPolyconicProjection, IlvOrthographicProjection, IlvMillerCylindricalProjection, IlvMercatorProjection, IlvLambertConformalConicProjection, IlvLambertAzimuthalEqualAreaProjection, IlvGnomonicProjection, IlvGeographicProjection, IlvEquidistantCylindricalProjection, IlvCylindricalEqualAreaProjection, IlvCassiniProjection, and IlvAlbersEqualAreaProjection.
|
protectedvirtual |
Must be redefined in subclasses to implement the inverse projection for a sphere.
The default implementation returns IlvProjection::UnsupportedFeatureError()
.
xy | Contains the Cartesian coordinates to inverse. |
Reimplemented in IlvAzimuthalEquidistantProjection, IlvUnknownProjection, IlvTransverseMercatorProjection, IlvStereographicProjection, IlvPolyconicProjection, IlvOrthographicProjection, IlvMillerCylindricalProjection, IlvMercatorProjection, IlvLambertConformalConicProjection, IlvLambertAzimuthalEqualAreaProjection, IlvGnomonicProjection, IlvGeographicProjection, IlvEquidistantCylindricalProjection, IlvCylindricalEqualAreaProjection, IlvCassiniProjection, and IlvAlbersEqualAreaProjection.
|
static |
Indicates that an internal projection computation failed.
Some projections, however, can return more specific error codes in this case.
void IlvProjection::unLock | ( | ) |
Unlocks the object.
If the projection does not have any lock, it is deleted.
|
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.
outputFile | The file to write the projection parameters to. |
Reimplemented in IlvUniversalTransverseMercatorProjection, IlvUniversalPolarStereographicProjection, IlvTransverseMercatorProjection, IlvStereographicProjection, IlvPolyconicProjection, IlvMercatorProjection, IlvLambertConformalConicProjection, IlvLambertEqualAreaConicProjection, IlvFrenchLambertProjection, IlvEquidistantCylindricalProjection, IlvCylindricalEqualAreaProjection, IlvConicProjection, IlvAzimuthalEquidistantProjection, and IlvAlbersEqualAreaProjection.