Don't force a vector layer to be used for QgsRubberBand::addGeometry

There's no reason to restrict this call solely to vector layers
-- it's useful to have accessible for adding geometries associated
with other layer types too.
This commit is contained in:
Nyall Dawson 2021-09-08 14:54:13 +10:00
parent 84247cb51e
commit d43c575ff3
3 changed files with 5 additions and 7 deletions

View File

@ -281,7 +281,7 @@ Copies the points from another rubber band.
.. versionadded:: 3.22
%End
void addGeometry( const QgsGeometry &geometry, QgsVectorLayer *layer, bool doUpdate = true );
void addGeometry( const QgsGeometry &geometry, QgsMapLayer *layer, bool doUpdate = true );
%Docstring
Adds the geometry of an existing feature to a rubberband
This is useful for multi feature highlighting.
@ -293,8 +293,7 @@ If additional geometries are to be added then set ``doUpdate`` to ``False`` to d
After adding the final geometry :py:func:`~QgsRubberBand.updatePosition` should be called.
:param geometry: the geometry object. Will be treated as a collection of vertices.
:param layer: the layer containing the feature, used for coord transformation to map
crs. If ``layer`` is ``None``, the coordinates are not going to be transformed.
:param layer: the layer associated with the geometry. This is used for transforming the geometry from the layer's CRS to themap crs. If ``layer`` is ``None`` no coordinate transformation will occur.
:param doUpdate: set to ``False`` to defer updates of the rubber band.
%End

View File

@ -284,7 +284,7 @@ void QgsRubberBand::setToGeometry( const QgsGeometry &geom, const QgsCoordinateR
addGeometry( geom, crs );
}
void QgsRubberBand::addGeometry( const QgsGeometry &geometry, QgsVectorLayer *layer, bool doUpdate )
void QgsRubberBand::addGeometry( const QgsGeometry &geometry, QgsMapLayer *layer, bool doUpdate )
{
QgsGeometry geom = geometry;
if ( layer )

View File

@ -337,11 +337,10 @@ class GUI_EXPORT QgsRubberBand : public QgsMapCanvasItem
* After adding the final geometry updatePosition() should be called.
*
* \param geometry the geometry object. Will be treated as a collection of vertices.
* \param layer the layer containing the feature, used for coord transformation to map
* crs. If \a layer is NULLPTR, the coordinates are not going to be transformed.
* \param layer the layer associated with the geometry. This is used for transforming the geometry from the layer's CRS to themap crs. If \a layer is NULLPTR no coordinate transformation will occur.
* \param doUpdate set to FALSE to defer updates of the rubber band.
*/
void addGeometry( const QgsGeometry &geometry, QgsVectorLayer *layer, bool doUpdate = true );
void addGeometry( const QgsGeometry &geometry, QgsMapLayer *layer, bool doUpdate = true );
/**
* Adds a \a geometry to the rubberband.