90 Commits

Author SHA1 Message Date
Alexander Bruy
5709f84b2f [processing] add createByDefault argument to directory output
constructor
2019-07-15 08:51:01 +10:00
Nyall Dawson
e65acadc3a [processing][API] Add methods to retrieve lists of files from
QgsProcessingParameterMultipleInput

These need to be handled differently to map layers, and none of
the existing API works for this use case.
2019-07-09 11:22:36 +10:00
Nyall Dawson
e9a1eab694 [processsing][API] Add api to allow QgsProcessingParameterFile parameters
to have a file filter string defined

Previously only an extension was settable, which prevented use when
multiple extension types are possible. A file filter string allows
for flexible file selection instead.
2019-07-08 15:07:42 +10:00
Nyall Dawson
d96c7386b1 Allow creation of color parameters with no opacity control 2019-07-01 06:32:21 +10:00
Nyall Dawson
38bb5fb260 [FEATURE][processing] New parameter type for colors
Allows for algorithms which require a color value as an input
2019-07-01 06:32:21 +10:00
Mathieu Pellerin
a888986567
[needs-docs][processing] Avoid field collision via optional prefix in overlay algorithms (#10092)
Makes for a more predictable collision avoidance, which
can be neccessary for some models.
2019-05-24 19:00:28 +07:00
rldhont
943c7d5d90 [Processing] Define boolean output
In processing, if an algorithm has a boolean as an output, it cannot be defined as boolean but as a number.

To be more precise in algorithms description, the commit add QgsProcessingOutputBoolean.
2019-05-17 08:21:57 +10:00
Matthias Kuhn
8416e7588c
Merge pull request #9781 from m-kuhn/processing_parameter_as_boolean
Add QgsProcessingAlgorithm::parameterAsBoolean
2019-04-17 09:20:07 +02:00
Alessandro Pasotti
394a189682 Fix class documentation 2019-04-17 10:06:41 +10:00
Nyall Dawson
b6bc1ee2d4 Tweak QgsProcessingUtils::combineLayerExtents for future proofing, remove deprecated usage 2019-04-17 10:06:41 +10:00
Alessandro Pasotti
f8dfdc4aa0 Deprecate method without transformContext 2019-04-17 10:06:41 +10:00
Matthias Kuhn
4771f802fc
Add QgsProcessingParameters::parameterAsBoolean for consistency 2019-04-15 14:08:41 +02:00
Matthias Kuhn
d0e24e8bc4
Add QgsProcessingAlgorithm::parameterAsBoolean
For consistency

Alias to QgsProcessingAlgorithm::parameterAsBool(), because the parameter class is called
QgsProcessingParameterBoolean
2019-04-12 21:26:09 +02:00
Nyall Dawson
933559b655 [processing] Report provider version string alongside QGIS version in log
Helpful for debugging and reproducability of results
2019-04-08 16:59:15 +10:00
Nyall Dawson
708bf4425b [processing] Add version method to QgsProcessingProvider
Allows retrieving provider version
2019-04-08 16:59:15 +10:00
Nyall Dawson
d3016d73d4 [processing] Add method to specify additional expression context variables
which will be available to a parameter when it is evaluated.

Specifying variables via this method is for metadata purposes only.
It is the algorithm's responsibility to correctly set the value of
these additional variables in all expression context used when evaluating
the parameter, in whichever way is appropriate for that particular variable.
2019-04-08 07:07:12 +10:00
Nyall Dawson
7674e1657b [processing] Include version information at start of log
Start the log text with QGIS/Qt/GEOS/GDAL version information strings.
This is helpful for debugging and accountability.
2019-04-02 06:16:45 +10:00
Denis Rouzaud
631c7016db
scope enum for QgsProcessing::LayerHint (#9639) 2019-03-27 17:23:36 -05:00
Harrissou Sant-anna
f998ec9bb4 Remove duplicate word 2019-03-22 12:44:27 +10:00
Nyall Dawson
719a225bca [processing] Port point widget wrapper to new API
And switch to a snapping canvas tool when selecting points from canvas
2019-03-17 16:19:40 +10:00
Nyall Dawson
32fbf0a92b [processing][FEATURE] New parameter type for map scales
This adds a new parameter type specifically for map scales,
QgsProcessingParameterScale. The values are evaluated using
self.parameterAsDouble, which returns the map scale
denominator (matching the standard in other parts of the
QGIS API).

Scale parameters are displayed to users using the standard
QgsScaleWidget, which includes the combo box of predefined
scales and a shortcut button to match the current map scale.
2019-03-13 16:52:29 +10:00
Nyall Dawson
0003e91f27 Add methods to resolve parameters to layouts/layout items 2019-03-12 08:16:52 +10:00
Nyall Dawson
ba82954ac5 [processing] Add new parameter type for layout item objects 2019-03-12 08:16:52 +10:00
Nyall Dawson
dd49720863 [processing] Add new parameter type for print layout names 2019-03-12 08:16:52 +10:00
Nyall Dawson
c0640c67b0 [processing] Add flag for algorithms with known issues 2019-03-06 06:33:06 +10:00
Nyall Dawson
d84b70f04d [processing] Add acceptable string values to parameter metadata
Returns a descriptive list of the possible string values acceptable
for the parameter.

E.g. for a QgsProcessingParameterVectorLayer this may include
"Path to a vector layer", for QgsProcessingParameterBoolean
"1 for true, 0 for false" etc.
2019-03-04 07:57:24 +10:00
Nyall Dawson
107b48a430 Add NULLPTR macro for use in doxygen comments
For the c++ api dox this expands to "\c nullptr" (the
\c directive indicates a code literal value), and for sipify/Python
it expands to ``None`` (`` is sphinx annotation for literal values)

Makes for nicer dox for both c++ and Python!
2019-02-27 09:41:11 +10:00
Nyall Dawson
b6d66becab Sipify 2019-02-27 09:41:11 +10:00
Bas Couwenberg
371176357b Fix spelling errors.
* cancelation -> cancellation
 * overal      -> overall
2019-02-24 22:39:40 +01:00
Víctor Olaya
13bff9620c [processing] do not allow using unsupported file formats
Show warning message if user selects incompatible output file format

fixes #21089
2019-02-23 05:24:56 +10:00
Nyall Dawson
cdc622ef4c Freackin Amurican sppelling 2019-02-23 05:23:23 +10:00
Nyall Dawson
e31fb920e7 [processing] Add API to allow custom expression variables to be set
for a model
2019-02-23 05:23:23 +10:00
Nyall Dawson
979adbbabf Indicate exception types to sip
Exposes the full Python exception when an error occurs in createInstance()
2019-02-20 13:05:09 +10:00
Nyall Dawson
7418c189d0 [processing] Also generate friendly names for outputs when converting models to scripts 2019-02-14 15:36:55 +10:00
Nyall Dawson
d342ce939b [processing] When converting models to Python, use friendlier (more
descriptive) names when storing child algorithm results

Makes for much easier to understand scripts
2019-02-14 15:36:55 +10:00
Nyall Dawson
493aed58fb API tweak 2019-02-13 07:59:30 +10:00
Nyall Dawson
9b2e60130f [processing] Update QgsProcessingModelAlgorithm::asPythonCode for 3.x API 2019-02-01 17:54:28 +11:00
Nyall Dawson
fb519ead46 Update QgsProcessingModelChildAlgorithm::asPythonCode for 3.x API 2019-02-01 17:54:28 +11:00
Nyall Dawson
946687c87b Update QgsProcessingModelChildParameterSource::asPythonCode 2019-02-01 17:54:28 +11:00
Nyall Dawson
37774f9aa9 [processing] Add util to convert QVariant value to Python literal 2019-02-01 17:54:28 +11:00
Nyall Dawson
ffa49df9fb Fix misleading dox 2019-02-01 17:54:28 +11:00
Nyall Dawson
63b6a77702 [processing] Add API to convert a parameter definition to an equivalent
Python constructor string
2019-01-29 18:15:40 +11:00
Nyall Dawson
d4b262cdb0 Add method to convert QgsProcessing::SourceType to string representation 2019-01-29 18:15:40 +11:00
Nyall Dawson
431861a468 [processing] Add a better API for specifying that outputs are temporary
Instead of requiring clients to generate temporary file names themselves,
(or use the cryptic "memory:" string!), this PR adds a static constant

    QgsProcessing.TEMPORARY_OUTPUT

If a layer/sink output parameter is set to QgsProcessing.TEMPORARY_OUTPUT,
then the temporary output filename will be generated automatically at
algorithm run time. This means callers don't need to mess around with
finding appropriate temporary folders and paths.

Another benefit is that TEMPORARY_OUTPUT is stored in the processing
history, so if you re-run a previous algorithm which was set to
output to a temporary file, it no longer tries to use that same
previous temporary path and instead generates a new one.
2019-01-25 23:27:08 +11:00
Nyall Dawson
3cb6a40ef2 [processing] Add API to get an import statement and classname for a parameter type 2019-01-25 18:12:11 +11:00
Nyall Dawson
5acd7ffaef [processing] Add API to set default unit to distance parameters
Otherwise the API forces use of a corresponding CRS parameter in
order to determine the relevant distance unit, but this is not
always desirable
2018-12-18 04:39:06 +10:00
Peter Petrik
e71660215c [processing] add QgsProcessingParameterMeshLayer parameter 2018-12-17 11:50:53 +01:00
Nyall Dawson
11ea28a5b3 [FEATURE][processing] Add a new parameter type for authentication config
This adds a new available parameter type for processing algorithms,
QgsProcessingParameterAuthConfig, allowing selection from available
authentication configurations (and creation of new ones).

It allows creation of processing algorithm which can fully take
advantage of QGIS' mature authentication handling, avoiding the
need to use insecure string parameters for users to input
sensitive logon credentials.

QgsProcessingParameterAuthConfig parameters are evaluated using
QgsProcessingAlgorithm.parameterAsString(), which returns the
selected authentication configuration ID.
2018-12-15 08:23:10 +10:00
Nyall Dawson
4bca7838bf [processing] Add method for providers to specify a different list
of supported output formats when an output has no geometry
2018-12-03 18:11:24 +10:00
Nyall Dawson
d72c4d001f [processing] Allow parameter metadata to set the number of decimal places
to show in numeric/distance widgets

E.g. to only show 2 decimal places:

  # only show two decimal places in parameter's widgets, not 6:
  param.setMetadata( {'widget_wrapper':
    { 'decimals': 2 }
  })
2018-11-30 05:02:59 +10:00