Loading...
Searching...
No Matches
Rule.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/Rule.h
22
23 \brief A Rule is used to attach property/scale conditions to and group the individual symbols used for rendering.
24*/
25
26#ifndef __TERRALIB_SE_INTERNAL_RULE_H
27#define __TERRALIB_SE_INTERNAL_RULE_H
28
29// TerraLib
30#include "../fe/Filter.h"
31#include "Config.h"
32
33// STL
34#include <string>
35#include <vector>
36
37// Boost
38#include <boost/noncopyable.hpp>
39
40namespace te
41{
42 namespace se
43 {
44// Forward declaration
45 class Description;
46 class Graphic;
47 class Symbolizer;
48
49 /*!
50 \class Rule
51
52 \brief A Rule is used to attach property/scale conditions to and group the individual symbols used for rendering.
53
54 Rules are used to group rendering instructions by
55 feature-property conditions and map scales. Rule
56 definitions are placed immediately inside of
57 featuretype- or coverage-style definitions.
58 If a rule has no Filter element, the
59 interpretation is that the rule condition is
60 always true, i.e., all features are accepted
61 and styled by the rule.
62 The ElseFilter has a more complicated interpretation
63 than the Filter element, and is interpreted as follows.
64 The nominal scale of the map to be portrayed is
65 computed (as described in the previous subclause) and
66 all rules for scale ranges that do not include the computed
67 nominal scale are discarded from further processing. Then, the
68 specific condition for the ElseFilter is computed by "or-ing"
69 together all of the other filter conditions and take the
70 global "not" of that condition.
71
72 \ingroup se
73
74 \sa FeatureTypeStyle, CoverageStyle, Description, Graphic, Symbolizer, te::fe::Filter
75 */
76 class TESEEXPORT Rule : public boost::noncopyable
77 {
78 public:
79
80 /** @name Initializer Methods
81 * Methods related to instantiation and destruction.
82 */
83 //@{
84
85 /*! \brief It initializes a new Rule. */
87
88 /*! \brief Destructor. */
90
91 //@}
92
93 /** @name Accessor methods
94 * Methods used to get or set properties.
95 */
96 //@{
97
98 void setName(std::string* name);
99
100 const std::string* getName() const;
101
103
105
106 void setLegendGraphic(Graphic* legendGraphic);
107
108 const Graphic* getLegendGraphic() const;
109
111
112 /*!
113 \brief
114
115 \note The ElseFilter must be false in order to set a filter.
116 */
118
119 const te::fe::Filter* getFilter() const;
120
121 /*!
122 \brief
123
124 \note The filter must be NULL in order to call this method.
125 */
127
129
130 bool hasElseFilter() const;
131
132 void setMinScaleDenominator(const double& minScaleDenominator);
133
134 const double& getMinScaleDenominator() const;
135
136 void setMaxScaleDenominator(const double& maxScaleDenominator);
137
138 const double& getMaxScaleDenominator() const;
139
141
142 void setSymbolizer(std::size_t i, Symbolizer* s);
143
144 void setSymbolizers(const std::vector<Symbolizer*>& symbs);
145
146 const std::vector<Symbolizer*>& getSymbolizers() const;
147
148 const Symbolizer* getSymbolizer(std::size_t i) const;
149
150 void removeSymbolizer(std::size_t i);
151
153
154 //@}
155
156 /*! \brief It creates a new copy of this object. */
157 Rule* clone() const;
158
159 private:
160
161 std::string* m_name; //!< It allows the rule to be referenced externally, which is needed in some methods of SE usage. (Optional)
162 Description* m_description; //!< It gives the familiar short title for display lists and longer description for the rule. (Optional)
163 Graphic* m_legendGraphic; //!< It allows an optional explicit Graphic Symbolizer to be displayed in a legend for this rule. (Optional)
164 te::fe::Filter* m_filter; //!< It allows the selection of features in rules to be controlled by attribute conditions. (Optional)
165 bool m_elseFilter; //!< It allows rules to be specified that are activated for features that are not selected by any other rule in a feature-type style. Default: false. If true, this is a Else filter rule. (Optional)
166 double m_minScaleDenominator; //!< It defines the range of map-rendering scales for which the rule should be applied. Default: 0.0. (Optional)
167 double m_maxScaleDenominator; //!< It defines the range of map-rendering scales for which the rule should be applied. Default: TE_DOUBLE_INFINITY. (Optional)
168 std::vector<Symbolizer*> m_symbolizers; //!< A Symbolizer describes how a feature/coverage is to appear on a map. (Mandatory)
169 };
170
171 } // end namespace se
172} // end namespace te
173
174#endif // __TERRALIB_SE_INTERNAL_RULE_H
A filter is any valid predicate expression.
Definition Filter.h:56
A Description gives human-readable descriptive information for the object it is included within.
Definition Description.h:57
A Graphic is a graphic symbol with an inherent shape, color(s), and possibly size.
Definition Graphic.h:67
A Rule is used to attach property/scale conditions to and group the individual symbols used for rende...
Definition Rule.h:77
void push_back(Symbolizer *s)
void setLegendGraphic(Graphic *legendGraphic)
const std::string * getName() const
const Symbolizer * getSymbolizer(std::size_t i) const
void clearSymbolizers()
Rule()
It initializes a new Rule.
void enableElseFilter()
std::vector< Symbolizer * > m_symbolizers
A Symbolizer describes how a feature/coverage is to appear on a map. (Mandatory)
Definition Rule.h:168
void setName(std::string *name)
const Graphic * getLegendGraphic() const
void setFilter(te::fe::Filter *f)
double m_maxScaleDenominator
It defines the range of map-rendering scales for which the rule should be applied....
Definition Rule.h:167
Description * m_description
It gives the familiar short title for display lists and longer description for the rule....
Definition Rule.h:162
void setSymbolizer(std::size_t i, Symbolizer *s)
~Rule()
Destructor.
double m_minScaleDenominator
It defines the range of map-rendering scales for which the rule should be applied....
Definition Rule.h:166
Rule * clone() const
It creates a new copy of this object.
void removeSymbolizer(std::size_t i)
const std::vector< Symbolizer * > & getSymbolizers() const
Graphic * m_legendGraphic
It allows an optional explicit Graphic Symbolizer to be displayed in a legend for this rule....
Definition Rule.h:163
te::fe::Filter * m_filter
It allows the selection of features in rules to be controlled by attribute conditions....
Definition Rule.h:164
bool hasElseFilter() const
bool m_elseFilter
It allows rules to be specified that are activated for features that are not selected by any other ru...
Definition Rule.h:165
void setMinScaleDenominator(const double &minScaleDenominator)
const double & getMaxScaleDenominator() const
void setSymbolizers(const std::vector< Symbolizer * > &symbs)
void setDescription(Description *d)
void disableElseFilter()
void removeLegendGraphic()
const te::fe::Filter * getFilter() const
const double & getMinScaleDenominator() const
const Description * getDescription() const
void setMaxScaleDenominator(const double &maxScaleDenominator)
std::string * m_name
It allows the rule to be referenced externally, which is needed in some methods of SE usage....
Definition Rule.h:161
A Symbolizer describes how a feature is to appear on a map.
Definition Symbolizer.h:81
TerraLib.
#define TESEEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition Config.h:201
Proxy configuration file for TerraView (see terraview_config.h).