3866 Commits

Author SHA1 Message Date
Nyall Dawson
60b8ec5488 Sip sync 2017-09-25 17:11:46 +10:00
Alexander Bruy
14a48c0349 Merge pull request #5201 from nyalldawson/point_crs
[processing] Transparently handle CRS for point parameters
2017-09-25 09:47:46 +03:00
Nyall Dawson
a71f2ad5dc Fix non-virtual destructor 2017-09-25 12:46:49 +10:00
Martin Dobias
990f353ae0 More doxygen comments 2017-09-24 16:26:41 +02:00
Martin Dobias
7389588745 More class documentation 2017-09-24 14:12:29 +02:00
Martin Dobias
d91ebe273b Trying to work around SIP file parsing error (dir starting with number) 2017-09-24 11:57:43 +02:00
Nyall Dawson
e1eef7ed19 Allow use of QgsPointXY/QgsReferencedPointXY for point parameter values 2017-09-24 12:09:38 +10:00
Etienne Trimaille
ba81068f49 [FEATURE] [needs-docs] Metadata editor
Adds a new metadata tab to layer properties, representing the new metadata model from QEP #91
2017-09-23 14:08:32 +10:00
Muhammad Yarjuna Rohmat
e2678936df [FEATURE][geonode] integration - copy style action
Allows copying styles directly from geonode layers for pasting into project layers.
2017-09-23 13:36:57 +10:00
Vincent Mora
02e3916bf5 [FEATURE] layer refresh and trigger actions on provider notification
[needs-docs]

In vector layer properties (only usefull for postgres datasources)

**in the rendering tab**

A "Refresh layer on notification" checkbox has been added to refresh layer
on provider notification.

For a postgres datasource, if a `NOTIFY qgis;` command is issued by one of the database clients,
a refresh of the layer will occur.

If the "Only if message is" checkbox is checked, the notification will trigger the refresh only
if the message contend is the one specified, e.g. if the user enters
"refresh" in the box right next to the "Only if message is" checkbox,
then a `NOTIFY qgis, 'refresh';` command in the datatabase will trigger
a layer refresh, but `NOTIFY qgis;` or `NOTIFY qgis, 'something else';`
won't.

**in the actions tab**

A column "On notification" has been added, the action editor widget
a has text field "Execute if notification message matches" to
specify a filter for notification from the provider. The filter is a
Perl-type regex.

Note that, as opposed to the "layer refresh" that

Exemple:
  - QGIS side "Execute if notification message matches" `^trigger my action`
  - Postgres side: `NOTIFY qgis, 'trigger my action'` will trigger the action
  - Postgres side: `NOTIFY qgis, 'trigger my action some additional data'` will trigger the action
  - Postgres side: `NOTIFY qgis, 'do not trigger my action some additional data'` will NOT trigger the action

Please note that if the `^`, which means "starts with",  in `^trigger my action` had been ommited,
the last notification would have triggered the action because the
notification message contains the `trigger my action`

A new qgis variable `notification_message` is available for use in
actions, it holds the contend of the notification message. To continue
with the previous exemple, if the action is of python type with the code:

```python
print('[% @notification_message %]')
```

The three notifictions above will result in two printed lines
```
trigger my action
trigger my action some additional data
```

User Warning:

For postgres providers, if the "Refresh layer on notification" is checked, or if one layer action has
"On notification" specified, a new connection to the database is made to
listen to postgres notifications. This olds even if transaction groups
are enabled at the project level.

Note that once the notification mechanism is started in a QGIS
session, it will not stop, even if there is no more need for it (Refresh
layer on notification" unchecked and no "On notification" in any
action). Consequently the connection listening to notification will
remain open.

IMPLEMENTATION DETAILS:

A notify signal has been added to the abstract QgsVectorDataProvider
along with a setListening function that enables/disble the notification
mechanism.

For the moment only the postgres provider implements the notification.

QgsAction has a notificationMessage member function that holds the regex
to match to trigger action

QgsActionManager becomes a QObject and is doing the filtering and execute actions on
notifications.

The notification notion extends beyond SRGBD servers (postgres and oracle at
least have the notify) and the "watch file" in the delimitedtext
provider could also benefit from this interface.

For the postgres provider a thread is created with a second connection
to the database. This thread is responsible for listening postgres
notifications.

It would be nice to avoid the creation of one listening chanel per
provider in the case transaction groups are enabled.

Please note that when listening starts (a thread and connection is
created in the postgres provider) it cannot be stopped by removing the
connected actions or unchecking the refresh check box. Indeed, since we
don't know who needs the signals, we dont't want to stop the service.

The service will not restart in the next qgis session though.

If this behavior is not deemed appropriate, we could use
```
int QObject::receivers ( const char * signal ) const
```
and have QgsDataProvider::setListening return a bool to tell the caller
if the signal has actually been closed.
2017-09-22 12:51:51 +02:00
Nyall Dawson
22eddfd4c0 Merge pull request #5238 from nyalldawson/geometry_coverage
Geometry unit test coverage + fixes
2017-09-22 17:18:39 +10:00
Nyall Dawson
a6b1c3ee9f Merge pull request #5237 from nyalldawson/port_algs
[processing] Port line intersection and split with lines to c++
2017-09-22 17:18:05 +10:00
Nyall Dawson
db738f65e6 Merge pull request #5234 from nyalldawson/action_lifetime
Fix browser action item lifetime
2017-09-22 16:11:42 +10:00
Nyall Dawson
57b76920d6 Expand docs 2017-09-22 15:22:01 +10:00
Nyall Dawson
c41dca937c Port processing combineFields to c++ 2017-09-22 15:19:32 +10:00
Nyall Dawson
33d2d1119c Update sip 2017-09-22 12:50:47 +10:00
Nyall Dawson
6afe25ef0f [processing] Proper progress reports during model execution
Instead of showing the progress reports for each child algorithm
individually, which leads to repeated 0->100% progress for every
step of a model, we proxy the progress reports and account for the
overall progress through a model as well. This means that
the progress accounts for both the progress within the current
model step AND the total number of steps left to execute.
2017-09-22 10:32:17 +10:00
Nyall Dawson
e7b08d520e Expand geometry test coverage 2017-09-22 09:54:23 +10:00
Nyall Dawson
7c53dc1574 Correctly parent browser item actions to transient menu instance
Currently most browser item actions are parented to the item
itself, which is often long-lived (e.g. connection items
which last for the duration of the qgis session). This
commit adds an explicit parent widget parameter to
QgsDataItem::actions to ensure that the newly created actions
are correctly parented to the menu, and deleted after the
menu is removed.
2017-09-22 09:32:54 +10:00
Matthias Kuhn
88fcbb0aac
QgsTask::waitForFinished without event loop
because the old approach with using signals, using deleteLater and using
an internal event loop is a very good recipe for big troubles.
2017-09-21 14:16:37 +02:00
Nyall Dawson
15e650d624 Merge pull request #5221 from nyalldawson/browser_awesome
Add QLR, processing models to browser
2017-09-21 05:20:07 +10:00
Nyall Dawson
a67dab52d2 Spelling 2017-09-20 18:45:59 +10:00
Nyall Dawson
253c4c7a42 Add a Custom item type for QgsDataItem 2017-09-20 14:09:03 +10:00
Nyall Dawson
8bce7a62a7 Allow QgsDataItems to override default double click behavior 2017-09-20 14:09:03 +10:00
Nyall Dawson
6ce3c6100d [FEATURE] Add 'open directory' action to right click menu for
folders in browser dock

Opens the folder in the OS' file explorer
2017-09-20 09:24:02 +10:00
Nyall Dawson
20e1d72007 Merge pull request #5209 from nyalldawson/geometry_coverage
[WIP] Extend geometry classes unit test coverage
2017-09-19 22:15:14 +10:00
Matthias Kuhn
8d34023d6e Merge pull request #5216 from m-kuhn/vectorFileWriter
Make error message accessible for python in vector file writer
2017-09-19 13:17:09 +02:00
Alessandro Pasotti
b0892488be Merge pull request #5212 from boundlessgeo/browser_homogenize
Geopackage: browser homogenize
2017-09-19 13:15:32 +02:00
Nyall Dawson
9e61cd63df Move overriden methods from headers to cpp files
Since they can't be inlined anyway
2017-09-19 17:22:33 +10:00
Nyall Dawson
f387210e4a Move QgsPolygonV2 equality operators up to QgsCurvePolygon 2017-09-19 17:22:33 +10:00
Nyall Dawson
bb425e4540 Cleaner signature for QgsAbstractGeometry::closestSegment 2017-09-19 17:22:33 +10:00
Nyall Dawson
54c988f918 Make QgsAbstractGeometry::toCurveType pure virtual, and implement
for all geometry types

Previously this method would return nullptrs for many geometry
types
2017-09-19 17:22:33 +10:00
Nyall Dawson
5bb359db90 Boost test coverage of geometry classes 2017-09-19 17:22:33 +10:00
Nyall Dawson
9b6e79cd18 Expand QgsTriangle test coverage 2017-09-19 17:22:32 +10:00
Nyall Dawson
a15340fc2c Extend geometry test coverage 2017-09-19 17:22:32 +10:00
Nyall Dawson
d3db082cd2 Extend unit tests for QgsPolygonV2, QgsPoint 2017-09-19 17:22:32 +10:00
Nyall Dawson
328fc9cb8d Consistently use unsigned int for QgsRegularPolygon 2017-09-19 17:22:32 +10:00
Nyall Dawson
92d739619d Fix memory leak in QgsEllipse 2017-09-19 17:22:32 +10:00
Nyall Dawson
a6b6892454 Allow data item providers to override default directory handling 2017-09-19 08:06:09 +02:00
rldhont
f88af6d55f QgsVectorLayer, countSymbolFeatures return QgsVectorLayerFeatureCounter 2017-09-19 07:34:35 +02:00
Matthias Kuhn
3043e85ea1
Return error message from QgsVectorFileWriter 2017-09-18 18:32:42 +02:00
Matthias Kuhn
63def3d870
Doxygen improvements 2017-09-18 18:32:06 +02:00
Mathieu Pellerin
09195fb567 [processing] implement source flag for feature based algorithms (#5208) 2017-09-18 13:33:20 +07:00
Nyall Dawson
b44cf5d10f Fix memory leak 2017-09-18 12:10:46 +10:00
Martin Dobias
c92d7dc39b Docstring/sip fixes in core/3d 2017-09-15 16:44:42 +02:00
Vincent Mora
f63c302420 [FEATURE] Add undo and redo on transaction groups (#4765)
* [FEATURE] adds undo/redo for transaction groups

[needs-docs] the undo/redo now works with transcation groups. Just check
that there is no restriction in the transaction groups doc concerning
undo.

related to #14799

The undo/redo is implemented using SAVEPOINT.

The QgsTransaction interface has been enlarged to allow savepoints
creation and management. The savepoint is destroyed on
rollbackToSavepoint to have the same behavior has the sql ROLLBACK TO
SAVEPPOINT.

To avoid the creation of a savepoint for each feature modified in bulk
editing (e.g. paste, field calculator) the logic is a bit complicated: the
savepoint is created on QgsVectorLayer::editCommandStarted and the first
actual undo command (QgsVectorLayerUndoPassthroughCommand) is
responsible for the re-creation of the savepoint in case of undo-redo.
Since the behavior must be different in case edition doesn't take place
inside an edit command, a member function has been added to
QgsVectorLayer to expose the mEditCommandActive state.

Another (commented) tricky bit is the modification of the database
structure on add/delete attributes. On undo, the attribute is removed
before the rollback to savepoint, i.e. there is a useless ALTER TABLE
issued to restore the structure just before restoring it with the
ROLLBACK TO SAVEPOINT. This is necessary to make the provider
aware of the change of structure. It could be nicer/cleaner to have a way
to reload providers metadata.

The editPaste function has also been modified to use addFeatures instead of
addFeature (plural/singular), this is at the expense of an additional "cpy"
of the clipboard in memory, but it should improve perf with postgis provider.

* fixup operator aliases
2017-09-15 14:55:43 +02:00
Martin Dobias
6df6681326 Read/write 3D renderers of map layers to project files 2017-09-15 10:39:07 +02:00
Martin Dobias
ba7573a94e GUI for configuration of 3D polygon symbols for vector layers
In the style dock there is a new "3D View" tab - so far working just for polygon layers.
It is possible to select a polygon layer, enable 3D renderer and adjust its properties.
If a 3D Map View is open, it will be immediately updated (if auto-apply is enabled)

Very exciting! :-)
2017-09-15 10:39:07 +02:00
Nyall Dawson
9b112284c7 Add method to recover extent parameter CRS 2017-09-15 14:09:27 +10:00
Nyall Dawson
cfdc3c71e7 Use geometry of reproject extent parameters for more accurate clipping 2017-09-15 08:35:42 +10:00