[Qgis-developer] Replacing Extent with Center in QgsMapSettings (for rotation)

Sandro Santilli strk at keybit.net
Fri Nov 28 01:41:29 PST 2014


On Fri, Nov 28, 2014 at 10:25:30AM +0100, Marco Hugentobler wrote:
> Hi Sandro
> 
> >which togheter with a scale and a rotation could be
> >used to derive the visible extent.
> 
> How would scale be defined for maps in degrees (witout constant
> scale on the map)?

By "scale" I mean "resolution", that is how many source units fit
in a pixel. The meaning of a source unit is left to the spatial projection;
map distortions issues are in no way attempted to be solved by this change.

> Alternatively, there could be a rectangle (four corner points)
> instead of a bounding box.

To represent an "area of interest", in alternative to "center & resolution" ?
It would be a 4 vertices polygon, rather than a "rectangle" (the term
is already taken for objects that are defined as being not-rotated).

Would such "area of interest" be then restricted to have only right angles ?
It could still sound arbitrary to allow rotation but not map projection
distortion... it should be analyzed what's the actual usability of such
configuration.

For sure a "rotating rectangle" would encode all of center, rotation
and scale (the latter being dependent on output). But does it make sense
for an "area of interest" to include rotation ?

--strk;


> On 27.11.2014 18:36, Sandro Santilli wrote:
> >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;


More information about the Qgis-developer mailing list