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) |
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="") const |
Returns a coordinate system name given an identification. More... | |
int | 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="") const |
Returns a coordinate system PROJ4 description given an identification. More... | |
SpatialReferenceSystemPtr | getSpatialReferenceSystem (unsigned int id, const std::string &authName="") const |
Returns a pointer to a coordinate system given an identification. More... | |
te::common::UnitOfMeasurePtr | getUnit (unsigned int id, const std::string &authName="") |
Returns the unit of measure for a SRS with a given id. More... | |
std::string | getWkt (unsigned int id, const std::string &authName="") 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="") |
Checks if a SRS with a given id refers to a geographic spatial reference system. More... | |
bool | isInitialized () |
Returns true if the System Manager is already initialized. More... | |
bool | isValidNameID (const std::string &name) |
Returns true if there is a SRS with the given name. More... | |
bool | isValidP4TxtID (const std::string &p4Txt) |
Returns true if there is a SRS with the given proj string. More... | |
bool | isValidWktID (const std::string &wkt) |
Returns true if there is a SRS with the given WKT. More... | |
bool | recognizes (unsigned int id, const std::string &authName="") const |
Returns true is a pair <id, authority> is recognized by the manager. More... | |
void | remove (unsigned int id, const std::string &authName) |
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... | |
static std::string | getProjLibDir () |
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)>, boost::multi_index::ordered_non_unique< BOOST_MULTI_INDEX_MEMBER(srs_desc, unsigned int, m_auth_id)> > > | srs_set |
Private Member Functions | |
std::pair< std::string, unsigned int > | getIdFromP4TxtImpl (const std::string &p4Txt) const |
Returns a coordinate system identification given a PROJ4 description or a pair with an empty string if not found. More... | |
std::pair< std::string, unsigned int > | getIdFromWktImpl (const std::string &wkt) const |
Returns a coordinate system identification given a WKT description or a pair with an empty string if not found. More... | |
SpatialReferenceSystemManager & | operator= (const SpatialReferenceSystemManager &rhs) |
Assignment operator not allowed. More... | |
SpatialReferenceSystemManager (const SpatialReferenceSystemManager &rhs) | |
Copy constructor not allowed. More... | |
Private Attributes | |
std::map< int, te::common::UnitOfMeasurePtr > | m_cacheUnitOfMeasure |
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 117 of file SpatialReferenceSystemManager.h.
|
private |
A mult-index container with the following indexes: 0) an unique index by <auth_name, id>; 1) a non-unique index by name; 2) a non-unique index by p4txt; 3) a non-unique index by wkt; 4) a non-unique index by auth_name; 5) a non-unique index by m_auth_id;
Definition at line 107 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 | ||
) |
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. |
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. |
|
private |
Returns a coordinate system identification given a PROJ4 description or a pair with an empty string if not found.
p4Txt | The coordinate system PROJ4 description. |
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. |
|
private |
Returns a coordinate system identification given a WKT description or a pair with an empty string if not found.
wkt | The coordinate system WKT. |
|
inlinestaticinherited |
It returns a reference to the singleton instance.
Definition at line 109 of file Singleton.h.
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 = "" |
||
) | const |
Returns a coordinate system name given an identification.
id | The coordinate system identification. |
authName | The authority responsible for the id or an empty string to match any authority. |
int 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 = "" |
||
) | const |
Returns a coordinate system PROJ4 description given an identification.
id | The coordinate system identification. |
authName | The authority responsible for the id or an empty string to match any authority. |
|
static |
SpatialReferenceSystemPtr te::srs::SpatialReferenceSystemManager::getSpatialReferenceSystem | ( | unsigned int | id, |
const std::string & | authName = "" |
||
) | const |
Returns a pointer to a coordinate system given an identification.
id | The coordinate system identification. |
authName | The authority responsible for the id or an empty string to match any authority. |
te::common::UnitOfMeasurePtr te::srs::SpatialReferenceSystemManager::getUnit | ( | unsigned int | id, |
const std::string & | authName = "" |
||
) |
Returns the unit of measure for a SRS with a given id.
id | The coordinate system identification. |
authName | The authority responsible for the id or an empty string to match any authority. |
std::string te::srs::SpatialReferenceSystemManager::getWkt | ( | unsigned int | id, |
const std::string & | authName = "" |
||
) | const |
Returns a coordinate system WKT description given an id.
id | The coordinate system identification. |
authName | The authority responsible for the id or an empty string to match any authority. |
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 = "" |
||
) |
Checks if a SRS with a given id refers to a geographic spatial reference system.
id | The coordinate system identification. |
authName | The authority responsible for the id or an empty string to match any authority. |
bool te::srs::SpatialReferenceSystemManager::isInitialized | ( | ) |
Returns true if the System Manager is already initialized.
bool te::srs::SpatialReferenceSystemManager::isValidNameID | ( | const std::string & | name | ) |
Returns true if there is a SRS with the given name.
bool te::srs::SpatialReferenceSystemManager::isValidP4TxtID | ( | const std::string & | p4Txt | ) |
Returns true if there is a SRS with the given proj string.
bool te::srs::SpatialReferenceSystemManager::isValidWktID | ( | const std::string & | wkt | ) |
Returns true if there is a SRS with the given WKT.
|
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 = "" |
||
) | 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 or an empty string to match any authority. |
void te::srs::SpatialReferenceSystemManager::remove | ( | unsigned int | id, |
const std::string & | authName | ||
) |
Removes a coordinate system representation from the manager, given its identification.
id | The coordinate system identification. |
authName | The authority responsible for the id. |
size_t te::srs::SpatialReferenceSystemManager::size | ( | ) | const |
Returns the number of objects in the manager.
|
friend |
Definition at line 68 of file SpatialReferenceSystemManager.h.
|
private |
Definition at line 112 of file SpatialReferenceSystemManager.h.
|
private |
Definition at line 111 of file SpatialReferenceSystemManager.h.