[Qgis-developer] QGIS 3.0: Plans to support librttopo?

Nyall Dawson nyall.dawson at gmail.com
Mon Mar 6 22:42:42 PST 2017


On 7 March 2017 at 16:31, Mark Johnson <mj10777 at googlemail.com> wrote:
>>> I'm confused - what is missing?
>
> The topic here is that when using MapUnits
> - where the MapUnits are degrees
> that a constant value (valid around the world) is not possible.
>
> If you set this to 5 (intended as meters on the map)
> - the further you zoom in, the circle will get bigger always showing an area
> of 5 meters
>
> If the Map is switched to WSG84
> - then you will get 5 degrees and not the desired area of 5 meters
> --> which for my area would be 0.000075, at the equator 0,000045 and in you
> area something different
>
> Since the source and destination crs are unknown when this attribute value
> is being set
> - one cannot assume that one or the other use meters and therefore cannot be
> used

It might be unknown at the time of setting that value - but it's
certainly known at the time that
QgsRenderContext::convertToPainterUnits or similar is called!

So you add a new QgsUnitTypes::RenderUnit enum value for
MapUnitMeters, and then if that unit is encountered by
QgsRenderContext::convertToPainterUnits you could do the calculation
from metres -> real map units -> painter units then. (The conversion
value could be cached in the render context to avoid multiple
coordinate transforms)

Nyall


More information about the Qgis-developer mailing list