288 Commits

Author SHA1 Message Date
Nyall Dawson
da02c9a7ba Fix deadlock when running algs in task manager and python exception occurs 2017-07-07 09:28:20 +10:00
Denis Rouzaud
54c6291378 script to write include SIP files 2017-06-28 10:45:51 +02:00
Nyall Dawson
9f5e33af72 Merge pull request #4767 from nyalldawson/layouts3
[layouts] Add layout measurement and size classes
2017-06-28 08:58:41 +10:00
Nyall Dawson
2b7b0db747 Allow keyword arguments for all arguments in PyQGIS bindings
Previously this was only enabled for optional arguments (i.e.
those with default values). Enabling them for all arguments
allows for more readable PyQGIS code, and there seems no
downside given that we already have this support partly enabled.

The consequence of this change is that when 3.0 API is frozen
the freeze must also include the naming of function arguments,
since that's effectively now part of public API.
2017-06-25 20:07:14 +10:00
Nyall Dawson
6a54130f0b [layout] Add layout measurement and size classes
These classes are used for storing measurements for a layout
(QgsLayoutMeasurement), sizes for a layout (QgsLayoutSize)
and points in a layout (QgsLayoutPoint)

They support storing a measurement unit alongside a measurement
length/size. A new class QgsLayoutMeasurementConverter handles
conversion between different units, including converting to and
from pixels via a specified DPI property.
2017-06-23 18:00:17 +10:00
Nyall Dawson
cbc9e03b9d Consolidate all QgsException subclasses in the same header 2017-06-23 12:08:54 +10:00
Nyall Dawson
d63d560eb3 Add support for VirtualErrorHandlers in core sip
Unfortunately requires a bunch of code to be duplicated from
QgsPythonUtilsImpl::getTraceback() into core.sip, but there's no way
to avoid this
2017-06-23 12:08:54 +10:00
Martin Dobias
7cd517c6ba [FEATURE] Legend for markers with data-defined size
(Merge pull request #4752 from wonder-sk/legend-data-defined-size)
2017-06-22 15:29:10 +02:00
Nyall Dawson
f6358b2118 Begin port of modeler algorithm to c++ 2017-06-20 14:45:13 +10:00
Martin Dobias
8c4d5bbb95 [FEATURE] Rendering of data-defined size in legend in "collapsed" mode
Instead of having different marker sizes in legend as separate legend nodes,
the new "collapsed" mode packs all sizes into one legend node.

This commit only makes it available in the API, not exposed in GUI yet.
2017-06-15 16:47:56 +02:00
Matthias Kuhn
4eae0872ab Fix QgsPoint(XY) sip bindings 2017-06-14 07:37:31 +02:00
Nyall Dawson
a23a6ac631 Create a QgsProcessingAlgRunnerTask task
Allows background execution of processing algorithms.

Not exposed anywhere in GUI (yet)
2017-06-06 07:41:19 +10:00
Nyall Dawson
fb811766f8 Add framework for algorithm outputs
This somewhat changes the meaning of outputs from processing 2.x.
In 2.x processing outputs were used both as a method of specifying
inputs to algorithms (file paths to destination layers created
by the algorithm) AND pure outputs (such as statistics calculated
by the algorithm).

This is now split. The old input-type-outputs (destination layers)
are now input parameters (since the parameter value IS an input to the
algorithm). To differentiate them from parameters indicating pure
input layers a new "isDestination()" method was added to
QgsProcessingParameterDefinition.

Output definitions are now purely indications of values CREATED
by the algorithms. Suitable candidates are the existing calculated
stats and actual file path/URI of any layers created by the algorithm.
Moving forward we should ensure all algorithms output as much
useful information as possible - e.g. number of features processed,
number of skipped features, count null geometries encountered, etc...
2017-06-06 07:41:19 +10:00
Nyall Dawson
ce063b8691 Add QgsFeatureSource interface as interface for classes which
provide feature iterators via a getFeatures method
2017-05-25 12:31:06 +10:00
Denis Rouzaud
fb8edea112 [sipify] implement template inheritance 2017-05-19 15:35:47 +02:00
Matthias Kuhn
ec40199862 Modularize expressions
The file qgsexpressions.h has grown to one monolithic piece over the
years. This makes it hard to maintain and slows down compilation because
even small changes at one end will result in recompiling big parts of
the source tree. It also requires the compiler to keep track of all
these implementation details for said big parts of the source tree.

This splits this implementation into smaller pieces. There are soe API
changes connected to this, but since these can be considered
implementation details, on which not many plugins rely, this shouldn't
have a big impact on the ecosystem outside the source tree.
2017-05-19 07:13:11 +02:00
Martin Dobias
21f03bc11c Clean up reading/writing of labeling configuration in vector layers
Historically the configuration used to be stored in layer's custom properties, but that does not scale
beyond simple rendering and so rule-based labeling introduced storage of configuration natively in XML elements.
That left us with two different ways of reading/writing labeling configurations. This work makes all configuration
to use native XML elements.

To keep compatibility of 2.x projects, reading of configuration from custom properties is preserved.

This commit also adds Python APIs for direct manipulation of labeling configuration through vector layer's
setLabeling() and labeling() calls.
2017-05-16 14:25:32 +08:00
Nyall Dawson
280ca31972 Merge pull request #4401 from nyalldawson/processing_params
c++ framework for parameters and running algorithms
2017-05-15 07:08:07 +10:00
Martin Dobias
23a7bd0fd9 Introduce QgsReadWriteContext that encapsulates QgsPathResolver
This should make the read/write methods more flexible if we need to give them extra context.
2017-05-13 18:09:26 +08:00
Nyall Dawson
384369c3c4 Rename QgsVectorLayerImport to QgsVectorLayerExporter
Since the majority of users of this class will be exporting
an existing map layer to a data provider, the QgsVectorLayerImport
name is misleading and suggests that this class is designed
just to bring layers "into" QGIS.

Explicitly naming the class "Exporter" should help API users
discover this class.

Also cleanup API and improve docs
2017-05-12 08:02:51 +10:00
Matthias Kuhn
964d9ac70a Send feature counting to background task 2017-05-11 12:42:26 +02:00
lbartoletti
13c1318a5f New geometry class: QgsRegularPolygon (#4502) 2017-05-10 22:23:28 +10:00
Nyall Dawson
3706d88045 [processing] c++ framework for parameters and running algorithms (WIP)
This commit adds the virtual method for running processing algs
to the base c++ class, and adds the initial framework
for c++ algorithm parameters.

When running an algorithm, a QVariantMap is passed
as the algorithm parameters. The high level API provided
by QgsProcessingParameters should be used to retrieve
strings/layers/doubles/etc from this QVariantMap.

This allows advanced use cases, such as passing QgsProperty
with the QVariantMap for "dynamic" parameters, where the
value should be evaluated for every feature processed.

E.g. if the buffer algorithm uses a dynamic property for distance,
then the distance could be bound to either a field value or
to a custom expression. This gets evaluated before buffering
each feature to allow for advanced variable buffering.

Support for dynamic parameters will be "opt in", and non default.
So algorithms will need to specifically add support for
dynamic properties as required.
2017-05-10 10:14:37 +10:00
Nyall Dawson
8d03642387 Merge pull request #4487 from nyalldawson/memory
Move memory provider to core
2017-05-06 14:13:15 +10:00
Nyall Dawson
b5ae888b60 Merge pull request #4478 from nyalldawson/layer_store
Split off map layer storage handling from QgsProject to QgsMapLayerStore
2017-05-06 13:00:05 +10:00
Martin Dobias
0a0c33dcf2 Remove QgsGeometryCache class
The geometry cache was only used for few geometry editing operations anyway. In earlier versions
of QGIS the geometry cache was also used by old snapping classes which have been replaced
by QgsPointLocator that also keeps a spatial index of geometries and it is not rebuilt on every re-render.

Reasons for removal:
- geometry cache was repopulated on every redraw of layers in editing mode, slowing down rendering
- data structure for the cache was a simple map with features accessed by their ID (no spatial index)
- the cache was only getting refreshed for the current view of the main map canvas (not a generic cache)
- not used for snapping anymore where caching was important to avoid roundtrips to data provider
2017-05-06 10:34:23 +08:00
Nyall Dawson
767cb12c2a Add QgsMemoryProviderUtils.createMemoryLayer for easy creation
of new memory layers from QgsFields/QgsCoordinateReferenceSystem/etc

Since memory provider cannot use QgsVectorLayerImport we need
another centeralized function for creating new memory layers
without the need to manually create the uri string.
2017-05-06 12:05:12 +10:00
Nyall Dawson
5600395e29 Add metadata validator
Adds a new abstract base class QgsMetadataValidator for validating
metadata against standard schemas.

Initially only QgsNativeMetadataValidator for validating against
the native QGIS metadata schema is implemented.

In future this could be extended with Dublin Core, ISO 19115
validators, etc...
2017-05-04 07:29:56 +10:00
Nyall Dawson
269bfe7bf7 Metadata class shell 2017-05-04 07:29:56 +10:00
Nyall Dawson
f9bd83c035 Split off map layer storage handling from QgsProject to QgsMapLayerStore
Turns out that there's valid use cases for having layer stores
outside of the cost of using a whole QgsProject.

Partially reverts the merger of QgsMapLayerRegistry into QgsProject,
except that there's no singletons here.
2017-05-03 07:09:44 +10:00
nirvn
295c21227c Add a QgsMapSettingsUtils::worldFileContent() function 2017-05-02 12:15:46 +07:00
lbartoletti
84471f2e6d New classes for circle and ellipse. 2017-04-27 10:25:29 +10:00
Nyall Dawson
241d283bb8 Create a context object for processing algorithm execution 2017-04-26 12:53:35 +10:00
Nyall Dawson
fea6bff707 Merge pull request #4389 from nyalldawson/scalebar
Refactor scalebar renderer, split from composer
2017-04-26 12:40:06 +10:00
Nyall Dawson
b40bc0c1f7 Refactor scale bar rendering
Move all scalebar rendering code out of composer and ensure that
all scalebar rendering is done independant of QgsComposerScaleBar

This allows scalebar rendering code to be reused by plugins
and by non-composer code.

Also rename QgsScaleBarStyle -> QgsScaleBarRenderer, (and all
subclasses too). This name better reflects what these classes do.
2017-04-26 11:46:51 +10:00
Nyall Dawson
363336394e Add a QgsFeatureSink interface for classes which accept adding features 2017-04-26 10:39:57 +10:00
Martin Dobias
25ed76b86e Move labeling engine config to a new class + QgsPalLabeling cleanup
Another bit to make core library independent from QgsProject::instance().
Until now labeling engine configuration was taken from project singleton.

Removed legacy methods from QgsPalLabeling - the class now does not have
any more member variables/methods, it is just a bunch of helper functions.

(PR #4384)
2017-04-21 18:04:09 +08:00
Mathieu Pellerin
e0d20e537d Update decorators to avoid relying on map canvas when rendering (#4388) 2017-04-21 12:06:24 +07:00
Mathieu Pellerin
db848a3f1a Upgrade the save as image function into a background task (#4382) 2017-04-21 11:47:37 +07:00
Denis Rouzaud
0b0e8a6a89 move QgsFieldModel and QgsFieldProxyModel to core and sipify 2017-04-19 16:44:36 +02:00
Martin Dobias
24c5b0326f Rewrite addTopologicalPoints() and remove legacy snapping code + unit test 2017-04-19 11:24:20 +08:00
Nyall Dawson
c4ea048e5b New QgsRange template based class for storing interval ranges
QgsRange classes represent a range of values of some element
type. For instance, ranges of QDateTime might be used to
represent the ranges of timestamp ranges.

Ranges can indicate whether the upper and lower values are
inclusive or exclusive. The inclusivity or exclusivity of
bounds is considered when determining things like whether
ranges overlap or during calculation of range intersections.

Includes typedefs for QgsDoubleRange, QgsIntRange, QgsDateRange.
2017-04-18 12:19:42 +10:00
Nyall Dawson
147bb7f1ed Move ellipsoid parameter retrieval to new QgsEllipsoidUtils class 2017-04-18 09:53:00 +10:00
Nyall Dawson
226bd9bb60 Move QgsRectangle and QgsBox3d to geometry folder
Since these are both geometry related classes, it's nicer to
keep these all together
2017-04-12 15:27:34 +10:00
Nyall Dawson
0d843ff4e6 Initial framework for 3D box class 2017-04-12 14:08:47 +10:00
Nyall Dawson
110828feab [FEATURE] Background saving of raster layers
Use the task manager framework to handle saving of raster layers
in the background
2017-04-07 08:18:57 +10:00
Nyall Dawson
8ffdb362cc Port some processing dataobjects routines to c++ 2017-04-05 15:27:17 +10:00
Nyall Dawson
52cc002990 Simple c++ base class for processing algorithms 2017-04-03 21:17:45 +10:00
Denis Rouzaud
a44eb4d7b0 use dedicated header for QgsAttributes 2017-03-30 15:13:01 +02:00
lbartoletti
fb3d07f3f5 [FEATURE] New class for triangle
Adds a new geometry class for Triangle geometries

Methods include orthocenter, bisectors, medians, medial, circumscribed (center,
radius), inscribed (center, radius)

Also adds make_triangle expression function for creating triangles
2017-03-21 18:50:47 +10:00