SpatialWhereClauseWidget.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/SpatialWhereClauseWidget.h
22 
23  \brief This file has the DataSetWidget class.
24 */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_QUERY_INTERNAL_SPATIALWHERECLAUSEWIDGET_H
27 #define __TERRALIB_QT_WIDGETS_QUERY_INTERNAL_SPATIALWHERECLAUSEWIDGET_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 #include "WhereClauseWidget.h"
37 #endif
38 
39 // STL
40 #include <memory>
41 #include <map>
42 #include <set>
43 
44 // Qt
45 #include <QComboBox>
46 #include <QWidget>
47 
48 
49 namespace Ui { class SpatialWhereClauseWidgetForm; }
50 
51 namespace te
52 {
53  namespace qt
54  {
55  namespace widgets
56  {
57  /*!
58  \class WhereClauseWidget
59 
60  \brief This class is used to define the WHERE object of select operation.
61  */
63  {
64  Q_OBJECT
65 
66  public:
67 
68  SpatialWhereClauseWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
69 
71 
72  te::da::Where* getWhere();
73 
74  std::string getWhereString();
75 
76  public:
77 
78  void addLayer(te::map::AbstractLayerPtr layer);
79 
80  void removeLayer(te::map::AbstractLayerPtr layer);
81 
82  void setDataSource(const te::da::DataSourcePtr& ds);
83 
84  void setLayerList(std::list<te::map::AbstractLayerPtr>& layerList);
85 
86  void setFromItems(std::vector<std::pair<std::string, std::string> > vec);
87 
88  void setGeomAttributeList(const std::vector<std::string>& vec, int srid);
89 
90  void setSpatialOperatorsList(const std::vector<std::string>& vec);
91 
92  void setConnectorsList(const std::vector<std::string>& vec);
93 
94  void clear();
95 
96  void resetInterface();
97 
98  public slots:
99 
100  void onAddWhereClausePushButtonClicked();
101 
102  void onRemoveWhereClausePushButtonClicked();
103 
104  void onClearAllPushButtonClicked();
105 
106  void onComboBoxActivated(QString value);
107 
108  signals:
109 
110  void clausesChanged();
111 
112  protected:
113 
114  te::da::Expression* getExpression(const QString& value, const std::string& propName);
115 
116  void copyCombo(QComboBox* input, QComboBox* output, std::string curValue = "");
117 
118  QStringList getPropertyValues(std::string propertyName);
119 
120 
121  private:
122 
123  std::unique_ptr<Ui::SpatialWhereClauseWidgetForm> m_ui;
124 
126 
127  std::vector<std::pair<std::string, std::string> > m_fromItems;
128 
129  std::map<int, ExpressionProperty*> m_mapExp;
130 
131  std::map< QComboBox*, std::pair<int, int> > m_comboMap;
132 
133  QStringList m_connectorsList;
134 
135  int m_count;
136  int m_srid;
137  };
138 
139  } // end namespace widgets
140  } // end namespace qt
141 } // end namespace te
142 
143 #endif // __TERRALIB_QT_WIDGETS_QUERY_INTERNAL_SPATIALWHERECLAUSEWIDGET_H
#define slots
boost::shared_ptr< DataSource > DataSourcePtr
Definition: DataSource.h:1449
std::map< QComboBox *, std::pair< int, int > > m_comboMap
std::map< int, ExpressionProperty * > m_mapExp
This is an abstract class that models a query expression.
Definition: Expression.h:47
std::vector< std::pair< std::string, std::string > > m_fromItems
This file has the DataSetWidget class.
TerraLib.
A class that can be used to model a filter expression that can be applied to a query.
Definition: Where.h:47
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
std::unique_ptr< Ui::SpatialWhereClauseWidgetForm > m_ui