All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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 
47  namespace qt
48  {
49 
50  namespace widgets
51  {
52 
53  class Scatter;
54  class Histogram;
55  class ChartDisplayWidget;
56 
57  /*!
58  \brief Scatter Creator
59 
60  \param dataset The dataset that will be used to populate the scatter's data
61  \param dataType The dataType that will be used to recover the objectIds associated with the given dataset.
62  \param propX The id of the property that contains the data of the x axis.
63  \param propY The id of the property that contains the data of the y axis.
64 
65  \note It will traverse the data set, using the moveNext() method
66  \note It will not take the ownership of the "dataset" pointer.
67  \note It will not take the ownership of the "dataType" pointer.
68  \note The caller will take the ownership of the returned scatter pointer.
69 
70  \return a new Scatter
71  */
72  TEQTWIDGETSEXPORT Scatter* createScatter(te::da::DataSet* dataset, te::da::DataSetType* dataType, int propX, int propY);
73 
74  /*!
75  \brief Scatter Creator
76 
77  \param dataset The dataset that will be used to populate the scatter's data
78  \param dataType The dataType that will be used to recover the objectIds associated with the given dataset.
79  \param propX The id of the property that contains the data of the x axis.
80  \param propY The id of the property that contains the data of the y axis.
81 
82  \note It will traverse the data set, using the moveNext() method
83  \note It will not take the ownership of the "dataset" pointer.
84  \note It will not take the ownership of the "dataType" pointer.
85  \note The caller will take the ownership of the returned ChartDisplayWidget pointer.
86 
87  */
88  TEQTWIDGETSEXPORT ChartDisplayWidget* createScatterDisplay(te::da::DataSet* dataset, te::da::DataSetType* dataType, int propX, int propY);
89 
90  /*!
91  \brief Histogram Creator
92 
93  \param dataset The dataset that will be used to populate the histogram's data
94  \param dataType The dataType that will be used to recover the objectIds associated with the given dataset.
95  \param propId The id of the property that contains the data
96  \param slices The desired number of intervals
97 
98  \note It will traverse the data set, using the moveNext() method
99  \note It will not take the ownership of the "dataset" pointer.
100  \note It will not take the ownership of the "dataType" pointer.
101  \note The caller will take the ownership of the returned histogram pointer.
102 
103  \return a new Histogram
104  */
105  TEQTWIDGETSEXPORT Histogram* createHistogram(te::da::DataSet* dataset, te::da::DataSetType* dataType, int propId, int slices);
106 
107  /*!
108  \brief Histogram Creator
109 
110  \param dataset The dataset that will be used to populate the histogram's data
111  \param dataType The dataType that will be used to recover the objectIds associated with the given dataset.
112  \param propId The id of the property that contains the data
113 
114  \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
115  \note It will traverse the data set, using the moveNext() method
116  \note It will not take the ownership of the "dataset" pointer.
117  \note It will not take the ownership of the "dataType" pointer.
118  \note The caller will take the ownership of the returned histogram pointer.
119 
120  \return a new Histogram
121  */
122  TEQTWIDGETSEXPORT Histogram* createHistogram(te::da::DataSet* dataset, te::da::DataSetType* dataType, int propId);
123 
124  /*!
125  \brief Histogram Creator
126 
127  \param dataset The dataset that will be used to populate the histogram's data
128  \param dataType The dataType that will be used to recover the objectIds associated with the given dataset.
129  \param propId The id of the property that contains the data
130  \param slices The desired number of intervals, the default is 10 and this parameter is not used when the preperty is a string
131 
132  \note It will traverse the data set, using the moveNext() method
133  \note It will not take the ownership of the "dataset" pointer.
134  \note It will not take the ownership of the "dataType" pointer.
135  \note The caller will take the ownership of the returned ChartDisplayWidget pointer.
136 
137  */
138  TEQTWIDGETSEXPORT ChartDisplayWidget* createHistogramDisplay(te::da::DataSet* dataset, te::da::DataSetType* dataType, int propId, int slices = 10);
139 
140  /*!
141  \function Terralib2Qwt
142 
143  This function returns a default QwtText.
144 
145  \param title A text.
146 
147  \return A QwtText
148 
149  \note The caller will take the ownership of the returned pointer.
150  */
151  TEQTWIDGETSEXPORT QwtText* Terralib2Qwt(const std::string& title);
152 
153 
154  /*!
155  \function Terralib2Qwt
156 
157  This function translates TerraLib text styles into a QwtText.
158 
159  \param text A text
160  \param color The text's color
161  \param font The text's font
162  \param backFill The text's background fill
163  \param backStroke The text's background stroke
164 
165  \return A QwtText
166 
167  \note The caller will take the ownership of the returned pointer.
168  \note It will not take the ownership of given "font", "backFill" and "backStroke"" pointers.
169  */
170  TEQTWIDGETSEXPORT QwtText* Terralib2Qwt(const std::string& text, te::color::RGBAColor* color,
171  te::se::Font* font, te::se::Fill* backFill,
172  te::se::Stroke* backStroke);
173 
174  /*!
175  \function Mark2Symbol
176 
177  This function translates a terralib's Graphic object into a QWTSymbol object.
178 
179  \param graphic The graphic that will be used to generate the symbol.
180 
181  \return A QwtSymbol
182 
183  \note The caller will take the ownership of the returned pointer.
184  \note It will not take the ownership of the Graphic pointer.
185  */
186  TEQTWIDGETSEXPORT QwtSymbol* Terralib2Qwt(te::se::Graphic* graphic);
187 
188  } // end namespace widgets
189  } // end namespace qt
190 } // end namespace te
191 
192 #endif // __TERRALIB_QT_WIDGETS_INTERNAL_CHARTUTILS_H
193 
TEQTWIDGETSEXPORT ChartDisplayWidget * createHistogramDisplay(te::da::DataSet *dataset, te::da::DataSetType *dataType, int propId, int slices=10)
Histogram Creator.
Definition: Utils.cpp:517
TEQTWIDGETSEXPORT QwtText * Terralib2Qwt(const std::string &title)
Definition: Utils.cpp:549
A class that models the description of a dataset.
Definition: DataSetType.h:72
TEQTWIDGETSEXPORT Histogram * createHistogram(te::da::DataSet *dataset, te::da::DataSetType *dataType, int propId, int slices)
Histogram Creator.
Definition: Utils.cpp:291
TEQTWIDGETSEXPORT ChartDisplayWidget * createScatterDisplay(te::da::DataSet *dataset, te::da::DataSetType *dataType, int propX, int propY)
Scatter Creator.
Definition: Utils.cpp:268
A Graphic is a graphic symbol with an inherent shape, color(s), and possibly size.
Definition: Graphic.h:66
A Font specifies the text font to use in a text symbolizer.
Definition: Font.h:63
A Fill specifies the pattern for filling an area geometry.
Definition: Fill.h:59
TEQTWIDGETSEXPORT Scatter * createScatter(te::da::DataSet *dataset, te::da::DataSetType *dataType, int propX, int propY)
Scatter Creator.
Definition: Utils.cpp:160
A dataset is the unit of information manipulated by the data access module of TerraLib.
Definition: DataSet.h:112
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
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:66