diff --git a/helpers.py b/helpers.py index 34da726..8dd0340 100644 --- a/helpers.py +++ b/helpers.py @@ -5,7 +5,7 @@ from osgeo import ogr from qgis.PyQt.QtCore import QCoreApplication -from qgis.core import QgsExpressionContextUtils, QgsSettings, QgsMapLayer, QgsMapLayerType, QgsVectorLayer,\ +from qgis.core import Qgis, QgsExpressionContextUtils, QgsSettings, QgsMapLayer, QgsMapLayerType, QgsVectorLayer,\ QgsWkbTypes from qgis.utils import iface @@ -180,8 +180,26 @@ def warnAboutCurveGeoms(layers: Iterable[QgsMapLayer]): for layer in layers: if not isLayerSupported(layer): continue + # additional exceptions due to missing support for curve geometries in ogr's spatialite-based spatial filtering + # https://github.com/WhereGroup/spatial_filter/issues/1 if layer.storageType().upper() in ['GPKG', 'SQLITE'] and QgsWkbTypes.isCurvedType(layer.wkbType()): - txt = tr('The layer "{layername}" has an unsupported geometry type: ' - '"CircularString", "CompoundCurve", "CurvePolygon", "MultiCurve", "MultiSurface", ' - '"Curve" or "Surface".').format(layername=layer.name()) + txt = tr( + 'The {layerType} layer {layerName!r} has a geometry type ({geometryType}) that is not supported by the ' + '{pluginName} plugin and will be ignored for filtering.' + ).format( + layerName=layer.name(), + layerType=layer.storageType(), + pluginName=LOCALIZED_PLUGIN_NAME, + geometryType=QgsWkbTypes.displayString(layer.wkbType()), + ) iface.messageBar().pushWarning(LOCALIZED_PLUGIN_NAME, txt) + + +def warnAboutQgisBugProjectSaving(): + """Show a warning because of https://github.com/qgis/QGIS/issues/55975""" + if Qgis.QGIS_VERSION_INT < 33404: + txt = tr( + "QGIS < 3.34.4 has a bug breaking the saving of (active) filters to projects " + '(Info)' + ).format(pluginName=LOCALIZED_PLUGIN_NAME) + iface.messageBar().pushWarning(LOCALIZED_PLUGIN_NAME, txt) diff --git a/i18n/spatial_filter_de.qm b/i18n/spatial_filter_de.qm index 71716e1..aab6b98 100644 Binary files a/i18n/spatial_filter_de.qm and b/i18n/spatial_filter_de.qm differ diff --git a/i18n/spatial_filter_de.ts b/i18n/spatial_filter_de.ts index 64ad7ad..aa1120b 100644 --- a/i18n/spatial_filter_de.ts +++ b/i18n/spatial_filter_de.ts @@ -58,16 +58,21 @@ Unknown filter Unbekannter Filter - - - The layer "{layername}" has an unsupported geometry type: "CircularString", "CompoundCurve", "CurvePolygon", "MultiCurve", "MultiSurface", "Curve" or "Surface". - Der Layer &quot;{layername}&quot; hat einen nicht 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;. - Spatial Filter Räumlicher Filter + + + The {layerType} layer {layerName!r} has a geometry type ({geometryType}) that is not supported by the {pluginName} plugin and will be ignored for filtering. + Der {layerType}-Layer {layerName!r} hat einen vom {pluginName!r}-Plugin nicht unterstützten Geometrietyp ({geometryType}) und kann daher nicht gefiltert werden. + + + + QGIS &lt; 3.34.4 has a bug breaking the saving of (active) filters to projects (<a href="https://github.com/WhereGroup/spatial_filter/issues/24">Info</a>) + QGIS &lt; 3.34.4 hat einen Bug, welcher beim Speichern von Projekten mit aktivem Filter zu Fehlern führt (<a href="https://github.com/WhereGroup/spatial_filter/issues/24">Info</a>) + ExtentDialog @@ -85,27 +90,27 @@ FilterController - + Select a polygon layer Polygonlayer auswählen - + No features selected Keine Features gewählt - + Geometry is not valid Geometrie ist ungültig - + New filter from selection Neuer Filter aus Auswahl - + New filter from sketch Neuer Filter aus Skizze diff --git a/metadata.txt b/metadata.txt index bf8a845..6c1aaaa 100644 --- a/metadata.txt +++ b/metadata.txt @@ -17,6 +17,9 @@ hasProcessingProvider=no tags=python, filter, vector, postgis, performance changelog= + Version 1.6: + - Add warning on QGIS < 3.34.4 due to bug in project saving + - Improved warning message on unsupported geometry types Version 1.5: - Clear filter when a new project is loaded or created Version 1.4: diff --git a/spatial_filter.py b/spatial_filter.py index 888626c..f0dd92c 100644 --- a/spatial_filter.py +++ b/spatial_filter.py @@ -42,11 +42,15 @@ def initGui(self): # we import just now because we need the QCoreApplication translator # to be installed already (e.g. for the LOCALIZED_PLUGIN_NAME) from .controller import FilterController + from .helpers import warnAboutQgisBugProjectSaving from .widgets import FilterToolbar self.toolbar = FilterToolbar(FilterController(), self.iface.mainWindow()) self.iface.mainWindow().addToolBar(self.toolbar) + warnAboutQgisBugProjectSaving() + + def unload(self): self.toolbar.hideFilterGeom() self.toolbar.controller.removeFilter()