Skip to content

Commit

Permalink
Add missing documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Jun 4, 2024
1 parent c17a5f1 commit fcacf2a
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,26 @@ align to segment for between line constraint.
If between line constraints are used, this will determine the angle to be locked depending on the snapped segment.
%End

bool processCanvasPressEvent( QgsMapMouseEvent *e );
bool processCanvasMoveEvent( QgsMapMouseEvent *e );
bool processCanvasReleaseEvent( QgsMapMouseEvent *e );
bool processCanvasPressEvent( QgsMapMouseEvent *event );
%Docstring
Processes the canvas press ``event``.

:return: Returns ``True`` if the event has been 'eaten' and should not propagate further.
%End

bool processCanvasMoveEvent( QgsMapMouseEvent *event );
%Docstring
Processes the canvas move ``event``.

:return: Returns ``True`` if the event has been 'eaten' and should not propagate further.
%End

bool processCanvasReleaseEvent( QgsMapMouseEvent *event );
%Docstring
Processes the canvas release ``event``.

:return: Returns ``True`` if the event has been 'eaten' and should not propagate further.
%End

void setTool( QgsAdvancedDigitizingTool *tool );
%Docstring
Expand Down
23 changes: 20 additions & 3 deletions python/gui/auto_generated/qgsadvanceddigitizingdockwidget.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,26 @@ align to segment for between line constraint.
If between line constraints are used, this will determine the angle to be locked depending on the snapped segment.
%End

bool processCanvasPressEvent( QgsMapMouseEvent *e );
bool processCanvasMoveEvent( QgsMapMouseEvent *e );
bool processCanvasReleaseEvent( QgsMapMouseEvent *e );
bool processCanvasPressEvent( QgsMapMouseEvent *event );
%Docstring
Processes the canvas press ``event``.

:return: Returns ``True`` if the event has been 'eaten' and should not propagate further.
%End

bool processCanvasMoveEvent( QgsMapMouseEvent *event );
%Docstring
Processes the canvas move ``event``.

:return: Returns ``True`` if the event has been 'eaten' and should not propagate further.
%End

bool processCanvasReleaseEvent( QgsMapMouseEvent *event );
%Docstring
Processes the canvas release ``event``.

:return: Returns ``True`` if the event has been 'eaten' and should not propagate further.
%End

void setTool( QgsAdvancedDigitizingTool *tool );
%Docstring
Expand Down
20 changes: 10 additions & 10 deletions src/gui/qgsadvanceddigitizingdockwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1545,49 +1545,49 @@ QList<QgsPointXY> QgsAdvancedDigitizingDockWidget::snapSegmentToAllLayers( const
return segment;
}

bool QgsAdvancedDigitizingDockWidget::processCanvasPressEvent( QgsMapMouseEvent *e )
bool QgsAdvancedDigitizingDockWidget::processCanvasPressEvent( QgsMapMouseEvent *event )
{
if ( mCurrentTool )
{
mCurrentTool->canvasPressEvent( e );
mCurrentTool->canvasPressEvent( event );
}

return constructionMode();
}

bool QgsAdvancedDigitizingDockWidget::processCanvasMoveEvent( QgsMapMouseEvent *e )
bool QgsAdvancedDigitizingDockWidget::processCanvasMoveEvent( QgsMapMouseEvent *event )
{
// perpendicular/parallel constraint
// do a soft lock when snapping to a segment
alignToSegment( e, QgsAdvancedDigitizingDockWidget::CadConstraint::SoftLock );
alignToSegment( event, QgsAdvancedDigitizingDockWidget::CadConstraint::SoftLock );

if ( mCurrentTool )
{
mCurrentTool->canvasMoveEvent( e );
mCurrentTool->canvasMoveEvent( event );
}

updateCadPaintItem();

return false;
}

bool QgsAdvancedDigitizingDockWidget::processCanvasReleaseEvent( QgsMapMouseEvent *e )
bool QgsAdvancedDigitizingDockWidget::processCanvasReleaseEvent( QgsMapMouseEvent *event )
{
if ( alignToSegment( e ) )
if ( alignToSegment( event ) )
{
return true;
}

if ( mCurrentTool )
{
if ( mCurrentTool->canvasReleaseEvent( e ) )
if ( mCurrentTool->canvasReleaseEvent( event ) )
{
return true;
}
else
{
// update the point list
QgsPoint point( e->mapPoint() );
QgsPoint point( event->mapPoint() );
point.setZ( QgsMapToolEdit::defaultZValue() );
point.setM( QgsMapToolEdit::defaultMValue() );

Expand All @@ -1603,7 +1603,7 @@ bool QgsAdvancedDigitizingDockWidget::processCanvasReleaseEvent( QgsMapMouseEven
}
}

addPoint( e->mapPoint() );
addPoint( event->mapPoint() );
releaseLocks( false );

return constructionMode();
Expand Down
20 changes: 17 additions & 3 deletions src/gui/qgsadvanceddigitizingdockwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,23 @@ class GUI_EXPORT QgsAdvancedDigitizingDockWidget : public QgsDockWidget, private
*/
bool alignToSegment( QgsMapMouseEvent *e, QgsAdvancedDigitizingDockWidget::CadConstraint::LockMode lockMode = QgsAdvancedDigitizingDockWidget::CadConstraint::HardLock );

bool processCanvasPressEvent( QgsMapMouseEvent *e );
bool processCanvasMoveEvent( QgsMapMouseEvent *e );
bool processCanvasReleaseEvent( QgsMapMouseEvent *e );
/**
* Processes the canvas press \a event.
* \returns Returns TRUE if the event has been 'eaten' and should not propagate further.
*/
bool processCanvasPressEvent( QgsMapMouseEvent *event );

/**
* Processes the canvas move \a event.
* \returns Returns TRUE if the event has been 'eaten' and should not propagate further.
*/
bool processCanvasMoveEvent( QgsMapMouseEvent *event );

/**
* Processes the canvas release \a event.
* \returns Returns TRUE if the event has been 'eaten' and should not propagate further.
*/
bool processCanvasReleaseEvent( QgsMapMouseEvent *event );

/**
* Sets an advanced digitizing tool which will take over digitizing until the tool is close.
Expand Down
6 changes: 6 additions & 0 deletions src/gui/qgsadvanceddigitizingtools.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ class GUI_EXPORT QgsAdvancedDigitizingTool : public QWidget

#ifndef SIP_RUN

/**
* \ingroup gui
* \brief A advanced digitizing tools to handle the selection of a poin at the intersection
* of two circles.
* \since QGIS 3.40
*/
class GUI_EXPORT QgsAdvancedDigitizingCirclesIntersectionTool : public QgsAdvancedDigitizingTool
{
Q_OBJECT
Expand Down

0 comments on commit fcacf2a

Please sign in to comment.