CreatePointTool.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/CreatePointTool.h
22 
23  \brief This class implements a concrete tool to create points.
24 */
25 
26 #ifndef __TERRALIB_EDIT_QT_INTERNAL_CREATEPOINTTOOL_H
27 #define __TERRALIB_EDIT_QT_INTERNAL_CREATEPOINTTOOL_H
28 
29 // TerraLib
30 #include "../../../geometry/Coord2D.h"
31 #ifndef Q_MOC_RUN
32 #include "../../../maptools/AbstractLayer.h"
33 #endif
34 #include "../Config.h"
35 #include "GeometriesUpdateTool.h"
36 
37 // STL
38 #include <vector>
39 
40 namespace te
41 {
42  namespace gm
43  {
44  class Geometry;
45  }
46 
47  namespace qt
48  {
49  namespace widgets
50  {
51  class MapDisplay;
52  }
53  }
54 
55  namespace edit
56  {
57  /*!
58  \class CreatePointTool
59 
60  \brief This class implements a concrete tool to create points.
61  */
63  {
64  Q_OBJECT
65 
66  public:
67 
68  /** @name Initializer Methods
69  * Methods related to instantiation and destruction.
70  */
71  //@{
72 
73  /*!
74  \brief It constructs a create line tool associated with the given map display.
75 
76  \param display The map display associated with the tool.
77  \param parent The tool's parent.
78 
79  \note The tool will NOT take the ownership of the given pointers.
80  */
81  CreatePointTool(te::qt::widgets::MapDisplay* display, const te::map::AbstractLayerPtr& layer, const QCursor& cursor, QObject* parent = 0);
82 
83  /*! \brief Destructor. */
84  ~CreatePointTool();
85 
86  //@}
87 
88  /** @name AbstractTool Methods
89  * Methods related with tool behavior.
90  */
91  //@{
92 
93  bool mousePressEvent(QMouseEvent* e);
94 
95  bool mouseDoubleClickEvent(QMouseEvent* e);
96 
97  void resetVisualizationTool();
98 
99  //@}
100 
101  te::gm::Geometry* buildPoint();
102 
103  private:
104 
105  void draw();
106 
107  void storeFeature();
108 
109  protected:
110 
111  std::vector<te::gm::Coord2D> m_coords; //!< The coord list managed by this tool.
112  bool m_isFinished; //!< A flag that indicates if the operations was finished.
113 
114  void clear();
115  };
116 
117  } // end namespace edit
118 } // end namespace te
119 
120 #endif // __TERRALIB_EDIT_QT_INTERNAL_CREATEPOINTTOOL_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
std::vector< te::gm::Coord2D > m_coords
The coord list managed by this tool.
URI C++ Library.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:74
bool m_isFinished
A flag that indicates if the operations was finished.
This class implements a concrete tool to create points.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr