mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-29 00:03:59 -04:00
Remove some workarounds for advanced digitizing from node tool
This commit is contained in:
parent
a2b2567ca3
commit
2f8afc02ab
@ -273,6 +273,15 @@ Constraint on a common angle
|
|||||||
:rtype: bool
|
:rtype: bool
|
||||||
%End
|
%End
|
||||||
|
|
||||||
|
void setPoints( const QList<QgsPointXY> &points );
|
||||||
|
%Docstring
|
||||||
|
Configures list of current CAD points
|
||||||
|
|
||||||
|
Some map tools may find it useful to override list of CAD points that is otherwise
|
||||||
|
automatically populated when user clicks with left mouse button on map canvas.
|
||||||
|
.. versionadded:: 3.0
|
||||||
|
%End
|
||||||
|
|
||||||
QgsPointXY currentPoint( bool *exists = 0 ) const;
|
QgsPointXY currentPoint( bool *exists = 0 ) const;
|
||||||
%Docstring
|
%Docstring
|
||||||
The last point.
|
The last point.
|
||||||
|
@ -474,22 +474,6 @@ void QgsNodeTool::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
|
|||||||
}
|
}
|
||||||
|
|
||||||
mSelectionRectStartPos.reset();
|
mSelectionRectStartPos.reset();
|
||||||
|
|
||||||
// there may be a temporary list of points (up to two) that need to be injected
|
|
||||||
// into CAD dock widget in order to make it behave as we need
|
|
||||||
if ( !mOverrideCadPoints.isEmpty() )
|
|
||||||
{
|
|
||||||
for ( const QgsPointXY &pt : qgsAsConst( mOverrideCadPoints ) )
|
|
||||||
{
|
|
||||||
QMouseEvent mouseEvent( QEvent::MouseButtonRelease,
|
|
||||||
toCanvasCoordinates( pt ),
|
|
||||||
Qt::LeftButton, Qt::LeftButton, Qt::NoModifier );
|
|
||||||
QgsMapMouseEvent me( canvas(), &mouseEvent );
|
|
||||||
cadDockWidget()->canvasReleaseEvent( &me, QgsAdvancedDigitizingDockWidget::ManyPoints );
|
|
||||||
}
|
|
||||||
|
|
||||||
mOverrideCadPoints.clear();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsNodeTool::cadCanvasMoveEvent( QgsMapMouseEvent *e )
|
void QgsNodeTool::cadCanvasMoveEvent( QgsMapMouseEvent *e )
|
||||||
@ -1082,8 +1066,7 @@ void QgsNodeTool::startDraggingMoveVertex( const QgsPointXY &mapPoint, const Qgs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mOverrideCadPoints.clear();
|
cadDockWidget()->setPoints( QList<QgsPointXY>() << m.point() << m.point() );
|
||||||
mOverrideCadPoints << m.point() << m.point();
|
|
||||||
|
|
||||||
if ( QgsProject::instance()->topologicalEditing() )
|
if ( QgsProject::instance()->topologicalEditing() )
|
||||||
{
|
{
|
||||||
@ -1283,8 +1266,7 @@ void QgsNodeTool::startDraggingAddVertex( const QgsPointLocator::Match &m )
|
|||||||
if ( v1.x() != 0 || v1.y() != 0 )
|
if ( v1.x() != 0 || v1.y() != 0 )
|
||||||
addDragBand( map_v1, m.point() );
|
addDragBand( map_v1, m.point() );
|
||||||
|
|
||||||
mOverrideCadPoints.clear();
|
cadDockWidget()->setPoints( QList<QgsPointXY>() << m.point() << m.point() );
|
||||||
mOverrideCadPoints << m.point() << m.point();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsNodeTool::startDraggingAddVertexAtEndpoint( const QgsPointXY &mapPoint )
|
void QgsNodeTool::startDraggingAddVertexAtEndpoint( const QgsPointXY &mapPoint )
|
||||||
@ -1308,8 +1290,8 @@ void QgsNodeTool::startDraggingAddVertexAtEndpoint( const QgsPointXY &mapPoint )
|
|||||||
// setup CAD dock previous points to endpoint and the previous point
|
// setup CAD dock previous points to endpoint and the previous point
|
||||||
QgsPointXY pt0 = geom.vertexAt( adjacentVertexIndexToEndpoint( geom, mMouseAtEndpoint->vertexId ) );
|
QgsPointXY pt0 = geom.vertexAt( adjacentVertexIndexToEndpoint( geom, mMouseAtEndpoint->vertexId ) );
|
||||||
QgsPointXY pt1 = geom.vertexAt( mMouseAtEndpoint->vertexId );
|
QgsPointXY pt1 = geom.vertexAt( mMouseAtEndpoint->vertexId );
|
||||||
mOverrideCadPoints.clear();
|
|
||||||
mOverrideCadPoints << pt0 << pt1;
|
cadDockWidget()->setPoints( QList<QgsPointXY>() << pt0 << pt1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsNodeTool::startDraggingEdge( const QgsPointLocator::Match &m, const QgsPointXY &mapPoint )
|
void QgsNodeTool::startDraggingEdge( const QgsPointLocator::Match &m, const QgsPointXY &mapPoint )
|
||||||
@ -1349,21 +1331,14 @@ void QgsNodeTool::startDraggingEdge( const QgsPointLocator::Match &m, const QgsP
|
|||||||
mDraggingExtraVerticesOffset << ( geom.vertexAt( v.vertexId ) - QgsPoint( layerPoint ) );
|
mDraggingExtraVerticesOffset << ( geom.vertexAt( v.vertexId ) - QgsPoint( layerPoint ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
mOverrideCadPoints.clear();
|
cadDockWidget()->setPoints( QList<QgsPointXY>() << m.point() << m.point() );
|
||||||
mOverrideCadPoints << m.point() << m.point();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsNodeTool::stopDragging()
|
void QgsNodeTool::stopDragging()
|
||||||
{
|
{
|
||||||
// deactivate advanced digitizing
|
// deactivate advanced digitizing
|
||||||
setAdvancedDigitizingAllowed( false );
|
setAdvancedDigitizingAllowed( false );
|
||||||
|
cadDockWidget()->clear(); // clear cad points and release locks
|
||||||
// stop adv digitizing
|
|
||||||
QMouseEvent mouseEvent( QEvent::MouseButtonRelease,
|
|
||||||
QPoint(),
|
|
||||||
Qt::RightButton, Qt::RightButton, Qt::NoModifier );
|
|
||||||
QgsMapMouseEvent me( canvas(), &mouseEvent );
|
|
||||||
cadDockWidget()->canvasReleaseEvent( &me, QgsAdvancedDigitizingDockWidget::SinglePoint );
|
|
||||||
|
|
||||||
mDraggingVertex.reset();
|
mDraggingVertex.reset();
|
||||||
mDraggingVertexType = NotDragging;
|
mDraggingVertexType = NotDragging;
|
||||||
|
@ -299,11 +299,6 @@ class APP_EXPORT QgsNodeTool : public QgsMapToolAdvancedDigitizing
|
|||||||
//! to stick with the same highlighted feature next time if there are more options
|
//! to stick with the same highlighted feature next time if there are more options
|
||||||
std::unique_ptr<QgsPointLocator::Match> mLastSnap;
|
std::unique_ptr<QgsPointLocator::Match> mLastSnap;
|
||||||
|
|
||||||
//! List of two points that will be forced into CAD dock with fake mouse events
|
|
||||||
//! to allow correct functioning of node tool with CAD dock.
|
|
||||||
//! (CAD dock does various assumptions that work with simple capture tools, but not with node tool)
|
|
||||||
QList<QgsPointXY> mOverrideCadPoints;
|
|
||||||
|
|
||||||
//! When double-clicking to add a new vertex, this member keeps the snap
|
//! When double-clicking to add a new vertex, this member keeps the snap
|
||||||
//! match from "press" event used to be used in following "release" event
|
//! match from "press" event used to be used in following "release" event
|
||||||
std::unique_ptr<QgsPointLocator::Match> mNewVertexFromDoubleClick;
|
std::unique_ptr<QgsPointLocator::Match> mNewVertexFromDoubleClick;
|
||||||
|
@ -222,8 +222,7 @@ void QgsAdvancedDigitizingDockWidget::setCadEnabled( bool enabled )
|
|||||||
mCadButtons->setEnabled( enabled );
|
mCadButtons->setEnabled( enabled );
|
||||||
mInputWidgets->setEnabled( enabled );
|
mInputWidgets->setEnabled( enabled );
|
||||||
|
|
||||||
clearPoints();
|
clear();
|
||||||
releaseLocks();
|
|
||||||
setConstructionMode( false );
|
setConstructionMode( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -921,8 +920,7 @@ bool QgsAdvancedDigitizingDockWidget::canvasReleaseEvent( QgsMapMouseEvent *e, A
|
|||||||
|
|
||||||
if ( e->button() == Qt::RightButton )
|
if ( e->button() == Qt::RightButton )
|
||||||
{
|
{
|
||||||
clearPoints();
|
clear();
|
||||||
releaseLocks();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1041,6 +1039,15 @@ void QgsAdvancedDigitizingDockWidget::keyPressEvent( QKeyEvent *e )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QgsAdvancedDigitizingDockWidget::setPoints( const QList<QgsPointXY> &points )
|
||||||
|
{
|
||||||
|
clearPoints();
|
||||||
|
Q_FOREACH ( const QgsPointXY &pt, points )
|
||||||
|
{
|
||||||
|
addPoint( pt );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool QgsAdvancedDigitizingDockWidget::eventFilter( QObject *obj, QEvent *event )
|
bool QgsAdvancedDigitizingDockWidget::eventFilter( QObject *obj, QEvent *event )
|
||||||
{
|
{
|
||||||
// event for line edits
|
// event for line edits
|
||||||
|
@ -277,6 +277,15 @@ class GUI_EXPORT QgsAdvancedDigitizingDockWidget : public QgsDockWidget, private
|
|||||||
//! Constraint on a common angle
|
//! Constraint on a common angle
|
||||||
bool commonAngleConstraint() const { return mCommonAngleConstraint; }
|
bool commonAngleConstraint() const { return mCommonAngleConstraint; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures list of current CAD points
|
||||||
|
*
|
||||||
|
* Some map tools may find it useful to override list of CAD points that is otherwise
|
||||||
|
* automatically populated when user clicks with left mouse button on map canvas.
|
||||||
|
* \since QGIS 3.0
|
||||||
|
*/
|
||||||
|
void setPoints( const QList<QgsPointXY> &points );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The last point.
|
* The last point.
|
||||||
* Helper for the CAD point list. The CAD point list is the list of points
|
* Helper for the CAD point list. The CAD point list is the list of points
|
||||||
|
Loading…
x
Reference in New Issue
Block a user