27 #include "../common/STLUtils.h"
28 #include "../common/StringUtils.h"
29 #include "../common/Translator.h"
30 #include "../se/Mark.h"
36 #include <boost/format.hpp>
56 throw Exception(
TE_TR(
"Requested size is invalid!"));
59 throw Exception(
TE_TR(
"The given mark is invalid!"));
63 throw Exception(
TE_TR(
"The given mark not have a valid well known name!"));
66 throw Exception(
TE_TR(
"The mark well known name is empty!"));
72 std::vector<std::string> tokens;
78 std::map<std::string, AbstractMarkRenderer*>::iterator it = m_renderers.find(key);
80 if(it == m_renderers.end())
81 throw Exception((boost::format(
TE_TR(
"There is not a mark renderer registered for the given mark %1%.")) % *name).str());
83 return it->second->render(mark, size);
88 std::map<std::string, AbstractMarkRenderer*>::const_iterator it;
89 for(it = m_renderers.begin(); it != m_renderers.end(); ++it)
90 it->second->getSupportedMarks(marks);
95 std::map<std::string, AbstractMarkRenderer*>::iterator it = m_renderers.find(key);
97 if(it != m_renderers.end())
98 throw Exception((boost::format(
TE_TR(
"There is already a mark renderer registered with the given key %1%.")) % key).str());
100 m_renderers[key] = renderer;
void getAllSupportedMarks(std::vector< std::string > &marks) const
It informs the set of all supported marks available in the system.
A Mark specifies a geometric shape and applies coloring to it.
~MarkRendererManager()
Singleton destructor.
ClassLevelLockingPolicy< ::boost::lock_guard< ::boost::recursive_mutex > > LockWrite
This is a singleton for managing all mark renderers instances available in the system.
#define TE_TR(message)
It marks a string in order to get translated.
void Tokenize(const std::string &str, std::vector< std::string > &tokens, const std::string &delimiters=" ")
It tokenizes a given string with a delimiter of your own choice.
void add(const std::string &key, AbstractMarkRenderer *renderer)
It adds a new mark renderer to the manager.
const std::string * getWellKnownName() const
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
An abstract class for conversion of Symbology Enconding Mark elements to an image pattern...
An abstract class for conversion of Symbology Enconding Mark elements to an image pattern...
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...
te::color::RGBAColor ** render(const te::se::Mark *mark, std::size_t size)
It generates the image pattern from the given Symbology Enconding Mark element.
MarkRendererManager()
It initializes the singleton instance of the mark renderer manager.