SymbolizerColorFinder.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/se/SymbolizerColorFinder.h
22 
23  \brief A Symbology Enconding visitor that finds a color given a symbolizer.
24 */
25 
26 #ifndef __TERRALIB_SE_INTERNAL_SYMBOLIZERCOLORFINDER_H
27 #define __TERRALIB_SE_INTERNAL_SYMBOLIZERCOLORFINDER_H
28 
29 // TerraLib
30 #include "Config.h"
31 #include "Visitor.h"
32 
33 // Boost
34 #include <boost/noncopyable.hpp>
35 
36 namespace te
37 {
38  namespace color { class RGBAColor; }
39  namespace se
40  {
41  class Fill;
42  class Graphic;
43  class GraphicStroke;
44  class Mark;
45  class Stroke;
46 
47  /*!
48  \class SymbolizerColorFinder
49 
50  \brief A Symbology Enconding visitor that finds a color given a symbolizer element.
51  If you want to use this visitor, use a command like:
52  <code>
53  te::se::SymbolizerColorFinder scf;
54  scf.find(symbolizer);
55  te::color::RGBAColor color = scf.getColor();
56  </code>
57 
58  \sa te::se::Visitor
59  */
60  class TESEEXPORT SymbolizerColorFinder : public te::se::Visitor, public boost::noncopyable
61  {
62  public:
63 
64  /** @name Initializer Methods
65  */
66  //@{
67 
68  /*! \brief Constructor. */
70 
71  /*! \brief Destructor. */
73 
74  //@}
75 
76  /** @name Find Method
77  * Method that can be used to find a color based on Symbology Enconding symbolizer elements.
78  */
79  //@{
80 
81  /*!
82  \brief It find the color based on given symbolizer.
83 
84  \param symbolizer The symbolizer that will be used searched.
85  */
86  void find(const te::se::Symbolizer* symbolizer);
87 
88  /*!
89  \brief Get the color.
90 
91  \return Color found given a symbolizer
92  */
93  te::color::RGBAColor getColor() { return m_color; }
94 
95  //@}
96 
97  /** @name Visitor Methods
98  * All concrete visitors must implement these methods.
99  */
100  //@{
101 
102  void visit(const te::se::Style& visited);
103  void visit(const te::se::FeatureTypeStyle& visited);
104  void visit(const te::se::CoverageStyle& visited);
105  void visit(const te::se::Symbolizer& visited);
106  void visit(const te::se::PolygonSymbolizer& visited);
107  void visit(const te::se::LineSymbolizer& visited);
108  void visit(const te::se::PointSymbolizer& visited);
109  void visit(const te::se::TextSymbolizer& visited);
110  void visit(const te::se::RasterSymbolizer& visited);
111 
112  //@}
113 
114  private:
115 
116  /*!
117  \brief Internal method that finds the color based on given Stroke element.
118 
119  \param stroke The Stroke element that will be used to find the color.
120  */
121  void find(const te::se::Stroke* stroke);
122 
123  /*!
124  \brief Internal method that finds the color based on given Fill element.
125 
126  \param fill The Fill element that will be used to find the color.
127  */
128  void find(const te::se::Fill* fill);
129 
130  /*!
131  \brief Internal method that finds the color based on given Mark element.
132 
133  \param mark The mark element that will be used to find the color.
134  */
135  void find(const te::se::Mark* mark);
136 
137  protected:
138 
139  te::color::RGBAColor m_color; //!< Color found given a symbolizer
140 
141  };
142 
143  } // end namespace se
144 } // end namespace te
145 
146 #endif // __TERRALIB_SE_INTERNAL_SYMBOLIZERCOLORFINDER_H
A TextSymbolizer is used to render text labels according to various graphical parameters.
A visitor interface for the SymbologyEncoding hierarchy.
The Style defines the styling that is to be applied to a geographic dataset (vector geometries or cov...
Definition: Style.h:65
A Mark specifies a geometric shape and applies coloring to it.
Definition: Mark.h:84
te::color::RGBAColor m_color
Color found given a symbolizer.
A PolygonSymbolizer is used to draw a polygon (or other area-type geometries), including filling its ...
A Symbolizer describes how a feature is to appear on a map.
Definition: Symbolizer.h:80
The CoverageStyle defines the styling that is to be applied to a subset of Coverage data...
Definition: CoverageStyle.h:45
A PointSymbolizer specifies the rendering of a graphic Symbolizer at a point.
A visitor interface for the SymbologyEncoding hierarchy.
Definition: Visitor.h:41
The FeatureTypeStyle defines the styling that is to be applied to a dataset that can be viewed as a f...
URI C++ Library.
The RasterSymbolizer describes how to render raster/matrix-coverage data (e.g., satellite photos...
A Fill specifies the pattern for filling an area geometry.
Definition: Fill.h:59
#define TESEEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:187
Configuration flags for the Symbology Encoding support of TerraLib.
A Symbology Enconding visitor that finds a color given a symbolizer element. If you want to use this ...
A Stroke specifies the appearance of a linear geometry.
Definition: Stroke.h:67
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
Definition: RGBAColor.h:57
A LineSymbolizer is used to style a stroke along a linear geometry type, such as a string of line seg...
te::color::RGBAColor getColor()
Get the color.