[Qgis-developer] Viewport rotation

Larry Shaffer larrys at dakotacarto.com
Thu Nov 20 11:44:29 PST 2014


Hi Sandro and Nyall,

On Thu, Nov 20, 2014 at 10:40 AM, Sandro Santilli <strk at keybit.net> wrote:

> On Thu, Nov 20, 2014 at 11:54:01AM +0100, Sandro Santilli wrote:
> > On Thu, Nov 20, 2014 at 09:01:55AM +1100, Nyall Dawson wrote:
>
> > > Ideally, I think this should be supported in the map renderer -
> > > QgsMapRendererJob.
> >
> > Would that be similar to considering it an additional transformation
> > on the input data, like reprojection ?
>
> I've tried this approach, basically adding rotation support to
> the QgsMapToPixel class. With such support I can see the map
> rotated as requested while "horizontal" labels remain horizontal.
> But "parallel" labels are completely off (and pretty funny).
>
> > > Currently the composer supports rotated maps, but it's a bit of a
> > > hack. It's really just rendering the map and then rotating the result.
> > > As a result all labels, symbology, etc also get rotated, which isn't
> > > ideal.
>
> For "parallel" labels, it is actually good that they rotate with the map.
> I guess there would need to be some rotation knowledge at various levels
> for things to be flexible enough.
>

Yes, for map rotation to work properly, its delta would have to be passed
into the calculations for each type of labeling placement, to provide
'expected' results. Such a delta would have to include not only the
rotation but also the new location of the label's point of reference.

Towards that end, I would say the most straightforward means of
implementing map rotation for effective labeling is to pre-rotate the
duplicated, temporary feature geometries first, before they are acted upon,
i.e. before extent (view port) clipping, etc., which would be prior to
sending into the PAL library for processing. Such an approach should keep
from having to pass the rotation offsets into the labeling calculations,
since the rotated features would already be in their output juxtaposition.

Maybe the feature pre-rotation could be done in the map renderer, prior to
sending to the labeling engine.

Regards,

Larry


> --strk;
>
>  ()  ASCII ribbon campaign  --  Keep it simple !
>  /\  http://strk.keybit.net/rants/ascii_mails.txt
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20141120/e23b8e1f/attachment.html>


More information about the Qgis-developer mailing list