Rogue Wave Views
Maps Package API Reference Guide
Product Documentation:

Rogue Wave Views
Documentation Home
List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions
IlvProjection Class Referenceabstract

All projections in the library inherit from this abstract class. More...

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

Inheritance diagram for IlvProjection:
IlvAzimuthalEquidistantProjection IlvCassiniProjection IlvConicProjection IlvCylindricalEqualAreaProjection IlvEquidistantCylindricalProjection IlvGeographicProjection IlvGnomonicProjection IlvLambertAzimuthalEqualAreaProjection IlvMercatorProjection IlvMillerCylindricalProjection IlvOrthographicProjection IlvPolyconicProjection IlvStereographicProjection IlvTransverseMercatorProjection IlvUnknownProjection

Public Member Functions

virtual IlvProjectioncopy () const =0
 Returns a copy of the projection. It must be overridden in each subclass. More...
 
IlvMapsError forward (const IlvCoordinate &llIn, IlvCoordinate &xyOut) const
 Converts a latitude and a longitude to Cartesian coordinates (x,y). More...
 
IlvMapsError forward (IlvCoordinate &x) const
 This member function converts a latitude and a longitude 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 (void) const
 Returns the ellipsoid used for the projection. More...
 
IlvMapsError getError () const
 Returns the status of the projection. If the projection is valid, the function returns IlvMapsError::NoError(), otherwise, it returns an error code. See the IlvMaps class to know how to interpret the error codes. 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 (void) const
 Returns the false easting and the false northing of the projection. More...
 
IlvMapsError inverse (const IlvCoordinate &xyIn, IlvCoordinate &llOut) const
 Converts the specified coordinate to a latitude and a longitude. More...
 
IlvMapsError inverse (IlvCoordinate &x) const
 Converts the IlvCoordinate representing Cartesian coordinates to a latitude and a longitude. More...
 
IlBoolean isBad () const
 Checks for an inconsistent state of the projection. More...
 
IlBoolean isEllipsoidEnabled () const
 Returns IlTrue 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
 Returns IlTrue if the inverse function is supported by the projection. More...
 
IlBoolean isShared () const
 Returns IlTrue if 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 IL_STDPREF ostream & printPROJ4Descriptor (IL_STDPREF 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. The default unit is meters. More...
 
void setUsingLongitudeReduction (IlBoolean use)
 Specifies whether the projection uses longitude reduction. More...
 
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 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 ()
 Returned if the coordinates passed to the forward function are not in a valid range for radian angles.
 
static IlvMapsError InvalidEllipsoidError ()
 Returned if 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 specified by proj4Descriptor. More...
 
static IlvMapsError ToleranceConditionError ()
 Returned when an internal projection computation fails. Some projections, however, can return more specific error codes in this case.
 
static IlvMapsError UnsupportedFeatureError ()
 Returned if 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)
 This constructor initializes a new instance of the class. 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...
 
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...
 

Detailed Description

All projections in the library inherit from this abstract class.

See also
IlvCoordinate, IlvMaps, IlvProjectionClassInfo, IlvProjectionDictionary, IlvProjectionGeometricProperty, IlvProjectionInterface, IlvUnitConverter. Library: ilvmaps

Constructor & Destructor Documentation

IlvProjection::IlvProjection ( IlBoolean  ellipsoidEnabled,
IlBoolean  inverseEnabled,
IlvProjectionGeometricProperty  property 
)
protected

This constructor initializes a new instance of the class.

Parameters
ellipsoidEnabledBoolean argument that should be set to IlTrue if non spherical ellipsoids can be used for the projection. Projections supporting non spherical ellipsoids should implement the eForward() member function.
inverseEnabledBoolean argument that should be 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.
propertySpecifies the geometric property of the projection.
See also
IlvProjectionGeometricProperty

Member Function Documentation

void IlvProjection::addError ( IlvMapsError  error)
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.

Parameters
errorThe error.
static IlvProjectionClassInfo* IlvProjection::ClassInfo ( )
static

Returns the class information of the class.

This static function is also available for the subclasses of IlvProjection.

Returns
The IlvProjectionClassInfo of the class.
static IlvClassInfo** IlvProjection::ClassInfoRef ( )
static

Returns the address of the class information of the class.

This static function is also available for the subclasses of IlvProjection.

Returns
The address of the IlvProjectionClassInfo of the class.
virtual IlvProjection* IlvProjection::copy ( ) const
pure virtual

Returns a copy of the projection. It must be overridden in each subclass.

Returns
The copy of the object.

Implemented in IlvFrenchLambertProjection, and IlvUnknownProjection.

virtual IlvMapsError IlvProjection::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 in IlvAzimuthalEquidistantProjection, IlvStereographicProjection, IlvTransverseMercatorProjection, IlvCylindricalEqualAreaProjection, IlvLambertConformalConicProjection, IlvMercatorProjection, IlvAlbersEqualAreaProjection, IlvPolyconicProjection, IlvLambertAzimuthalEqualAreaProjection, IlvCassiniProjection, and IlvUnknownProjection.

virtual IlvMapsError IlvProjection::eInverse ( IlvCoordinate xy) const
protectedvirtual
IlvMapsError IlvProjection::forward ( const IlvCoordinate llIn,
IlvCoordinate xyOut 
) const

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(coord,coord). 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
llInRepresents the longitude and latitude expressed in radian (x = longitude, y = latitude).
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 data.
Returns
An IlvMapsError different from IlvMaps::NoError() if the conversion fails.
IlvMapsError IlvProjection::forward ( IlvCoordinate x) const

This member function converts a latitude and a longitude to Cartesian coordinates.

Parameters
xIlvCoordinate containing the coordinates to be converted.
Returns
IlvMapsError different from IlvMaps::NoError() if the conversion fails.
See also
IlvProjection::forward()
IlDouble IlvProjection::getCentralMeridian ( ) const

Returns the central meridian of the projection.

Returns
The central meridian of the projection.
See also
IlvProjection::getLLCenter()
IlDouble IlvProjection::getCentralParallel ( ) const

Returns the central parallel of the projection.

Returns
The central parallel of the projection.
See also
IlvProjection::getLLCenter()
virtual IlvProjectionClassInfo* IlvProjection::getClassInfo ( ) const
virtual

Returns the class information for the projection.

Returns
The class information for the projection.

Reimplemented in IlvConicProjection, IlvFrenchLambertProjection, and IlvUnknownProjection.

const IlvHorizontalDatum* IlvProjection::getDatum ( void  ) const

Returns the horizontal datum used for the projection.

Warning
The datum returned is destroyed when the projection itself is destroyed. You can however make a copy of the ellipsoid using the IlvHorizontalDatum::copy() method if you want to reuse this datum after the projection has been destroyed.
const IlvEllipsoid* IlvProjection::getEllipsoid ( void  ) const

Returns the ellipsoid used for the projection.

Warning
The ellipsoid returned is destroyed when the projection itself is destroyed. You can however make a copy of the ellipsoid using the IlvEllipsoid::copy() method if you want to reuse this ellipsoid after the projection has been destroyed.
Returns
The ellipsoid used for the projection.
IlvMapsError IlvProjection::getError ( ) const

Returns the status of the projection. If the projection is valid, the function returns IlvMapsError::NoError(), otherwise, it returns an error code. See the IlvMaps class to know how to interpret the error codes.

Returns
The status of the projection.
IlDouble IlvProjection::getFalseEasting ( ) const

Returns the false easting of the projection.

Returns
The false easting of the projection.
See also
IlvProjection::getXYOffset()
IlDouble IlvProjection::getFalseNorthing ( ) const

Returns the false northing of the projection.

Returns
The false northing of the projection.
See also
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.

Returns
The interface of the projection.
IlvCoordinate IlvProjection::getLLCenter ( void  ) const

Returns the central meridian and the central parallel associated with the projection (0-0 by default).

In the IlvCoordinate object returned, x is the central meridian while y is the central parallel of the projection. These values are expressed in radian.

Returns
The central meridian and the central parallel associated with the projection.
IlvProjectionGeometricProperty IlvProjection::getProperty ( ) const

Returns the geometric property of the projection.

Returns
The geometric property of the projection.
See also
IlvProjectionGeometricProperty
const IlvUnitConverter* IlvProjection::getUnitConverter ( ) const

Returns the unit converter.

Warning
The converter returned is destroyed when the projection itself is destroyed. You can however make a copy of the converter using the method IlvUnitConverter::copy() if you want to reuse this unit converter after the projection has been destroyed
Returns
The unit converter.
IlvCoordinate IlvProjection::getXYOffset ( void  ) const

Returns the false easting and the false northing of the projection.

Returns
IlvCoordinate containing the false easting and the false northing of the projection.
IlvMapsError IlvProjection::inverse ( const IlvCoordinate xyIn,
IlvCoordinate llOut 
) const

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(coord,coord).
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.
IlvMapsError IlvProjection::inverse ( IlvCoordinate x) const

Converts the IlvCoordinate representing Cartesian coordinates to a latitude and a longitude.

Parameters
xHolding the coordinate to be converted before the call and the result after the call.
Returns
IlvMapsError different from IlvMaps::NoError() if the conversion fails.
See also
IlvProjection::inverse()
IlBoolean IlvProjection::isBad ( ) const

Checks for an inconsistent state of the projection.

Returns IlTrue if the projection is in an inconsistent state because wrong parameters have been passed to the constructor.

IlBoolean IlvProjection::isEllipsoidEnabled ( ) const

Returns IlTrue if non spherical ellipsoids can be used for the projection.

Returns
IlTrue if non spherical ellipsoids can be used for the projection.
IlBoolean IlvProjection::isGeocentric ( ) const

Checks if the projection uses geocentric latitudes.

Returns
IlTrue if the projection uses geocentric latitudes.
IlBoolean IlvProjection::isInverseEnabled ( ) const

Returns IlTrue if the inverse function is supported by the projection.

Returns
IlTrue if the inverse function is supported by the projection, IlFalse otherwise.
IlBoolean IlvProjection::isShared ( ) const

Returns IlTrue if the projection is shared.

Warning
If a projection is shared, the projection should not be deleted directly.
Returns
IlTrue if the projection is shared, IlFalse otherwise.
See also
lock(), unLock().
IlBoolean IlvProjection::isUsingLongitudeReduction ( ) const

Returns IlTrue if the projection uses range reduction for longitudes.

Returns
IlTrue if the projection uses range reduction for longitudes, IlFalse otherwise.
static IlvProjection* IlvProjection::Load ( IlvInputFile inputFile)
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.

Parameters
inputFileThe file to read the projection from.
Returns
The read IlvProjection or a null pointer if the load operation fails.
virtual IL_STDPREF ostream& IlvProjection::printPROJ4Descriptor ( IL_STDPREF ostream &  ostr,
IlvMapsError *  status = 0 
) const
virtual

This virtual member function converts the projection to a string in the PROJ4 format.

Parameters
ostrThe output stream receiving the string.
statusIlvMapsError reporting a write error.
Returns
The output stream.

Reimplemented in IlvGeographicProjection.

static IlvProjection* IlvProjection::PROJ4ToIlvProjection ( const char *  PROJ4descriptor,
IlvMapsError *  status = 0 
)
static

Creates the projection specified by proj4Descriptor.

It returns a null pointer if an error occurs, that is, if proj4Descriptor specifies an unregistered projection or contains syntax errors. If passed, the status optional argument returns the status of the operation, namely:

  • IlvMap::NoError() if no read problem occurred, or
  • the corresponding error code otherwise (see the class IlvMaps to know how to interpret the error codes returned).
Parameters
PROJ4descriptorThe PROJ4 description.
statusIlvMapsError indicating an invalid string or an unregistered projection.
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.

Parameters
outputFileThe file to write the projection to.
void IlvProjection::setCentralMeridian ( IlDouble  lon)

Sets the central meridian of the projection.

Parameters
lonThe central meridian in radian.
See also
IlvProjection::setLLCenter()
void IlvProjection::setCentralParallel ( IlDouble  lat)

Sets the central parallel of the projection.

Parameters
latThe central parallel in radian.
See also
IlvProjection::setLLCenter()
virtual IlvMapsError IlvProjection::setDatum ( const IlvHorizontalDatum datum)
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.

Returns
The datum or a null pointer if not defined.
virtual IlvMapsError IlvProjection::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 in IlvAzimuthalEquidistantProjection, IlvStereographicProjection, IlvTransverseMercatorProjection, IlvCylindricalEqualAreaProjection, IlvMercatorProjection, IlvAlbersEqualAreaProjection, IlvLambertAzimuthalEqualAreaProjection, IlvPolyconicProjection, IlvLambertConformalConicProjection, IlvCassiniProjection, and IlvGeographicProjection.

void IlvProjection::setError ( IlvMapsError  error)
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.

Parameters
errorThe new error status.
See also
IlvProjection::getError()
void IlvProjection::setFalseEasting ( IlDouble  falseEasting)

Sets the false easting of the projection.

Parameters
falseEastingThe false easting of the projection.
See also
IlvProjection::setXYOffset()
void IlvProjection::setFalseNorthing ( IlDouble  falseNorthing)

Sets the false northing of the projection.

Parameters
falseNorthingThe false northing of the projection.
See also
IlvProjection::setFalseNorthing()
void IlvProjection::setGeocentric ( IlBoolean  geoc)

Specifies whether the projection uses geocentric or geodetic latitudes.

The IlvProjection constructor sets this parameter to IlFalse.

Parameters
geocIf IlTrue, the projection uses geocentric latitudes.
virtual void IlvProjection::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 in IlvFrenchLambertProjection, IlvUniversalTransverseMercatorProjection, IlvAzimuthalEquidistantProjection, IlvStereographicProjection, IlvAlbersEqualAreaProjection, IlvLambertAzimuthalEqualAreaProjection, IlvPolyconicProjection, IlvLambertConformalConicProjection, IlvUniversalPolarStereographicProjection, IlvOrthographicProjection, IlvCassiniProjection, and IlvGnomonicProjection.

void IlvProjection::setShared ( )

Specifies that the projection will be shared.

Warning
If a projection is shared, the projection should not be deleted directly.
See also
lock(), unLock().
void IlvProjection::setUnitConverter ( const IlvUnitConverter converter)

Sets the unit converter of the projection. The default unit is meters.

Parameters
converterThe 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 Boolean flag is set to IlTrue, which means that the internal range of longitude is reduced to this range. Setting it to IlFalse disables internal range reduction. However, this should be used with care in applications.

void IlvProjection::setXYOffset ( IlDouble  x0,
IlDouble  y0 
)

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.
virtual IlvMapsError IlvProjection::sForward ( IlvCoordinate ll) const
protectedpure virtual
virtual IlvMapsError IlvProjection::sInverse ( IlvCoordinate xy) const
protectedvirtual
void IlvProjection::unLock ( )

Unlocks the object.

If the projection does not have any lock, it is deleted.

virtual void IlvProjection::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 in IlvFrenchLambertProjection, IlvConicProjection, IlvUniversalTransverseMercatorProjection, IlvLambertEqualAreaConicProjection, IlvStereographicProjection, IlvAzimuthalEquidistantProjection, IlvUniversalPolarStereographicProjection, IlvTransverseMercatorProjection, IlvCylindricalEqualAreaProjection, IlvLambertConformalConicProjection, IlvEquidistantCylindricalProjection, IlvMercatorProjection, IlvAlbersEqualAreaProjection, and IlvPolyconicProjection.


© Copyright 2016, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.