Add enum flags for 3D basemap hints

Like the existing 2D basemap flags, but exclusively for layers with 3d content
This commit is contained in:
Nyall Dawson 2025-06-04 12:16:01 +10:00
parent 077b6d5c51
commit b182ae02e8
6 changed files with 27 additions and 1 deletions

View File

@ -4103,6 +4103,7 @@ FileOperationFlags = Qgis # dirty hack since SIP seems to introduce the flags i
# monkey patching scoped based enum
Qgis.MapLayerProperty.UsersCannotToggleEditing.__doc__ = "Indicates that users are not allowed to toggle editing for this layer. Note that this does not imply that the layer is non-editable (see isEditable(), supportsEditing() ), rather that the editable status of the layer cannot be changed by users manually \n.. versionadded:: 3.22"
Qgis.MapLayerProperty.IsBasemapLayer.__doc__ = "Layer is considered a 'basemap' layer, and certain properties of the layer should be ignored when calculating project-level properties. For instance, the extent of basemap layers is ignored when calculating the extent of a project, as these layers are typically global and extend outside of a project's area of interest \n.. versionadded:: 3.26"
Qgis.MapLayerProperty.Is3DBasemapLayer.__doc__ = "Layer is considered a '3D basemap' layer. This flag is similar to IsBasemapLayer, but reserved for layers which contain 3D data \n.. versionadded:: 3.44"
Qgis.MapLayerProperty.__doc__ = """Generic map layer properties.
.. versionadded:: 3.22
@ -4115,6 +4116,10 @@ Qgis.MapLayerProperty.__doc__ = """Generic map layer properties.
.. versionadded:: 3.26
* ``Is3DBasemapLayer``: Layer is considered a '3D basemap' layer. This flag is similar to IsBasemapLayer, but reserved for layers which contain 3D data
.. versionadded:: 3.44
"""
# --
@ -4141,6 +4146,7 @@ Qgis.AutoRefreshMode.baseClass = Qgis
Qgis.DataProviderFlag.IsBasemapSource.__doc__ = "Associated source should be considered a 'basemap' layer. See Qgis.MapLayerProperty.IsBasemapLayer."
Qgis.DataProviderFlag.FastExtent2D.__doc__ = "Provider's 2D extent retrieval via QgsDataProvider.extent() is always guaranteed to be trivial/fast to calculate \n.. versionadded:: 3.38"
Qgis.DataProviderFlag.FastExtent3D.__doc__ = "Provider's 3D extent retrieval via QgsDataProvider.extent3D() is always guaranteed to be trivial/fast to calculate \n.. versionadded:: 3.38"
Qgis.DataProviderFlag.Is3DBasemapSource.__doc__ = "Associated source should be considered a '3D basemap' layer. See Qgis.MapLayerProperty.Is3DBasemapLayer. \n.. versionadded:: 3.44"
Qgis.DataProviderFlag.__doc__ = """Generic data provider flags.
.. versionadded:: 3.26
@ -4154,6 +4160,10 @@ Qgis.DataProviderFlag.__doc__ = """Generic data provider flags.
.. versionadded:: 3.38
* ``Is3DBasemapSource``: Associated source should be considered a '3D basemap' layer. See Qgis.MapLayerProperty.Is3DBasemapLayer.
.. versionadded:: 3.44
"""
# --

View File

@ -1302,6 +1302,7 @@ The development version
{
UsersCannotToggleEditing,
IsBasemapLayer,
Is3DBasemapLayer,
};
typedef QFlags<Qgis::MapLayerProperty> MapLayerProperties;
@ -1318,6 +1319,7 @@ The development version
IsBasemapSource,
FastExtent2D,
FastExtent3D,
Is3DBasemapSource,
};
typedef QFlags<Qgis::DataProviderFlag> DataProviderFlags;

View File

@ -4061,6 +4061,7 @@ FileOperationFlags = Qgis # dirty hack since SIP seems to introduce the flags i
# monkey patching scoped based enum
Qgis.MapLayerProperty.UsersCannotToggleEditing.__doc__ = "Indicates that users are not allowed to toggle editing for this layer. Note that this does not imply that the layer is non-editable (see isEditable(), supportsEditing() ), rather that the editable status of the layer cannot be changed by users manually \n.. versionadded:: 3.22"
Qgis.MapLayerProperty.IsBasemapLayer.__doc__ = "Layer is considered a 'basemap' layer, and certain properties of the layer should be ignored when calculating project-level properties. For instance, the extent of basemap layers is ignored when calculating the extent of a project, as these layers are typically global and extend outside of a project's area of interest \n.. versionadded:: 3.26"
Qgis.MapLayerProperty.Is3DBasemapLayer.__doc__ = "Layer is considered a '3D basemap' layer. This flag is similar to IsBasemapLayer, but reserved for layers which contain 3D data \n.. versionadded:: 3.44"
Qgis.MapLayerProperty.__doc__ = """Generic map layer properties.
.. versionadded:: 3.22
@ -4073,6 +4074,10 @@ Qgis.MapLayerProperty.__doc__ = """Generic map layer properties.
.. versionadded:: 3.26
* ``Is3DBasemapLayer``: Layer is considered a '3D basemap' layer. This flag is similar to IsBasemapLayer, but reserved for layers which contain 3D data
.. versionadded:: 3.44
"""
# --
@ -4098,6 +4103,7 @@ Qgis.AutoRefreshMode.baseClass = Qgis
Qgis.DataProviderFlag.IsBasemapSource.__doc__ = "Associated source should be considered a 'basemap' layer. See Qgis.MapLayerProperty.IsBasemapLayer."
Qgis.DataProviderFlag.FastExtent2D.__doc__ = "Provider's 2D extent retrieval via QgsDataProvider.extent() is always guaranteed to be trivial/fast to calculate \n.. versionadded:: 3.38"
Qgis.DataProviderFlag.FastExtent3D.__doc__ = "Provider's 3D extent retrieval via QgsDataProvider.extent3D() is always guaranteed to be trivial/fast to calculate \n.. versionadded:: 3.38"
Qgis.DataProviderFlag.Is3DBasemapSource.__doc__ = "Associated source should be considered a '3D basemap' layer. See Qgis.MapLayerProperty.Is3DBasemapLayer. \n.. versionadded:: 3.44"
Qgis.DataProviderFlag.__doc__ = """Generic data provider flags.
.. versionadded:: 3.26
@ -4111,6 +4117,10 @@ Qgis.DataProviderFlag.__doc__ = """Generic data provider flags.
.. versionadded:: 3.38
* ``Is3DBasemapSource``: Associated source should be considered a '3D basemap' layer. See Qgis.MapLayerProperty.Is3DBasemapLayer.
.. versionadded:: 3.44
"""
# --

View File

@ -1302,6 +1302,7 @@ The development version
{
UsersCannotToggleEditing,
IsBasemapLayer,
Is3DBasemapLayer,
};
typedef QFlags<Qgis::MapLayerProperty> MapLayerProperties;
@ -1318,6 +1319,7 @@ The development version
IsBasemapSource,
FastExtent2D,
FastExtent3D,
Is3DBasemapSource,
};
typedef QFlags<Qgis::DataProviderFlag> DataProviderFlags;

View File

@ -89,7 +89,7 @@ QgsReferencedRectangle QgsProjectViewSettings::fullExtent() const
QList< QgsMapLayer * > nonBaseMapLayers;
std::copy_if( layers.begin(), layers.end(),
std::back_inserter( nonBaseMapLayers ),
[]( const QgsMapLayer * layer ) { return !( layer->properties() & Qgis::MapLayerProperty::IsBasemapLayer ); } );
[]( const QgsMapLayer * layer ) { return !( layer->properties() & Qgis::MapLayerProperty::IsBasemapLayer ) && !( layer->properties() & Qgis::MapLayerProperty::Is3DBasemapLayer ); } );
// unless ALL layers from the project are basemap layers, we exclude these by default as their extent won't be useful for the project.
if ( !nonBaseMapLayers.empty( ) )

View File

@ -2229,6 +2229,7 @@ class CORE_EXPORT Qgis
{
UsersCannotToggleEditing = 1 << 0, //!< Indicates that users are not allowed to toggle editing for this layer. Note that this does not imply that the layer is non-editable (see isEditable(), supportsEditing() ), rather that the editable status of the layer cannot be changed by users manually \since QGIS 3.22
IsBasemapLayer = 1 << 1, //!< Layer is considered a 'basemap' layer, and certain properties of the layer should be ignored when calculating project-level properties. For instance, the extent of basemap layers is ignored when calculating the extent of a project, as these layers are typically global and extend outside of a project's area of interest \since QGIS 3.26
Is3DBasemapLayer = 1 << 2, //!< Layer is considered a '3D basemap' layer. This flag is similar to IsBasemapLayer, but reserved for layers which contain 3D data \since QGIS 3.44
};
//! Map layer properties
Q_DECLARE_FLAGS( MapLayerProperties, MapLayerProperty )
@ -2258,6 +2259,7 @@ class CORE_EXPORT Qgis
IsBasemapSource = 1 << 1, //!< Associated source should be considered a 'basemap' layer. See Qgis::MapLayerProperty::IsBasemapLayer.
FastExtent2D = 1 << 2, //!< Provider's 2D extent retrieval via QgsDataProvider::extent() is always guaranteed to be trivial/fast to calculate \since QGIS 3.38
FastExtent3D = 1 << 3, //!< Provider's 3D extent retrieval via QgsDataProvider::extent3D() is always guaranteed to be trivial/fast to calculate \since QGIS 3.38
Is3DBasemapSource = 1 << 4, //!< Associated source should be considered a '3D basemap' layer. See Qgis::MapLayerProperty::Is3DBasemapLayer. \since QGIS 3.44
};
//! Data provider flags
Q_DECLARE_FLAGS( DataProviderFlags, DataProviderFlag )