Style.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/Style.h
22 
23  \brief The Style defines the styling that is to be applied to a geographic dataset (vector geometries or coverage).
24 */
25 
26 #ifndef __TERRALIB_SE_INTERNAL_STYLE_H
27 #define __TERRALIB_SE_INTERNAL_STYLE_H
28 
29 // TerraLib
30 #include "../common/BaseVisitable.h"
31 #include "Config.h"
32 #include "Visitor.h"
33 
34 // STL
35 #include <string>
36 #include <vector>
37 
38 // Boost
39 #include <boost/noncopyable.hpp>
40 
41 namespace te
42 {
43 // Forward declarations
44  namespace xl { class SimpleLink; }
45 
46  namespace se
47  {
48 // Forward declarations
49  class Description;
50  class Rule;
51 
52  /*!
53  \class Style
54 
55  \brief The Style defines the styling that is to be applied to a geographic dataset (vector geometries or coverage).
56 
57  The ordering to use for the Rules inside of a Style
58  is following the "painters model" with the first item in a list
59  being the first item plotted and hence being on the "bottom".
60 
61  \ingroup se
62 
63  \sa FeatureTypeStyle, CoverageStyle, Description, Rule
64  */
65  class TESEEXPORT Style : public te::common::BaseVisitable<Visitor>, public boost::noncopyable
66  {
67  public:
68 
70 
71  /** @name Initializer Methods
72  * Methods related to instantiation and destruction.
73  */
74  //@{
75 
76  /*! \brief It initializes a new Style. */
77  Style();
78 
79  /*! \brief Virtual destructor. */
80  virtual ~Style();
81 
82  //@}
83 
84  /** @name Accessor methods
85  * Methods used to get or set properties.
86  */
87  //@{
88 
89  void setName(std::string* name);
90 
91  const std::string* getName() const;
92 
93  void setDescription(Description* d);
94 
95  const Description* getDescription() const;
96 
97  void push_back(const std::string& semanticTypeIdentifier);
98 
99  const std::string& getSemanticTypeIdentifier(std::size_t i);
100 
101  const std::vector<std::string>* getSemanticTypeIdentifiers() const;
102 
103  void push_back(Rule* rule);
104 
105  const std::vector<Rule*>& getRules() const;
106 
107  Rule* getRule(std::size_t i) const;
108 
109  void push_back(te::xl::SimpleLink* onlineResource);
110 
111  const std::vector<te::xl::SimpleLink*>& getOnlineResources() const;
112 
113  const te::xl::SimpleLink* getOnlineResource(std::size_t i) const;
114 
115  void setVersion(const std::string& v);
116 
117  const std::string& getVersion() const;
118 
119  /*!
120  \brief It returns the style type.
121 
122  \return The style type.
123  */
124  virtual const std::string& getType() const = 0;
125 
126  //@}
127 
128  /*! \brief It creates a new copy of this object. */
129  virtual Style* clone() const = 0;
130 
131  protected:
132 
133  std::string* m_name; //!< It allows the style to be referenced. Names must be unique in the context in which they are defined. (Optional)
134  Description* m_description; //!< It gives an informative description of the style. (Optional)
135  std::vector<std::string>* m_semanticTypeIdentifiers; //!< The SemanticTypeIdentifier is experimental and is intended to be used to identify what the feature style is suitable to be used for using community-controlled name(s). (Optional)
136  std::vector<Rule*> m_rules; //!< It allows conditional rendering. (Mandatory if m_onlineResource is empty, otherwise, it is optional)
137  std::vector<te::xl::SimpleLink*> m_onlineResources; //!< It refers to an external document. (Mandatory if m_rules is empty, otherwise, it is optional)
138  std::string m_version; //!< The version is an optional attribute on the FeatureTypeStyle that identifies the SE version number that the FeatureTypeStyle corresponds to. (Optional)
139  };
140 
141  } // end namespace se
142 } // end namespace te
143 
144 #endif // __TERRALIB_SE_INTERNAL_STYLE_H
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.
The Style defines the styling that is to be applied to a geographic dataset (vector geometries or cov...
Definition: Style.h:65
std::string * m_name
It allows the style to be referenced. Names must be unique in the context in which they are defined...
Definition: Style.h:133
Description * m_description
It gives an informative description of the style. (Optional)
Definition: Style.h:134
The root of all hierarchies that can be visited.
Definition: BaseVisitable.h:53
std::vector< Rule * > m_rules
It allows conditional rendering. (Mandatory if m_onlineResource is empty, otherwise, it is optional)
Definition: Style.h:136
std::vector< std::string > * m_semanticTypeIdentifiers
The SemanticTypeIdentifier is experimental and is intended to be used to identify what the feature st...
Definition: Style.h:135
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
A Rule is used to attach property/scale conditions to and group the individual symbols used for rende...
Definition: Rule.h:78
std::string m_version
The version is an optional attribute on the FeatureTypeStyle that identifies the SE version number th...
Definition: Style.h:138
std::vector< te::xl::SimpleLink * > m_onlineResources
It refers to an external document. (Mandatory if m_rules is empty, otherwise, it is optional) ...
Definition: Style.h:137