The ColorSchemeCatalogManager is a singleton that can be used to manage all loaded color scheme catalogs. More...
#include <ColorSchemeCatalogManager.h>
Public Member Functions | |
ColorSchemeCatalogManager Accessor Method | |
Method used to access the data stored on this manager. | |
void | init () |
Inializes the manager from a JSON file containing instances of color schemes. More... | |
void | insert (ColorSchemeCatalog *c) |
It inserts a new catalog that will be managed by ColorSchemeCatalogManager. More... | |
void | disconnect (ColorSchemeCatalog *c) |
It removes the internal reference to the catalog. More... | |
void | erase (ColorSchemeCatalog *c) |
It removes the catalog from the manager and clears it resources. More... | |
ColorSchemeCatalog * | findByName (const std::string &name) const |
It returns the catalog identified by a given name or NULL if none is found. More... | |
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. More... | |
const std::vector< ColorSchemeCatalog * > & | getCatalogs () const |
It returns the list of catalogs available in the system. More... | |
bool | isEmpty () const |
It returns true if the manager contains at least one catalog. If no catalog exists, it returns false. More... | |
void | clear () |
It unloads all catalogs managed by ColorSchemeCatalogManager. More... | |
Static Public Member Functions | |
static T & | getInstance () |
It returns a reference to the singleton instance. More... | |
Private Member Functions | |
Copy Constructor and Assignment Operator | |
Copy constructor and assignment operator not allowed. | |
ColorSchemeCatalogManager (const ColorSchemeCatalogManager &rhs) | |
Copy constructor not allowed. More... | |
ColorSchemeCatalogManager & | operator= (const ColorSchemeCatalogManager &rhs) |
Assignment operator not allowed. More... | |
Private Attributes | |
std::map< std::string, ColorSchemeCatalog * > | m_catalogIdxByName |
An index from catalog's name to catalog's instance (note: we can not have duplicated names). More... | |
std::vector< ColorSchemeCatalog * > | m_catalogs |
This is the list of all system's loaded catalogs. More... | |
Friends | |
class | te::common::Singleton< ColorSchemeCatalogManager > |
Initializer Methods | |
~ColorSchemeCatalogManager () | |
Destructor. More... | |
ColorSchemeCatalogManager () | |
It initializes the Singleton. More... | |
The ColorSchemeCatalogManager is a singleton that can be used to manage all loaded color scheme catalogs.
Use this class to keep the loaded catalogs and to be a point of entry for plugins that need to known what are the opened catalogs of your application. When the singleton finishes its life time it automatically clears all loaded catalogs stored on it. You can also use it only inside a given window, where a list of catalogs will be displayed and then when the window gets closed, you clear the catalogs to save memory.
Definition at line 75 of file ColorSchemeCatalogManager.h.
te::color::ColorSchemeCatalogManager::~ColorSchemeCatalogManager | ( | ) |
Destructor.
|
protected |
It initializes the Singleton.
|
private |
Copy constructor not allowed.
rhs | The right-hand-side copy that would be used to copy from. |
void te::color::ColorSchemeCatalogManager::clear | ( | ) |
It unloads all catalogs managed by ColorSchemeCatalogManager.
void te::color::ColorSchemeCatalogManager::disconnect | ( | ColorSchemeCatalog * | c | ) |
It removes the internal reference to the catalog.
c | The catalog to be removed. |
Exception | If the catalog doesn't exist it will raise an exception. |
void te::color::ColorSchemeCatalogManager::erase | ( | ColorSchemeCatalog * | c | ) |
It removes the catalog from the manager and clears it resources.
c | The catalog to be removed. |
Exception | If the catalog doesn't exist it will raise an exception. |
ColorSchemeCatalog* te::color::ColorSchemeCatalogManager::findByName | ( | const std::string & | name | ) | const |
It returns the catalog identified by a given name or NULL if none is found.
name | The name of the catalog we are looking for. |
const std::vector<ColorSchemeCatalog*>& te::color::ColorSchemeCatalogManager::getCatalogs | ( | ) | const |
It returns the list of catalogs available in the system.
|
inlinestaticinherited |
It returns a reference to the singleton instance.
Definition at line 120 of file Singleton.h.
std::pair<std::vector<ColorSchemeCatalog*>::const_iterator, std::vector<ColorSchemeCatalog*>::const_iterator> te::color::ColorSchemeCatalogManager::getIterator | ( | ) | const |
It returns a pair of iterators over the catalogs of this manager.
void te::color::ColorSchemeCatalogManager::init | ( | ) |
Inializes the manager from a JSON file containing instances of color schemes.
This methods reads the file "TE_JSON_FILES_LOCATION/color_ramps.json" for color schemes definitions and insert them on the manager if it is empty.
te::srs::Exception | if the JSON file is not well formed. |
void te::color::ColorSchemeCatalogManager::insert | ( | ColorSchemeCatalog * | c | ) |
It inserts a new catalog that will be managed by ColorSchemeCatalogManager.
c | The new catalog to be managed by this manager. |
Exception | If the catalog already exists it will raise an exception. |
bool te::color::ColorSchemeCatalogManager::isEmpty | ( | ) | const |
It returns true if the manager contains at least one catalog. If no catalog exists, it returns false.
|
private |
Assignment operator not allowed.
rhs | The right-hand-side copy that would be used to copy from. |
|
friend |
Definition at line 77 of file ColorSchemeCatalogManager.h.
|
private |
An index from catalog's name to catalog's instance (note: we can not have duplicated names).
Definition at line 214 of file ColorSchemeCatalogManager.h.
|
private |
This is the list of all system's loaded catalogs.
Definition at line 213 of file ColorSchemeCatalogManager.h.