Loading...
Searching...
No Matches
PolygonAcquire.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/tools/PolygonAcquire.h
22
23 \brief This class implements a concrete tool to acquire a polygon geometry
24*/
25
26#ifndef __TERRALIB_QT_WIDGETS_INTERNAL_POLYGONACQUIRE_H
27#define __TERRALIB_QT_WIDGETS_INTERNAL_POLYGONACQUIRE_H
28
29// TerraLib
30#include "../../../geometry/Coord2D.h"
31#include "../../../geometry/Polygon.h"
32#include "../Config.h"
33#include "AbstractTool.h"
34
35// Qt
36#include <QPainterPath>
37#include <QPen>
38
39// STL
40#include <vector>
41#include <string>
42
43namespace te
44{
45 namespace qt
46 {
47 namespace widgets
48 {
49// Forward declarations
50 class Canvas;
51 class MapDisplay;
52
53 /*!
54 \class PolygonAcquire
55
56 \brief This class implements a concrete tool to acquire a polygon geometry
57 */
59 {
60 Q_OBJECT
61
62 public:
63
64 /** @name Initializer Methods
65 * Methods related to instantiation and destruction.
66 */
67 //@{
68
69 /*!
70 \brief It constructs a PolygonAcquire tool associated with the given map display.
71
72 \param display The map display associated with the tool.
73 \param parent The tool's parent.
74
75 \note The tool will NOT take the ownership of the given pointers.
76 */
77 PolygonAcquire(MapDisplay* display, QObject* parent = 0);
78
79 /*! \brief Destructor. */
81
82 //@}
83
84 /** @name AbstractTool Methods
85 * Methods related with tool behavior.
86 */
87 //@{
88
89 bool mousePressEvent(QMouseEvent* e);
90
91 bool mouseMoveEvent(QMouseEvent* e);
92
93 bool mouseReleaseEvent(QMouseEvent* e);
94
95 bool mouseDoubleClickEvent(QMouseEvent* e);
96
97 //@}
98
99 private:
100
102
103 void drawLine(Canvas& canvas);
104
105 void drawPolygon(Canvas& canvas);
106
107 void clear();
108
109 private slots:
110
112
113 signals:
114
116
117 protected:
118
119 std::vector<te::gm::Coord2D> m_coords; //!< The coord list managed by the measure tool.
120 te::gm::Coord2D m_lastPos; //!< The last position captured on mouse move event.
121 QPen m_pen; //!< The pen used to draw the path.
122 QBrush m_brush; //!< The brush used to draw the path.
123 bool m_isFinished; //!< A flag that indicates if the operations was finished.
124 };
125
126 } // end namespace widgets
127 } // end namespace qt
128} // end namespace te
129
130#endif // __TERRALIB_QT_WIDGETS_INTERNAL_POLYGONACQUIRE_H
Abstract tool concept.
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
Definition: Polygon.h:51
This class defines an interface for objects that can receive application events and respond to them,...
Definition: AbstractTool.h:64
A canvas built on top of Qt.
Definition: Canvas.h:55
A widget to control the display of a set of layers.
Definition: MapDisplay.h:72
This class implements a concrete tool to acquire a polygon geometry.
QBrush m_brush
The brush used to draw the path.
te::gm::Coord2D m_lastPos
The last position captured on mouse move event.
bool mouseReleaseEvent(QMouseEvent *e)
This event handler can be reimplemented in a concrete tool class to receive mouse release events for ...
bool mouseMoveEvent(QMouseEvent *e)
This event handler can be reimplemented in a concrete tool class to receive mouse move events for the...
void polygonAquired(te::gm::Polygon *poly)
QPen m_pen
The pen used to draw the path.
void drawLine(Canvas &canvas)
std::vector< te::gm::Coord2D > m_coords
The coord list managed by the measure tool.
bool mousePressEvent(QMouseEvent *e)
This event handler can be reimplemented in a concrete tool class to receive mouse press events for th...
void drawPolygon(Canvas &canvas)
bool m_isFinished
A flag that indicates if the operations was finished.
bool mouseDoubleClickEvent(QMouseEvent *e)
This event handler can be reimplemented in a concrete tool class to receive mouse double click events...
PolygonAcquire(MapDisplay *display, QObject *parent=0)
It constructs a PolygonAcquire tool associated with the given map display.
TerraLib.
#define slots
An utility struct for representing 2D coordinates.
Definition: Coord2D.h:41
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63