1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686
|
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/processing/models/qgsprocessingmodelalgorithm.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
class QgsProcessingModelAlgorithm : QgsProcessingAlgorithm
{
%Docstring(signature="appended")
Model based algorithm with processing.
%End
%TypeHeaderCode
#include "qgsprocessingmodelalgorithm.h"
%End
public:
static const QMetaObject staticMetaObject;
public:
QgsProcessingModelAlgorithm( const QString &name = QString(), const QString &group = QString(), const QString &groupId = QString() );
%Docstring
Constructor for QgsProcessingModelAlgorithm.
%End
virtual void initAlgorithm( const QVariantMap &configuration = QVariantMap() ); //#spellok
virtual Qgis::ProcessingAlgorithmFlags flags() const;
virtual QString name() const;
virtual QString displayName() const;
virtual QString group() const;
virtual QString groupId() const;
virtual QIcon icon() const;
virtual QString svgIconPath() const;
virtual QString shortHelpString() const;
virtual QString shortDescription() const;
virtual QString helpUrl() const;
virtual bool canExecute( QString *errorMessage /Out/ = 0 ) const;
virtual QString asPythonCommand( const QVariantMap ¶meters, QgsProcessingContext &context ) const;
virtual QgsExpressionContext createExpressionContext( const QVariantMap ¶meters, QgsProcessingContext &context, QgsProcessingFeatureSource *source = 0 ) const;
void setName( const QString &name );
%Docstring
Sets the model ``name``.
.. seealso:: :py:func:`name`
%End
void setGroup( const QString &group );
%Docstring
Sets the model ``group``.
.. seealso:: :py:func:`group`
%End
bool validate( QStringList &issues /Out/ ) const;
%Docstring
Validates the model, returning ``True`` if all child algorithms in the
model are valid.
:return: - ``True`` if the child is valid
- issues: a list of issues encountered during the validation
.. versionadded:: 3.14
%End
QMap<QString, QgsProcessingModelChildAlgorithm> childAlgorithms() const;
%Docstring
Returns the map of child algorithms contained in the model. The keys are
the child algorithm ids (see
QgsProcessingModelAlgorithm.ChildAlgorithm.childId()).
.. seealso:: :py:func:`childAlgorithm`
.. seealso:: :py:func:`setChildAlgorithms`
.. seealso:: :py:func:`addChildAlgorithm`
%End
void setChildAlgorithms( const QMap<QString, QgsProcessingModelChildAlgorithm> &childAlgorithms );
%Docstring
Sets the map of child algorithms contained in the model. The keys are
the child algorithm ids (see
QgsProcessingModelAlgorithm.ChildAlgorithm.childId()). All existing
child algorithms will be replaced.
.. seealso:: :py:func:`childAlgorithms`
.. seealso:: :py:func:`childAlgorithm`
.. seealso:: :py:func:`setChildAlgorithm`
.. seealso:: :py:func:`addChildAlgorithm`
%End
void setChildAlgorithm( const QgsProcessingModelChildAlgorithm &algorithm );
%Docstring
Sets the child ``algorithm`` within the model. If a child algorithm
already exists in the model with the same child ID then that algorithm
will be replaced.
.. seealso:: :py:func:`addChildAlgorithm`
.. seealso:: :py:func:`setChildAlgorithms`
%End
QString addChildAlgorithm( QgsProcessingModelChildAlgorithm &algorithm );
%Docstring
Adds a new child ``algorithm`` to the model. If a child algorithm
already exists in the model with the same child ID then ``algorithm``
will be assigned a new autogenerated unique ID. The assigned child ID
will be returned.
.. seealso:: :py:func:`childAlgorithms`
.. seealso:: :py:func:`childAlgorithm`
.. seealso:: :py:func:`setChildAlgorithm`
.. seealso:: :py:func:`setChildAlgorithms`
%End
QgsProcessingModelChildAlgorithm &childAlgorithm( const QString &id );
%Docstring
Returns the child algorithm with matching ``id``. If no child algorithm
exists with this ID a new algorithm will be added to the model and
returned.
.. seealso:: :py:func:`addChildAlgorithm`
.. seealso:: :py:func:`childAlgorithms`
%End
bool removeChildAlgorithm( const QString &id );
%Docstring
Attempts to remove the child algorithm with matching ``id``. Returns
``True`` if the algorithm could be removed, or ``False`` if the
algorithm could not be removed (e.g. due to other child algorithms
depending on it).
.. seealso:: :py:func:`deactivateChildAlgorithm`
%End
void deactivateChildAlgorithm( const QString &id );
%Docstring
Deactivates the child algorithm with matching ``id``. All other child
algorithms which depend on the child algorithm will also be deactivated.
.. seealso:: :py:func:`removeChildAlgorithm`
.. seealso:: :py:func:`activateChildAlgorithm`
%End
bool activateChildAlgorithm( const QString &id );
%Docstring
Attempts to activate the child algorithm with matching ``id``. If any
child algorithms on which the child depends are not active, then the
child will not be activated and ``False`` will be returned.
.. seealso:: :py:func:`deactivateChildAlgorithm`
%End
QSet< QString > dependentChildAlgorithms( const QString &childId, const QString &conditionalBranch = QString() ) const;
%Docstring
Returns a list of the child algorithm IDs depending on the child
algorithm with the specified ``childId``.
Optionally, a specific conditional branch which is created by the child
algorithm can be specified in order to restrict the returned list to
algorithms which depend on this specific branch.
.. seealso:: :py:func:`dependsOnChildAlgorithms`
%End
QSet< QString > dependsOnChildAlgorithms( const QString &childId ) const;
%Docstring
Returns a list of the child algorithm IDs on which the child algorithm
with the specified ``childId`` depends upon.
.. seealso:: :py:func:`dependentChildAlgorithms`
%End
QList< QgsProcessingModelChildDependency > availableDependenciesForChildAlgorithm( const QString &childId ) const;
%Docstring
Returns details of available dependencies for the child algorithm with
matching id.
.. versionadded:: 3.14
%End
bool validateChildAlgorithm( const QString &childId, QStringList &issues /Out/ ) const;
%Docstring
Validates the child algorithm with matching ID, returning ``True`` if
all mandatory inputs to the algorithm have valid values.
:param childId: ID for child to validate
:return: - ``True`` if the child is valid
- issues: a list of issues encountered during the validation
.. versionadded:: 3.14
%End
void addModelParameter( QgsProcessingParameterDefinition *definition /Transfer/, const QgsProcessingModelParameter &component );
%Docstring
Adds a new parameter to the model, with the specified ``definition`` and
graphical ``component``. Ownership of ``definition`` is transferred to
the model.
.. seealso:: :py:func:`updateModelParameter`
.. seealso:: :py:func:`removeModelParameter`
%End
void updateModelParameter( QgsProcessingParameterDefinition *definition /Transfer/ );
%Docstring
Replaces the definition of an existing parameter (by parameter name)
with a new ``definition``. Ownership of ``definition`` is transferred to
the model, and any existing parameter is deleted.
.. seealso:: :py:func:`addModelParameter`
.. seealso:: :py:func:`removeModelParameter`
%End
void removeModelParameter( const QString &name );
%Docstring
Removes an existing model parameter by ``name``. The definition of the
matching parameter is deleted.
.. seealso:: :py:func:`addModelParameter`
.. seealso:: :py:func:`updateModelParameter`
%End
void changeParameterName( const QString &oldName, const QString &newName );
%Docstring
Changes a model parameter's internal name from ``oldName`` to
``newName``.
This method will automatically update all model components to relink
using the new name.
.. versionadded:: 3.26
%End
bool childAlgorithmsDependOnParameter( const QString &name ) const;
%Docstring
Returns ``True`` if any child algorithms depend on the model parameter
with the specified ``name``.
.. seealso:: :py:func:`otherParametersDependOnParameter`
%End
bool otherParametersDependOnParameter( const QString &name ) const;
%Docstring
Returns ``True`` if any other model parameters depend on the parameter
with the specified ``name`` (e.g. field parameters where ``name`` is the
parent layer parameter).
.. seealso:: :py:func:`childAlgorithmsDependOnParameter`
%End
QMap<QString, QgsProcessingModelParameter> parameterComponents() const;
%Docstring
Returns the map of parameter components used by the model. The keys
should match the algorithm's parameter names (see
:py:func:`~QgsProcessingModelAlgorithm.parameterDefinitions` ).
.. seealso:: :py:func:`setParameterComponent`
.. seealso:: :py:func:`parameterComponent`
%End
void setParameterComponents( const QMap<QString, QgsProcessingModelParameter> ¶meterComponents );
%Docstring
Sets the map of parameter components used by the model. The keys should
match the algorithm's parameter names (see
:py:func:`~QgsProcessingModelAlgorithm.parameterDefinitions` ). All
existing parameter components will be replaced.
.. seealso:: :py:func:`parameterComponents`
.. seealso:: :py:func:`setParameterComponent`
.. seealso:: :py:func:`parameterComponent`
%End
void setParameterComponent( const QgsProcessingModelParameter &component );
%Docstring
Sets a parameter ``component`` for the model. If a parameter component
already exists in the model with the same parameter name then that
component will be replaced.
.. seealso:: :py:func:`parameterComponents`
.. seealso:: :py:func:`setParameterComponents`
.. seealso:: :py:func:`parameterComponent`
%End
QgsProcessingModelParameter ¶meterComponent( const QString &name );
%Docstring
Returns the parameter component with matching ``name``. If no parameter
component exists with this name a new component will be added to the
model and returned.
.. seealso:: :py:func:`parameterComponents`
.. seealso:: :py:func:`setParameterComponents`
.. seealso:: :py:func:`setParameterComponent`
%End
QList< QgsProcessingModelParameter > orderedParameters() const;
%Docstring
Returns an ordered list of parameters for the model.
.. seealso:: :py:func:`setParameterOrder`
.. versionadded:: 3.14
%End
void setParameterOrder( const QStringList &order );
%Docstring
Sets the ``order`` for showing parameters for the model.
The ``order`` list should consist of parameter names corresponding to
existing model
:py:func:`~QgsProcessingModelAlgorithm.parameterComponents`.
.. seealso:: :py:func:`orderedParameters`
.. versionadded:: 3.14
%End
QList< QgsProcessingModelOutput > orderedOutputs() const;
%Docstring
Returns an ordered list of outputs for the model.
.. seealso:: :py:func:`setOutputOrder`
.. versionadded:: 3.32
%End
void setOutputOrder( const QStringList &order );
%Docstring
Sets the ``order`` for sorting outputs for the model.
The ``order`` list should consist of "output child algorithm id:output
name" formatted strings corresponding to existing model outputs.
.. seealso:: :py:func:`orderedOutputs`
.. versionadded:: 3.32
%End
QString outputGroup() const;
%Docstring
Returns the destination layer tree group name for outputs created by the
model.
.. seealso:: :py:func:`setOutputGroup`
.. versionadded:: 3.32
%End
void setOutputGroup( const QString &group );
%Docstring
Sets the destination layer tree ``group`` name for outputs created by
the model.
.. seealso:: :py:func:`outputGroup`
.. versionadded:: 3.32
%End
void updateDestinationParameters();
%Docstring
Updates the model's parameter definitions to include all relevant
destination parameters as required by child algorithm ModelOutputs. Must
be called whenever child algorithm ModelOutputs are altered.
%End
void addGroupBox( const QgsProcessingModelGroupBox &groupBox );
%Docstring
Adds a new group ``box`` to the model.
If an existing group box with the same uuid already exists then its
definition will be replaced.
.. seealso:: :py:func:`groupBoxes`
.. versionadded:: 3.14
%End
QList< QgsProcessingModelGroupBox > groupBoxes() const;
%Docstring
Returns a list of the group boxes within the model.
.. seealso:: :py:func:`addGroupBox`
.. versionadded:: 3.14
%End
void removeGroupBox( const QString &uuid );
%Docstring
Removes the group box with matching ``uuid`` from the model.
.. seealso:: :py:func:`addGroupBox`
.. seealso:: :py:func:`groupBoxes`
.. versionadded:: 3.14
%End
bool toFile( const QString &path ) const;
%Docstring
Writes the model to a file, at the specified ``path``.
.. seealso:: :py:func:`fromFile`
%End
bool fromFile( const QString &path );
%Docstring
Reads the model from a file, at the specified ``path``.
.. seealso:: :py:func:`toFile`
%End
QVariant toVariant() const;
%Docstring
Saves this model to a QVariantMap, wrapped in a QVariant. You can use
:py:class:`QgsXmlUtils`.writeVariant to save it to an XML document.
.. seealso:: :py:func:`loadVariant`
.. versionadded:: 3.4
%End
bool loadVariant( const QVariant &variant );
%Docstring
Loads this model from a QVariantMap, wrapped in a QVariant ``variant``.
You can use :py:class:`QgsXmlUtils`.readVariant to load it from an XML
document.
.. seealso:: :py:func:`toVariant`
.. versionadded:: 3.4
%End
QVariantMap &helpContent();
%Docstring
Returns the model's help contents (a free-form map of values describing
the algorithm's use and metadata).
.. seealso:: :py:func:`setHelpContent`
%End
void setHelpContent( const QVariantMap &contents );
%Docstring
Sets the model's help ``contents`` (a free-form map of values describing
the algorithm's use and metadata).
.. seealso:: :py:func:`helpContent`
%End
QString sourceFilePath() const;
%Docstring
Returns the source file path for the model, if available.
.. seealso:: :py:func:`setSourceFilePath`
%End
void setSourceFilePath( const QString &path );
%Docstring
Sets the source file ``path`` for the model, if available.
.. seealso:: :py:func:`sourceFilePath`
%End
bool modelNameMatchesFilePath() const;
%Docstring
Returns ``True`` if the model name matches the current model
:py:func:`~QgsProcessingModelAlgorithm.sourceFilePath`.
Specifically, this method will return true if the complete base name of
:py:func:`~QgsProcessingModelAlgorithm.sourceFilePath` is identical
(case-insensitive) to the model name.
.. versionadded:: 3.24
%End
QStringList asPythonCode( QgsProcessing::PythonOutputType outputType, int indentSize ) const;
%Docstring
Attempts to convert the model to executable Python code, and returns the
generated lines of code.
The ``outputType`` argument dictates the desired script type.
The ``indentSize`` arguments specifies the size of indented lines.
%End
QList< QgsProcessingModelChildParameterSource > availableSourcesForChild( const QString &childId, const QStringList ¶meterTypes = QStringList(),
const QStringList &outputTypes = QStringList(), const QList< int > &dataTypes = QList< int >() ) const;
%Docstring
Returns a list of possible sources which can be used for the parameters
for a child algorithm in the model. Returned sources are those which
match either one of the specified ``parameterTypes`` (see
:py:func:`QgsProcessingParameterDefinition.type()` ) or one of the
specified ``outputTypes`` (see
:py:func:`QgsProcessingOutputDefinition.type()` ). If specified, an
optional list of ``dataTypes`` can be used to filter the returned
sources to those with compatible data types for the parameter/outputs.
%End
class VariableDefinition
{
%Docstring(signature="appended")
Definition of a expression context variable available during model
execution.
%End
%TypeHeaderCode
#include "qgsprocessingmodelalgorithm.h"
%End
public:
VariableDefinition( const QVariant &value = QVariant(), const QgsProcessingModelChildParameterSource &source = QgsProcessingModelChildParameterSource::fromStaticValue( QVariant() ), const QString &description = QString() );
%Docstring
Constructor for a new VariableDefinition with the specified ``value``
and original parameter ``source``, and ``description``.
%End
QVariant value;
QgsProcessingModelChildParameterSource source;
QString description;
};
QMap< QString, QgsProcessingModelAlgorithm::VariableDefinition > variablesForChildAlgorithm( const QString &childId, QgsProcessingContext *context = 0, const QVariantMap &modelParameters = QVariantMap(),
const QVariantMap &results = QVariantMap() ) const;
%Docstring
Returns a map of variable name to variable definition for expression
context variables which are available for use by child algorithm during
model execution.
The child algorithm ``childId`` and processing ``context`` are
manadatory. If ``modelParameters`` and ``results`` are not specified,
then only the variable names and sources will be returned, but all
variable values will be null. This can be used to determine in advance
which variables will be available for a specific child algorithm, e.g.
for use in expression builder widgets.
In order to calculate the actual variable value, the input model
``modelParameters`` and already executed child algorithm ``results``
must be passed.
.. seealso:: :py:func:`createExpressionContextScopeForChildAlgorithm`
%End
QgsExpressionContextScope *createExpressionContextScopeForChildAlgorithm( const QString &childId, QgsProcessingContext &context, const QVariantMap &modelParameters = QVariantMap(),
const QVariantMap &results = QVariantMap() ) const /Factory/;
%Docstring
Creates a new expression context scope for a child algorithm within the
model.
.. seealso:: :py:func:`variablesForChildAlgorithm`
%End
QVariantMap variables() const;
%Docstring
Returns the map of custom expression context variables defined for this
model.
These variables are added to the model's expression context scope,
allowing for preset "constant" expression variables to be utilized
within the model.
.. seealso:: :py:func:`setVariables`
.. versionadded:: 3.8
%End
void setVariables( const QVariantMap &variables );
%Docstring
Sets the map of custom expression context ``variables`` for this model.
These variables are added to the model's expression context scope,
allowing for preset "constant" expression variables to be utilized
within the model.
.. seealso:: :py:func:`variables`
.. versionadded:: 3.8
%End
QVariantMap designerParameterValues() const;
%Docstring
Returns the parameter values to use as default values when running this
model through the designer dialog.
This usually corresponds to the last set of parameter values used when
the model was run through the designer.
.. seealso:: :py:func:`setDesignerParameterValues`
.. versionadded:: 3.14
%End
void setDesignerParameterValues( const QVariantMap &values );
%Docstring
Sets the parameter ``values`` to use as default values when running this
model through the designer dialog.
This usually corresponds to the last set of parameter values used when
the model was run through the designer.
.. seealso:: :py:func:`designerParameterValues`
.. versionadded:: 3.14
%End
const QgsProcessingParameterDefinition *modelParameterFromChildIdAndOutputName( const QString &childId, const QString &childOutputName ) const;
%Docstring
Given a child algorithm ID and output name, attempts to match it to a
parameter definition from the overall model.
.. versionadded:: 3.26
%End
static QString safeName( const QString &name, bool capitalize = false );
%Docstring
Makes a name "safe", by replacing any non-alphanumeric characters with
underscores.
If ``capitalize`` is ``True`` then the string will be converted to a
camel case string.
.. versionadded:: 3.26
%End
protected:
virtual QgsProcessingAlgorithm *createInstance() const /Factory/;
virtual QVariantMap processAlgorithm( const QVariantMap ¶meters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) throw( QgsProcessingException );
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/processing/models/qgsprocessingmodelalgorithm.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
|