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(
TR_MAP(
"Requested size is invalid!"));
59 throw Exception(
TR_MAP(
"The given mark is invalid!"));
63 throw Exception(
TR_MAP(
"The given mark not have a valid well known name!"));
66 throw Exception(
TR_MAP(
"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(
TR_MAP(
"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(
TR_MAP(
"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.
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()
Singleton destructor.
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...
An abstract class for conversion of Symbology Enconding Mark elements to an image pattern...
const std::string * getWellKnownName() const
void add(const std::string &key, AbstractMarkRenderer *renderer)
It adds a new mark renderer to the manager.
ClassLevelLockingPolicy< ::boost::lock_guard< ::boost::recursive_mutex > > LockWrite
MarkRendererManager()
It initializes the singleton instance of the mark renderer manager.
An exception class for the MapTools module.
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
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.
#define TR_MAP(message)
It marks a string in order to get translated. This is a special mark used in the Map Rendering module...
This is a singleton for managing all mark renderers instances available in the system.
An abstract class for conversion of Symbology Enconding Mark elements to an image pattern...
A Mark specifies a geometric shape and applies coloring to it.