Loading...
Searching...
No Matches
ExternalGraphicRendererManager.h
Go to the documentation of this file.
1/* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2
3 This file is part of the TerraLib - a Framework for building GIS enabled applications.
4
5 TerraLib is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 TerraLib is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with TerraLib. See COPYING. If not, write to
17 TerraLib Team at <terralib-team@terralib.org>.
18 */
19
20/*!
21 \file terralib/maptools/ExternalGraphicRendererManager.h
22
23 \brief This is a singleton for managing all external graphic renderers instances available in the system.
24*/
25
26#ifndef __TERRALIB_MAPTOOLS_INTERNAL_EXTERNALGRAPHICRENDERERMANAGER_H
27#define __TERRALIB_MAPTOOLS_INTERNAL_EXTERNALGRAPHICRENDERERMANAGER_H
28
29// TerraLib
30#include "../color/RGBAColor.h"
31#include "../common/Singleton.h"
32#include "../common/ThreadingPolicies.h"
33#include "Config.h"
34
35// STL
36#include <vector>
37
38namespace te
39{
40// Forward declaration
41 namespace se
42 {
43 class ExternalGraphic;
44 }
45
46 namespace map
47 {
48// Forward declaration
49 class AbstractExternalGraphicRenderer;
50
51 /*!
52 \class ExternalGraphicRendererManager
53
54 \brief This is a singleton for managing all external graphic renderers instances available in the system.
55
56 If you want to render a external graphic, use commands like:
57 <code>
58 te::color::RBGA** image = te::map::ExternalGraphicRendererManager::getInstance().render(eg, size);
59 </code>
60
61 \sa AbstractExternalGraphickRenderer
62 */
63 class TEMAPEXPORT ExternalGraphicRendererManager : public te::common::ClassLevelLockable<ExternalGraphicRendererManager,
64 ::boost::recursive_mutex,
65 ::boost::lock_guard< ::boost::recursive_mutex>,
66 ::boost::lock_guard< ::boost::recursive_mutex> >,
67 public te::common::Singleton<ExternalGraphicRendererManager>
68 {
70
71 public:
72
73 /*!
74 \brief It generates the image pattern from the given Symbology Enconding External Graphic element.
75
76 \param eg The Symbology Enconding External Graphic element that will be used as base to build the image pattern.
77 \param height The height of image pattern that will be generated.
78 \param rotation The rotation of the image pattern that will be generated.
79 \param width An output parameter that will be filled with the width of generated image pattern.
80
81 \return The RGBA image that represents the external graphic.
82
83 \note This method will consult all registered external graphic renderers and the first that can process the given element will be used.
84
85 \note The caller will take the ownership of the returned pointer.
86
87 \exception Exception It will throws an exception if the image pattern can not be generated.
88 */
89 te::color::RGBAColor** render(const te::se::ExternalGraphic* eg, std::size_t height, double rotation, std::size_t& width);
90
91 /*!
92 \brief It adds a new external graphic renderer to the manager.
93
94 \param renderer The new external graphic renderer that will be added on the manager.
95
96 \note The manager will take the owership of the given external graphic renderer.
97 */
99
100 /*!
101 \brief It clears the graphic renderers of the manager.
102
103 */
104 void clear();
105
106 protected:
107
108 /*! \brief It initializes the singleton instance of the external graphic renderer manager. */
110
111 /*! \brief Singleton destructor. */
113
114 private:
115
116 std::vector<AbstractExternalGraphicRenderer*> m_renderers; //!< The external graphic renderers in the manager.
117 };
118
119 } // end namespace map
120} // end namespace te
121
122#endif // __TERRALIB_MAPTOOLS_INTERNAL_EXTERNALGRAPHICRENDERERMANAGER_H
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
Definition RGBAColor.h:58
This policy assures a class-level locking scheme for a derived class.
Template support for singleton pattern.
Definition Singleton.h:101
An abstract class for conversion of Symbology Enconding ExternalGraphic elements to an image pattern.
This is a singleton for managing all external graphic renderers instances available in the system.
ExternalGraphicRendererManager()
It initializes the singleton instance of the external graphic renderer manager.
~ExternalGraphicRendererManager()
Singleton destructor.
void add(AbstractExternalGraphicRenderer *renderer)
It adds a new external graphic renderer to the manager.
void clear()
It clears the graphic renderers of the manager.
std::vector< AbstractExternalGraphicRenderer * > m_renderers
The external graphic renderers in the manager.
te::color::RGBAColor ** render(const te::se::ExternalGraphic *eg, std::size_t height, double rotation, std::size_t &width)
It generates the image pattern from the given Symbology Enconding External Graphic element.
The ExternalGraphic allows a reference to be made to an external graphic file with a Web URL or to in...
TerraLib.
#define TEMAPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition Config.h:60
Proxy configuration file for TerraView (see terraview_config.h).