Loading...
Searching...
No Matches
WhereClauseWidget.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/query/WhereClauseWidget.h
22
23 \brief This file has the DataSetWidget class.
24*/
25
26#ifndef __TERRALIB_QT_WIDGETS_QUERY_INTERNAL_WHERECLAUSEWIDGET_H
27#define __TERRALIB_QT_WIDGETS_QUERY_INTERNAL_WHERECLAUSEWIDGET_H
28
29// TerraLib
30#include "../Config.h"
31#ifndef Q_MOC_RUN
32#include "../../../dataaccess/datasource/DataSource.h"
33#include "../../../dataaccess/query/Expression.h"
34#include "../../../dataaccess/query/Where.h"
35#include "../../../maptools/AbstractLayer.h"
36#endif
37
38// STL
39#include <memory>
40#include <map>
41#include <set>
42
43// Qt
44#include <QComboBox>
45#include <QWidget>
46
47
48namespace Ui { class WhereClauseWidgetForm; }
49
50namespace te
51{
52 namespace qt
53 {
54 namespace widgets
55 {
57 {
58 /*! \brief Default constructor. */
60 {
62 m_isSpatialCriteria = false;
63 m_isPropertyValue = false;
64 m_isValueValue = false;
65
66 m_property = "";
67 m_operator = "";
68 m_value = "";
69
70 m_expression = 0;
72 }
73
75 {
76 delete m_expression;
77 }
78
81
84
85 std::string m_property;
86 std::string m_operator;
87 std::string m_value;
88
90
91 QComboBox* m_valuesComboBox;
92 };
93
94 /*!
95 \class WhereClauseWidget
96
97 \brief This class is used to define the WHERE object of select operation.
98 */
99 class TEQTWIDGETSEXPORT WhereClauseWidget : public QWidget
100 {
101 Q_OBJECT
102
103 public:
104
105 WhereClauseWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
106
108
110
111 std::string getWhereString();
112
113 public:
114
116
118
120
121 void setLayerList(std::list<te::map::AbstractLayerPtr>& layerList);
122
123 void setFromItems(std::vector<std::pair<std::string, std::string> > vec);
124
125 void setAttributeList(const std::vector<std::string>& vec);
126
127 void setGeomAttributeList(const std::vector<std::string>& vec, int srid);
128
129 void setOperatorsList(const std::vector<std::string>& vec);
130
131 void setSpatialOperatorsList(const std::vector<std::string>& vec);
132
133 void setConnectorsList(const std::vector<std::string>& vec);
134
135 void setCriteriaTabEnabled(int index, bool enable);
136
137 void clear();
138
140
142
143 public slots:
144
146
148
150
152
154
155 void onComboBoxActivated(QString value);
156
157 signals:
158
160
161 protected:
162
163 te::da::Expression* getExpression(const QString& value, const std::string& propName);
164
165 void copyCombo(QComboBox* input, QComboBox* output, std::string curValue = "");
166
167 QStringList getPropertyValues(std::string propertyName);
168
169
170 private:
171
172 std::unique_ptr<Ui::WhereClauseWidgetForm> m_ui;
173
175
176 std::vector<std::pair<std::string, std::string> > m_fromItems;
177
178 std::map<int, ExpressionProperty*> m_mapExp;
179
180 std::map< QComboBox*, std::pair<int, int> > m_comboMap;
181
182 QStringList m_connectorsList;
183
186 };
187
188 } // end namespace widgets
189 } // end namespace qt
190} // end namespace te
191
192#endif // __TERRALIB_QT_WIDGETS_QUERY_INTERNAL_WHERECLAUSEWIDGET_H
This is an abstract class that models a query expression.
Definition: Expression.h:48
A class that can be used to model a filter expression that can be applied to a query.
Definition: Where.h:48
This class is used to define the WHERE object of select operation.
void copyCombo(QComboBox *input, QComboBox *output, std::string curValue="")
void setOperatorsList(const std::vector< std::string > &vec)
std::map< int, ExpressionProperty * > m_mapExp
void removeLayer(te::map::AbstractLayerPtr layer)
void setGeomAttributeList(const std::vector< std::string > &vec, int srid)
void setFromItems(std::vector< std::pair< std::string, std::string > > vec)
te::da::Expression * getExpression(const QString &value, const std::string &propName)
void addLayer(te::map::AbstractLayerPtr layer)
void setDataSource(const te::da::DataSourcePtr &ds)
std::map< QComboBox *, std::pair< int, int > > m_comboMap
void setAttributeList(const std::vector< std::string > &vec)
std::unique_ptr< Ui::WhereClauseWidgetForm > m_ui
void setLayerList(std::list< te::map::AbstractLayerPtr > &layerList)
void setConnectorsList(const std::vector< std::string > &vec)
void onRestrictValueComboBoxActivated(QString value)
QStringList getPropertyValues(std::string propertyName)
std::vector< std::pair< std::string, std::string > > m_fromItems
void setSpatialOperatorsList(const std::vector< std::string > &vec)
void setCriteriaTabEnabled(int index, bool enable)
WhereClauseWidget(QWidget *parent=0, Qt::WindowFlags f=0)
void onComboBoxActivated(QString value)
boost::shared_ptr< DataSource > DataSourcePtr
Definition: DataSource.h:1449
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
TerraLib.
#define slots
ExpressionProperty()
Default constructor.
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63