3 Commits

Author SHA1 Message Date
Nyall Dawson
994f45470a Dox++ 2019-10-31 14:59:39 +10:00
Nyall Dawson
f602ed3751 Add API to allow setting the default view extent for a new project
Allows a QgsProject created using QGIS api only (i.e., not via the desktop
application) to specify the default extent which should be visible when
that project is opened.

Straight from the dox:

Sets the default view extent, which should be used as the initial map extent
when this project is opened.

\warning When a project is opened in the QGIS desktop application and saved, individual
map canvases will store their own previous view extent as custom project properties. Reloading
this saved version of the project will trigger the canvases to restore their individual last view
extents. Accordingly, in the QGIS desktop application, this setting only forms a default, initial
view used when the project is opened for the very first time.
2019-10-31 14:59:39 +10:00
Nyall Dawson
65490ab13e Move QgsProject map scales settings to a new class, QgsProjectViewSettings
attached to QgsProject

And deprecate old getters/setters

The goal here is to create a place for project view related settings (e.g.
map scales, default extent, possibly future things like a fixed project
maximum area of interest, etc). Currently these are all handled in an
ad-hoc way, e.g. sometimes in project custom keys, sometimes inside
xml saved and restored by map canvases. But both these approaches break
important use case for plugins, e.g. creating a project from scratch
which will zoom to a desired extent on load. That's totally impossible
in the current API, unless you resort to extremely fragile manual
xml crafting...
2019-10-31 14:59:39 +10:00