All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Utils.h
Go to the documentation of this file.
1 /* Copyright (C) 2001-2009 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/charts/Utils.h
22 
23  \brief This file contains a set of utility chart functions
24 */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_INTERNAL_CHARTUTILS_H
27 #define __TERRALIB_QT_WIDGETS_INTERNAL_CHARTUTILS_H
28 
29 //TerraLib
30 #include "../Config.h"
31 
32 //QWT
33 #include <qwt_text.h>
34 #include <qwt_symbol.h>
35 
36 //STL
37 #include <vector>
38 
39 namespace te
40 {
41  // Forward declarations
42  namespace color { class RGBAColor; }
43  namespace se { class Font; class Fill; class Stroke; class Mark; class Graphic;}
44  namespace da { class DataSet; class DataSetType; class ObjectId; }
45  namespace dt { class DateTime; }
46  namespace qt
47  {
48  namespace widgets
49  {
50 
51  class Scatter;
52  class Histogram;
53 
54  /*!
55  \brief Scatter Creator
56 
57  \param dataset The dataset that will be used to populate the scatter's data
58  \param dataType The dataType that will be used to recover the objectIds associated with the given dataset.
59  \param propX The id of the property that contains the data of the x axis.
60  \param propY The id of the property that contains the data of the y axis.
61 
62  \note It will traverse the data set, using the moveNext() method
63  \note It will not take the ownership of the "dataset" pointer.
64  \note It will not take the ownership of the "dataType" pointer.
65  \note The caller will take the ownership of the returned scatter pointer.
66 
67  \return a new Scatter
68  */
69  TEQTWIDGETSEXPORT Scatter* createScatter(te::da::DataSet* dataset, te::da::DataSetType* dataType, int propX, int propY);
70 
71  /*!
72  \brief Histogram Creator
73 
74  \param dataset The dataset that will be used to populate the histogram's data
75  \param dataType The dataType that will be used to recover the objectIds associated with the given dataset.
76  \param propId The id of the property that contains the data
77  \param slices The desired number of intervals
78 
79  \note It will traverse the data set, using the moveNext() method
80  \note It will not take the ownership of the "dataset" pointer.
81  \note It will not take the ownership of the "dataType" pointer.
82  \note The caller will take the ownership of the returned histogram pointer.
83 
84  \return a new Histogram
85  */
86  TEQTWIDGETSEXPORT Histogram* createHistogram(te::da::DataSet* dataset, te::da::DataSetType* dataType, int propId, int slices);
87 
88  /*!
89  \brief Histogram Creator
90 
91  \param dataset The dataset that will be used to populate the histogram's data
92  \param dataType The dataType that will be used to recover the objectIds associated with the given dataset.
93  \param propId The id of the property that contains the data
94 
95  \note This version is used to create a histogram based on a set of labels (Strings), therefore there is no user-defined number of intervals, each unique label is an interval
96  \note It will traverse the data set, using the moveNext() method
97  \note It will not take the ownership of the "dataset" pointer.
98  \note It will not take the ownership of the "dataType" pointer.
99  \note The caller will take the ownership of the returned histogram pointer.
100 
101  \return a new Histogram
102  */
103  TEQTWIDGETSEXPORT Histogram* createHistogram(te::da::DataSet* dataset, te::da::DataSetType* dataType, int propId);
104 
105  /*!
106  \function Terralib2Qwt
107 
108  This function returns a default QwtText.
109 
110  \param title A text.
111 
112  \return A QwtText
113 
114  \note The caller will take the ownership of the returned pointer.
115  */
116  TEQTWIDGETSEXPORT QwtText* Terralib2Qwt(const std::string& title);
117 
118 
119  /*!
120  \function Terralib2Qwt
121 
122  This function translates TerraLib text styles into a QwtText.
123 
124  \param text A text
125  \param color The text's color
126  \param font The text's font
127  \param backFill The text's background fill
128  \param backStroke The text's background stroke
129 
130  \return A QwtText
131 
132  \note The caller will take the ownership of the returned pointer.
133  \note It will not take the ownership of given "font", "backFill" and "backStroke"" pointers.
134  */
135  TEQTWIDGETSEXPORT QwtText* Terralib2Qwt(const std::string& text, te::color::RGBAColor* color,
136  te::se::Font* font, te::se::Fill* backFill,
137  te::se::Stroke* backStroke);
138 
139  /*!
140  \function Mark2Symbol
141 
142  This function translates a terralib's Graphic object into a QWTSymbol object.
143 
144  \param graphic The graphic that will be used to generate the symbol.
145 
146  \return A QwtSymbol
147 
148  \note The caller will take the ownership of the returned pointer.
149  \note It will not take the ownership of the Graphic pointer.
150  */
151  TEQTWIDGETSEXPORT QwtSymbol* Terralib2Qwt(te::se::Graphic* graphic);
152 
153  } // end namespace widgets
154  } // end namespace qt
155 } // end namespace te
156 
157 #endif // __TERRALIB_QT_WIDGETS_INTERNAL_CHARTUTILS_H
158 
TEQTWIDGETSEXPORT Histogram * createHistogram(te::da::DataSet *dataset, te::da::DataSetType *dataType, int propId, int slices)
Histogram Creator.
Definition: Utils.cpp:262
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:101
A Fill specifies the pattern for filling an area geometry.
Definition: Fill.h:59
A Stroke specifies the appearance of a linear geometry.
Definition: Stroke.h:67
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
Definition: RGBAColor.h:57
A Font specifies the text font to use in a text symbolizer.
Definition: Font.h:63
TEQTWIDGETSEXPORT Scatter * createScatter(te::da::DataSet *dataset, te::da::DataSetType *dataType, int propX, int propY)
Scatter Creator.
Definition: Utils.cpp:155
TEQTWIDGETSEXPORT QwtText * Terralib2Qwt(const std::string &title)
Definition: Utils.cpp:483
A class that models the description of a dataset.
Definition: DataSetType.h:72
A Graphic is a graphic symbol with an inherent shape, color(s), and possibly size.
Definition: Graphic.h:66
A dataset is the unit of information manipulated by the data access module of TerraLib.
Definition: DataSet.h:111