Utils.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/qt/widgets/se/Utils.h
22 
23  \brief This file contains utility functions for dealing with Symbology Enconding and Qt concepts.
24  */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_SE_INTERNAL_UTILS_H
27 #define __TERRALIB_QT_WIDGETS_SE_INTERNAL_UTILS_H
28 
29 // TerraLib
30 #include "../Config.h"
31 
32 // STL
33 #include <string>
34 
35 // Qt
36 #include <QStringList>
37 
38 // Forward declarations
39 class QBrush;
40 class QFont;
41 class QPen;
42 
43 namespace te
44 {
45 // Forward declarations
46  namespace se
47  {
48  class Fill;
49  class Font;
50  class Stroke;
51  class Symbolizer;
52  }
53 
54  namespace xml
55  {
56  class AbstractWriter;
57  class Reader;
58  }
59 
60  namespace qt
61  {
62  namespace widgets
63  {
64 // Forward declaration
65  class Symbol;
66  class SymbolNode;
67  class SymbolLibrary;
68 
69  /*!
70  \brief It configs the given pen based on Symbology Enconding Stroke element.
71 
72  \param pen The pen that will be configured.
73  \param stroke The Symbology Enconding Stroke element that will be used. If NULL, Qt::transparent color will be setted on pen.
74 
75  \note Warning: It consider that the parameters of Stroke element is enconded using a Literal OGC Filter expression.
76  */
77  TEQTWIDGETSEXPORT void Config(QPen& pen, const te::se::Stroke* stroke);
78 
79  /*!
80  \brief It configs the given brush based on Symbology Enconding Fill element.
81 
82  \param brush The brush that will be configured.
83  \param fill The Symbology Enconding Fill element that will be used. If NULL, Qt::transparent color will be setted on brush.
84 
85  \note Warning: It consider that the parameters of Fill element is enconded using a Literal OGC Filter expression.
86  */
87  TEQTWIDGETSEXPORT void Config(QBrush& brush, const te::se::Fill* fill);
88 
89  //!< Reads the SymbolLibrary from a buffer
90  TEQTWIDGETSEXPORT void ReadSymbolLibraryFromBuffer(const std::string& buffer);
91 
92  /*!
93  \brief It reads a symbol library file and put the result on SymbolLibraryManager.
94 
95  \param path The path of the symbol library file.
96  */
97  TEQTWIDGETSEXPORT void ReadSymbolLibrary(const std::string& path);
98 
99  /*!
100  \brief It reads a symbol using the given reader.
101 
102  \return The symbol read.
103  */
105 
106  /*!
107  \brief It reads a symbol using the given reader.
108 
109  \return The symbol read.
110  */
112 
114 
115  //!< Serializes the SymbolLibrary into a buffer
117 
118  /*!
119  \brief It reads a symbol using the given reader.
120 
121  \return The symbol read.
122  */
123  TEQTWIDGETSEXPORT void WriteSymbolLibrary(const std::string& path);
124 
126 
128 
130 
132 
134 
135  /*!
136  \brief It converts a Qt Font to TerraLib Font.
137 
138  \param font The Qt Font that will be converted.
139  */
141 
142  /*!
143  \brief It converts a TerraLib Font to Qt Font.
144 
145  \param font The TerraLib Font that will be converted.
146  */
148 
149  } // end namespace widgets
150  } // end namespace qt
151 } // end namespace te
152 
153 #endif // __TERRALIB_QT_WIDGETS_SE_INTERNAL_UTILS_H
A class that models a XML writer object built on top of Xerces-C++.
This class represents a library of symbols.
Definition: SymbolLibrary.h:55
This class represents a symbol. TODO: More description!
Definition: Symbol.h:55
A Fill specifies the pattern for filling an area geometry.
Definition: Fill.h:60
A Font specifies the text font to use in a text symbolizer.
Definition: Font.h:64
A Stroke specifies the appearance of a linear geometry.
Definition: Stroke.h:68
A Symbolizer describes how a feature is to appear on a map.
Definition: Symbolizer.h:81
This class models a XML writer object.
This class models a XML reader object.
Definition: Reader.h:56
TEQTWIDGETSEXPORT SymbolNode * ReadGroup(te::xml::Reader &reader)
It reads a symbol using the given reader.
TEQTWIDGETSEXPORT void Config(QPen &pen, const te::se::Stroke *stroke)
It configs the given pen based on Symbology Enconding Stroke element.
TEQTWIDGETSEXPORT void BuildGroupTreeInsideLibrary(te::xml::Reader &reader, SymbolLibrary *library)
Serializes the SymbolLibrary into a buffer.
TEQTWIDGETSEXPORT std::string SerializeSymbolLibraryToBuffer()
TEQTWIDGETSEXPORT void ReadSymbolLibrary(const std::string &path)
It reads a symbol library file and put the result on SymbolLibraryManager.
TEQTWIDGETSEXPORT void SerializeSymbolLibrary(te::xml::AbstractWriter &writer)
TEQTWIDGETSEXPORT Symbol * ReadSymbol(te::xml::Reader &reader)
It reads a symbol using the given reader.
TEQTWIDGETSEXPORT QFont Convert2Qt(const te::se::Font *font)
It converts a TerraLib Font to Qt Font.
TEQTWIDGETSEXPORT void ReadSymbolLibraryFromBuffer(const std::string &buffer)
TEQTWIDGETSEXPORT te::se::Font * Convert2TerraLib(const QFont &font)
It converts a Qt Font to TerraLib Font.
TEQTWIDGETSEXPORT void WriteSymbolLibrary(const std::string &path)
It reads a symbol using the given reader.
TEQTWIDGETSEXPORT void WriteElements(te::xml::AbstractWriter &writer, te::qt::widgets::SymbolNode *root)
TEQTWIDGETSEXPORT void WriteElement(te::qt::widgets::SymbolNode *group, te::xml::AbstractWriter &writer)
TerraLib.
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63