mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-15 00:02:52 -04:00
Add more methods to the Processing script template
This commit is contained in:
parent
174c548d40
commit
8c0a4221e1
@ -79,13 +79,21 @@ class ExampleProcessingAlgorithm(QgsProcessingAlgorithm):
|
|||||||
"""
|
"""
|
||||||
return "examplescripts"
|
return "examplescripts"
|
||||||
|
|
||||||
|
def shortDescription(self) -> str:
|
||||||
|
"""
|
||||||
|
Returns an optional translated short description of the algorithm, displayed
|
||||||
|
on hover in Processing Toolbox. This should be at most a single sentence, e.g.,
|
||||||
|
“Converts 2D features to 3D by sampling a DEM raster.”
|
||||||
|
"""
|
||||||
|
return "Example algorithm short description on hover"
|
||||||
|
|
||||||
def shortHelpString(self) -> str:
|
def shortHelpString(self) -> str:
|
||||||
"""
|
"""
|
||||||
Returns a localised short helper string for the algorithm. This string
|
Returns a localised helper string for the algorithm displayed in the dialog.
|
||||||
should provide a basic description about what the algorithm does and the
|
This string should provide a basic description about what the algorithm does and the
|
||||||
parameters and outputs associated with it.
|
parameters and outputs associated with it.
|
||||||
"""
|
"""
|
||||||
return "Example algorithm short description"
|
return "Example algorithm description"
|
||||||
|
|
||||||
def initAlgorithm(self, config: Optional[dict[str, Any]] = None):
|
def initAlgorithm(self, config: Optional[dict[str, Any]] = None):
|
||||||
"""
|
"""
|
||||||
@ -95,13 +103,14 @@ class ExampleProcessingAlgorithm(QgsProcessingAlgorithm):
|
|||||||
|
|
||||||
# We add the input vector features source. It can have any kind of
|
# We add the input vector features source. It can have any kind of
|
||||||
# geometry.
|
# geometry.
|
||||||
self.addParameter(
|
|
||||||
QgsProcessingParameterFeatureSource(
|
input_layer = QgsProcessingParameterFeatureSource(
|
||||||
self.INPUT,
|
self.INPUT,
|
||||||
"Input layer",
|
"Input layer",
|
||||||
[QgsProcessing.SourceType.TypeVectorAnyGeometry],
|
[QgsProcessing.SourceType.TypeVectorAnyGeometry],
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
input_layer.setHelp("A descriptive, translated string explaining the parameter’s behavior and use in depth.")
|
||||||
|
self.addParameter(input_layer)
|
||||||
|
|
||||||
# We add a feature sink in which to store our processed features (this
|
# We add a feature sink in which to store our processed features (this
|
||||||
# usually takes the form of a newly created vector layer when the
|
# usually takes the form of a newly created vector layer when the
|
||||||
|
Loading…
x
Reference in New Issue
Block a user