PolygonSymbolizer.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/PolygonSymbolizer.h
22 
23  \brief A PolygonSymbolizer is used to draw a polygon (or other area-type geometries), including filling its interior and stroking its border (outline).
24 */
25 
26 #ifndef __TERRALIB_SE_INTERNAL_POLYGONSYMBOLIZER_H
27 #define __TERRALIB_SE_INTERNAL_POLYGONSYMBOLIZER_H
28 
29 // TerraLib
30 #include "Symbolizer.h"
31 
32 namespace te
33 {
34 // Forward declarations
35  namespace fe { class PropertyName; }
36 
37  namespace se
38  {
39 // Forward declarations
40  class Displacement;
41  class Fill;
42  class ParameterValue;
43  class Stroke;
44 
45  /*!
46  \class PolygonSymbolizer
47 
48  \brief A PolygonSymbolizer is used to draw a polygon (or other area-type geometries), including filling its interior and stroking its border (outline).
49 
50  The Fill and Stroke elements are contained in the PolygonSymbolizer in the
51  conceptual order that they are used and plotted using the "painters model",
52  where the Fill will be rendered first, and then the Stroke will be rendered
53  on top of the fill.
54  A missing Stroke element means that the geometry will not be stroked.
55 
56  \ingroup se
57 
58  \sa Symbolizer, Fill, Stroke, te::fe::PropertyName, Displacement, ParameterValue, ImageOutline
59  */
61  {
62  public:
63 
65 
66  /** @name Initializer Methods
67  * Methods related to instantiation and destruction.
68  */
69  //@{
70 
71  /*! \brief It initializes a new PolygonSymbolizer. */
73 
74  /*!
75  \brief Copy constructor.
76 
77  \param rhs The other polygon symbolizer.
78  */
79  PolygonSymbolizer(const PolygonSymbolizer& rhs);
80 
81  /*! \brief Destructor. */
82  ~PolygonSymbolizer();
83 
84  //@}
85 
86  /** @name Accessor methods
87  * Methods used to get or set properties.
88  */
89  //@{
90 
91  /*!
92  \brief
93 
94  The Geometry element of a PolygonSymbolizer defines the linear
95  geometry to be used for styling. The Geometry element is
96  optional and if it is absent then the all geometry properties
97  of the feature type that is used in the containing FeatureType
98  are used. Most frequently, though, feature types will have only
99  a single geometry property. See OGC te::fe::PropertyName
100  class for more information on attribute names.
101  If a polygon has "holes", then they are not filled, but the
102  borders around the holes are stroked in the usual way. "Islands"
103  within holes are filled and stroked, and so on. If a point geometry
104  is referenced instead of a polygon, then a small, square, ortho-normal
105  polygon should be constructed for rendering. If a line is referenced,
106  then the line (string) is closed for filling (only) by connecting its
107  end point to its start point, any line crossings are corrected in
108  some way, and only the original line is stroked. If a raster geometry
109  is used, then the raster-coverage area is used as the polygon. A missing
110  Geometry element selects the "default" geometry for a feature type.
111 
112  \note Geometry types other than inherently linear types can
113  also be used. If a point geometry is used, it should be
114  interpreted as a line of "epsilon" (arbitrarily small) length
115  with a horizontal orientation centered on the point, and should
116  be rendered with two end caps. If a polygon is used (or
117  other "area" type), then its closed outline is used as the line
118  string (with no end caps). If a raster geometry is used, its
119  coverage-area outline is used for the line, rendered with no end caps.
120  */
121  void setGeometry(te::fe::PropertyName* geometry);
122 
123  const te::fe::PropertyName* getGeometry() const;
124 
125  /*!
126  \brief A Fill specifies the pattern for filling an area geometry.
127 
128  The allowed SvgParameters are: "fill" (color) and "fill-opacity".
129  */
130  void setFill(Fill* f);
131 
132  /*!
133  \brief Gets the Fill associates with the PolygonSymbolizer.
134 
135  \return The Fill element.
136  */
137  const Fill* getFill() const;
138 
139  /*!
140  \brief A Stroke specifies the appearance of a linear geometry.
141 
142  A missing Stroke element means that the geometry will not be stroked.
143  */
144  void setStroke(Stroke* stroke);
145 
146  /*!
147  \brief Gets the Stroke associates with the PolygonSymbolizer.
148 
149  \return The Stroke element.
150  */
151  const Stroke* getStroke() const;
152 
153  /*!
154  \brief The Displacement gives the X and Y displacements from the original geometry.
155 
156  This element may be used to
157  avoid over-plotting of multiple PolygonSymbolizers for
158  one geometry or supplying "shadows" of polygon gemeotries.
159  The displacements are in units of pixels above and to the
160  right of the point. The default displacement is X = 0, Y = 0.
161 
162  \param d
163  */
164  void setDisplacement(Displacement* d);
165 
166  const Displacement* getDisplacement() const;
167 
168  /*!
169  \brief PerpendicularOffset works as defined for LineSymbolizer, allowing to draw polygons smaller or larger than their actual geometry.
170 
171  The distance is in uoms and is positive
172  to the outside of the polygon. Negative numbers mean drawing
173  the polygon smaller. The default offset is 0.
174  */
175  void setPerpendicularOffset(ParameterValue* perpendicularOffset);
176 
177  const ParameterValue* getPerpendicularOffset() const;
178 
179  const std::string& getType() const;
180 
181  //@}
182 
183  /*! \brief It creates a new copy of this object. */
184  Symbolizer* clone() const;
185 
186  private:
187 
188  te::fe::PropertyName* m_geometry; //!< A Geometry gives reference to a (the) geometry property of a feature to be used for rendering. (Optional)
189  Fill* m_fill; //!< Specifies how the area of the geometry will be filled. (Optional)
190  Stroke* m_stroke; //!< A "Stroke" specifies the appearance of a linear geometry. (Optional)
191  Displacement* m_displacement; //!< The Displacement gives the X and Y displacements from the original geometry. (Optional)
192  ParameterValue* m_perpendicularOffset; //!< A "PerpendicularOffset" gives the perpendicular distance away from a line to draw a label. (Optional)
193 
194  static const std::string sm_type; //!< A static data member used in the implementation of getType method.
195  };
196 
197  } // namespace se
198 } // end namespace te
199 
200 #endif // __TERRALIB_SE_INTERNAL_POLYGONSYMBOLIZER_H
Displacement * m_displacement
The Displacement gives the X and Y displacements from the original geometry. (Optional) ...
Stroke * m_stroke
A "Stroke" specifies the appearance of a linear geometry. (Optional)
A PolygonSymbolizer is used to draw a polygon (or other area-type geometries), including filling its ...
A Displacement gives X and Y offset displacements to use for rendering a text label, graphic or other Symbolizer near a point.
Definition: Displacement.h:58
A Symbolizer describes how a feature is to appear on a map.
Definition: Symbolizer.h:80
te::fe::PropertyName * m_geometry
A Geometry gives reference to a (the) geometry property of a feature to be used for rendering...
The "ParameterValueType" uses WFS-Filter expressions to give values for SE graphic parameters...
This class is used to encode the name of any property of an object.
Definition: PropertyName.h:54
URI C++ Library.
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
#define TE_DEFINE_VISITABLE
Definition: BaseVisitable.h:75
static const std::string sm_type
A static data member used in the implementation of getType method.
Fill * m_fill
Specifies how the area of the geometry will be filled. (Optional)
A Stroke specifies the appearance of a linear geometry.
Definition: Stroke.h:67
A Symbolizer describes how a Feature is to appear on a map.
ParameterValue * m_perpendicularOffset
A "PerpendicularOffset" gives the perpendicular distance away from a line to draw a label...