Skip to content
Permalink
Browse files
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.
  • Loading branch information
nyalldawson committed Sep 8, 2021
1 parent 84247cb commit d43c575ff3fabcebb8408c4f8a4946db73a56f7a
Showing with 5 additions and 7 deletions.
  1. +2 −3 python/gui/auto_generated/qgsrubberband.sip.in
  2. +1 −1 src/gui/qgsrubberband.cpp
  3. +2 −3 src/gui/qgsrubberband.h
@@ -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

@@ -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 )
@@ -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.

0 comments on commit d43c575

Please sign in to comment.