Skip to content

Commit

Permalink
Doxymentation
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn authored and 3nids committed Sep 11, 2015
1 parent efcbbfd commit dae0d4a
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/gui/qgsmapmouseevent.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ class GUI_EXPORT QgsMapMouseEvent : public QMouseEvent
*/
QgsMapMouseEvent( QgsMapCanvas* mapCanvas, QMouseEvent* event );

/**
* 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 type The type of the event
* @param pos The pixel position of the mouse
* @param button The pressed button
* @param buttons Further buttons that are pressed
* @param modifiers Keyboard modifiers
*/
QgsMapMouseEvent( QgsMapCanvas* mapCanvas, Type type, const QPoint &pos, Qt::MouseButton button = Qt::NoButton,
Qt::MouseButtons buttons = Qt::NoButton, Qt::KeyboardModifiers modifiers = Qt::NoModifier );

Expand Down Expand Up @@ -82,12 +92,34 @@ class GUI_EXPORT QgsMapMouseEvent : public QMouseEvent
*/
inline QgsPoint mapPoint() const { return mMapPoint; }

/**
* Set the (snapped) point this event points to in map coordinates.
* The point in pixel coordinates will be calculated accordingly.
*
* @param point The point in map coordinates
*/
void setMapPoint( const QgsPoint& point );

/**
* Returns the original, unmodified map point of the mouse cursor.
*
* @return The cursor position in map coordinates.
*/
QgsPoint originalMapPoint() const { return mMapPoint; }

/**
* The snapped mouse cursor in pixel coordinates.
*
* @return The snapped mouse cursor position in pixel coordinates.
*/
QPoint pixelPoint() const { return mPixelPoint; }

/**
* The unsnapped, real mouse cursor position in pixel coordinates.
* Alias to pos()
*
* @return Mouse position in pixel coordinates
*/
QPoint originalPixelPoint() const { return pos(); }

private:
Expand Down
47 changes: 47 additions & 0 deletions src/gui/qgsmaptooladvanceddigitizing.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,56 @@ class GUI_EXPORT QgsMapToolAdvancedDigitizing : public QgsMapToolEdit
//! catch the mouse move event, filters it, transforms it to map coordinates and send it to virtual method
void canvasMoveEvent( QgsMapMouseEvent* e ) override;

/**
* The capture mode
*
* @return Capture mode
*/
CaptureMode mode() const { return mCaptureMode; }

/**
* Registers this maptool with the cad dock widget
*/
void activate();

/**
* Unregisters this maptool from the cad dock widget
*/
void deactivate();

QgsAdvancedDigitizingDockWidget* cadDockWidget() const { return mCadDockWidget; }

protected:
/**
* Override this method when subclassing this class.
* This will receive adapted events from the cad system whenever a
* canvasPressEvent is triggered and it's not hidden by the cad's
* construction mode.
*
* @param e Mouse events prepared by the cad system
*/
virtual void cadCanvasPressEvent( QgsMapMouseEvent* e ) { Q_UNUSED( e ) }


/**
* Override this method when subclassing this class.
* This will receive adapted events from the cad system whenever a
* canvasReleaseEvent is triggered and it's not hidden by the cad's
* construction mode.
*
* @param e Mouse events prepared by the cad system
*/
virtual void cadCanvasReleaseEvent( QgsMapMouseEvent* e ) { Q_UNUSED( e ) }


/**
* Override this method when subclassing this class.
* This will receive adapted events from the cad system whenever a
* canvasMoveEvent is triggered and it's not hidden by the cad's
* construction mode.
*
* @param e Mouse events prepared by the cad system
*/
virtual void cadCanvasMoveEvent( QgsMapMouseEvent* e ) { Q_UNUSED( e ) }

CaptureMode mCaptureMode;
Expand All @@ -75,6 +114,14 @@ class GUI_EXPORT QgsMapToolAdvancedDigitizing : public QgsMapToolEdit
bool mSnapOnDoubleClick;

private slots:
/**
* Is to be called by the cad system whenever a point changes outside of a
* mouse event. E.g. when additional constraints are triggered.
* The specified point will be used to generate a fake mouse event which will
* be sent as move event to cadCanvasMoveEvent.
*
* @param point The last point known to the cad system.
*/
void cadPointChanged( const QgsPoint& point );

private:
Expand Down

0 comments on commit dae0d4a

Please sign in to comment.