rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Maps Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

IlvProjection Class Reference

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

List of all members.

Public Member Functions

virtual IlvProjectioncopy () const =0
 Returns a copy of the projection. It must be overridden in each subclass.
IlvMapsError forward (IlvCoordinate &x) const
 This member function converts a latitude and a longitude to Cartesian coordinates.
IlvMapsError forward (const IlvCoordinate &llIn, IlvCoordinate &xyOut) const
 Converts a latitude and a longitude to Cartesian coordinates (x,y).
IlDouble getCentralMeridian () const
 Returns the central meridian of the projection.
IlDouble getCentralParallel () const
 Returns the central parallel of the projection.
virtual IlvProjectionClassInfogetClassInfo () const
 Returns the class information for the projection.
const IlvHorizontalDatumgetDatum (void) const
 Returns the horizontal datum used for the projection.
const IlvEllipsoidgetEllipsoid (void) const
 Returns the ellipsoid used for the projection.
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.
IlDouble getFalseEasting () const
 Returns the false easting of the projection.
IlDouble getFalseNorthing () const
 Returns the false northing of the projection.
IlvProjectionInterfacegetInterface ()
 Returns the interface of the projection.
IlvCoordinate getLLCenter (void) const
 Returns the central meridian and the central parallel associated with the projection (0-0 by default).
IlvProjectionGeometricProperty getProperty () const
 Returns the geometric property of the projection.
const IlvUnitConvertergetUnitConverter () const
 Returns the unit converter.
IlvCoordinate getXYOffset (void) const
 Returns the false easting and the false northing of the projection.
IlvMapsError inverse (IlvCoordinate &x) const
 Converts the IlvCoordinate representing Cartesian coordinates to a latitude and a longitude.
IlvMapsError inverse (const IlvCoordinate &xyIn, IlvCoordinate &llOut) const
 Converts the specified coordinate to a latitude and a longitude.
IlBoolean isBad () const
 Checks for an inconsistent state of the projection.
IlBoolean isEllipsoidEnabled () const
 Returns IlTrue if non spherical ellipsoids can be used for the projection.
IlBoolean isGeocentric () const
 Checks if the projection uses geocentric latitudes.
IlBoolean isInverseEnabled () const
 Returns IlTrue if the inverse function is supported by the projection.
IlBoolean isShared () const
 Returns IlTrue if the projection is shared.
IlBoolean isUsingLongitudeReduction () const
 Returns IlTrue if the projection uses range reduction for longitudes.
void lock ()
 Locks the projection.
virtual IL_STDPREF ostream & printPROJ4Descriptor (IL_STDPREF ostream &, IlvMapsError *status=0) const
 This virtual member function converts the projection to a string in the PROJ4 format.
void save (IlvOutputFile &outputFile) const
 Saves an instance of a subclass of IlvProjection to the specified output file.
void setCentralMeridian (IlDouble lon)
 Sets the central meridian of the projection.
void setCentralParallel (IlDouble lat)
 Sets the central parallel of the projection.
virtual IlvMapsError setDatum (const IlvHorizontalDatum *datum)
 Sets the datum used for the projection.
virtual IlvMapsError setEllipsoid (const IlvEllipsoid &ellipsoid)
 Sets the ellipsoid used for the projection.
void setFalseEasting (IlDouble falseEasting)
 Sets the false easting of the projection.
void setFalseNorthing (IlDouble falseNorthing)
 Sets the false northing of the projection.
void setGeocentric (IlBoolean geoc)
 Specifies whether the projection uses geocentric or geodetic latitudes.
virtual void setLLCenter (IlDouble lon, IlDouble lat)
 Specifies the central meridian and the central parallel (in radian) associated with the projection.
void setShared ()
 Specifies that the projection will be shared.
void setUnitConverter (const IlvUnitConverter &converter)
 Sets the unit converter of the projection. The default unit is meters.
void setUsingLongitudeReduction (IlBoolean use)
 Specifies whether the projection uses longitude reduction.
void setXYOffset (IlDouble x0, IlDouble y0)
 Specifies the false easting and the false northing.
void unLock ()
 Unlocks the object.
virtual void write (IlvOutputFile &outputFile) const
 Saves the parameters of a projection to the specified output file.

Static Public Member Functions

static IlvProjectionClassInfoClassInfo ()
 Returns the class information of the class.
static IlvClassInfo ** ClassInfoRef ()
 Returns the address of the class information of the class.
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.
static IlvProjectionPROJ4ToIlvProjection (const char *PROJ4descriptor, IlvMapsError *status=0)
 Creates the projection specified by proj4Descriptor.
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.
void addError (IlvMapsError error)
 Used by the constructors of subclasses if an error occurs during an object initialization.
virtual IlvMapsError eForward (IlvCoordinate &ll) const
 Must be redefined in subclasses to implement the projection for a non spherical ellipsoid.
virtual IlvMapsError eInverse (IlvCoordinate &xy) const
 Implements the inverse projection for a non spherical ellipsoid.
void setError (IlvMapsError error)
 Sets the status of this projection.
virtual IlvMapsError sForward (IlvCoordinate &ll) const =0
 Must be redefined in subclasses to implement the projection for a sphere.
virtual IlvMapsError sInverse (IlvCoordinate &xy) const
 Must be redefined in subclasses to implement the inverse projection for a sphere.

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:
ellipsoidEnabled Boolean 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.
inverseEnabled Boolean 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.
property Specifies 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:
error The error.
static IlvProjectionClassInfo* IlvProjection::ClassInfo (  )  [static]
static IlvClassInfo** IlvProjection::ClassInfoRef (  )  [static]
virtual IlvProjection* IlvProjection::copy (  )  const [pure virtual]
virtual IlvMapsError IlvProjection::eForward ( IlvCoordinate ll  )  const [protected, virtual]

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

The default implementation returns IlvProjection::UnsupportedFeatureError().

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

Reimplemented in IlvAlbersEqualAreaProjection, IlvAzimuthalEquidistantProjection, IlvCassiniProjection, IlvCylindricalEqualAreaProjection, IlvLambertAzimuthalEqualAreaProjection, IlvLambertConformalConicProjection, IlvMercatorProjection, IlvPolyconicProjection, IlvStereographicProjection, IlvTransverseMercatorProjection, and IlvUnknownProjection.

virtual IlvMapsError IlvProjection::eInverse ( IlvCoordinate xy  )  const [protected, virtual]

Implements the inverse projection for a non spherical ellipsoid.

The default implementation returns IlvProjection::UnsupportedFeatureError().

Parameters:
xy Contains the Cartesian coordinates to inverse.
Returns:
An error code.

Reimplemented in IlvAlbersEqualAreaProjection, IlvAzimuthalEquidistantProjection, IlvCassiniProjection, IlvCylindricalEqualAreaProjection, IlvLambertAzimuthalEqualAreaProjection, IlvLambertConformalConicProjection, IlvMercatorProjection, IlvPolyconicProjection, IlvStereographicProjection, IlvTransverseMercatorProjection, and IlvUnknownProjection.

IlvMapsError IlvProjection::forward ( IlvCoordinate x  )  const

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

Parameters:
x IlvCoordinate containing the coordinates to be converted.
Returns:
IlvMapsError different from IlvMaps::NoError() if the conversion fails.
See also:
IlvProjection::forward
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.

Warning:
[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:
llIn Represents 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.
xyOut The resulting projected data.
Returns:
An IlvMapsError different from IlvMaps::NoError() if the conversion fails.
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]
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 ( IlvCoordinate x  )  const

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

Parameters:
x Holding 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
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.

Warning:
[note] The variables llIn and xyOut can be identical. For example, you can write: projection.inverse(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:
xyIn The coordinates to be converted.
llOut The converted coordinates.
Returns:
An IlvMapsError different from IlvMaps::NoError() if the conversion fails.
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:
inputFile The 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 &  ,
IlvMapsError *  status = 0 
) const [virtual]

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

Parameters:
ostream The output stream receiving the string.
status IlvMapsError 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:
PROJ4descriptor The PROJ4 description.
status IlvMapsError 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:
outputFile The file to write the projection to.
void IlvProjection::setCentralMeridian ( IlDouble  lon  ) 

Sets the central meridian of the projection.

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

Sets the central parallel of the projection.

Parameters:
lat The 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:
ellipsoid The ellipsoid used for the projection.
Returns:
IlvMapsError if the ellipsoid does not match the projection.

Reimplemented in IlvAlbersEqualAreaProjection, IlvAzimuthalEquidistantProjection, IlvCassiniProjection, IlvCylindricalEqualAreaProjection, IlvGeographicProjection, IlvLambertAzimuthalEqualAreaProjection, IlvLambertConformalConicProjection, IlvMercatorProjection, IlvPolyconicProjection, IlvStereographicProjection, and IlvTransverseMercatorProjection.

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:
error The new error status.
See also:
IlvProjection::getError
void IlvProjection::setFalseEasting ( IlDouble  falseEasting  ) 

Sets the false easting of the projection.

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

Sets the false northing of the projection.

Parameters:
falseNorthing The 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:
geoc If 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:
lon The central meridian in radian.
lat The central parallel in radian.

Reimplemented in IlvAlbersEqualAreaProjection, IlvAzimuthalEquidistantProjection, IlvCassiniProjection, IlvFrenchLambertProjection, IlvGnomonicProjection, IlvLambertAzimuthalEqualAreaProjection, IlvLambertConformalConicProjection, IlvOrthographicProjection, IlvPolyconicProjection, IlvStereographicProjection, IlvUniversalPolarStereographicProjection, and IlvUniversalTransverseMercatorProjection.

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:
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 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:
x0 The false easting.
y0 The false northing.
virtual IlvMapsError IlvProjection::sForward ( IlvCoordinate ll  )  const [protected, pure virtual]
virtual IlvMapsError IlvProjection::sInverse ( IlvCoordinate xy  )  const [protected, virtual]
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:
outputFile The file to write the projection parameters to.

Reimplemented in IlvAlbersEqualAreaProjection, IlvAzimuthalEquidistantProjection, IlvConicProjection, IlvCylindricalEqualAreaProjection, IlvEquidistantCylindricalProjection, IlvFrenchLambertProjection, IlvLambertEqualAreaConicProjection, IlvLambertConformalConicProjection, IlvMercatorProjection, IlvPolyconicProjection, IlvStereographicProjection, IlvTransverseMercatorProjection, IlvUniversalPolarStereographicProjection, and IlvUniversalTransverseMercatorProjection.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

© Copyright 2012, 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.