[Qgis-developer] QgsRubberband does not draw polygons(python)

vinayan vinayan123 at gmail.com
Mon Apr 8 06:13:12 PDT 2013


Hi,

I am simply stuck at a seemingly simple issue. I want to create a polygon
rubberband. But even after setting the isPolygon in the constructor to
'True', it is creating a polyline rubberband. I am using latest master
version. Here is what i tried in the python console.

pastebin link <http://pastebin.com/bKGJwZkB>  

mCanv = iface.mapCanvas()
rb = QgsRubberBand(mCanv,True) #shouldn't this constructor create a polygon
shaped band?
 
rb.addPoint(QgsPoint(300,300))
rb.addPoint(QgsPoint(400,400))
rb.addPoint(QgsPoint(400,600))
 
print rb.asGeometry().exportToWkt()
 
LINESTRING(300.0 300.0, 400.0 400.0, 400.0 600.0)

Shouldn't the exportToWkt() be outputting a Polygon instead of a Linestring?
What am i doing wrong here?

Thanks
Vinayan






--
View this message in context: http://osgeo-org.1560.n6.nabble.com/QgsRubberband-does-not-draw-polygons-python-tp5045238.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.


More information about the Qgis-developer mailing list