Skip to content

Commit 043ea5c

Browse files
Merge remote-tracking branch 'origin/processing/basal_contacts' into processing/sorter
2 parents 56a20ae + f9878b0 commit 043ea5c

4 files changed

Lines changed: 82 additions & 2 deletions

File tree

.github/workflows/linter.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
pull_request:
99
branches:
10-
- master
10+
- main
1111
paths:
1212
- '**.py'
1313
workflow_dispatch:
@@ -55,5 +55,5 @@ jobs:
5555
token: ${{ secrets.GITHUB_TOKEN }}
5656
title: "style: auto format fixes"
5757
body: "This PR applies style fixes by black and ruff."
58-
base: master
58+
base: main
5959
branch: lint/style-fixes-${{ github.run_id }}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .extract_basal_contacts import BasalContactsAlgorithm
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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()

map2loop/processing/provider.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
__version__,
1717
)
1818

19+
from .algorithms import BasalContactsAlgorithm
20+
1921
# ############################################################################
2022
# ########## Classes ###############
2123
# ##################################
@@ -26,6 +28,7 @@ class Map2LoopProvider(QgsProcessingProvider):
2628

2729
def loadAlgorithms(self):
2830
"""Loads all algorithms belonging to this provider."""
31+
self.addAlgorithm(BasalContactsAlgorithm())
2932
pass
3033

3134
def id(self) -> str:

0 commit comments

Comments
 (0)