26 #ifndef __TERRALIB_SRS_INTERNAL_SPATIALREFERENCESYSTEMMANAGER_H 
   27 #define __TERRALIB_SRS_INTERNAL_SPATIALREFERENCESYSTEMMANAGER_H 
   30 #include "../common/Singleton.h" 
   31 #include "../common/UnitOfMeasure.h" 
   42 #include <boost/lexical_cast.hpp> 
   43 #include <boost/multi_index_container.hpp> 
   44 #include <boost/multi_index/member.hpp> 
   45 #include <boost/multi_index/mem_fun.hpp> 
   46 #include <boost/multi_index/ordered_index.hpp> 
   78         srs_desc(
const std::string& name, 
unsigned int auth_id, 
const std::string& auth_name, 
const std::string& p4txt, 
const std::string& wkt);
 
   96       typedef boost::multi_index_container<
 
   98       boost::multi_index::indexed_by<
 
   99       boost::multi_index::ordered_unique<BOOST_MULTI_INDEX_CONST_MEM_FUN(
srs_desc,std::string,srid)>,
 
  100       boost::multi_index::ordered_non_unique<BOOST_MULTI_INDEX_MEMBER(
srs_desc,std::string,m_name)>,
 
  101       boost::multi_index::ordered_non_unique<BOOST_MULTI_INDEX_MEMBER(
srs_desc,std::string,m_p4txt)>,
 
  102       boost::multi_index::ordered_non_unique<BOOST_MULTI_INDEX_MEMBER(
srs_desc,std::string,m_wkt)>,
 
  103       boost::multi_index::ordered_non_unique<BOOST_MULTI_INDEX_MEMBER(
srs_desc,std::string,m_auth_name)>
 
  115       typedef boost::multi_index::nth_index<srs_set,0>::type::iterator 
iterator;
 
  134       void init(
const std::string& fileName);
 
  145       void add(
const std::string& name, 
const std::string& p4Txt, 
const std::string& wkt, 
unsigned int id, 
const std::string& authName=
"EPSG");
 
  153       bool recognizes(
unsigned int id, 
const std::string& authName=
"EPSG") 
const;
 
  161       std::string 
getName (
unsigned int id, 
const std::string& authName=
"EPSG") 
const;
 
  169       std::string 
getP4Txt(
unsigned int id, 
const std::string& authName=
"EPSG") 
const;
 
  177       std::string 
getWkt  (
unsigned int id, 
const std::string& authName=
"EPSG") 
const;
 
  185       std::pair<std::string,unsigned int> 
getIdFromName (
const std::string& name) 
const;
 
  193       std::pair<std::string,unsigned int> 
getIdFromP4Txt(
const std::string& p4Txt) 
const;
 
  201       std::pair<std::string,unsigned int> 
getIdFromWkt  (
const std::string& wkt) 
const;
 
  216       void remove (
unsigned int id, 
const std::string& authName=
"EPSG");
 
  231       std::pair<te::srs::SpatialReferenceSystemManager::iterator,te::srs::SpatialReferenceSystemManager::iterator> 
getIterators() 
const;
 
  243       bool isGeographic(
unsigned int id, 
const std::string& authName=
"EPSG");
 
This file contains the structs necessary to represent a Spatial Reference System.
 
Template support for singleton pattern.
 
A class to manage Coordinate Systems representations within TerraLib environment.
 
std::pair< std::string, unsigned int > getIdFromP4Txt(const std::string &p4Txt) const
Returns a coordinate system identification given a PROJ4 description.
 
void clear()
Removes all coordinate system representations from the manager.
 
~SpatialReferenceSystemManager()
Destructor.
 
std::pair< std::string, unsigned int > getIdFromWkt(const std::string &wkt) const
Returns a coordinate system identification given a WKT description.
 
static std::string getProjLibDir()
 
std::string getName(unsigned int id, const std::string &authName="EPSG") const
Returns a coordinate system name given an identification.
 
bool isValidWktID(const std::string &wkt)
 
int getNewUserDefinedSRID()
Returns a SRID, not yet used, to identify an SRS created by an user.
 
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.
 
te::common::UnitOfMeasurePtr getUnit(unsigned int id, const std::string &authName="EPSG")
Returns the unit of measure for a SRS with a given id.
 
boost::multi_index::nth_index< srs_set, 0 >::type::iterator iterator
An iterator by SRS <id,authority>
 
std::pair< std::string, unsigned int > getIdFromP4TxtImpl(const std::string &p4Txt) const
Returns a coordinate system identification given a PROJ4 description. This function does not throw ex...
 
SpatialReferenceSystemManager & operator=(const SpatialReferenceSystemManager &rhs)
Assignment operator not allowed.
 
bool isInitialized()
Checks if the System Manager is already initialized.
 
std::pair< std::string, unsigned int > getIdFromWktImpl(const std::string &wkt) const
Returns a coordinate system identification given a WKT description. This function does not throw exce...
 
bool isValidNameID(const std::string &name)
 
void init()
Inializes the manager from a JSON file containing instances of SRSs.
 
SpatialReferenceSystemManager(const SpatialReferenceSystemManager &rhs)
Copy constructor not allowed.
 
bool recognizes(unsigned int id, const std::string &authName="EPSG") const
Returns true is a pair <id, authority> is recognized by the manager.
 
void init(const std::string &fileName)
Inializes the manager from a JSON file containing instances of SRSs.
 
std::string getP4Txt(unsigned int id, const std::string &authName="EPSG") const
Returns a coordinate system PROJ4 description given an identification.
 
SpatialReferenceSystemPtr getSpatialReferenceSystem(unsigned int id, const std::string &authName="EPSG") const
Returns a pointer to a coordinate system given an identification.
 
std::pair< std::string, unsigned int > getIdFromName(const std::string &name) const
Returns a coordinate system identification given a name.
 
void remove(unsigned int id, const std::string &authName="EPSG")
Removes a coordinate system representation from the manager, given its identification.
 
std::map< int, te::common::UnitOfMeasurePtr > m_cacheUnitOfMeasure
 
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
 
std::pair< te::srs::SpatialReferenceSystemManager::iterator, te::srs::SpatialReferenceSystemManager::iterator > getIterators() const
Returns an iterator mechanism over the coordinate system descriptions in the manager.
 
std::string getWkt(unsigned int id, const std::string &authName="EPSG") const
Returns a coordinate system WKT description given an id.
 
size_t size() const
Returns the number of objects in the manager.
 
SpatialReferenceSystemManager()
Constructor.
 
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.
 
bool isValidP4TxtID(const std::string &p4Txt)
 
boost::shared_ptr< UnitOfMeasure > UnitOfMeasurePtr
 
std::unique_ptr< SpatialReferenceSystem > SpatialReferenceSystemPtr
 
srs_desc(const std::string &name, unsigned int auth_id, const std::string &auth_name, const std::string &p4txt, const std::string &wkt)
 
#define TESRSEXPORT
You can use this macro in order to export/import classes and functions from this module.
 
Proxy configuration file for TerraView (see terraview_config.h).