Skip to content

Commit 19d5070

Browse files
authored
Merge branch 'main' into copilot/create-separate-gui-components
2 parents dc726d8 + bddd914 commit 19d5070

File tree

16 files changed

+118
-136
lines changed

16 files changed

+118
-136
lines changed

.github/workflows/documentation.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343

4444
steps:
4545
- name: Get source code
46-
uses: actions/checkout@v5
46+
uses: actions/checkout@v6
4747

4848
- name: Set up Python
4949
uses: actions/setup-python@v6
@@ -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@v4
72+
uses: actions/upload-artifact@v5
7373
with:
7474
name: documentation
7575
path: docs/_build/html/*

.github/workflows/linter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727

2828
steps:
2929
- name: Get source code
30-
uses: actions/checkout@v5
30+
uses: actions/checkout@v6
3131

3232
- name: Set up Python
3333
uses: actions/setup-python@v6

.github/workflows/package_and_release.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ jobs:
2828

2929
steps:
3030
- name: Get source code
31-
uses: actions/checkout@v4
31+
uses: actions/checkout@v6
3232

3333
- name: Setup Python
34-
uses: actions/setup-python@v5
34+
uses: actions/setup-python@v6
3535
with:
3636
python-version: ${{ env.PYTHON_VERSION }}
3737

@@ -49,7 +49,7 @@ jobs:
4949
- name: Compile translations
5050
run: lrelease ${{ env.PROJECT_FOLDER }}/resources/i18n/*.ts
5151

52-
- uses: actions/upload-artifact@v4
52+
- uses: actions/upload-artifact@v5
5353
with:
5454
name: translations-build
5555
path: ${{ env.PROJECT_FOLDER }}/**/*.qm
@@ -66,10 +66,10 @@ jobs:
6666

6767
steps:
6868
- name: Checkout
69-
uses: actions/checkout@v4
69+
uses: actions/checkout@v6
7070

7171
- name: Setup Python
72-
uses: actions/setup-python@v5
72+
uses: actions/setup-python@v6
7373
with:
7474
cache: "pip"
7575
cache-dependency-path: "requirements/packaging.txt"
@@ -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@v4
84+
uses: actions/download-artifact@v6
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@v4
105+
- uses: actions/upload-artifact@v5
106106
with:
107107
name: ${{ env.PROJECT_FOLDER }}-latest
108108
path: |
@@ -123,10 +123,10 @@ jobs:
123123

124124
steps:
125125
- name: Checkout
126-
uses: actions/checkout@v4
126+
uses: actions/checkout@v6
127127

128128
- name: Setup Python
129-
uses: actions/setup-python@v5
129+
uses: actions/setup-python@v6
130130
with:
131131
cache: "pip"
132132
cache-dependency-path: "requirements/packaging.txt"
@@ -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@v4
141+
uses: actions/download-artifact@v6
142142
with:
143143
name: translations-build
144144
path: ${{ env.PROJECT_FOLDER }}

.github/workflows/packager.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515

1616
steps:
1717
- name: Checkout
18-
uses: actions/checkout@v5
18+
uses: actions/checkout@v6
1919

2020
- name: Setup Python
2121
uses: actions/setup-python@v6
@@ -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@v4
48+
- uses: actions/upload-artifact@v5
4949
with:
5050
name: ${{ env.PROJECT_FOLDER }}-latest
5151
path: ${{ env.PROJECT_FOLDER }}.*.zip

.github/workflows/releaser.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919

2020
steps:
2121
- name: Get source code
22-
uses: actions/checkout@v5
22+
uses: actions/checkout@v6
2323

2424
- name: Set up Python
2525
uses: actions/setup-python@v6

.github/workflows/tester.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828

2929
steps:
3030
- name: Get source code
31-
uses: actions/checkout@v5
31+
uses: actions/checkout@v6
3232

3333
- name: Set up Python
3434
uses: actions/setup-python@v6
@@ -62,7 +62,7 @@ jobs:
6262

6363
# steps:
6464
# - name: Get source code
65-
# uses: actions/checkout@v5
65+
# uses: actions/checkout@v6
6666

6767
# - name: Print QGIS version
6868
# run: qgis --version

loopstructural/main/vectorLayerWrapper.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
)
2727
from qgis.PyQt.QtCore import QDateTime, QVariant
2828
from shapely.geometry import LineString, MultiLineString, MultiPoint, MultiPolygon, Point, Polygon
29+
from shapely.wkb import loads as wkb_loads
2930

3031

3132
def qgsRasterToGdalDataset(rlayer: QgsRasterLayer):

loopstructural/plugin_main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ def initGui(self):
143143
# -- Menu
144144
self.iface.addPluginToMenu(__title__, self.action_settings)
145145
self.iface.addPluginToMenu(__title__, self.action_help)
146+
self.initProcessing()
146147

147148
# Map2Loop tool actions
148149
self.action_sampler = QAction(

loopstructural/processing/algorithms/extract_basal_contacts.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88
* *
99
***************************************************************************
1010
"""
11-
1211
# Python imports
1312
from typing import Any, Optional
1413

1514
# QGIS imports
15+
from qgis import processing
1616
from qgis.core import (
17+
QgsFeatureSink,
1718
QgsProcessing,
1819
QgsProcessingAlgorithm,
1920
QgsProcessingContext,

loopstructural/processing/algorithms/sampler.py

Lines changed: 19 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@
1010
"""
1111
# Python imports
1212
from typing import Any, Optional
13-
from qgis.PyQt.QtCore import QVariant
13+
from qgis.PyQt.QtCore import QMetaType, QVariant
1414
from osgeo import gdal
1515
import pandas as pd
1616

1717
# QGIS imports
1818
from qgis.core import (
19+
QgsFeatureSink,
1920
QgsProcessing,
2021
QgsProcessingAlgorithm,
2122
QgsProcessingContext,
@@ -31,6 +32,7 @@
3132
QgsFeature,
3233
QgsGeometry,
3334
QgsPointXY,
35+
QgsVectorLayer,
3436
QgsWkbTypes,
3537
QgsCoordinateReferenceSystem
3638
)
@@ -75,7 +77,8 @@ def initAlgorithm(self, config: Optional[dict[str, Any]] = None) -> None:
7577
QgsProcessingParameterEnum(
7678
self.INPUT_SAMPLER_TYPE,
7779
"SAMPLER_TYPE",
78-
["Decimator", "Spacing"],
80+
["Decimator (Point Geometry Data)",
81+
"Spacing (Line Geometry Data)"],
7982
defaultValue=0
8083
)
8184
)
@@ -110,7 +113,7 @@ def initAlgorithm(self, config: Optional[dict[str, Any]] = None) -> None:
110113
self.addParameter(
111114
QgsProcessingParameterNumber(
112115
self.INPUT_DECIMATION,
113-
"DECIMATION",
116+
"DECIMATION (Point Geometry Data)",
114117
QgsProcessingParameterNumber.Integer,
115118
defaultValue=1,
116119
optional=True,
@@ -120,7 +123,7 @@ def initAlgorithm(self, config: Optional[dict[str, Any]] = None) -> None:
120123
self.addParameter(
121124
QgsProcessingParameterNumber(
122125
self.INPUT_SPACING,
123-
"SPACING",
126+
"SPACING (Line Geometry Data)",
124127
QgsProcessingParameterNumber.Double,
125128
defaultValue=200.0,
126129
optional=True,
@@ -174,19 +177,11 @@ def processAlgorithm(
174177
samples = sampler.sample(spatial_data_gdf)
175178

176179
fields = QgsFields()
177-
if samples is not None and not samples.empty:
178-
for column_name in samples.columns:
179-
dtype = samples[column_name].dtype
180-
dtype_str = str(dtype)
181-
182-
if dtype_str in ['float16', 'float32', 'float64']:
183-
field_type = QVariant.Double
184-
elif dtype_str in ['int8', 'int16', 'int32', 'int64']:
185-
field_type = QVariant.Int
186-
else:
187-
field_type = QVariant.String
188-
189-
fields.append(QgsField(column_name, field_type))
180+
fields.append(QgsField("ID", QVariant.String))
181+
fields.append(QgsField("X", QVariant.Double))
182+
fields.append(QgsField("Y", QVariant.Double))
183+
fields.append(QgsField("Z", QVariant.Double))
184+
fields.append(QgsField("featureId", QVariant.String))
190185

191186
crs = None
192187
if spatial_data_gdf is not None and spatial_data_gdf.crs is not None:
@@ -213,21 +208,13 @@ def processAlgorithm(
213208
#spacing has no z values
214209
feature.setGeometry(QgsGeometry.fromPointXY(QgsPointXY(row['X'], row['Y'])))
215210

216-
attributes = []
217-
for column_name in samples.columns:
218-
value = row.get(column_name)
219-
dtype = samples[column_name].dtype
220-
221-
if pd.isna(value):
222-
attributes.append(None)
223-
elif dtype in ['float16', 'float32', 'float64']:
224-
attributes.append(float(value))
225-
elif dtype in ['int8', 'int16', 'int32', 'int64']:
226-
attributes.append(int(value))
227-
else:
228-
attributes.append(str(value))
229-
230-
feature.setAttributes(attributes)
211+
feature.setAttributes([
212+
str(row.get('ID', '')),
213+
float(row.get('X', 0)),
214+
float(row.get('Y', 0)),
215+
float(row.get('Z', 0)) if pd.notna(row.get('Z')) else 0.0,
216+
str(row.get('featureId', ''))
217+
])
231218

232219
sink.addFeature(feature)
233220

0 commit comments

Comments
 (0)