A class to manage Coordinate Systems representations within TerraLib environment. More...
#include <SpatialReferenceSystemManager.h>
Classes | |
struct | srs_desc |
Public Types | |
typedef boost::multi_index::nth_index< srs_set, 0 >::type::iterator | iterator |
An iterator by SRS <id,authority> More... | |
Public Member Functions | |
void | add (const std::string &name, const std::string &p4Txt, const std::string &wkt, unsigned int id, const std::string &authName="EPSG") |
Adds a <id, authority> to the manager. More... | |
void | clear () |
Removes all coordinate system representations from the manager. More... | |
std::pair< std::string, unsigned int > | getIdFromName (const std::string &name) const |
Returns a coordinate system identification given a name. More... | |
std::pair< std::string, unsigned int > | getIdFromP4Txt (const std::string &p4Txt) const |
Returns a coordinate system identification given a PROJ4 description. More... | |
std::pair< std::string, unsigned int > | getIdFromWkt (const std::string &wkt) const |
Returns a coordinate system identification given a WKT description. More... | |
std::pair< te::srs::SpatialReferenceSystemManager::iterator, te::srs::SpatialReferenceSystemManager::iterator > | getIterators () const |
Returns an iterator mechanism over the coordinate system descriptions in the manager. More... | |
std::string | getName (unsigned int id, const std::string &authName="EPSG") const |
Returns a coordinate system name given an identification. More... | |
std::string | getNewUserDefinedSRID () |
Returns a SRID, not yet used, to identify an SRS created by an user. More... | |
std::string | getP4Txt (unsigned int id, const std::string &authName="EPSG") const |
Returns a coordinate system PROJ4 description given an identification. More... | |
SpatialReferenceSystemPtr | getSpatialReferenceSystem (unsigned int id, const std::string &authName="EPSG") const |
Returns a pointer to a coordinate system given an identification. More... | |
te::common::UnitOfMeasurePtr | getUnit (unsigned int id, const std::string &authName="EPSG") |
Returns the unit of measure for a SRS with a given id. More... | |
std::string | getWkt (unsigned int id, const std::string &authName="EPSG") const |
Returns a coordinate system WKT description given an id. More... | |
void | init () |
Inializes the manager from a JSON file containing instances of SRSs. More... | |
void | init (const std::string &fileName) |
Inializes the manager from a JSON file containing instances of SRSs. More... | |
bool | isGeographic (unsigned int id, const std::string &authName="EPSG") |
Checks if a SRS with a given id refers to a geographic spatial reference system. More... | |
bool | isInitialized () |
Checks if the System Manager is already initialized. More... | |
bool | recognizes (unsigned int id, const std::string &authName="EPSG") const |
Returns true is a pair <id, authority> is recognized by the manager. More... | |
void | remove (unsigned int id, const std::string &authName="EPSG") |
Removes a coordinate system representation from the manager, given its identification. More... | |
size_t | size () const |
Returns the number of objects in the manager. More... | |
~SpatialReferenceSystemManager () | |
Destructor. More... | |
Static Public Member Functions | |
static SpatialReferenceSystemManager & | getInstance () |
It returns a reference to the singleton instance. More... | |
Protected Member Functions | |
SpatialReferenceSystemManager () | |
Constructor. More... | |
Private Types | |
typedef boost::multi_index_container< srs_desc, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< BOOST_MULTI_INDEX_CONST_MEM_FUN(srs_desc, std::string, srid)>, boost::multi_index::ordered_non_unique< BOOST_MULTI_INDEX_MEMBER(srs_desc, std::string, m_name)>, boost::multi_index::ordered_non_unique< BOOST_MULTI_INDEX_MEMBER(srs_desc, std::string, m_p4txt)>, boost::multi_index::ordered_non_unique< BOOST_MULTI_INDEX_MEMBER(srs_desc, std::string, m_wkt)>, boost::multi_index::ordered_non_unique< BOOST_MULTI_INDEX_MEMBER(srs_desc, std::string, m_auth_name)> > > | srs_set |
Private Member Functions | |
SpatialReferenceSystemManager & | operator= (const SpatialReferenceSystemManager &rhs) |
Assignment operator not allowed. More... | |
SpatialReferenceSystemManager (const SpatialReferenceSystemManager &rhs) | |
Copy constructor not allowed. More... | |
Private Attributes | |
srs_set | m_set |
Friends | |
class | te::common::Singleton< SpatialReferenceSystemManager > |
A class to manage Coordinate Systems representations within TerraLib environment.
A Coordinate System used to describe coordinates are also known as Spatial Reference System. It can be represented by either one of these properties:
A PROJ4 text: to support coordinate conversion.
Refer to the Spatial Reference website for more information about EPSG codes for SRS.
Definition at line 68 of file SpatialReferenceSystemManager.h.
typedef boost::multi_index::nth_index<srs_set,0>::type::iterator te::srs::SpatialReferenceSystemManager::iterator |
An iterator by SRS <id,authority>
Definition at line 114 of file SpatialReferenceSystemManager.h.
|
private |
A mult-index container with the following indexes: 1) an unique index by <auth_name, id>; 2) a non-unique index by name; 3) a non-unique index by p4txt; 4) a non-unique index by wkt; 5) a non-unique index by auth_name;
Definition at line 105 of file SpatialReferenceSystemManager.h.
te::srs::SpatialReferenceSystemManager::~SpatialReferenceSystemManager | ( | ) |
Destructor.
|
protected |
Constructor.
|
private |
Copy constructor not allowed.
rhs | The right-hand-side copy that would be used to copy from. |
void te::srs::SpatialReferenceSystemManager::add | ( | const std::string & | name, |
const std::string & | p4Txt, | ||
const std::string & | wkt, | ||
unsigned int | id, | ||
const std::string & | authName = "EPSG" |
||
) |
Adds a <id, authority> to the manager.
name | A simple, human-readable, interface-friendly, name; |
p4Txt | a PROJ4 library description of coordinate system; |
wkt | An OGC's WKT description for the coordinate system; |
id | SRS id. |
authName | The authority responsible for the id. Default "EPSG". |
te::srs::Exception | if the coordinate system id is already registered in the manager. |
void te::srs::SpatialReferenceSystemManager::clear | ( | ) |
Removes all coordinate system representations from the manager.
std::pair<std::string,unsigned int> te::srs::SpatialReferenceSystemManager::getIdFromName | ( | const std::string & | name | ) | const |
Returns a coordinate system identification given a name.
name | The coordinate system name. |
te::srs::Exception | if the coordinate system name is not found in the manager. |
std::pair<std::string,unsigned int> te::srs::SpatialReferenceSystemManager::getIdFromP4Txt | ( | const std::string & | p4Txt | ) | const |
Returns a coordinate system identification given a PROJ4 description.
p4Txt | The coordinate system PROJ4 description. |
te::srs::Exception | if the coordinate system PROJ4 description is not found in the manager. |
std::pair<std::string,unsigned int> te::srs::SpatialReferenceSystemManager::getIdFromWkt | ( | const std::string & | wkt | ) | const |
Returns a coordinate system identification given a WKT description.
wkt | The coordinate system WKT. |
te::srs::Exception | if the coordinate system WKT is not found in the manager. |
|
staticinherited |
It returns a reference to the singleton instance.
std::pair<te::srs::SpatialReferenceSystemManager::iterator,te::srs::SpatialReferenceSystemManager::iterator> te::srs::SpatialReferenceSystemManager::getIterators | ( | ) | const |
Returns an iterator mechanism over the coordinate system descriptions in the manager.
The first iterator of the returned pair points to first coordinate system description. The second iterator of the returned pair points to the last plus one ccoordinate system description.
std::string te::srs::SpatialReferenceSystemManager::getName | ( | unsigned int | id, |
const std::string & | authName = "EPSG" |
||
) | const |
Returns a coordinate system name given an identification.
id | The coordinate system identification. |
authName | The authority responsible for the id. Default "EPSG". |
std::string te::srs::SpatialReferenceSystemManager::getNewUserDefinedSRID | ( | ) |
Returns a SRID, not yet used, to identify an SRS created by an user.
std::string te::srs::SpatialReferenceSystemManager::getP4Txt | ( | unsigned int | id, |
const std::string & | authName = "EPSG" |
||
) | const |
Returns a coordinate system PROJ4 description given an identification.
id | The coordinate system identification. |
authName | The authority responsible for the id. Default "EPSG". |
SpatialReferenceSystemPtr te::srs::SpatialReferenceSystemManager::getSpatialReferenceSystem | ( | unsigned int | id, |
const std::string & | authName = "EPSG" |
||
) | const |
Returns a pointer to a coordinate system given an identification.
id | The coordinate system identification. |
authName | The authority responsible for the id. Default "EPSG". |
te::common::UnitOfMeasurePtr te::srs::SpatialReferenceSystemManager::getUnit | ( | unsigned int | id, |
const std::string & | authName = "EPSG" |
||
) |
Returns the unit of measure for a SRS with a given id.
std::string te::srs::SpatialReferenceSystemManager::getWkt | ( | unsigned int | id, |
const std::string & | authName = "EPSG" |
||
) | const |
Returns a coordinate system WKT description given an id.
id | The coordinate system identification. |
authName | The authority responsible for the id. Default "EPSG". |
void te::srs::SpatialReferenceSystemManager::init | ( | ) |
Inializes the manager from a JSON file containing instances of SRSs.
This methods reads the file "TE_JSON_FILES_LOCATION/srs.json" for SRSs definitions and insert them on the manager if it is empty.
te::srs::Exception | if the JSON file is not well formed. |
void te::srs::SpatialReferenceSystemManager::init | ( | const std::string & | fileName | ) |
Inializes the manager from a JSON file containing instances of SRSs.
fileName | Name of the JSON file. |
te::srs::Exception | if the JSON file is not well formed. |
bool te::srs::SpatialReferenceSystemManager::isGeographic | ( | unsigned int | id, |
const std::string & | authName = "EPSG" |
||
) |
Checks if a SRS with a given id refers to a geographic spatial reference system.
bool te::srs::SpatialReferenceSystemManager::isInitialized | ( | ) |
Checks if the System Manager is already initialized.
|
private |
Assignment operator not allowed.
rhs | The right-hand-side copy that would be used to copy from. |
bool te::srs::SpatialReferenceSystemManager::recognizes | ( | unsigned int | id, |
const std::string & | authName = "EPSG" |
||
) | const |
Returns true is a pair <id, authority> is recognized by the manager.
id | The coordinate system identification. |
authName | The authority responsible for the id. Default "EPSG". |
void te::srs::SpatialReferenceSystemManager::remove | ( | unsigned int | id, |
const std::string & | authName = "EPSG" |
||
) |
Removes a coordinate system representation from the manager, given its identification.
id | The coordinate system identification. |
authName | The authority responsible for the id. Default "EPSG". |
size_t te::srs::SpatialReferenceSystemManager::size | ( | ) | const |
Returns the number of objects in the manager.
|
friend |
Definition at line 70 of file SpatialReferenceSystemManager.h.
|
private |
Definition at line 109 of file SpatialReferenceSystemManager.h.