A Converter is responsible for the conversion of coordinates between different Coordinate Systems (CS). More...
#include <Converter.h>
Public Member Functions | |
bool | convert (double *xIn, double *yIn, double *xOut, double *yOut, long numCoord, int coordOffset=1) const |
Converts a vector of coordinates from source SRS to target SRS. More... | |
bool | convert (double *x, double *y, long numCoord, int coordOffset=1) const |
Converts a vector of coordinates from source SRS to target SRS. More... | |
bool | convert (const double xIn, const double yIn, double &xOut, double &yOut) const |
Converts a single coordinate from source SRS to target SRS. More... | |
bool | convert (double &x, double &y) const |
Converts a coordinate from source SRS to target SRS. More... | |
Converter () | |
Default empty constructor. More... | |
Converter (int sourceSRID, int targetSRID) | |
Constructor with parameters. More... | |
bool | convertToGeographic (double &x, double &y, int SRID) const |
Converts a coordinate from a projected SRS to its underlying geographic SRS (same Datum). More... | |
bool | convertToProjected (double &lon, double &lat, int SRID) const |
Converts a coordinate from a geographic SRS to a projected SRS based on the same Datum. More... | |
int | getSourceSRID () const |
Gets source SRS identifier. More... | |
int | getTargetSRID () const |
Gets target SRS identifier. More... | |
bool | invert (double *xIn, double *yIn, double *xOut, double *yOut, long numCoord, int coordOffset=1) const |
Inverts a vector of coordinates from target SRS to dource SRS. More... | |
bool | invert (double *x, double *y, long numCoord, int coordOffset=1) const |
Inverts a vector of coordinates from target SRS to source SRS. More... | |
bool | invert (const double xIn, const double yIn, double &xOut, double &yOut) const |
Inverts a coordinate from source SRS to target SRS. More... | |
bool | invert (double &x, double &y) const |
Inverts a coordinate from target SRS to source SRS. More... | |
void | setSourcePJ4txt (const std::string &pj4txt) |
Sets the source SRS PROJ4 description. More... | |
void | setSourceSRID (int sourceSRID) |
Sets the source SRS identifier. More... | |
void | setTargetPJ4txt (const std::string &pj4txt) |
Sets the target SRS PROJ4 description. More... | |
void | setTargetSRID (int targetSRID) |
Sets the target SRS identifier. More... | |
~Converter () | |
Destructor. More... | |
Private Attributes | |
void * | m_sourcePj4Handler |
int | m_sourceSRID |
void * | m_targetPj4Handler |
int | m_targetSRID |
A Converter is responsible for the conversion of coordinates between different Coordinate Systems (CS).
A Converter is responsible for the conversion of coordinates between two different Coordinate Systems (CS) or a Spatial Reference System (SRS). A CS can be uniquely identified by a numeric code (SRID). This implementation is based on the PROJ4 cartographic library and only works if it has been enabled.
Definition at line 53 of file Converter.h.
te::srs::Converter::Converter | ( | ) |
Default empty constructor.
te::srs::Converter::Converter | ( | int | sourceSRID, |
int | targetSRID | ||
) |
Constructor with parameters.
sourceSRID | source SRS identifier (input). |
targetSRID | target SRS identifier (input). |
te::srs::Exception | identifier not recognized. |
te::srs::Converter::~Converter | ( | ) |
Destructor.
bool te::srs::Converter::convert | ( | double * | xIn, |
double * | yIn, | ||
double * | xOut, | ||
double * | yOut, | ||
long | numCoord, | ||
int | coordOffset = 1 |
||
) | const |
Converts a vector of coordinates from source SRS to target SRS.
The X and Y dimensions of the coordinates are given in separate vectors. Output vectors must be previously allocaded by the caller of this method and caller is responsible for deallocating them.
xIn | pointer to array of X values in source SRS (input). |
yIn | pointer to array of Y valueS in source SRS (input). |
xOut | pointer to array of X values in target SRS (output). |
yOut | pointer to array of X values in target SRS (output). |
numCoord | number of coordinates in the input arrays (input). |
coordOffset | the step size from value to value (measured in doubles) within the xIn/yIn arrays (input). |
bool te::srs::Converter::convert | ( | double * | x, |
double * | y, | ||
long | numCoord, | ||
int | coordOffset = 1 |
||
) | const |
Converts a vector of coordinates from source SRS to target SRS.
x | pointer to array of X values in source SRS as input and modified to target SRS for output. |
y | pointer to array of Y valueS in source SRS as input and modified to target SRS for output. |
numCoord | number of coordinates in the array (input). |
coordOffset | the step size from value to value (measured in doubles) within the x/y arrays (input). |
bool te::srs::Converter::convert | ( | const double | xIn, |
const double | yIn, | ||
double & | xOut, | ||
double & | yOut | ||
) | const |
Converts a single coordinate from source SRS to target SRS.
xIn | coordinate X value in source SRS (input). |
yIn | coordinate Y value in source SRS (input). |
xOut | coordinate X value in target SRS (output). |
yOut | coordinate Y values in target SRS (output). |
bool te::srs::Converter::convert | ( | double & | x, |
double & | y | ||
) | const |
Converts a coordinate from source SRS to target SRS.
x | X value in source SRS as input and modified to target SRS for output. |
y | Y value in source SRS as input and modified to target SRS for output. |
bool te::srs::Converter::convertToGeographic | ( | double & | x, |
double & | y, | ||
int | SRID | ||
) | const |
Converts a coordinate from a projected SRS to its underlying geographic SRS (same Datum).
x | projected X-coordinate. Will return the geographic longitude coordinate. |
y | projected Y-coordinate. Will return the geographic latitude coordinate. |
SRID | projected SRS identifier that x and y refers to. |
bool te::srs::Converter::convertToProjected | ( | double & | lon, |
double & | lat, | ||
int | SRID | ||
) | const |
Converts a coordinate from a geographic SRS to a projected SRS based on the same Datum.
lon | geographic longitude. Will return the projected x-coordinate. |
lat | geogrpahic latitude. Will return the projected y-coordinate. |
SRID | target projected SRS identifier. |
int te::srs::Converter::getSourceSRID | ( | ) | const |
Gets source SRS identifier.
int te::srs::Converter::getTargetSRID | ( | ) | const |
Gets target SRS identifier.
bool te::srs::Converter::invert | ( | double * | xIn, |
double * | yIn, | ||
double * | xOut, | ||
double * | yOut, | ||
long | numCoord, | ||
int | coordOffset = 1 |
||
) | const |
Inverts a vector of coordinates from target SRS to dource SRS.
The X and Y dimensions of the coordinates are given in separate vectors. Output vectors must be previously allocaded by the caller of this method, and caller is responsible for deallocating them.
xIn | pointer to array of X values in target SRS (input). |
yIn | pointer to array of Y valueS in target SRS (input). |
xOut | pointer to array of X values in source SRS (output). |
yOut | pointer to array of Y values in source SRS (output). |
numCoord | number of coordinates in the array (input). |
coordOffset | the step size from value to value (in double size) within the x/y arrays (input). |
bool te::srs::Converter::invert | ( | double * | x, |
double * | y, | ||
long | numCoord, | ||
int | coordOffset = 1 |
||
) | const |
Inverts a vector of coordinates from target SRS to source SRS.
x | pointer to array of X values in target SRS as input and modified to source SRS for output. |
y | pointer to array of Y values in target SRS as input and modified to source SRS for output. |
numCoord | number of coordinates in the array (input). |
coordOffset | the step size from value to value in double size) within the x/y arrays (input). |
bool te::srs::Converter::invert | ( | const double | xIn, |
const double | yIn, | ||
double & | xOut, | ||
double & | yOut | ||
) | const |
Inverts a coordinate from source SRS to target SRS.
xIn | pointer to array of X values in target SRS (input). |
yIn | pointer to array of Y valueS in target SRS (input). |
xOut | pointer to array of X values in source SRS (output). |
yOut | pointer to array of Y values in source SRS (output). |
bool te::srs::Converter::invert | ( | double & | x, |
double & | y | ||
) | const |
Inverts a coordinate from target SRS to source SRS.
x | pointer to array of X values in target SRS as inputand modified to source SRS for output. |
y | pointer to array of Y values in target SRS as inputand modified to source SRS for output. |
void te::srs::Converter::setSourcePJ4txt | ( | const std::string & | pj4txt | ) |
Sets the source SRS PROJ4 description.
pj4txt | PROJ4 description (input). Do not pass an empty string. |
te::srs::Exception | PROJ4 description is not valid. |
void te::srs::Converter::setSourceSRID | ( | int | sourceSRID | ) |
Sets the source SRS identifier.
sourceSRID | the source SRS identifier (input). |
te::srs::Exception | identifier not recognized. |
void te::srs::Converter::setTargetPJ4txt | ( | const std::string & | pj4txt | ) |
Sets the target SRS PROJ4 description.
pj4txt | PROJ4 description (input). Do not pass an empty string. |
te::srs::Exception | PROJ4 description is not valid. |
void te::srs::Converter::setTargetSRID | ( | int | targetSRID | ) |
Sets the target SRS identifier.
targetSRID | the target SRS identifier (input). |
te::srs::Exception | identifier not recognized. |
|
private |
Definition at line 217 of file Converter.h.
|
private |
Definition at line 215 of file Converter.h.
|
private |
Definition at line 218 of file Converter.h.
|
private |
Definition at line 214 of file Converter.h.