Skip to content

Commit ad69700

Browse files
authored
fix: add widget for painting stratigraphic order from column onto shapefile
2 parents 3537cd3 + 0704eb8 commit ad69700

File tree

14 files changed

+994
-30
lines changed

14 files changed

+994
-30
lines changed

.github/workflows/documentation.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
python-version: ${{ env.PYTHON_VERSION }}
5454

5555
- name: Cache Sphinx cache
56-
uses: actions/cache@v4
56+
uses: actions/cache@v5
5757
with:
5858
path: docs/_build/cache
5959
key: ${{ runner.os }}-sphinx-${{ hashFiles('docs/**/*') }}
@@ -69,7 +69,7 @@ jobs:
6969
run: sphinx-build -b html -j auto -d docs/_build/cache -q docs docs/_build/html
7070

7171
- name: Save build doc as artifact
72-
uses: actions/upload-artifact@v5
72+
uses: actions/upload-artifact@v6
7373
with:
7474
name: documentation
7575
path: docs/_build/html/*

.github/workflows/package_and_release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
- name: Compile translations
5050
run: lrelease ${{ env.PROJECT_FOLDER }}/resources/i18n/*.ts
5151

52-
- uses: actions/upload-artifact@v5
52+
- uses: actions/upload-artifact@v6
5353
with:
5454
name: translations-build
5555
path: ${{ env.PROJECT_FOLDER }}/**/*.qm
@@ -81,7 +81,7 @@ jobs:
8181
python -m pip install -U -r requirements/packaging.txt
8282
8383
- name: Download translations
84-
uses: actions/download-artifact@v6
84+
uses: actions/download-artifact@v7
8585
with:
8686
name: translations-build
8787
path: ${{ env.PROJECT_FOLDER }}
@@ -102,7 +102,7 @@ jobs:
102102
--allow-uncommitted-changes \
103103
--plugin-repo-url $(gh api "repos/$GITHUB_REPOSITORY/pages" --jq '.html_url')
104104
105-
- uses: actions/upload-artifact@v5
105+
- uses: actions/upload-artifact@v6
106106
with:
107107
name: ${{ env.PROJECT_FOLDER }}-latest
108108
path: |
@@ -138,7 +138,7 @@ jobs:
138138
python -m pip install -U -r requirements/packaging.txt
139139
140140
- name: Download translations
141-
uses: actions/download-artifact@v6
141+
uses: actions/download-artifact@v7
142142
with:
143143
name: translations-build
144144
path: ${{ env.PROJECT_FOLDER }}

.github/workflows/packager.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
- name: Package the latest version
4646
run: qgis-plugin-ci package latest --allow-uncommitted-changes
4747

48-
- uses: actions/upload-artifact@v5
48+
- uses: actions/upload-artifact@v6
4949
with:
5050
name: ${{ env.PROJECT_FOLDER }}-latest
5151
path: ${{ env.PROJECT_FOLDER }}.*.zip

docs/usage/interface.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,31 @@ The fault-fault relationship table defines the interaction between faults in the
4444

4545
![Fault Topology](../static/fault_topology_hamersley.png)
4646

47+
## Processing Tools
48+
49+
The plugin provides several QGIS Processing algorithms for working with geological data. These can be accessed through the QGIS Processing Toolbox.
50+
51+
### Paint Stratigraphic Order
52+
53+
The **Paint Stratigraphic Order** algorithm allows you to visualize the stratigraphic order on geology polygons. This tool is useful for:
54+
- Visually debugging the stratigraphic column
55+
- Quality checking unit order
56+
- Creating visualizations of stratigraphic relationships
57+
58+
The algorithm takes:
59+
- **Input Polygons**: A polygon layer containing geological units (e.g., your geology map)
60+
- **Unit Name Field**: The field in your polygon layer that contains unit names
61+
- **Stratigraphic Column**: A table or layer with the stratigraphic column (ordered from youngest to oldest)
62+
- **Paint Mode**: Choose between:
63+
- **Stratigraphic Order** (0 = youngest, N = oldest): Paints a numeric order onto each polygon
64+
- **Cumulative Thickness**: Paints the cumulative thickness from the bottom (oldest) unit
65+
66+
The algorithm adds a new field to your polygon layer:
67+
- `strat_order`: The stratigraphic order (when using Stratigraphic Order mode)
68+
- `cum_thickness`: The cumulative thickness in the stratigraphic column (when using Cumulative Thickness mode)
69+
70+
Units that don't match the stratigraphic column will have null values, helping you identify data quality issues.
71+
4772
## Model parameters
4873
Once the layers have been selected, stratigraphic column defined and the fault topology relationships set, the LoopStructural model can be initialised.
4974

loopstructural/gui/map2loop_tools/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
from .dialogs import (
88
BasalContactsDialog,
9+
PaintStratigraphicOrderDialog,
910
SamplerDialog,
1011
SorterDialog,
1112
ThicknessCalculatorDialog,
@@ -14,6 +15,7 @@
1415

1516
__all__ = [
1617
'BasalContactsDialog',
18+
'PaintStratigraphicOrderDialog',
1719
'SamplerDialog',
1820
'SorterDialog',
1921
'ThicknessCalculatorDialog',

loopstructural/gui/map2loop_tools/basal_contacts_widget.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def _is_null_like(v):
288288
continue
289289
if val not in values:
290290
values.append(val)
291-
stratigraphic_order = values
291+
stratigraphic_order = values
292292
print(f"Extracting all contacts for units: {stratigraphic_order}")
293293
self.data_manager.logger(f"Extracting all contacts for units: {stratigraphic_order}")
294294

@@ -310,4 +310,10 @@ def _is_null_like(v):
310310
contact_type = "all contacts and basal contacts"
311311
elif not all_contacts and result['basal_contacts'].empty is False:
312312
addGeoDataFrameToproject(result['basal_contacts'], "Basal contacts")
313+
else:
314+
QMessageBox.information(
315+
self,
316+
"No Contacts Found",
317+
"No contacts were found with the given parameters.",
318+
)
313319
return result, contact_type

loopstructural/gui/map2loop_tools/dialogs.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,3 +183,40 @@ def setup_ui(self):
183183
def _run_and_accept(self):
184184
"""Run the calculator and accept dialog if successful."""
185185
self.widget._run_calculator()
186+
187+
188+
class PaintStratigraphicOrderDialog(QDialog):
189+
"""Dialog for painting stratigraphic order onto geology polygons."""
190+
191+
def __init__(self, parent=None, data_manager=None, debug_manager=None):
192+
"""Initialize the paint stratigraphic order dialog."""
193+
super().__init__(parent)
194+
self.setWindowTitle("Paint Stratigraphic Order")
195+
self.data_manager = data_manager
196+
self.debug_manager = debug_manager
197+
self.setup_ui()
198+
199+
def setup_ui(self):
200+
"""Set up the dialog UI."""
201+
from .paint_stratigraphic_order_widget import PaintStratigraphicOrderWidget
202+
203+
layout = QVBoxLayout(self)
204+
self.widget = PaintStratigraphicOrderWidget(
205+
self,
206+
data_manager=self.data_manager,
207+
debug_manager=self.debug_manager,
208+
)
209+
layout.addWidget(self.widget)
210+
211+
# Replace the run button with dialog buttons
212+
self.widget.runButton.hide()
213+
214+
self.button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel, self)
215+
self.button_box.accepted.connect(self._run_and_accept)
216+
self.button_box.rejected.connect(self.reject)
217+
layout.addWidget(self.button_box)
218+
219+
def _run_and_accept(self):
220+
"""Run the painter and accept dialog if successful."""
221+
self.widget._run_painter()
222+

0 commit comments

Comments
 (0)