Skip to content

Commit 5bec453

Browse files
committed
Merge branch 'main' of github.com:WhereGroup/spatial_filter into main
2 parents d84dcd2 + 363da7c commit 5bec453

5 files changed

Lines changed: 67 additions & 45 deletions

File tree

CONTRIBUTE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ Contributors are welcome to extend the plugin's features further. Please fork th
1212

1313
1. Create .qm file
1414

15-
lrelease i18n/spatial_filter_de.py
15+
lrelease i18n/spatial_filter_de.ts
1616

1717
or alternatively
1818

1919
pbt translate
2020

21-
[Translation docs](https://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/plugins/plugins.html#translation)
21+
[Translation docs](https://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/plugins/plugins.html#translation)

controller.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77

88
from .maptool import PolygonTool
99
from .filters import FilterDefinition, Predicate
10-
from .helpers import getSupportedLayers, removeFilterFromLayer, addFilterToLayer, refreshLayerTree, hasLayerException
10+
from .helpers import getSupportedLayers, removeFilterFromLayer, addFilterToLayer, refreshLayerTree, hasLayerException, \
11+
warnAboutCurveGeoms
1112
from .settings import FILTER_COMMENT_START, FILTER_COMMENT_STOP
1213

1314

@@ -36,6 +37,7 @@ def removeFilter(self):
3637
self.refreshFilter()
3738

3839
def onLayersAdded(self, layers: Iterable[QgsMapLayer]):
40+
warnAboutCurveGeoms(layers)
3941
if self.hasValidFilter():
4042
# Apply the filter to added layers or loaded project
4143
for layer in getSupportedLayers(layers):

helpers.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55

66
from osgeo import ogr
77
from qgis.PyQt.QtCore import QCoreApplication
8-
from qgis.core import QgsExpressionContextUtils, QgsSettings, QgsMapLayer, QgsMapLayerType, QgsVectorLayer
8+
from qgis.core import Qgis, QgsExpressionContextUtils, QgsSettings, QgsMapLayer, QgsMapLayerType, QgsVectorLayer,\
9+
QgsWkbTypes
910
from qgis.utils import iface
1011

1112
from .settings import SUPPORTED_STORAGE_TYPES, GROUP, FILTER_COMMENT_START, FILTER_COMMENT_STOP, LAYER_EXCEPTION_VARIABLE
@@ -172,3 +173,12 @@ def class_for_name(module_name: str, class_name: str):
172173
# get the class, will raise AttributeError if class cannot be found
173174
c = getattr(m, class_name)
174175
return c
176+
177+
178+
def warnAboutCurveGeoms(layers: Iterable[QgsMapLayer]):
179+
for layer in layers:
180+
if layer.storageType().upper() in ['GPKG', 'SQLITE'] and QgsWkbTypes.isCurvedType(layer.wkbType()):
181+
txt = tr('The layer "{layername}" has an unsupported geometry type: '
182+
'"Circularstring", "CompoundCurve", "CurvePolygon", "MultiCurve", "MultiSurface", '
183+
'"Curve" or "Surface".').format(layername=layer.name())
184+
iface.messageBar().pushMessage(txt, level=Qgis.Warning)

i18n/spatial_filter_de.qm

529 Bytes
Binary file not shown.

i18n/spatial_filter_de.ts

Lines changed: 51 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,32 @@
99
<translation type="obsolete">Filterwerkzeugleiste</translation>
1010
</message>
1111
<message>
12-
<location filename="../filters.py" line="145"/>
12+
<location filename="../filters.py" line="146"/>
1313
<source>Current filter definition is not valid</source>
1414
<translation>Aktuelle Filterdefinition ist ungültig</translation>
1515
</message>
1616
<message>
17-
<location filename="../filters.py" line="148"/>
17+
<location filename="../filters.py" line="149"/>
1818
<source>Please provide a name for the filter</source>
1919
<translation>Bitte zuerst einen Filternamen vergeben</translation>
2020
</message>
2121
<message>
22-
<location filename="../filters.py" line="182"/>
22+
<location filename="../filters.py" line="183"/>
2323
<source>Overwrite settings for filter</source>
2424
<translation>Einstellungen überschreiben für Filter</translation>
2525
</message>
2626
<message>
27-
<location filename="../filters.py" line="183"/>
27+
<location filename="../filters.py" line="184"/>
2828
<source>Overwrite?</source>
2929
<translation>Überschreiben?</translation>
3030
</message>
3131
<message>
32-
<location filename="../filters.py" line="188"/>
32+
<location filename="../filters.py" line="189"/>
3333
<source>Delete filter</source>
3434
<translation>Filter löschen</translation>
3535
</message>
3636
<message>
37-
<location filename="../filters.py" line="189"/>
37+
<location filename="../filters.py" line="190"/>
3838
<source>Delete?</source>
3939
<translation>Löschen?</translation>
4040
</message>
@@ -99,30 +99,40 @@
9999
<translation type="obsolete">Keine Features gewählt</translation>
100100
</message>
101101
<message>
102-
<location filename="../filters.py" line="176"/>
102+
<location filename="../filters.py" line="177"/>
103103
<source>Current settings will be lost. Apply anyway?</source>
104104
<translation>Aktuelle Einstellungen gehen verloren. Trotzdem anwenden?</translation>
105105
</message>
106106
<message>
107-
<location filename="../filters.py" line="177"/>
107+
<location filename="../filters.py" line="178"/>
108108
<source>Continue?</source>
109109
<translation>Fortfahren?</translation>
110110
</message>
111111
<message>
112-
<location filename="../filters.py" line="118"/>
112+
<location filename="../filters.py" line="119"/>
113113
<source>New Filter</source>
114114
<translation>Neuer Filter</translation>
115115
</message>
116116
<message>
117-
<location filename="../filters.py" line="142"/>
117+
<location filename="../filters.py" line="143"/>
118118
<source>No current filter</source>
119119
<translation>Kein Filter aktiv</translation>
120120
</message>
121121
<message>
122-
<location filename="../filters.py" line="83"/>
122+
<location filename="../filters.py" line="84"/>
123123
<source>Unknown filter</source>
124124
<translation>Unbekannter Filter</translation>
125125
</message>
126+
<message>
127+
<location filename="../helpers.py" line="181"/>
128+
<source>The layer &quot;{layername}&quot; has an unsupported geometry type: &quot;Circularstring&quot;, &quot;CompoundCurve&quot;, &quot;CurvePolygon&quot;, &quot;MultiCurve&quot;, &quot;MultiSurface&quot;, &quot;Curve&quot; or &quot;Surface&quot;.</source>
129+
<translation>Der Layer &quot;{layername}&quot; hat einen nicht unterstüzten Geometrietyp: &quot;Circularstring&quot;, &quot;CompoundCurve&quot;, &quot;CurvePolygon&quot;, &quot;MultiCurve&quot;, &quot;MultiSurface&quot;, &quot;Curve&quot; oder &quot;Surface&quot;.</translation>
130+
</message>
131+
<message>
132+
<location filename="../helpers.py" line="184"/>
133+
<source>A layer contains an unsupported geometry type: &quot;Circularstring&quot;, &quot;CompoundCurve&quot;, &quot;CurvePolygon&quot;, &quot;MultiCurve&quot;, &quot;MultiSurface&quot;, &quot;Curve&quot; oder &quot;Surface&quot;.</source>
134+
<translation type="obsolete">Ein Layer hat einen unicht unterstützten Geometrietyp: &quot;Circularstring&quot;, &quot;CompoundCurve&quot;, &quot;CurvePolygon&quot;, &quot;MultiCurve&quot;, &quot;MultiSurface&quot;, &quot;Curve&quot; oder &quot;Surface&quot;.</translation>
135+
</message>
126136
</context>
127137
<context>
128138
<name>Controller</name>
@@ -155,7 +165,7 @@
155165
<translation>Rechteckige Filtergeometrie setzen</translation>
156166
</message>
157167
<message>
158-
<location filename="../widgets.py" line="62"/>
168+
<location filename="../widgets.py" line="67"/>
159169
<source>New filter from extent</source>
160170
<translation>Neuer Filter aus Ausdehnung</translation>
161171
</message>
@@ -168,27 +178,27 @@
168178
<translation type="obsolete">Neuer Filter</translation>
169179
</message>
170180
<message>
171-
<location filename="../controller.py" line="76"/>
181+
<location filename="../controller.py" line="78"/>
172182
<source>Select a polygon layer</source>
173183
<translation>Polygonlayer auswählen</translation>
174184
</message>
175185
<message>
176-
<location filename="../controller.py" line="79"/>
186+
<location filename="../controller.py" line="81"/>
177187
<source>No features selected</source>
178188
<translation>Keine Features gewählt</translation>
179189
</message>
180190
<message>
181-
<location filename="../controller.py" line="115"/>
191+
<location filename="../controller.py" line="117"/>
182192
<source>Geometry is not valid</source>
183193
<translation>Geometrie ist ungültig</translation>
184194
</message>
185195
<message>
186-
<location filename="../controller.py" line="84"/>
196+
<location filename="../controller.py" line="86"/>
187197
<source>New filter from selection</source>
188198
<translation>Neuer Filter aus Auswahl</translation>
189199
</message>
190200
<message>
191-
<location filename="../controller.py" line="118"/>
201+
<location filename="../controller.py" line="120"/>
192202
<source>New filter from sketch</source>
193203
<translation>Neuer Filter aus Skizze</translation>
194204
</message>
@@ -239,12 +249,12 @@
239249
<context>
240250
<name>FilterToolbar</name>
241251
<message>
242-
<location filename="../widgets.py" line="318"/>
252+
<location filename="../widgets.py" line="323"/>
243253
<source>Rectangular filter</source>
244254
<translation>Rechteckiger Filter</translation>
245255
</message>
246256
<message>
247-
<location filename="../widgets.py" line="323"/>
257+
<location filename="../widgets.py" line="328"/>
248258
<source>Filter from selected features</source>
249259
<translation>Filter aus gewählten Features</translation>
250260
</message>
@@ -259,17 +269,17 @@
259269
<translation type="obsolete">Filter speichern</translation>
260270
</message>
261271
<message>
262-
<location filename="../widgets.py" line="344"/>
272+
<location filename="../widgets.py" line="349"/>
263273
<source>Manage filters</source>
264274
<translation>Filter verwalten</translation>
265275
</message>
266276
<message>
267-
<location filename="../widgets.py" line="271"/>
277+
<location filename="../widgets.py" line="275"/>
268278
<source>Filter Toolbar</source>
269279
<translation>Filterwerkzeugleiste</translation>
270280
</message>
271281
<message>
272-
<location filename="../widgets.py" line="420"/>
282+
<location filename="../widgets.py" line="429"/>
273283
<source>Show filter geometry</source>
274284
<translation>Filtergeometrie anzeigen</translation>
275285
</message>
@@ -284,22 +294,22 @@
284294
<translation type="obsolete">Filter deaktivieren</translation>
285295
</message>
286296
<message>
287-
<location filename="../widgets.py" line="390"/>
297+
<location filename="../widgets.py" line="397"/>
288298
<source>No filter geometry set</source>
289299
<translation>Keine Filtergeometrie gesetzt</translation>
290300
</message>
291301
<message>
292-
<location filename="../widgets.py" line="339"/>
302+
<location filename="../widgets.py" line="344"/>
293303
<source>Exclude layers from filter</source>
294304
<translation>Ausnahmen festlegen</translation>
295305
</message>
296306
<message>
297-
<location filename="../widgets.py" line="416"/>
307+
<location filename="../widgets.py" line="425"/>
298308
<source>Hide filter geometry</source>
299309
<translation>Filtergeometrie verstecken</translation>
300310
</message>
301311
<message>
302-
<location filename="../widgets.py" line="328"/>
312+
<location filename="../widgets.py" line="333"/>
303313
<source>Draw a filter polygon on the canvas</source>
304314
<translation>Filter-Polygon in der Karte zeichnen</translation>
305315
</message>
@@ -309,43 +319,43 @@
309319
<translation type="obsolete">Geometrie ist ungültig</translation>
310320
</message>
311321
<message>
312-
<location filename="../widgets.py" line="282"/>
322+
<location filename="../widgets.py" line="286"/>
313323
<source>Remove current filter</source>
314324
<translation>Filter entfernen</translation>
315325
</message>
316326
<message>
317-
<location filename="../widgets.py" line="307"/>
327+
<location filename="../widgets.py" line="312"/>
318328
<source>Filter style</source>
319329
<translation>Filterstil</translation>
320330
</message>
321331
<message>
322-
<location filename="../widgets.py" line="311"/>
332+
<location filename="../widgets.py" line="316"/>
323333
<source>Style filter</source>
324334
<translation>Filterstil wählen</translation>
325335
</message>
326336
<message>
327-
<location filename="../widgets.py" line="304"/>
337+
<location filename="../widgets.py" line="309"/>
328338
<source>Zoom to filter</source>
329339
<translation>Auf Filter zoomen</translation>
330340
</message>
331341
</context>
332342
<context>
333343
<name>LayerExceptionsDialog</name>
334344
<message>
335-
<location filename="../widgets.py" line="74"/>
345+
<location filename="../widgets.py" line="79"/>
336346
<source>Exclude layers from filter</source>
337347
<translation>Ausnahmen festlegen</translation>
338348
</message>
339349
</context>
340350
<context>
341351
<name>LayerModel</name>
342352
<message>
343-
<location filename="../models.py" line="51"/>
353+
<location filename="../models.py" line="48"/>
344354
<source>Layer has no spatial index</source>
345355
<translation>Layer hat keinen räumlichen Index</translation>
346356
</message>
347357
<message>
348-
<location filename="../models.py" line="55"/>
358+
<location filename="../models.py" line="52"/>
349359
<source>Layer type is not supported</source>
350360
<translation>Layertyp wird nicht unterstützt</translation>
351361
</message>
@@ -414,22 +424,22 @@
414424
<context>
415425
<name>PredicateButton</name>
416426
<message>
417-
<location filename="../widgets.py" line="188"/>
427+
<location filename="../widgets.py" line="193"/>
418428
<source>Geometric predicate</source>
419429
<translation>Räumlicher Operator</translation>
420430
</message>
421431
<message>
422-
<location filename="../widgets.py" line="192"/>
432+
<location filename="../widgets.py" line="197"/>
423433
<source>Geometric Predicate</source>
424434
<translation>Räumlicher Operator</translation>
425435
</message>
426436
<message>
427-
<location filename="../widgets.py" line="206"/>
437+
<location filename="../widgets.py" line="211"/>
428438
<source>Object of comparison</source>
429439
<translation>Vergleichsobjekt</translation>
430440
</message>
431441
<message>
432-
<location filename="../widgets.py" line="211"/>
442+
<location filename="../widgets.py" line="216"/>
433443
<source>BBOX</source>
434444
<translation>BBOX</translation>
435445
</message>
@@ -439,7 +449,7 @@
439449
<translation type="obsolete">Vergleiche Features mit Bounding Box des Filters</translation>
440450
</message>
441451
<message>
442-
<location filename="../widgets.py" line="217"/>
452+
<location filename="../widgets.py" line="222"/>
443453
<source>GEOM</source>
444454
<translation>GEOM</translation>
445455
</message>
@@ -449,17 +459,17 @@
449459
<translation type="obsolete">Vergleiche Features mit exakter Filtergeometrie</translation>
450460
</message>
451461
<message>
452-
<location filename="../widgets.py" line="183"/>
462+
<location filename="../widgets.py" line="188"/>
453463
<source>intersects</source>
454464
<translation>schneidet</translation>
455465
</message>
456466
<message>
457-
<location filename="../widgets.py" line="184"/>
467+
<location filename="../widgets.py" line="189"/>
458468
<source>within</source>
459469
<translation>innerhalb</translation>
460470
</message>
461471
<message>
462-
<location filename="../widgets.py" line="185"/>
472+
<location filename="../widgets.py" line="190"/>
463473
<source>disjoint</source>
464474
<translation>schneidet nicht</translation>
465475
</message>

0 commit comments

Comments
 (0)