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/serialization/xml/Style.h
22 
23  \brief Auxiliary classes and functions to serialize style informations from a XML document.
24 */
25 
26 #ifndef __TERRALIB_SE_SERIALIZATION_XML_INTERNAL_STYLE_H
27 #define __TERRALIB_SE_SERIALIZATION_XML_INTERNAL_STYLE_H
28 
29 // TerraLib
30 #include "../../../common/Singleton.h"
31 #include "../../Config.h"
32 
33 // STL
34 #include <map>
35 #include <string>
36 
37 // Boost
38 #include <boost/function.hpp>
39 
40 namespace te
41 {
42  namespace se { class Style; }
43 
44  namespace xml
45  {
46  class AbstractWriter;
47  class Reader;
48  }
49 
50  namespace se
51  {
52  class Style;
53 
54  namespace serialize
55  {
56  class TESEEXPORT Style : public te::common::Singleton<Style>
57  {
59 
60  public:
61 
62  typedef boost::function<te::se::Style* (te::xml::Reader&)> StyleReadFnctType;
63  typedef boost::function<void (const te::se::Style*, te::xml::AbstractWriter&)> StyleWriteFnctType;
64  typedef std::pair<StyleReadFnctType, StyleWriteFnctType> StyleFnctSerializeType;
65  typedef std::map<std::string, StyleFnctSerializeType> StyleFnctIdxType;
66 
67  void reg(const std::string& styleType, const StyleFnctSerializeType& fncts);
68 
69  te::se::Style* read(te::xml::Reader& reader) const;
70 
71  void write(const te::se::Style* style, te::xml::AbstractWriter& writer) const;
72 
73  ~Style();
74 
75  protected:
76 
77  Style();
78 
79  private:
80 
81  StyleFnctIdxType m_fncts;
82  };
83  } //end namespace serialize
84  } // end namespace serialize
85 } // end namespace te
86 
87 #endif // __TERRALIB_SE_SERIALIZATION_XML_INTERNAL_STYLE_H
std::map< std::string, StyleFnctSerializeType > StyleFnctIdxType
Definition: Style.h:65
std::pair< StyleReadFnctType, StyleWriteFnctType > StyleFnctSerializeType
Definition: Style.h:64
boost::function< void(const te::se::Style *, te::xml::AbstractWriter &)> StyleWriteFnctType
Definition: Style.h:63
The Style defines the styling that is to be applied to a geographic dataset (vector geometries or cov...
Definition: Style.h:65
This class models a XML reader object.
Definition: Reader.h:55
This class models a XML writer object.
boost::function< te::se::Style *(te::xml::Reader &)> StyleReadFnctType
Definition: Style.h:62
URI C++ Library.
StyleFnctIdxType m_fncts
Definition: Style.h:81
#define TESEEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:187
A class that models a XML writer object built on top of Xerces-C++.
Template support for singleton pattern.
Definition: Singleton.h:100