QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
gui
qgsmapmouseevent.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsmapmouseevent.h - mouse event in map coordinates and ability to snap
3
----------------------
4
begin : October 2014
5
copyright : (C) Denis Rouzaud
6
email : denis.rouzaud@gmail.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 QGSMAPMOUSEEVENT_H
17
#define QGSMAPMOUSEEVENT_H
18
19
#include "qgis_gui.h"
20
#include "
qgspointlocator.h
"
21
#include "
qgspointxy.h
"
22
23
#include <QMouseEvent>
24
25
class
QgsMapCanvas
;
26
class
QgsMapToolAdvancedDigitizing
;
27
37
class
GUI_EXPORT
QgsMapMouseEvent
:
public
QMouseEvent
38
{
39
#ifdef SIP_RUN
40
SIP_CONVERT_TO_SUBCLASS_CODE
41
if
(
dynamic_cast<
QgsMapMouseEvent
*
>
( sipCpp ) )
42
sipType = sipType_QgsMapMouseEvent;
43
else
44
sipType = 0;
45
SIP_END
46
#endif
47
48
public
:
55
QgsMapMouseEvent
(
QgsMapCanvas
*mapCanvas, QMouseEvent *event );
56
67
QgsMapMouseEvent
(
68
QgsMapCanvas
*mapCanvas, QEvent::Type type, QPoint pos, Qt::MouseButton button = Qt::NoButton, Qt::MouseButtons buttons = Qt::NoButton, Qt::KeyboardModifiers modifiers = Qt::NoModifier
69
);
70
75
QgsPointXY
snapPoint
();
76
83
bool
isSnapped
()
const
{
return
mSnapMatch.isValid(); }
84
89
inline
QgsPointXY
mapPoint
()
const
{
return
mMapPoint; }
90
97
QgsPointLocator::Match
mapPointMatch
()
const
{
return
mSnapMatch; }
98
105
void
setMapPoint(
const
QgsPointXY
&point );
106
112
QgsPointXY
originalMapPoint
()
const
{
return
mMapPoint; }
113
119
QPoint
pixelPoint
()
const
{
return
mPixelPoint; }
120
127
QPoint
originalPixelPoint
()
const
{
return
pos(); }
128
136
void
snapToGrid(
double
precision,
const
QgsCoordinateReferenceSystem
&crs );
137
138
private
:
139
QPoint mapToPixelCoordinates(
const
QgsPointXY
&point );
140
142
bool
mHasCachedSnapResult;
143
145
QgsPointXY
mOriginalMapPoint;
146
148
QgsPointXY
mMapPoint;
149
154
QPoint mPixelPoint;
155
157
QgsMapCanvas
*mMapCanvas =
nullptr
;
158
159
QgsPointLocator::Match
mSnapMatch;
160
};
161
162
#endif
// QGSMAPMOUSEEVENT_H
QgsCoordinateReferenceSystem
Represents a coordinate reference system (CRS).
Definition
qgscoordinatereferencesystem.h:216
QgsMapCanvas
Map canvas is a class for displaying all GIS data types on a canvas.
Definition
qgsmapcanvas.h:96
QgsMapMouseEvent::originalPixelPoint
QPoint originalPixelPoint() const
The unsnapped, real mouse cursor position in pixel coordinates.
Definition
qgsmapmouseevent.h:127
QgsMapMouseEvent::originalMapPoint
QgsPointXY originalMapPoint() const
Returns the original, unmodified map point of the mouse cursor.
Definition
qgsmapmouseevent.h:112
QgsMapMouseEvent::isSnapped
bool isSnapped() const
Returns true if there is a snapped point cached.
Definition
qgsmapmouseevent.h:83
QgsMapMouseEvent::mapPoint
QgsPointXY mapPoint() const
mapPoint returns the point in coordinates
Definition
qgsmapmouseevent.h:89
QgsMapMouseEvent::QgsMapMouseEvent
QgsMapMouseEvent(QgsMapCanvas *mapCanvas, QMouseEvent *event)
Creates a new QgsMapMouseEvent.
Definition
qgsmapmouseevent.cpp:23
QgsMapMouseEvent::pixelPoint
QPoint pixelPoint() const
The snapped mouse cursor in pixel coordinates.
Definition
qgsmapmouseevent.h:119
QgsMapMouseEvent::mapPointMatch
QgsPointLocator::Match mapPointMatch() const
Returns the matching data from the most recently snapped point.
Definition
qgsmapmouseevent.h:97
QgsMapMouseEvent::snapPoint
QgsPointXY snapPoint()
snapPoint will snap the points using the map canvas snapping utils configuration
Definition
qgsmapmouseevent.cpp:41
QgsMapToolAdvancedDigitizing
A QgsMapTool which gives events directly in map coordinates and allows filtering of events.
Definition
qgsmaptooladvanceddigitizing.h:42
QgsPointXY
Represents a 2D point.
Definition
qgspointxy.h:62
SIP_CONVERT_TO_SUBCLASS_CODE
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition
qgis_sip.h:203
SIP_END
#define SIP_END
Definition
qgis_sip.h:220
qgspointlocator.h
qgspointxy.h
QgsPointLocator::Match
Definition
qgspointlocator.h:191
Generated on
for QGIS API Documentation by
1.17.0