Bug report #13152
QgsRubberBand not displaying holes in geometry
|Affected QGIS version:||2.10.0||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||21215|
Adding a geometry from a shapefile to QgsRubberBand does not displays holes in the original geometry (holes are filled).
For testing, try the following code with the attached shapefile.
from qgis.core import * from qgis.gui import * canvas = qgis.utils.iface.mapCanvas() cLayer = canvas.currentLayer() rbbrBndPol = QgsRubberBand(canvas, 2) f = QgsFeature() fR = QgsFeatureRequest().setFilterFid(0) f = cLayer.getFeatures(fR) f = f.next() rbbrBndPol.addGeometry(f.geometry(), cLayer)
#1 Updated by Matthias Kuhn almost 8 years ago
- Status changed from Open to Closed
This is by design. The rubberband is the kind of tool you would use to draw a hole into an existing polygon.
You can use QgsHighlight instead.
#2 Updated by Luca Congedo almost 8 years ago
Sorry for the noise.
Thank you very much for the link.