Feature request #15755
Make it simpler to use QgsGeometryRubberBand
|Pull Request or Patch supplied:||No||Resolution:|
|Easy fix?:||No||Copied to github as #:||23677|
Having previously used the QgsRubberBand to draw temporary lines in QGIS I needed to draw polygons too. I found the QgsGeometryRubberBand which seems to handle polygons much better. After struggeling with the setGeometry(...) method I finally understood how to use it.
QgsRubberBand.setToGeometry method takes a QgsGeometry and extracts all the points into its own container.
QgsGeometryRubberBand.setGeometry method takes an QgsAbstractGeometryV2 and just make a reference to it (takes ownership???).
geometry = QgsGeometry.fromWkt('SOME GEOMETRY HERE.') rb = QgsRubberBand(canvas) rb.setToGeometry(geometry, None) grb = QgsGeometryRubberBand(canvas) grb.setGeometry(geomtry.geometry().clone())
I had to clone the abstract geometry since I don't keep my geometry object alive.
There two methods have their cousins, the QgsVertexMarker and the QgsHighlight.
Wouldn't it be better to make them all a bit more homogeneous if they are to remain as 4 different classes?