mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-16 00:05:45 -04:00
[api] Add a public method to clear the rubber band for the
QgsMapToolExtent Otherwise plugins have no way to remove this from the canvas
This commit is contained in:
parent
d68cd295db
commit
34735aa9ef
@ -57,6 +57,13 @@ If the aspect ratio isn't fixed, the width and height will be set to zero.
|
||||
QgsRectangle extent() const;
|
||||
%Docstring
|
||||
Returns the current extent drawn onto the canvas.
|
||||
%End
|
||||
|
||||
void clearRubberBand();
|
||||
%Docstring
|
||||
Removes the tool's rubber band from the canvas.
|
||||
|
||||
.. versionadded:: 3.20
|
||||
%End
|
||||
|
||||
signals:
|
||||
|
@ -34,8 +34,7 @@ void QgsMapToolExtent::activate()
|
||||
|
||||
void QgsMapToolExtent::deactivate()
|
||||
{
|
||||
mRubberBand->reset( QgsWkbTypes::PolygonGeometry );
|
||||
|
||||
clearRubberBand();
|
||||
QgsMapTool::deactivate();
|
||||
}
|
||||
|
||||
@ -95,6 +94,11 @@ QgsRectangle QgsMapToolExtent::extent() const
|
||||
}
|
||||
}
|
||||
|
||||
void QgsMapToolExtent::clearRubberBand()
|
||||
{
|
||||
mRubberBand->reset( QgsWkbTypes::PolygonGeometry );
|
||||
}
|
||||
|
||||
void QgsMapToolExtent::calculateEndPoint( QgsPointXY &point )
|
||||
{
|
||||
if ( mRatio.width() > 0 && mRatio.height() > 0 )
|
||||
@ -112,8 +116,6 @@ void QgsMapToolExtent::drawExtent()
|
||||
if ( qgsDoubleNear( mStartPoint.x(), mEndPoint.x() ) && qgsDoubleNear( mStartPoint.y(), mEndPoint.y() ) )
|
||||
return;
|
||||
|
||||
mRubberBand->reset( QgsWkbTypes::PolygonGeometry );
|
||||
|
||||
QgsRectangle rect( mStartPoint, mEndPoint );
|
||||
|
||||
mRubberBand->reset( QgsWkbTypes::PolygonGeometry );
|
||||
|
@ -64,6 +64,13 @@ class GUI_EXPORT QgsMapToolExtent : public QgsMapTool
|
||||
*/
|
||||
QgsRectangle extent() const;
|
||||
|
||||
/**
|
||||
* Removes the tool's rubber band from the canvas.
|
||||
*
|
||||
* \since QGIS 3.20
|
||||
*/
|
||||
void clearRubberBand();
|
||||
|
||||
signals:
|
||||
|
||||
//! signal emitted on extent change
|
||||
|
Loading…
x
Reference in New Issue
Block a user