111 Commits

Author SHA1 Message Date
Nyall Dawson
9dabb9dd20 Avoid some "" literals and QString::nulls in layer API
Use QString() instead
2017-04-10 17:17:17 +10:00
Nyall Dawson
de62c4e643 Fix some QgsMapLayer getters which are incorrectly marked as slots 2017-04-10 17:12:14 +10:00
Nyall Dawson
1128373830 Remove QgsMapLayer::invalidTransformInput slot
Calling slot does nothing and is not used anywhere
2017-04-10 17:09:43 +10:00
Nyall Dawson
acd8aa94a3 Sipify QgsMapLayer 2017-04-10 17:07:50 +10:00
Martin Dobias
5f5c1ddb15 Use a path resolver class instead of QgsProject::instance() in map layers
A new class QgsPathResolver is introduced for conversion between absolute
and relative paths when reading/writing XML.

Cleaned up code in layer definition file support (.qlr) to better handle
relative/absolute path conversion.
2017-02-16 09:56:11 +08:00
Nyall Dawson
38f87a624e [FEATURE] Allow layers to be automatically refreshed at a specified interval
This allows users to set a timer interval in layer properties
for individual layers. These layers will be automatically refreshed
at a matching interval.

Canvas updates are deferred in order to avoid refreshing multiple
times if more than one layer has an auto update interval set.

Additionally, logic has been added to skip any auto redraws of
the canvas while the canvas is already being redrawn. This avoids
issues caused by setting a layer auto refresh to a shorter time than
is required to redraw the canvas.
2017-02-13 08:28:39 +10:00
Nyall Dawson
04d392b5a3 Allow QgsMapLayer::triggerRepaint to defer updates
By calling QgsMapLayer::triggerRepaint( true ) any cached
version of the layer will be invalidated, but a map canvas
refresh won't automatically be triggered

This allows invalidation of cached images while deferring
the actual map update until the next canvas refresh.
2017-02-13 08:27:01 +10:00
Nyall Dawson
d47d31d13c Rename "Db"/"DB" in API to "Database"
Motivations:
- consistency - we generally use expanded names, and this also
matches Qt API which uses Database instead of Db
- avoids unpredictable capitalization throughout API (mix of "Db"
and "DB")
2017-02-07 09:32:05 +10:00
Martin Dobias
8ba609e516 Tidy up layer definitions code + removal of QgsProject::instance()
Moved code related to layer definitions away from QgsMapLayer
2017-01-29 23:22:37 +08:00
Denis Rouzaud
0a63d1f2c2 [spellcheck] properly look into various cases and add more fixes" 2017-01-16 16:39:20 +01:00
Martin Dobias
b340d7bdb6 Add willBeDeleted() signal to QgsMapLayer (#3998)
This allows pieces of code that depend on map layers to listen directly
to the layer's notification rather than having to listen to project's
layersWillBeRemoved signal (and cycle through the whole list)
2017-01-16 16:51:44 +08:00
Harrissou Sant-anna
7911994097 Replace capitalise by capitalize 2016-12-30 00:02:06 +01:00
Martin Dobias
d56a97d4fe Merge QgsMapLayerRegistry into QgsProject
All methods/signals of QgsMapLayerRegistry moved verbatim to QgsProject.
2016-12-10 15:18:12 +08:00
Matthias Kuhn
03f08a6c79 Fix QgsMapLayer ConvertToSubClassCode (#3611)
Fix #15683
2016-10-17 10:47:08 +02:00
Martin Dobias
a9105b7e7a Remove QgsMapLayer::draw() method from API (replaced by createMapRenderer()) (#3501) 2016-09-16 18:32:36 +08:00
Hugo Mercier
a86611b626 Cleanup layer dependency api 2016-09-01 09:58:37 +02:00
Hugo Mercier
0749ba43ba Rework layer dependencies
A new class QgsMapLayerDependency allows to represent different kinds
of dependencies between layers.
2016-08-31 14:40:13 +02:00
Hugo Mercier
1a5a7c5905 [Feature] Data dependencies between layers
This allows to declare data dependencies between layers. A data
dependency occurs when a data modification in a layer, not by direct
user manipulation may modify data of other layers.
This is the case for instance when geometry of a layer is updated by a
database trigger after modification of another layer's geometry.
2016-08-31 09:22:09 +02:00
Nyall Dawson
4cfacf14e3 Make API more consistent
- rename methods with XML to Xml, CRS to Crs, WMS to Wms, ID to Id
- rename methods with SRS to Crs
- rename methods with abbreviations like "dest" to "destination"
- rename methods with abbreviations like "src" to "source"
2016-07-21 08:40:50 +10:00
Martin Dobias
31c75ef22e Remove QgsLabel and QgsLabelAttributes + remove QgsPalLabeling from renderer jobs 2016-07-20 18:35:20 +08:00
Nyall Dawson
21eab8c2ea Add missing docs 2016-07-15 08:08:24 +10:00
Nyall Dawson
0d84ca74c5 Make QgsMapLayer::metadata() const 2016-07-15 06:07:08 +10:00
Nyall Dawson
0935b58fef Cleanup QgsMapLayer for 3.0
- implement QGIS 3.0 TODOs
- mark methods as const correct
- rename 'the...' parameters to remove 'the'
- mark QgsVectorLayer::getFeatures as const
2016-07-15 06:07:00 +10:00
Nyall Dawson
6c6f3c1e34 Remove deprecated members from QgsMapLayer 2016-07-15 06:02:45 +10:00
Nyall Dawson
726569c6bc QgsMapLayer::crs() now returns a copy, not a reference
(desirable because QgsCoordinateReferenceSystem is implicitly shared)
2016-07-15 06:00:51 +10:00
Matthias Kuhn
15c2f0a902 Make QgsMapLayer::name a Q_PROPERTY (#3259)
Make QgsMapLayer::name a Q_PROPERTY

And align setName / name / nameChanged

Deprecates setLayerName / layerNameChanged
2016-07-04 01:10:10 +02:00
Nyall Dawson
c3c5c43190 Avoid style dock flashing when editing layers
Also prevent a lot of duplicate style dock updates, and fix
the style dock losing connection to layer style changes
2016-06-27 14:03:36 +10:00
Martin Dobias
8fcac87f9d Fix API break of QgsMapLayer class introduced in 2.16
This breakage was resulting in a Python error when using plugin layers
due to calls to pure virtual method writeStyle()
2016-06-22 20:10:17 +02:00
Matthias Kuhn
95f81391d3 sip bindings 2016-06-03 15:13:42 +02:00
Nathan Woodrow
ca914f118e [FEATURE] Add style/history tab to style dock 2016-05-10 10:32:30 +10:00
Matthias Kuhn
93e73ac66f Make readOnly mode of vector layers configurable 2016-03-29 08:27:53 +02:00
Nyall Dawson
5e08626051 Add QgsMapLayer::isSpatial() method
The current approach of testing !vl || vl->geometryType() != NoGeometry
is not intuitive and has been the source of 2 recent bugs.

Replacing these tests with the new isSpatial() function makes it
immediately obvious what is being tested. It also allows for
non-spatial plugin layers to be correctly handled by overriding
this method.
2016-03-16 12:38:16 +11:00
Nyall Dawson
80afbeda93 Use doubles instead of float for min/max layer scales 2016-03-10 10:45:19 +11:00
Nyall Dawson
3b4638ab83 Followup 01f615d 2016-03-10 07:43:25 +11:00
Patrick Valsecchi
3efc73be61 Made layers/labels visibility more consistent
Some places forgot to make the max scale inclusive.
2016-03-09 09:56:06 +01:00
Juergen E. Fischer
a90be95f7b sip sync 2016-02-14 03:50:49 +01:00
Nyall Dawson
c3a57434d9 Fix clazy 'pass small and trivially-copyable type by value' warnings 2016-02-02 19:47:21 +11:00
Hugo Mercier
1a1af3788c Rework layer dependencies to work also with layer definition files 2016-01-07 14:03:15 +01:00
rldhont
a32587bcd1 [FEATURE][QGIS Server] Add short name to layers, groups and project
A number of elements have both a <Name> and a <Title>. The Name is a text string used for machine-to-machine
communication while the Title is for the benefit of humans. For example, a dataset might have the descriptive Title
“Maximum Atmospheric Temperature” and be requested using the abbreviated Name “ATMAX”.

User can already set title for layers, groups and project. OWS name is based on the name used in layer tree. This name is more a label for humans than a name for machine-to-machine communication.

To add the capability to users to define Name as a text string for machine-to-machine communication, this pull-request adds:
* short name line edits to layers properties
* WMS data dialog to layer tree group (short name, title, abstract)
* short name line edits to project properties
* add a regexp validator "^[A-Za-z][A-Za-z0-9\._-]*" to short name line edit accessible through a static method
* add a TreeName element in the fullProjectSettings

If a short name has been set for layers, groups and project it is used by QGIS Sever as the layer name.
2015-12-23 10:03:04 +01:00
rldhont
f7566710af [Doc] Update QgsMapLayer documentation
Add documentation string to 10 QgsMapLayer methods.
2015-12-21 17:33:47 +01:00
Matthias Kuhn
56ccb2b858 sipClass_Klass is deprecated for a long time: replace with sipType_Klass 2015-11-11 23:22:51 +01:00
Nyall Dawson
fe221d54bf Don't return QStrings by reference, since they're implicitly shared
anyway
2015-10-28 09:47:44 +11:00
Nyall Dawson
f1633a1796 Change all signals to use const refs for non trivial objects 2015-10-26 22:46:25 +11:00
Matthias Kuhn
cd0eb05ded [py3] Some compatibility fixes for python 3 2015-10-24 13:47:32 +02:00
Nyall Dawson
c49b5b777f Change a lot of arguments to const references in core/gui
Rationale:
- there was a lot of large objects passed by value, so potentially
there's a speed bump from this
- even for implicitly shared classes like QString/QList there's still
a (small) cost for copying the objects when there's no reason to
- it's the right thing to do!
2015-10-07 12:02:04 +11:00
Juergen E. Fischer
9752c468c1 indentation update 2015-07-29 11:52:14 +02:00
Nyall Dawson
7314047698 Fix missing doc strings due to invalid doxygen tags 2015-04-30 17:26:58 +10:00
Juergen E. Fischer
abd4a04399 sip update 2015-02-03 02:21:52 +01:00
Martin Dobias
11d331dd66 Add QgsMapLayer::importNamedStyle() functions
Like this we do not need to use a temporary file to load a style
2015-01-16 14:14:41 +07:00
Martin Dobias
8b5587fe13 Improve the internals of map layer style manager
- style manager is always enabled (client code does not need to distinguish between enabled/disabled state)
- layers currently active style is stored only in QgsMapLayer - in style manager it has entry with no data (avoids duplication of data)

This also solves issues with visibility presets and styles when some presets do not have stored style
2015-01-09 17:04:26 +07:00