QGIS API Documentation
3.99.0-Master (357b655ed83)
Loading...
Searching...
No Matches
src
gui
maptools
qgsmaptoolshapeabstract.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgsmaptoolshapeabstract.cpp
3
----------------------
4
begin : January 2022
5
copyright : (C) 2022 by Denis Rouzaud
6
email :
[email protected]
7
***************************************************************************/
8
9
/***************************************************************************
10
* *
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
15
* *
16
***************************************************************************/
17
18
#include "
qgsmaptoolshapeabstract.h
"
19
20
#include "
qgsgeometryrubberband.h
"
21
#include "
qgsmapcanvas.h
"
22
23
#include <QKeyEvent>
24
25
#include "moc_qgsmaptoolshapeabstract.cpp"
26
27
QgsMapToolShapeAbstract::~QgsMapToolShapeAbstract
()
28
{
29
clean
();
30
}
31
32
void
QgsMapToolShapeAbstract::keyPressEvent
( QKeyEvent *e )
33
{
34
e->ignore();
35
}
36
37
void
QgsMapToolShapeAbstract::keyReleaseEvent
( QKeyEvent *e )
38
{
39
e->ignore();
40
}
41
42
void
QgsMapToolShapeAbstract::clean
()
43
{
44
if
(
mTempRubberBand
)
45
{
46
delete
mTempRubberBand
;
47
mTempRubberBand
=
nullptr
;
48
}
49
50
mPoints
.clear();
51
}
52
53
void
QgsMapToolShapeAbstract::undo
()
54
{
55
if
(
mPoints
.count() == 1 )
56
clean
();
57
else
if
(
mPoints
.count() > 1 )
58
mPoints
.removeLast();
59
}
60
61
void
QgsMapToolShapeAbstract::setTransientGeometry
(
const
QgsGeometry
&geometry )
62
{
63
emit
transientGeometryChanged
(
QgsReferencedGeometry
( geometry,
mParentTool
->canvas()->mapSettings().destinationCrs() ) );
64
}
QgsGeometry
A geometry is the spatial representation of a feature.
Definition
qgsgeometry.h:178
QgsMapToolShapeAbstract::transientGeometryChanged
void transientGeometryChanged(const QgsReferencedGeometry &geometry)
Emitted whenever the geometry associated with the tool is changed, including transient (i....
QgsMapToolShapeAbstract::mPoints
QgsPointSequence mPoints
points (in map coordinates)
Definition
qgsmaptoolshapeabstract.h:135
QgsMapToolShapeAbstract::keyReleaseEvent
virtual void keyReleaseEvent(QKeyEvent *e)
Filters a key release event Ignores the event in default implementation.
Definition
qgsmaptoolshapeabstract.cpp:37
QgsMapToolShapeAbstract::undo
virtual void undo()
Called to undo last action (last point added).
Definition
qgsmaptoolshapeabstract.cpp:53
QgsMapToolShapeAbstract::clean
virtual void clean()
Called to clean the map tool (after canceling the operation or when the digitization has finished).
Definition
qgsmaptoolshapeabstract.cpp:42
QgsMapToolShapeAbstract::setTransientGeometry
void setTransientGeometry(const QgsGeometry &geometry)
Sets the current geometry, including transient (i.e.
Definition
qgsmaptoolshapeabstract.cpp:61
QgsMapToolShapeAbstract::mParentTool
QgsMapToolCapture * mParentTool
Definition
qgsmaptoolshapeabstract.h:132
QgsMapToolShapeAbstract::keyPressEvent
virtual void keyPressEvent(QKeyEvent *e)
Filters a key press event Ignores the event in default implementation.
Definition
qgsmaptoolshapeabstract.cpp:32
QgsMapToolShapeAbstract::mTempRubberBand
QgsGeometryRubberBand * mTempRubberBand
Definition
qgsmaptoolshapeabstract.h:137
QgsMapToolShapeAbstract::~QgsMapToolShapeAbstract
~QgsMapToolShapeAbstract() override
Definition
qgsmaptoolshapeabstract.cpp:27
QgsReferencedGeometry
A QgsGeometry with associated coordinate reference system.
Definition
qgsreferencedgeometry.h:153
qgsgeometryrubberband.h
qgsmapcanvas.h
qgsmaptoolshapeabstract.h
Generated on
for QGIS API Documentation by
1.15.0