EditInfoTool.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/edit/qt/tools/EditInfoTool.h
22 
23  \brief This class implements a concrete tool for edit attributes of geometry.
24 */
25 
26 #ifndef __TERRALIB_EDIT_QT_INTERNAL_EDITINFOTOOL_H
27 #define __TERRALIB_EDIT_QT_INTERNAL_EDITINFOTOOL_H
28 
29 // TerraLib
30 #include "../../../geometry/Envelope.h"
31 #ifndef Q_MOC_RUN
32 #include "../../../maptools/AbstractLayer.h"
33 #include "GeometriesUpdateTool.h"
34 #endif
35 #include "../Config.h"
36 
37 // Qt
38 #include <QPointF>
39 #include <QTreeWidget>
40 #include <QTreeWidgetItem>
41 #include <QDialog>
42 
43 namespace te
44 {
45  namespace qt
46  {
47  namespace widgets
48  {
49  class Canvas;
50  class MapDisplay;
51  }
52  }
53 
54  namespace edit
55  {
56 
58  {
59  Q_OBJECT
60 
61  public:
62  EditInfoTool(te::qt::widgets::MapDisplay* display, const te::map::AbstractLayerPtr& layer, QObject* parent = 0);
63 
64  ~EditInfoTool();
65 
66  //@}
67 
68  /** @name AbstractTool Methods
69  * Methods related with tool behavior.
70  */
71  //@{
72 
73  //bool mouseReleaseEvent(QMouseEvent* e);
74  bool mousePressEvent(QMouseEvent* e);
75 
76  //@}
77 
78  private:
79 
80  void draw();
81 
82  void updateCursor();
83 
84  void pickFeature(const te::map::AbstractLayerPtr& layer, const QPointF& pos);
85 
86  te::gm::Envelope buildEnvelope(const QPointF& pos);
87 
88  void getInfo(const te::gm::Envelope& e);
89 
90  std::auto_ptr<te::dt::AbstractData> getValue(int type, QString value) const;
91 
92  void storeFeature();
93 
94  te::da::DataSet* m_dataset; //!< The attributes dataset type.
95  std::map<std::size_t, te::dt::AbstractData*> m_data;
96  std::vector<std::size_t> m_restrictivePropertyPos;
97  QDialog* m_dialog;
98  QTreeWidget* m_infoWidget; //!< Widget used to show the informations.
99 
100  private slots:
101 
102  void onCancelPushButtonPressed();
103 
104  void onOkPushButtonPressed();
105 
106  void onAttributesTreeWidgetItemDoubleClicked(QTreeWidgetItem* item, int column);
107 
108  };
109 
110  } // end namespace edit
111 } // end namespace te
112 
113 #endif // __TERRALIB_EDIT_QT_INTERNAL_EDITINFOTOOL_H
#define TEEDITQTEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:60
A widget to control the display of a set of layers.
Definition: MapDisplay.h:69
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
URI C++ Library.
QTreeWidget * m_infoWidget
Widget used to show the informations.
Definition: EditInfoTool.h:98
A dataset is the unit of information manipulated by the data access module of TerraLib.
Definition: DataSet.h:112
std::vector< std::size_t > m_restrictivePropertyPos
Definition: EditInfoTool.h:96
te::da::DataSet * m_dataset
The attributes dataset type.
Definition: EditInfoTool.h:94
std::map< std::size_t, te::dt::AbstractData * > m_data
Definition: EditInfoTool.h:95
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr