Fill.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/Fill.h
22 
23  \brief A Fill specifies the pattern for filling an area geometry.
24 */
25 
26 #ifndef __TERRALIB_SE_INTERNAL_FILL_H
27 #define __TERRALIB_SE_INTERNAL_FILL_H
28 
29 // TerraLib
30 #include "Config.h"
31 
32 // STL
33 #include <map>
34 #include <string>
35 
36 // Boost
37 #include <boost/noncopyable.hpp>
38 
39 namespace te
40 {
41  namespace se
42  {
43 // Forward declaration
44  class Graphic;
45  class SvgParameter;
46 
47  /*!
48  \class Fill
49 
50  \brief A Fill specifies the pattern for filling an area geometry.
51 
52  Here, the SvgParameter names are "fill" instead of "stroke"
53  and "fill-opacity" instead of "stroke-opacity".
54 
55  \ingroup se
56 
57  \sa PolygonSymbolizer, Graphic, FillBasicColor, Mark, TextSymbolizer, Halo
58  */
59  class TESEEXPORT Fill : public boost::noncopyable
60  {
61  public:
62 
63  /** @name Initializer Methods
64  * Methods related to instantiation and destruction.
65  */
66  //@{
67 
68  /*! \brief It initializes a new Fill. */
69  Fill();
70 
71  /*! \brief Destructor. */
72  ~Fill();
73 
74  //@}
75 
76  /** @name Accessor methods
77  * Methods used to get or set properties.
78  */
79  //@{
80 
81  /*!
82  \brief Sets the GraphicFill element to this Fill.
83  GraphicFill defines that the pixels of the area will be drawn repeating an area-fill pattern.
84 
85  \note The Fill object will take the ownership of the informed fill pointer.
86  */
88 
89  /*!
90  \brief Gets the GraphicFill element associate to this Fill.
91 
92  \return The GraphicFill element.
93  */
94  const Graphic* getGraphicFill() const;
95 
96  /*!
97  \brief Add a SvgParameter to this Fill.
98 
99  \note If there is already a SvgParamater with the same name it will be overrided.
100  \note The Fill object will take the ownership of the informed p pointer.
101  */
102  void add(SvgParameter* p);
103 
104  void setColor(const std::string& color);
105 
106  void setOpacity(const std::string& opacity);
107 
108  const SvgParameter* getColor() const;
109 
110  const SvgParameter* getOpacity() const;
111 
112  //@}
113 
114  /*! \brief It creates a new copy of this object. */
115  Fill* clone() const;
116 
117  private:
118 
119  void setParameter(const std::string& name, const std::string& value);
120 
121  const SvgParameter* getParameter(const std::string& name) const;
122 
123  private:
124 
125  Graphic* m_graphicFill; //!< Repeated graphic fill style. If omitted, then no fill will be rendered. (Optional)
126  std::map<std::string, SvgParameter*> m_svgParams; //!< Solid color style. (Optional)
127 
128  static const std::string sm_fill; //!< SVG/CSS "fill" parameter.
129  static const std::string sm_opacity; //!< SVG/CSS "fill-opacity parameter.
130  };
131 
132  } // end namespace se
133 } // end namespace te
134 
135 #endif // __TERRALIB_SE_INTERNAL_FILL_H
te::se::Fill::setOpacity
void setOpacity(const std::string &opacity)
te::se::Fill
A Fill specifies the pattern for filling an area geometry.
Definition: Fill.h:60
te::se::SvgParameter
A SvgParameter refers to an SVG/CSS graphical-formatting parameter.
Definition: SvgParameter.h:49
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::se::Fill::getParameter
const SvgParameter * getParameter(const std::string &name) const
te::se::Fill::Fill
Fill()
It initializes a new Fill.
te::se::Fill::setGraphicFill
void setGraphicFill(Graphic *g)
Sets the GraphicFill element to this Fill. GraphicFill defines that the pixels of the area will be dr...
te::se::Fill::clone
Fill * clone() const
It creates a new copy of this object.
te::se::Fill::setParameter
void setParameter(const std::string &name, const std::string &value)
te::se::Fill::m_graphicFill
Graphic * m_graphicFill
Repeated graphic fill style. If omitted, then no fill will be rendered. (Optional)
Definition: Fill.h:125
TESEEXPORT
#define TESEEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:201
te::se::Fill::m_svgParams
std::map< std::string, SvgParameter * > m_svgParams
Solid color style. (Optional)
Definition: Fill.h:126
te::se::Fill::getColor
const SvgParameter * getColor() const
te::se::Fill::sm_fill
static const std::string sm_fill
SVG/CSS "fill" parameter.
Definition: Fill.h:128
te::se::Fill::add
void add(SvgParameter *p)
Add a SvgParameter to this Fill.
te::se::Fill::sm_opacity
static const std::string sm_opacity
SVG/CSS "fill-opacity parameter.
Definition: Fill.h:129
te::se::Graphic
A Graphic is a graphic symbol with an inherent shape, color(s), and possibly size.
Definition: Graphic.h:67
te::se::Fill::~Fill
~Fill()
Destructor.
Config.h
Proxy configuration file for TerraView (see terraview_config.h).
te::se::Fill::getGraphicFill
const Graphic * getGraphicFill() const
Gets the GraphicFill element associate to this Fill.
te::se::Fill::getOpacity
const SvgParameter * getOpacity() const
te::se::Fill::setColor
void setColor(const std::string &color)