I am trying to calculate the size of a single symbol in pixels using:
canvas = iface.mapCanvas()
context = QgsRenderContext.fromMapSettings(canvas.mapSettings())
layer = iface.activeLayer()
rnd = layer.renderer()
sym = rnd.symbol()
scaled_size_in_pixels = context.convertToPainterUnits(
sym.size(),
sym.sizeUnit(),
sym.sizeMapUnitScale() )
The last line can also be calculated by:
scaled_size_in_pixels = sym.size(context)
I am finding that this is returning the size of the filled area of the
symbol, but it does not include the border. Is this a bug or do I need to
add something additional to include the border?
Thanks,
Calvin
_______________________________________________
QGIS-Developer mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer