Bug report #16866

RenderUnit::RenderMetersInMapUnits: no preview Image in Symbology-Dialog

Added by Mark Johnson over 6 years ago. Updated about 5 years ago.

Status:Feedback
Priority:High
Assignee:-
Category:GUI
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

Description

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;

Showing Symbology-Dialog with blank preview Image

MetersInMapUnits.Scale_050.png - Showing Symbology-Dialog with blank preview Image (89.1 KB) Mark Johnson, 2017-07-14 05:58 AM

updatePreview.all.Original.png (53.7 KB) Mark Johnson, 2017-07-15 12:31 PM

History

#1 Updated by Mark Johnson over 6 years ago

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.

#2 Updated by Giovanni Manghi about 5 years ago

  • Status changed from Open to Feedback

Please check if this issue is still valid on QGIS 3.4.5 or 3.6.

Also available in: Atom PDF