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);
97 typedef boost::multi_index_container<
99 boost::multi_index::indexed_by<
100 boost::multi_index::ordered_unique<BOOST_MULTI_INDEX_CONST_MEM_FUN(
srs_desc,std::string,srid)>,
101 boost::multi_index::ordered_non_unique<BOOST_MULTI_INDEX_MEMBER(
srs_desc,std::string,m_name)>,
102 boost::multi_index::ordered_non_unique<BOOST_MULTI_INDEX_MEMBER(
srs_desc,std::string,m_p4txt)>,
103 boost::multi_index::ordered_non_unique<BOOST_MULTI_INDEX_MEMBER(
srs_desc,std::string,m_wkt)>,
104 boost::multi_index::ordered_non_unique<BOOST_MULTI_INDEX_MEMBER(
srs_desc,std::string,m_auth_name)>,
105 boost::multi_index::ordered_non_unique<BOOST_MULTI_INDEX_MEMBER(
srs_desc,
unsigned int,m_auth_id)>
117 typedef boost::multi_index::nth_index<srs_set,0>::type::iterator
iterator;
136 void init(
const std::string& fileName);
147 void add(
const std::string& name,
const std::string& p4Txt,
const std::string& wkt,
unsigned int id,
const std::string& authName );
155 bool recognizes(
unsigned int id,
const std::string& authName =
"" )
const;
163 std::string
getName (
unsigned int id,
const std::string& authName =
"" )
const;
171 std::string
getP4Txt(
unsigned int id,
const std::string& authName =
"" )
const;
179 std::string
getWkt (
unsigned int id,
const std::string& authName =
"" )
const;
187 std::pair<std::string,unsigned int>
getIdFromName (
const std::string& name)
const;
195 std::pair<std::string,unsigned int>
getIdFromP4Txt(
const std::string& p4Txt)
const;
203 std::pair<std::string,unsigned int>
getIdFromWkt (
const std::string& wkt)
const;
212 const std::string& authName =
"" )
const;
219 void remove (
unsigned int id,
const std::string& authName );
234 std::pair<te::srs::SpatialReferenceSystemManager::iterator,te::srs::SpatialReferenceSystemManager::iterator>
getIterators()
const;
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.
SpatialReferenceSystemManager & operator=(const SpatialReferenceSystemManager &rhs)
Assignment operator not allowed.
void clear()
Removes all coordinate system representations from the manager.
~SpatialReferenceSystemManager()
Destructor.
void remove(unsigned int id, const std::string &authName)
Removes a coordinate system representation from the manager, given its identification.
static std::string getProjLibDir()
bool isValidWktID(const std::string &wkt)
Returns true if there is a SRS with the given WKT.
std::pair< std::string, unsigned int > getIdFromName(const std::string &name) const
Returns a coordinate system identification given a name.
int getNewUserDefinedSRID()
Returns a SRID, not yet used, to identify an SRS created by an user.
std::string getP4Txt(unsigned int id, const std::string &authName="") const
Returns a coordinate system PROJ4 description given an identification.
boost::multi_index::nth_index< srs_set, 0 >::type::iterator iterator
An iterator by SRS <id,authority>
bool isInitialized()
Returns true if the System Manager is already initialized.
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::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 i...
bool isGeographic(unsigned int id, const std::string &authName="")
Checks if a SRS with a given id refers to a geographic spatial reference system.
bool isValidNameID(const std::string &name)
Returns true if there is a SRS with the given name.
void init()
Inializes the manager from a JSON file containing instances of SRSs.
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 ...
SpatialReferenceSystemManager(const SpatialReferenceSystemManager &rhs)
Copy constructor not allowed.
std::string getName(unsigned int id, const std::string &authName="") const
Returns a coordinate system name given an identification.
void init(const std::string &fileName)
Inializes the manager from a JSON file containing instances of SRSs.
std::pair< std::string, unsigned int > getIdFromP4Txt(const std::string &p4Txt) const
Returns a coordinate system identification given a PROJ4 description.
std::string getWkt(unsigned int id, const std::string &authName="") const
Returns a coordinate system WKT description given an id.
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
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.
SpatialReferenceSystemPtr getSpatialReferenceSystem(unsigned int id, const std::string &authName="") const
Returns a pointer to a coordinate system given an identification.
std::pair< std::string, unsigned int > getIdFromWkt(const std::string &wkt) const
Returns a coordinate system identification given a WKT description.
bool recognizes(unsigned int id, const std::string &authName="") const
Returns true is a pair <id, authority> is recognized by the manager.
std::map< int, te::common::UnitOfMeasurePtr > m_cacheUnitOfMeasure
te::common::UnitOfMeasurePtr getUnit(unsigned int id, const std::string &authName="")
Returns the unit of measure for a SRS with a given id.
size_t size() const
Returns the number of objects in the manager.
SpatialReferenceSystemManager()
Constructor.
bool isValidP4TxtID(const std::string &p4Txt)
Returns true if there is a SRS with the given proj string.
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).