|
| 1 | +""" |
| 2 | +*************************************************************************** |
| 3 | +* * |
| 4 | +* This program is free software; you can redistribute it and/or modify * |
| 5 | +* it under the terms of the GNU General Public License as published by * |
| 6 | +* the Free Software Foundation; either version 2 of the License, or * |
| 7 | +* (at your option) any later version. * |
| 8 | +* * |
| 9 | +*************************************************************************** |
| 10 | +""" |
| 11 | + |
| 12 | +from typing import Any, Optional |
| 13 | + |
| 14 | +from qgis import processing |
| 15 | +from qgis.core import ( |
| 16 | + QgsFeatureSink, |
| 17 | + QgsProcessing, |
| 18 | + QgsProcessingAlgorithm, |
| 19 | + QgsProcessingContext, |
| 20 | + QgsProcessingException, |
| 21 | + QgsProcessingFeedback, |
| 22 | + QgsProcessingParameterFeatureSink, |
| 23 | + QgsProcessingParameterFeatureSource, |
| 24 | +) |
| 25 | + |
| 26 | + |
| 27 | +class BasalContactsAlgorithm(QgsProcessingAlgorithm): |
| 28 | + """Processing algorithm to create basal contacts.""" |
| 29 | + |
| 30 | + INPUT = "INPUT" |
| 31 | + OUTPUT = "OUTPUT" |
| 32 | + |
| 33 | + def name(self) -> str: |
| 34 | + """Return the algorithm name.""" |
| 35 | + return "loop: basal_contacts" |
| 36 | + |
| 37 | + def displayName(self) -> str: |
| 38 | + """Return the algorithm display name.""" |
| 39 | + return "Loop3d: Basal Contacts" |
| 40 | + |
| 41 | + def group(self) -> str: |
| 42 | + """Return the algorithm group name.""" |
| 43 | + return "Loop3d" |
| 44 | + |
| 45 | + def groupId(self) -> str: |
| 46 | + """Return the algorithm group ID.""" |
| 47 | + return "loop3d" |
| 48 | + |
| 49 | + def initAlgorithm(self, config: Optional[dict[str, Any]] = None) -> None: |
| 50 | + """Initialize the algorithm parameters.""" |
| 51 | + self.addParameter( |
| 52 | + QgsProcessingParameterFeatureSource( |
| 53 | + self.INPUT, |
| 54 | + "Geology Polygons", |
| 55 | + [QgsProcessing.TypeVectorPolygon], |
| 56 | + ) |
| 57 | + ) |
| 58 | + self.addParameter( |
| 59 | + QgsProcessingParameterFeatureSink( |
| 60 | + self.OUTPUT, |
| 61 | + "Basal Contacts", |
| 62 | + ) |
| 63 | + ) |
| 64 | + pass |
| 65 | + |
| 66 | + def processAlgorithm( |
| 67 | + self, |
| 68 | + parameters: dict[str, Any], |
| 69 | + context: QgsProcessingContext, |
| 70 | + feedback: QgsProcessingFeedback, |
| 71 | + ) -> dict[str, Any]: |
| 72 | + pass |
| 73 | + |
| 74 | + def createInstance(self) -> QgsProcessingAlgorithm: |
| 75 | + """Create a new instance of the algorithm.""" |
| 76 | + return self.__class__() # BasalContactsAlgorithm() |
0 commit comments