Symbolizer.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/Symbolizer.h
22 
23  \brief A Symbolizer describes how a Feature is to appear on a map.
24 */
25 
26 #ifndef __TERRALIB_SE_INTERNAL_SYMBOLIZER_H
27 #define __TERRALIB_SE_INTERNAL_SYMBOLIZER_H
28 
29 // TerraLib
30 #include "../common/BaseVisitable.h"
31 #include "Config.h"
32 #include "Enums.h"
33 #include "Visitor.h"
34 
35 // STL
36 #include <string>
37 
38 // Boost
39 #include <boost/noncopyable.hpp>
40 
41 namespace te
42 {
43 // Forward declaration
44  namespace common { class BaseUnitOfMeasure; }
45  namespace xl { class SimpleLink; }
46 
47  namespace se
48  {
49 // Forward declaration
50  class Description;
51 
52  /*!
53  \class Symbolizer
54 
55  \brief A Symbolizer describes how a feature is to appear on a map.
56 
57  A Symbolizer is an abstract type for encoding
58  the graphical properties used to portray geographic information.
59  Concrete Symbolizers are derived from this base type.
60  A Symbolizer describes how a feature is to appear
61  on a map. The Symbolizer describes not just the shape
62  that should appear but also such graphical properties
63  as color and opacity. A Symbolizer is obtained by
64  specifying one of a small number of different types
65  of Symbolizers and then supplying parameters to override
66  its default behaviour. Five types of Symbolizers are defined:
67  <ol>
68  <li>Line</li>
69  <li>Polygon</li>
70  <li>Point</li>
71  <li>Text</li>
72  <li>Raster</li>
73  </ol>
74  Concrete Symbolizer types are derived from this base type.
75 
76  \ingroup se
77 
78  \sa Rule, LineSymbolizer, PointSymbolizer, PolygonSymbolizer, TextSymbolizer, RasterSymbolizer, Description
79  */
80  class TESEEXPORT Symbolizer : public te::common::BaseVisitable<Visitor>, public boost::noncopyable
81  {
82  public:
83 
85 
86  /** @name Initializer Methods
87  * Methods related to instantiation and destruction.
88  */
89  //@{
90 
91  /*! \brief It initializes a new Symbolizer. */
92  Symbolizer();
93 
94  /*!
95  \brief Copy constructor.
96 
97  \param rhs The other symbolizer.
98  */
99  Symbolizer(const Symbolizer& rhs);
100 
101  /*! \brief Virtual destructor. */
102  virtual ~Symbolizer();
103 
104  //@}
105 
106  /** @name Accessor methods
107  * Methods used to get or set properties.
108  */
109  //@{
110 
111  void setName(const std::string& name);
112 
113  const std::string& getName() const;
114 
115  void setDescription(Description* d);
116 
117  const Description* getDescription() const;
118 
119  void setBaseSymbolizer(te::xl::SimpleLink* baseSymbolizer);
120 
121  const te::xl::SimpleLink* getBaseSymbolizer() const;
122 
123  void setVersion(const std::string& version);
124 
125  const std::string& getVersion() const;
126 
127  /*!
128  \brief It sets the unit-of-measure.
129 
130  All Symbolizers include an optional gml:uom-attribute as
131  used by GML (this is set inside the abstract SymbolizerType
132  and therefore inherited by all Symbolizers). This applies
133  to all elements included inside a Symbolizer such as
134  stroke-width, size, font-size, Gap, InitialGap, Displacement
135  and PerpendicularOffset. If no uom is set inside of Symbolizer,
136  all units are measured in pixel, the behaviour used by SLD 1.0.0.
137  The following uom definitions are recommended to be used:
138  <ul>
139  <li>http://www.opengeospatial.org/se/units/metre</li>
140  <li>http://www.opengeospatial.org/se/units/foot</li>
141  <li>http://www.opengeospatial.org/se/units/pixel</li>
142  </ul>
143  */
144  void setUom(const te::common::BaseUnitOfMeasure* uom);
145 
146  const te::common::BaseUnitOfMeasure* getUom() const;
147 
148  /*!
149  \brief It returns the symbolizer type.
150 
151  \return The symbolizer type.
152  */
153  virtual const std::string& getType() const = 0;
154 
155  //@}
156 
157  /*! \brief It creates a new copy of this object. */
158  virtual Symbolizer* clone() const = 0;
159 
160  private:
161 
162  std::string m_name; //!< It allows the symbolizer to be referenced externally, which is needed in some methods of SE usage. (Optional)
163  Description* m_description; //!< It gives the familiar short title for display lists and longer description for the symbolizer. (Optional)
164  te::xl::SimpleLink* m_baseSymbolizer; //!< A BaseSymbolizer (an OnlineResource) defines the default properties of a Symbolizer to be those of an external Symbolizer, which will frequently be inside of an OGC Symbolizer repository. The Symbolizer properties given in-line override the base-Symbolizer properties. (Optional)
165  std::string m_version; //!< The version is an optional attribute on the FeatureType Style element that identifies the SE version number that the FeatureTypeStyle corresponds to. For now, the only allowed value is 1.1.0. (Mandatory)
166  const te::common::BaseUnitOfMeasure* m_uom; //!< Unit of measurement. If no uom is set inside of Symbolizer, all units are measured in pixel. (Mandatory)
167  };
168 
169  } // end namespace se
170 } // end namespace te
171 
172 #endif // __TERRALIB_SE_INTERNAL_SYMBOLIZER_H
173 
Enumerations related to Symbology Enconding module.
A Description gives human-readable descriptive information for the object it is included within...
Definition: Description.h:56
A visitor interface for the SymbologyEncoding hierarchy.
const te::common::BaseUnitOfMeasure * m_uom
Unit of measurement. If no uom is set inside of Symbolizer, all units are measured in pixel...
Definition: Symbolizer.h:166
te::xl::SimpleLink * m_baseSymbolizer
A BaseSymbolizer (an OnlineResource) defines the default properties of a Symbolizer to be those of an...
Definition: Symbolizer.h:164
The root of all hierarchies that can be visited.
Definition: BaseVisitable.h:53
A Symbolizer describes how a feature is to appear on a map.
Definition: Symbolizer.h:80
std::string m_version
The version is an optional attribute on the FeatureType Style element that identifies the SE version ...
Definition: Symbolizer.h:165
URI C++ Library.
#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.
#define TE_DEFINE_VISITABLE
Definition: BaseVisitable.h:75
Description * m_description
It gives the familiar short title for display lists and longer description for the symbolizer...
Definition: Symbolizer.h:163
std::string m_name
It allows the symbolizer to be referenced externally, which is needed in some methods of SE usage...
Definition: Symbolizer.h:162