mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
New Project Reading flag to trust layer metadata
This commit is contained in:
parent
779d218206
commit
3c7d6616d1
@ -4,7 +4,9 @@ QgsProject.FlagDontResolveLayers = QgsProject.ReadFlag.FlagDontResolveLayers
|
|||||||
QgsProject.ReadFlag.FlagDontResolveLayers.__doc__ = "Don't resolve layer paths (i.e. don't load any layer content). Dramatically improves project read time if the actual data from the layers is not required."
|
QgsProject.ReadFlag.FlagDontResolveLayers.__doc__ = "Don't resolve layer paths (i.e. don't load any layer content). Dramatically improves project read time if the actual data from the layers is not required."
|
||||||
QgsProject.FlagDontLoadLayouts = QgsProject.ReadFlag.FlagDontLoadLayouts
|
QgsProject.FlagDontLoadLayouts = QgsProject.ReadFlag.FlagDontLoadLayouts
|
||||||
QgsProject.ReadFlag.FlagDontLoadLayouts.__doc__ = "Don't load print layouts. Improves project read time if layouts are not required, and allows projects to be safely read in background threads (since print layouts are not thread safe)."
|
QgsProject.ReadFlag.FlagDontLoadLayouts.__doc__ = "Don't load print layouts. Improves project read time if layouts are not required, and allows projects to be safely read in background threads (since print layouts are not thread safe)."
|
||||||
QgsProject.ReadFlag.__doc__ = 'Flags which control project read behavior.\n\n.. versionadded:: 3.10\n\n' + '* ``FlagDontResolveLayers``: ' + QgsProject.ReadFlag.FlagDontResolveLayers.__doc__ + '\n' + '* ``FlagDontLoadLayouts``: ' + QgsProject.ReadFlag.FlagDontLoadLayouts.__doc__
|
QgsProject.FlagTrustLayerMetadata = QgsProject.ReadFlag.FlagTrustLayerMetadata
|
||||||
|
QgsProject.ReadFlag.FlagTrustLayerMetadata.__doc__ = "Trust layer metadata. Improves project read time. Do not use it if layers' extent is not fixed during the project's use by QGIS and QGIS Server."
|
||||||
|
QgsProject.ReadFlag.__doc__ = 'Flags which control project read behavior.\n\n.. versionadded:: 3.10\n\n' + '* ``FlagDontResolveLayers``: ' + QgsProject.ReadFlag.FlagDontResolveLayers.__doc__ + '\n' + '* ``FlagDontLoadLayouts``: ' + QgsProject.ReadFlag.FlagDontLoadLayouts.__doc__ + '\n' + '* ``FlagTrustLayerMetadata``: ' + QgsProject.ReadFlag.FlagTrustLayerMetadata.__doc__
|
||||||
# --
|
# --
|
||||||
# monkey patching scoped based enum
|
# monkey patching scoped based enum
|
||||||
QgsProject.FileFormat.Qgz.__doc__ = "Archive file format, supports auxiliary data"
|
QgsProject.FileFormat.Qgz.__doc__ = "Archive file format, supports auxiliary data"
|
||||||
|
@ -38,6 +38,7 @@ open within the main QGIS application.
|
|||||||
{
|
{
|
||||||
FlagDontResolveLayers,
|
FlagDontResolveLayers,
|
||||||
FlagDontLoadLayouts,
|
FlagDontLoadLayouts,
|
||||||
|
FlagTrustLayerMetadata,
|
||||||
};
|
};
|
||||||
typedef QFlags<QgsProject::ReadFlag> ReadFlags;
|
typedef QFlags<QgsProject::ReadFlag> ReadFlags;
|
||||||
|
|
||||||
|
@ -1121,7 +1121,7 @@ bool QgsProject::addLayer( const QDomElement &layerElem, QList<QDomNode> &broken
|
|||||||
// apply specific settings to vector layer
|
// apply specific settings to vector layer
|
||||||
if ( QgsVectorLayer *vl = qobject_cast<QgsVectorLayer *>( mapLayer.get() ) )
|
if ( QgsVectorLayer *vl = qobject_cast<QgsVectorLayer *>( mapLayer.get() ) )
|
||||||
{
|
{
|
||||||
vl->setReadExtentFromXml( mTrustLayerMetadata );
|
vl->setReadExtentFromXml( mTrustLayerMetadata || ( flags & QgsProject::ReadFlag::FlagTrustLayerMetadata ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( type == QLatin1String( "raster" ) )
|
else if ( type == QLatin1String( "raster" ) )
|
||||||
@ -1497,6 +1497,7 @@ bool QgsProject::readProjectFile( const QString &filename, QgsProject::ReadFlags
|
|||||||
mEvaluateDefaultValues = true;
|
mEvaluateDefaultValues = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Read trust layer metadata config in the project
|
||||||
nl = doc->elementsByTagName( QStringLiteral( "trust" ) );
|
nl = doc->elementsByTagName( QStringLiteral( "trust" ) );
|
||||||
if ( nl.count() )
|
if ( nl.count() )
|
||||||
{
|
{
|
||||||
|
@ -118,6 +118,7 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera
|
|||||||
{
|
{
|
||||||
FlagDontResolveLayers = 1 << 0, //!< Don't resolve layer paths (i.e. don't load any layer content). Dramatically improves project read time if the actual data from the layers is not required.
|
FlagDontResolveLayers = 1 << 0, //!< Don't resolve layer paths (i.e. don't load any layer content). Dramatically improves project read time if the actual data from the layers is not required.
|
||||||
FlagDontLoadLayouts = 1 << 1, //!< Don't load print layouts. Improves project read time if layouts are not required, and allows projects to be safely read in background threads (since print layouts are not thread safe).
|
FlagDontLoadLayouts = 1 << 1, //!< Don't load print layouts. Improves project read time if layouts are not required, and allows projects to be safely read in background threads (since print layouts are not thread safe).
|
||||||
|
FlagTrustLayerMetadata = 1 << 2, //!< Trust layer metadata. Improves project read time. Do not use it if layers' extent is not fixed during the project's use by QGIS and QGIS Server.
|
||||||
};
|
};
|
||||||
Q_DECLARE_FLAGS( ReadFlags, ReadFlag )
|
Q_DECLARE_FLAGS( ReadFlags, ReadFlag )
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user