Bug report #16866
RenderUnit::RenderMetersInMapUnits: no preview Image in Symbology-Dialog
|Affected QGIS version:||master||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||24765|
For the implementation of RenderMetersInMapUnits, one aspect has been overlooked:
- the preview Image in the Symbology-Dialog remains blank when RenderMetersInMapUnits is active
Otherwise everything seems to work as expected.
For the 'designing' if the Symbol to be shown this should be considered important.
I assume that something similar must be done as in QgsRenderContext::convertToMapUnits
- where in the case statement RenderMetersInMapUnits must be added before QgsUnitTypes::RenderMapUnits with a FALLTHROUGH;
#1 Updated by Mark Johnson about 3 years ago
- File updatePreview.all.Original.png added
This problem seems to be caused by a (possibly) logical error in QgsSymbol::bigSymbolPreviewImage
The QgsUnitTypes::RenderUnit of the Layer is being used instead of QgsUnitTypes::RenderMillimeters.
The QgsDistanceArea being used is not based on the Layer being used.
Thus when this runs, MapUnits are assumed to be in Degrees, RenderMetersInMapUnits (a value given in Meters) is transformed into degrees. So for the given 5.1 Meters: 0.00000458141 is bing used - which cannot be seen.
This seems to also to effect Icons being shown for the 'Simple marker' and in the Layer Panel.
For QgsSymbol::bigSymbolPreviewImage, this is simple to resolve
- save the OutputUnit of the class (which renderPolyline, renderPolygon and renderPoint use)
- setOutputUnit( QgsUnitTypes::RenderMillimeters);
- restore the original value of the OutputUnit.
I was hoping to do the same for QgsSymbol::drawPreviewIcon, but that did not work.
- so this problem is still open.
A pull request is being made for the first solution with a reference to this issue.