Skip to content
Permalink
Browse files

Move maptools from app->gui

  • Loading branch information
m-kuhn authored and 3nids committed Sep 11, 2015
1 parent 26e9783 commit efcbbfdaeb911a416a25cff8ff8ca22375b3ec06
Showing with 881 additions and 832 deletions.
  1. +1 −0 python/gui/gui.sip
  2. +78 −0 python/gui/qgsmapmouseevent.sip
  3. +4 −4 python/gui/qgsmaptool.sip
  4. +3 −3 python/gui/qgsmaptoolemitpoint.sip
  5. +3 −3 python/gui/qgsmaptoolidentify.sip
  6. +1 −1 python/gui/qgsmaptoolidentifyfeature.sip
  7. +2 −2 python/gui/qgsmaptoolpan.sip
  8. +3 −3 python/gui/qgsmaptooltouch.sip
  9. +3 −4 python/gui/qgsmaptoolzoom.sip
  10. +0 −10 src/app/CMakeLists.txt
  11. +3 −5 src/app/nodetool/qgsmaptoolnodetool.cpp
  12. +3 −3 src/app/nodetool/qgsmaptoolnodetool.h
  13. +0 −86 src/app/qgsmapmouseevent.h
  14. +14 −4 src/app/qgsmaptooladdcircularstring.cpp
  15. +1 −1 src/app/qgsmaptooladdcircularstring.h
  16. +5 −6 src/app/qgsmaptooladdfeature.cpp
  17. +1 −1 src/app/qgsmaptooladdfeature.h
  18. +4 −3 src/app/qgsmaptooladdpart.cpp
  19. +1 −1 src/app/qgsmaptooladdpart.h
  20. +4 −3 src/app/qgsmaptooladdring.cpp
  21. +1 −1 src/app/qgsmaptooladdring.h
  22. +0 −122 src/app/qgsmaptooladvanceddigitizing.cpp
  23. +4 −4 src/app/qgsmaptoolannotation.cpp
  24. +4 −4 src/app/qgsmaptoolannotation.h
  25. +2 −2 src/app/qgsmaptoolchangelabelproperties.cpp
  26. +2 −2 src/app/qgsmaptoolchangelabelproperties.h
  27. +4 −3 src/app/qgsmaptoolcircularstringcurvepoint.cpp
  28. +2 −2 src/app/qgsmaptoolcircularstringcurvepoint.h
  29. +8 −4 src/app/qgsmaptoolcircularstringradius.cpp
  30. +2 −2 src/app/qgsmaptoolcircularstringradius.h
  31. +4 −3 src/app/qgsmaptooldeletepart.cpp
  32. +3 −3 src/app/qgsmaptooldeletepart.h
  33. +5 −4 src/app/qgsmaptooldeletering.cpp
  34. +3 −3 src/app/qgsmaptooldeletering.h
  35. +3 −3 src/app/qgsmaptoolfeatureaction.cpp
  36. +3 −3 src/app/qgsmaptoolfeatureaction.h
  37. +4 −4 src/app/qgsmaptoolfillring.cpp
  38. +1 −1 src/app/qgsmaptoolfillring.h
  39. +3 −3 src/app/qgsmaptoolidentifyaction.cpp
  40. +3 −3 src/app/qgsmaptoolidentifyaction.h
  41. +2 −2 src/app/qgsmaptoolmeasureangle.cpp
  42. +2 −2 src/app/qgsmaptoolmeasureangle.h
  43. +6 −3 src/app/qgsmaptoolmovefeature.cpp
  44. +3 −3 src/app/qgsmaptoolmovefeature.h
  45. +3 −3 src/app/qgsmaptoolmovelabel.cpp
  46. +3 −3 src/app/qgsmaptoolmovelabel.h
  47. +2 −2 src/app/qgsmaptooloffsetcurve.cpp
  48. +2 −2 src/app/qgsmaptooloffsetcurve.h
  49. +3 −3 src/app/qgsmaptoolpinlabels.cpp
  50. +3 −3 src/app/qgsmaptoolpinlabels.h
  51. +5 −2 src/app/qgsmaptoolreshape.cpp
  52. +1 −1 src/app/qgsmaptoolreshape.h
  53. +2 −2 src/app/qgsmaptoolrotatefeature.cpp
  54. +2 −2 src/app/qgsmaptoolrotatefeature.h
  55. +3 −3 src/app/qgsmaptoolrotatelabel.cpp
  56. +3 −3 src/app/qgsmaptoolrotatelabel.h
  57. +14 −6 src/app/qgsmaptoolrotatepointsymbols.cpp
  58. +3 −3 src/app/qgsmaptoolrotatepointsymbols.h
  59. +1 −1 src/app/qgsmaptoolselect.cpp
  60. +1 −1 src/app/qgsmaptoolselect.h
  61. +3 −3 src/app/qgsmaptoolselectfreehand.cpp
  62. +3 −3 src/app/qgsmaptoolselectfreehand.h
  63. +2 −2 src/app/qgsmaptoolselectpolygon.cpp
  64. +2 −2 src/app/qgsmaptoolselectpolygon.h
  65. +3 −3 src/app/qgsmaptoolselectradius.cpp
  66. +3 −3 src/app/qgsmaptoolselectradius.h
  67. +3 −3 src/app/qgsmaptoolselectrectangle.cpp
  68. +3 −3 src/app/qgsmaptoolselectrectangle.h
  69. +3 −3 src/app/qgsmaptoolshowhidelabels.cpp
  70. +3 −3 src/app/qgsmaptoolshowhidelabels.h
  71. +4 −3 src/app/qgsmaptoolsimplify.cpp
  72. +3 −3 src/app/qgsmaptoolsimplify.h
  73. +2 −2 src/app/qgsmaptoolsplitfeatures.cpp
  74. +1 −1 src/app/qgsmaptoolsplitfeatures.h
  75. +2 −2 src/app/qgsmaptoolsplitparts.cpp
  76. +1 −1 src/app/qgsmaptoolsplitparts.h
  77. +3 −3 src/app/qgsmeasuretool.cpp
  78. +3 −3 src/app/qgsmeasuretool.h
  79. +14 −4 src/gui/CMakeLists.txt
  80. 0 src/{app → gui}/qgsadvanceddigitizingcanvasitem.cpp
  81. 0 src/{app → gui}/qgsadvanceddigitizingcanvasitem.h
  82. +104 −141 src/{app → gui}/qgsadvanceddigitizingdockwidget.cpp
  83. +52 −39 src/{app → gui}/qgsadvanceddigitizingdockwidget.h
  84. +11 −7 src/gui/qgsmapcanvas.cpp
  85. +63 −50 src/{app → gui}/qgsmapmouseevent.cpp
  86. +115 −0 src/gui/qgsmapmouseevent.h
  87. +4 −4 src/gui/qgsmaptool.cpp
  88. +5 −4 src/gui/qgsmaptool.h
  89. +72 −0 src/gui/qgsmaptooladvanceddigitizing.cpp
  90. +24 −35 src/{app → gui}/qgsmaptooladvanceddigitizing.h
  91. +29 −41 src/{app → gui}/qgsmaptoolcapture.cpp
  92. +11 −15 src/{app → gui}/qgsmaptoolcapture.h
  93. +2 −13 src/{app → gui}/qgsmaptooledit.cpp
  94. +2 −2 src/{app → gui}/qgsmaptooledit.h
  95. +3 −3 src/gui/qgsmaptoolemitpoint.cpp
  96. +3 −3 src/gui/qgsmaptoolemitpoint.h
  97. +3 −3 src/gui/qgsmaptoolidentify.cpp
  98. +3 −3 src/gui/qgsmaptoolidentify.h
  99. +1 −1 src/gui/qgsmaptoolidentifyfeature.cpp
  100. +1 −1 src/gui/qgsmaptoolidentifyfeature.h
  101. +2 −2 src/gui/qgsmaptoolpan.cpp
  102. +2 −2 src/gui/qgsmaptoolpan.h
  103. +3 −3 src/gui/qgsmaptooltouch.cpp
  104. +3 −3 src/gui/qgsmaptooltouch.h
  105. +3 −3 src/gui/qgsmaptoolzoom.cpp
  106. +3 −3 src/gui/qgsmaptoolzoom.h
  107. +3 −3 src/plugins/coordinate_capture/coordinatecapturemaptool.cpp
  108. +3 −3 src/plugins/coordinate_capture/coordinatecapturemaptool.h
  109. +1 −1 src/plugins/evis/idtool/eviseventidtool.cpp
  110. +1 −1 src/plugins/evis/idtool/eviseventidtool.h
  111. +1 −1 src/plugins/georeferencer/qgsgeoreftooladdpoint.cpp
  112. +1 −1 src/plugins/georeferencer/qgsgeoreftooladdpoint.h
  113. +1 −1 src/plugins/georeferencer/qgsgeoreftooldeletepoint.cpp
  114. +1 −1 src/plugins/georeferencer/qgsgeoreftooldeletepoint.h
  115. +3 −3 src/plugins/georeferencer/qgsgeoreftoolmovepoint.cpp
  116. +3 −3 src/plugins/georeferencer/qgsgeoreftoolmovepoint.h
  117. +1 −1 src/plugins/georeferencer/qgsmapcoordsdialog.h
  118. +2 −2 src/plugins/grass/qgsgrassedittools.cpp
  119. +2 −2 src/plugins/grass/qgsgrassedittools.h
  120. +3 −3 src/plugins/grass/qgsgrassregion.cpp
  121. +3 −3 src/plugins/grass/qgsgrassregion.h
  122. +8 −3 tests/src/gui/testqgsmaptoolzoom.cpp
@@ -79,6 +79,7 @@
%Include qgsmaplayercombobox.sip
%Include qgsmaplayermodel.sip
%Include qgsmaplayerproxymodel.sip
%Include qgsmapmouseevent.sip
%Include qgsmapoverviewcanvas.sip
%Include qgsmaptip.sip
%Include qgsmaptool.sip
@@ -0,0 +1,78 @@
/***************************************************************************
qgsmapmouseevent.h - mouse event in map coordinates and ability to snap
----------------------
begin : October 2014
copyright : (C) Denis Rouzaud
email : denis.rouzaud@gmail.com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

/**
* A QgsMapMouseEvent is the result of a user interaction with the mouse on a QgsMapCanvas.
* It is sent whenever the user moves, clicks, releases or double clicks the mouse.
* In addition to the coordiantes in pixel space it also knows the coordinates in the mapcanvas' CRS
* as well as it knows the concept of snapping.
*/
class QgsMapMouseEvent : QMouseEvent
{
%TypeHeaderCode
#include "qgsmapmouseevent.h"
%End
public:

enum SnappingMode
{
NoSnapping,
SnapProjectConfig, //!< snap according to the configuration set in the snapping settings
SnapAllLayers, //!< snap to all rendered layers (tolerance and type from defaultSettings())
};

/**
* Creates a new QgsMapMouseEvent. Should only be required to be called from the QgsMapCanvas.
*
* @param mapCanvas The map canvas on which the event occured
* @param event The original mouse event
*/
QgsMapMouseEvent( QgsMapCanvas* mapCanvas, QMouseEvent* event );

/**
* @brief snapPoint will snap the points using the map canvas snapping utils configuration
* @note if snapping did not succeeded, the map point will be reset to its original position
*/
QgsPoint snapPoint( SnappingMode snappingMode );

/**
* returns the first snapped segment. If the cached snapped match is a segment, it will simply return it.
* Otherwise it will try to snap a segment according to the event's snapping mode. In this case the cache
* will not be overwritten.
* @param snapped if given, determines if a segment has been snapped
* @param allLayers if true, override snapping mode
*/
QList<QgsPoint> snapSegment( SnappingMode snappingMode, bool* snapped = 0, bool allLayers = false ) const;

/**
* Returns true if there is a snapped point cached.
* Will only be useful after snapPoint has previously been called.
*
* @return True if there is a snapped point cached.
*/
bool isSnapped() const;

/**
* @brief mapPoint returns the point in coordinates
* @return the point in map coordinates, after snapping if requested in the event.
*/
QgsPoint mapPoint() const;

QgsPoint originalMapPoint() const;

QPoint pixelPoint() const;

QPoint originalPixelPoint() const;
};
@@ -36,16 +36,16 @@ class QgsMapTool : QObject
virtual ~QgsMapTool();

//! Mouse move event for overriding. Default implementation does nothing.
virtual void canvasMoveEvent( QMouseEvent * e );
virtual void canvasMoveEvent( QgsMapMouseEvent* e );

//! Mouse double click event for overriding. Default implementation does nothing.
virtual void canvasDoubleClickEvent( QMouseEvent * e );
virtual void canvasDoubleClickEvent( QgsMapMouseEvent* e );

//! Mouse press event for overriding. Default implementation does nothing.
virtual void canvasPressEvent( QMouseEvent * e );
virtual void canvasPressEvent( QgsMapMouseEvent* e );

//! Mouse release event for overriding. Default implementation does nothing.
virtual void canvasReleaseEvent( QMouseEvent * e );
virtual void canvasReleaseEvent( QgsMapMouseEvent* e );

//! Mouse wheel event for overriding. Default implementation does nothing.
virtual void wheelEvent( QWheelEvent* e );
@@ -10,13 +10,13 @@ class QgsMapToolEmitPoint : QgsMapTool
QgsMapToolEmitPoint( QgsMapCanvas* canvas );

//! Overridden mouse move event
virtual void canvasMoveEvent( QMouseEvent * e );
virtual void canvasMoveEvent( QgsMapMouseEvent * e );

//! Overridden mouse press event - emits the signal
virtual void canvasPressEvent( QMouseEvent * e );
virtual void canvasPressEvent( QgsMapMouseEvent * e );

//! Overridden mouse release event
virtual void canvasReleaseEvent( QMouseEvent * e );
virtual void canvasReleaseEvent( QgsMapMouseEvent * e );

signals:
//! signal emitted on canvas click
@@ -48,13 +48,13 @@ class QgsMapToolIdentify : QgsMapTool
virtual ~QgsMapToolIdentify();

//! Overridden mouse move event
virtual void canvasMoveEvent( QMouseEvent * e );
virtual void canvasMoveEvent( QgsMapMouseEvent * e );

//! Overridden mouse press event
virtual void canvasPressEvent( QMouseEvent * e );
virtual void canvasPressEvent( QgsMapMouseEvent * e );

//! Overridden mouse release event
virtual void canvasReleaseEvent( QMouseEvent * e );
virtual void canvasReleaseEvent( QgsMapMouseEvent * e );

virtual void activate();

@@ -17,7 +17,7 @@ class QgsMapToolIdentifyFeature : QgsMapToolIdentify
//! change the layer used by the map tool to identify
void setLayer( QgsVectorLayer* vl );

void canvasReleaseEvent( QMouseEvent* e );
void canvasReleaseEvent( QgsMapMouseEvent* e );

signals:
void featureIdentified( QgsFeature );
@@ -10,10 +10,10 @@ class QgsMapToolPan : QgsMapTool
QgsMapToolPan( QgsMapCanvas* canvas );

//! Overridden mouse move event
virtual void canvasMoveEvent( QMouseEvent * e );
virtual void canvasMoveEvent( QgsMapMouseEvent * e );

//! Overridden mouse release event
virtual void canvasReleaseEvent( QMouseEvent * e );
virtual void canvasReleaseEvent( QgsMapMouseEvent * e );

virtual bool isTransient();
};
@@ -15,13 +15,13 @@ class QgsMapToolTouch : QgsMapTool
void deactivate();

//! Overridden mouse move event
virtual void canvasMoveEvent( QMouseEvent * e );
virtual void canvasMoveEvent( QgsMapMouseEvent * e );

//! Overridden mouse release event
virtual void canvasReleaseEvent( QMouseEvent * e );
virtual void canvasReleaseEvent( QgsMapMouseEvent * e );

//! Overridden Mouse double click event.
virtual void canvasDoubleClickEvent( QMouseEvent * e );
virtual void canvasDoubleClickEvent( QgsMapMouseEvent * e );

virtual bool isTransient();

@@ -12,19 +12,18 @@ class QgsMapToolZoom : QgsMapTool
~QgsMapToolZoom();

//! Overridden mouse move event
virtual void canvasMoveEvent( QMouseEvent * e );
virtual void canvasMoveEvent( QgsMapMouseEvent* e );

//! Overridden mouse press event
virtual void canvasPressEvent( QMouseEvent * e );
virtual void canvasPressEvent( QgsMapMouseEvent* e );

//! Overridden mouse release event
virtual void canvasReleaseEvent( QMouseEvent * e );
virtual void canvasReleaseEvent( QgsMapMouseEvent* e );

//! indicates whether we're zooming in or out
virtual bool isTransient();

//! Flag to indicate a map canvas drag operation is taking place
virtual void deactivate();

};

@@ -15,8 +15,6 @@ SET(QGIS_APP_SRCS
qgsattributetabledialog.cpp
qgsbookmarks.cpp
qgsbrowserdockwidget.cpp
qgsadvanceddigitizingdockwidget.cpp
qgsadvanceddigitizingcanvasitem.cpp
qgsclipboard.cpp
qgsconfigureshortcutsdialog.cpp
qgscustomization.cpp
@@ -47,7 +45,6 @@ SET(QGIS_APP_SRCS
qgslabelpreview.cpp
qgsloadstylefromdbdialog.cpp
qgsmaplayerstyleguiutils.cpp
qgsmapmouseevent.cpp
qgssavestyletodbdialog.cpp
qgsguivectorlayertools.cpp
qgswelcomepageitemsmodel.cpp
@@ -59,19 +56,16 @@ SET(QGIS_APP_SRCS
qgsmaptooladdring.cpp
qgsmaptoolfillring.cpp
qgsmaptoolannotation.cpp
qgsmaptoolcapture.cpp
qgsmaptoolchangelabelproperties.cpp
qgsmaptooldeletering.cpp
qgsmaptooldeletepart.cpp
qgsmaptooledit.cpp
qgsmaptoolfeatureaction.cpp
qgsmaptoolformannotation.cpp
qgsmaptoolhtmlannotation.cpp
qgsmaptoolpinlabels.cpp
qgsmaptoolshowhidelabels.cpp
qgsmaptoolidentifyaction.cpp
qgsmaptoollabel.cpp
qgsmaptooladvanceddigitizing.cpp
qgsmaptoolmeasureangle.cpp
qgsmaptoolmovefeature.cpp
qgsmaptoolmovelabel.cpp
@@ -181,7 +175,6 @@ SET (QGIS_APP_MOC_HDRS
qgsattributetabledialog.h
qgsbookmarks.h
qgsbrowserdockwidget.h
qgsadvanceddigitizingdockwidget.h
qgsclipboard.h
qgsconfigureshortcutsdialog.h
qgscustomization.h
@@ -220,11 +213,9 @@ SET (QGIS_APP_MOC_HDRS
qgsversioninfo.h

qgsmaptooladdfeature.h
qgsmaptoolcapture.h
qgsmaptoolcircularstringradius.h
qgsmaptooladdpart.h
qgsmaptooladdring.h
qgsmaptooledit.h
qgsmaptoolfillring.h
qgsmaptoolchangelabelproperties.h
qgsmaptooldeletepart.h
@@ -233,7 +224,6 @@ SET (QGIS_APP_MOC_HDRS
qgsmaptoolpinlabels.h
qgsmaptoolshowhidelabels.h
qgsmaptoolidentifyaction.h
qgsmaptooladvanceddigitizing.h
qgsmaptoolmeasureangle.h
qgsmaptoolmovefeature.h
qgsmaptoolmovelabel.h
@@ -38,16 +38,14 @@ QgsMapToolNodeTool::QgsMapToolNodeTool( QgsMapCanvas* canvas )
, mIsPoint( false )
{
mSnapper.setMapCanvas( canvas );
mCadAllowed = true;
mSnapOnPress = true;
}

QgsMapToolNodeTool::~QgsMapToolNodeTool()
{
cleanTool();
}

void QgsMapToolNodeTool::canvasMapPressEvent( QgsMapMouseEvent* e )
void QgsMapToolNodeTool::canvasPressEvent( QgsMapMouseEvent* e )
{
removeRubberBands();
QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( mCanvas->currentLayer() );
@@ -122,7 +120,7 @@ void QgsMapToolNodeTool::canvasMapPressEvent( QgsMapMouseEvent* e )
}
}

void QgsMapToolNodeTool::canvasMapMoveEvent( QgsMapMouseEvent* e )
void QgsMapToolNodeTool::canvasMoveEvent( QgsMapMouseEvent* e )
{
if ( !mSelectedFeature || !mSelectedFeature->hasSelection() )
{
@@ -228,7 +226,7 @@ void QgsMapToolNodeTool::cleanTool( bool deleteSelectedFeature )
}
}

void QgsMapToolNodeTool::canvasDoubleClickEvent( QMouseEvent * e )
void QgsMapToolNodeTool::canvasDoubleClickEvent( QgsMapMouseEvent* e )
{
if ( !mSelectedFeature )
return;
@@ -34,13 +34,13 @@ class QgsMapToolNodeTool: public QgsMapToolEdit
QgsMapToolNodeTool( QgsMapCanvas* canvas );
virtual ~QgsMapToolNodeTool();

void canvasDoubleClickEvent( QMouseEvent * e ) override;
void canvasDoubleClickEvent( QgsMapMouseEvent* e ) override;

//! mouse press event in map coordinates (eventually filtered) to be redefined in subclass
void canvasMapPressEvent( QgsMapMouseEvent* e ) override;
void canvasPressEvent( QgsMapMouseEvent* e ) override;

//! mouse move event in map coordinates (eventually filtered) to be redefined in subclass
void canvasMapMoveEvent( QgsMapMouseEvent* e ) override;
void canvasMoveEvent( QgsMapMouseEvent* e ) override;

void keyPressEvent( QKeyEvent* e ) override;

0 comments on commit efcbbfd

Please sign in to comment.
You can’t perform that action at this time.