QGIS API Documentation
3.14.0-Pi (9f7028fd23)
src
gui
qgsmaptoolextent.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsmaptoolextent.h - map tool that emits an extent
3
---------------------
4
begin : July 2017
5
copyright : (C) 2017 by Mathieu Pellerin
6
email : nirvn dot asia at gmail dot com
7
***************************************************************************
8
* *
9
* This program is free software; you can redistribute it and/or modify *
10
* it under the terms of the GNU General Public License as published by *
11
* the Free Software Foundation; either version 2 of the License, or *
12
* (at your option) any later version. *
13
* *
14
***************************************************************************/
15
16
#ifndef QGSMAPTOOLEXTENT_H
17
#define QGSMAPTOOLEXTENT_H
18
19
#include "
qgsmaptool.h
"
20
#include "
qgspointxy.h
"
21
#include "
qgsrubberband.h
"
22
#include "qgis_gui.h"
23
#include "
qobjectuniqueptr.h
"
24
25
class
QgsMapCanvas
;
26
27
33
class
GUI_EXPORT
QgsMapToolExtent
:
public
QgsMapTool
34
{
35
Q_OBJECT
36
37
public
:
38
40
QgsMapToolExtent
(
QgsMapCanvas
*canvas );
41
42
Flags
flags
()
const override
{
return
QgsMapTool::AllowZoomRect
; }
43
void
canvasMoveEvent
(
QgsMapMouseEvent
*e )
override
;
44
void
canvasPressEvent
(
QgsMapMouseEvent
*e )
override
;
45
void
canvasReleaseEvent
(
QgsMapMouseEvent
*e )
override
;
46
void
activate
()
override
;
47
void
deactivate
()
override
;
48
54
void
setRatio
( QSize ratio ) { mRatio = ratio; }
55
60
QSize
ratio
()
const
{
return
mRatio; }
61
65
QgsRectangle
extent()
const
;
66
67
signals:
68
70
void
extentChanged(
const
QgsRectangle
&extent );
71
72
private
:
73
74
void
calculateEndPoint(
QgsPointXY
&point );
75
76
void
drawExtent();
77
78
QObjectUniquePtr< QgsRubberBand >
mRubberBand;
79
80
QgsPointXY
mStartPoint;
81
QgsPointXY
mEndPoint;
82
83
bool
mDraw =
false
;
84
85
QSize mRatio;
86
87
};
88
89
#endif
QgsMapCanvas
Definition:
qgsmapcanvas.h:83
QgsMapTool::deactivate
virtual void deactivate()
called when map tool is being deactivated
Definition:
qgsmaptool.cpp:99
QgsRectangle
Definition:
qgsrectangle.h:41
qgsrubberband.h
QgsMapTool
Definition:
qgsmaptool.h:63
QObjectUniquePtr< QgsRubberBand >
qgsmaptool.h
qobjectuniqueptr.h
QgsMapTool::activate
virtual void activate()
called when set as currently active map tool
Definition:
qgsmaptool.cpp:83
QgsPointXY
Definition:
qgspointxy.h:43
QgsMapTool::canvasPressEvent
virtual void canvasPressEvent(QgsMapMouseEvent *e)
Mouse press event for overriding. Default implementation does nothing.
Definition:
qgsmaptool.cpp:167
QgsMapMouseEvent
Definition:
qgsmapmouseevent.h:35
QgsMapTool::canvasMoveEvent
virtual void canvasMoveEvent(QgsMapMouseEvent *e)
Mouse move event for overriding. Default implementation does nothing.
Definition:
qgsmaptool.cpp:157
QgsMapTool::canvasReleaseEvent
virtual void canvasReleaseEvent(QgsMapMouseEvent *e)
Mouse release event for overriding. Default implementation does nothing.
Definition:
qgsmaptool.cpp:172
QgsMapToolExtent
Definition:
qgsmaptoolextent.h:33
QgsMapTool::AllowZoomRect
@ AllowZoomRect
Allow zooming by rectangle (by holding shift and dragging) while the tool is active.
Definition:
qgsmaptool.h:95
QgsMapToolExtent::flags
Flags flags() const override
Returns the flags for the map tool.
Definition:
qgsmaptoolextent.h:42
QgsMapToolExtent::ratio
QSize ratio() const
Returns the current fixed aspect ratio to be used when dragging extent onto the canvas.
Definition:
qgsmaptoolextent.h:60
QgsMapToolExtent::setRatio
void setRatio(QSize ratio)
Sets a fixed aspect ratio to be used when dragging extent onto the canvas.
Definition:
qgsmaptoolextent.h:54
qgspointxy.h
Generated on Mon Jun 22 2020 05:14:09 for QGIS API Documentation by
1.8.17