27 #include "../common/Exception.h"
28 #include "../common/STLUtils.h"
29 #include "../common/Translator.h"
52 std::map<std::string, ColorSchemeCatalog*>::iterator itProjectIdxByName = m_catalogIdxByName.find(c->
getName());
54 if(itProjectIdxByName != m_catalogIdxByName.end())
59 for(; i < m_catalogs.size(); ++i)
61 if(m_catalogs[i]->getName() == c->
getName())
65 if(i == m_catalogs.size())
69 m_catalogs.erase(m_catalogs.begin() + i);
70 m_catalogIdxByName.erase(itProjectIdxByName);
83 std::map<std::string, ColorSchemeCatalog*>::const_iterator it = m_catalogIdxByName.find(name);
85 if(it != m_catalogIdxByName.end())
91 std::pair<std::vector<te::color::ColorSchemeCatalog*>::const_iterator,
94 return std::pair<std::vector<te::color::ColorSchemeCatalog*>::const_iterator,
95 std::vector<te::color::ColorSchemeCatalog*>::const_iterator>(m_catalogs.begin(), m_catalogs.end());
105 return m_catalogs.empty();
114 m_catalogIdxByName.clear();
void clear()
It unloads all catalogs managed by ColorSchemeCatalogManager.
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
std::vector< ColorSchemeCatalog * > m_catalogs
This is the list of all system's loaded catalogs.
ColorSchemeCatalogManager()
It initializes the Singleton.
std::pair< std::vector< ColorSchemeCatalog * >::const_iterator, std::vector< ColorSchemeCatalog * >::const_iterator > getIterator() const
It returns a pair of iterators over the catalogs of this manager.
void FreeContents(boost::unordered_map< K, V * > &m)
This function can be applied to a map of pointers. It will delete each pointer in the map...
#define TR_COLOR(message)
It marks a string in order to get translated. This is a special mark used in the Color module of Terr...
ColorSchemeCatalog * findByName(const std::string &name) const
It returns the catalog identified by a given name or NULL if none is found.
std::map< std::string, ColorSchemeCatalog * > m_catalogIdxByName
An index from catalog's name to catalog's instance (note: we can not have duplicated names)...
void disconnect(ColorSchemeCatalog *c)
It removes the internal reference to the catalog.
A catalog for color schemes groups.
~ColorSchemeCatalogManager()
Destructor.
const std::string & getName() const
It returns the catalog name.
const std::vector< ColorSchemeCatalog * > & getCatalogs() const
It returns the list of catalogs available in the system.
void insert(ColorSchemeCatalog *c)
It inserts a new catalog that will be managed by ColorSchemeCatalogManager.
bool isEmpty() const
It returns true if the manager contains at least one catalog. If no catalog exists, it returns false.
A catalog for color schemes.
The ColorSchemeCatalogManager is a singleton that can be used to manage all loaded color scheme catal...
void erase(ColorSchemeCatalog *c)
It removes the catalog from the manager and clears it resources.