Skip to content

Commit efcbbfd

Browse files
m-kuhn3nids
authored andcommittedSep 11, 2015
Move maptools from app->gui
1 parent 26e9783 commit efcbbfd

File tree

122 files changed

+881
-832
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+881
-832
lines changed
 

‎python/gui/gui.sip

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
%Include qgsmaplayercombobox.sip
8080
%Include qgsmaplayermodel.sip
8181
%Include qgsmaplayerproxymodel.sip
82+
%Include qgsmapmouseevent.sip
8283
%Include qgsmapoverviewcanvas.sip
8384
%Include qgsmaptip.sip
8485
%Include qgsmaptool.sip

‎python/gui/qgsmapmouseevent.sip

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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+
/**
17+
* A QgsMapMouseEvent is the result of a user interaction with the mouse on a QgsMapCanvas.
18+
* It is sent whenever the user moves, clicks, releases or double clicks the mouse.
19+
* In addition to the coordiantes in pixel space it also knows the coordinates in the mapcanvas' CRS
20+
* as well as it knows the concept of snapping.
21+
*/
22+
class QgsMapMouseEvent : QMouseEvent
23+
{
24+
%TypeHeaderCode
25+
#include "qgsmapmouseevent.h"
26+
%End
27+
public:
28+
29+
enum SnappingMode
30+
{
31+
NoSnapping,
32+
SnapProjectConfig, //!< snap according to the configuration set in the snapping settings
33+
SnapAllLayers, //!< snap to all rendered layers (tolerance and type from defaultSettings())
34+
};
35+
36+
/**
37+
* Creates a new QgsMapMouseEvent. Should only be required to be called from the QgsMapCanvas.
38+
*
39+
* @param mapCanvas The map canvas on which the event occured
40+
* @param event The original mouse event
41+
*/
42+
QgsMapMouseEvent( QgsMapCanvas* mapCanvas, QMouseEvent* event );
43+
44+
/**
45+
* @brief snapPoint will snap the points using the map canvas snapping utils configuration
46+
* @note if snapping did not succeeded, the map point will be reset to its original position
47+
*/
48+
QgsPoint snapPoint( SnappingMode snappingMode );
49+
50+
/**
51+
* returns the first snapped segment. If the cached snapped match is a segment, it will simply return it.
52+
* Otherwise it will try to snap a segment according to the event's snapping mode. In this case the cache
53+
* will not be overwritten.
54+
* @param snapped if given, determines if a segment has been snapped
55+
* @param allLayers if true, override snapping mode
56+
*/
57+
QList<QgsPoint> snapSegment( SnappingMode snappingMode, bool* snapped = 0, bool allLayers = false ) const;
58+
59+
/**
60+
* Returns true if there is a snapped point cached.
61+
* Will only be useful after snapPoint has previously been called.
62+
*
63+
* @return True if there is a snapped point cached.
64+
*/
65+
bool isSnapped() const;
66+
67+
/**
68+
* @brief mapPoint returns the point in coordinates
69+
* @return the point in map coordinates, after snapping if requested in the event.
70+
*/
71+
QgsPoint mapPoint() const;
72+
73+
QgsPoint originalMapPoint() const;
74+
75+
QPoint pixelPoint() const;
76+
77+
QPoint originalPixelPoint() const;
78+
};

0 commit comments

Comments
 (0)
Please sign in to comment.