[Qgis-developer] Replacing Extent with Center in QgsMapSettings (for rotation)
Sandro Santilli
strk at keybit.net
Thu Nov 27 09:36:18 PST 2014
I've finally handled to get a correctly rendered rotated map
(git://github.com/strk/QGIS.git "rotation" branch) but more work
will be needed to correctly get the source data extent and output
rectangle for clipping purpose.
As I continue working in the branch, I can't stop thinking that
the QgsMapSetting class should be refactored to move away from
the concept of "extent" as a defining setting.
Currently, callers set the map's "extent", which togheter with
the output viewport size is used to derive the scale and the
"visible extent" (see QgsMapSettings::updateDerived).
Once the concept of rotation is added, the meaning of "extent"
becomes very confusing. What does it represent, exactly ?
The only "stable" concept you can derive from the extent is its
center, which togheter with a scale and a rotation could be
used to derive the visible extent.
OpenLayers indeed has center, rotation and scale as the defining
parameters of a view: http://openlayers.org/en/v3.0.0/apidoc/ol.View.html
In this scenario, panning would move the center, retaining scale
and rotation. Zooming would change scale, retaninig rotation and center
(combined zoom+pan could still be used). Rotation would retain the
scale and center.
Right now the class has mExtent and a mVisibleExtent members,
with the new configuration only the "visible extent" would make sense,
and could always be computed given an output size (currently also
a member of the class).
How would you see a transition toward this new configuration ?
If you want to follow the progress for rotation support, there's
a pull request for it: https://github.com/qgis/QGIS/pull/1700
--srk;
() ASCII ribbon campaign -- Keep it simple !
/\ http://strk.keybit.net/rants/ascii_mails.txt
More information about the Qgis-developer
mailing list