24 #include "qgis_core.h" 33 #include <QStringList> 88 Q_PROPERTY( QStringList nonIdentifiableLayers READ nonIdentifiableLayers WRITE setNonIdentifiableLayers NOTIFY nonIdentifiableLayersChanged )
89 Q_PROPERTY( QString fileName READ fileName WRITE setFileName NOTIFY fileNameChanged )
90 Q_PROPERTY( QString homePath READ homePath WRITE setPresetHomePath NOTIFY homePathChanged )
92 Q_PROPERTY( QString ellipsoid READ ellipsoid WRITE setEllipsoid NOTIFY ellipsoidChanged )
93 Q_PROPERTY(
QgsMapThemeCollection *mapThemeCollection READ mapThemeCollection NOTIFY mapThemeCollectionChanged )
94 Q_PROPERTY(
QgsSnappingConfig snappingConfig READ snappingConfig WRITE setSnappingConfig NOTIFY snappingConfigChanged )
96 Q_PROPERTY( QList<
QgsVectorLayer *> avoidIntersectionsLayers READ avoidIntersectionsLayers WRITE setAvoidIntersectionsLayers NOTIFY avoidIntersectionsLayersChanged )
121 void setTitle( const QString &title );
129 QString title() const;
134 bool isDirty() const;
142 void setFileName( const QString &name );
150 QString fileName() const;
177 QDateTime lastModified() const;
184 QString absoluteFilePath() const;
190 QString baseName() const;
214 QString ellipsoid() const;
222 void setEllipsoid( const QString &ellipsoid );
259 bool read( const QString &filename );
276 bool readLayer( const QDomNode &layerNode );
286 bool write( const QString &filename );
304 bool writeEntry( const QString &scope, const QString &key,
bool value )
SIP_PYNAME( writeEntryBool );
315 bool writeEntry( const QString &scope, const QString &key,
double value )
SIP_PYNAME( writeEntryDouble );
325 bool writeEntry( const QString &scope, const QString &key,
int value );
335 bool writeEntry( const QString &scope, const QString &key, const QString &value );
345 bool writeEntry( const QString &scope, const QString &key, const QStringList &value );
353 QStringList readListEntry( const QString &scope, const QString &key, const QStringList &def = QStringList(),
bool *ok =
nullptr ) const;
355 QString readEntry( const QString &scope, const QString &key, const QString &def = QString(),
bool *ok =
nullptr ) const;
356 int readNumEntry( const QString &scope, const QString &key,
int def = 0,
bool *ok =
nullptr ) const;
357 double readDoubleEntry( const QString &scope, const QString &key,
double def = 0,
bool *ok =
nullptr ) const;
358 bool readBoolEntry( const QString &scope, const QString &key,
bool def = false,
bool *ok =
nullptr ) const;
362 bool removeEntry( const QString &scope, const QString &key );
370 QStringList entryList( const QString &scope, const QString &key ) const;
377 QStringList subkeyList( const QString &scope, const QString &key ) const;
385 void dumpProperties() const;
399 QString writePath( const QString &filename ) const;
402 QString readPath( const QString &filename ) const;
405 QString error() const;
414 QString layerIsEmbedded( const QString &
id ) const;
421 bool createEmbeddedLayer( const QString &layerId, const QString &projectFilePath, QList<QDomNode> &brokenNodes,
428 QgsLayerTreeGroup *createEmbeddedGroup( const QString &groupName, const QString &projectFilePath, const QStringList &invisibleLayers );
431 void setTopologicalEditing(
bool enabled );
434 bool topologicalEditing() const;
450 void setDistanceUnits(
QgsUnitTypes::DistanceUnit unit );
479 QString homePath() const;
493 QString presetHomePath() const;
546 void setNonIdentifiableLayers(
const QList<QgsMapLayer *> &layers );
551 void setNonIdentifiableLayers(
const QStringList &layerIds );
556 QStringList nonIdentifiableLayers()
const;
565 bool autoTransaction()
const;
576 void setAutoTransaction(
bool autoTransaction );
595 QgsTransactionGroup *transactionGroup(
const QString &providerKey,
const QString &connString );
602 bool evaluateDefaultValues()
const;
609 void setEvaluateDefaultValues(
bool evaluateDefaultValues );
625 QList<QgsVectorLayer *> avoidIntersectionsLayers()
const;
632 void setAvoidIntersectionsLayers(
const QList<QgsVectorLayer *> &layers );
639 QVariantMap customVariables()
const;
645 void setCustomVariables(
const QVariantMap &customVariables );
685 QgsMapLayer *mapLayer(
const QString &layerId )
const;
694 QList<QgsMapLayer *> mapLayersByName(
const QString &layerName )
const;
702 QMap<QString, QgsMapLayer *> mapLayers()
const;
707 bool isZipped()
const;
722 template <
typename T>
725 return mLayerStore->layers<T>();
754 QList<QgsMapLayer *> addMapLayers(
const QList<QgsMapLayer *> &mapLayers
SIP_TRANSFER,
755 bool addToLegend =
true,
786 bool addToLegend =
true,
803 void removeMapLayers(
const QStringList &layerIds );
819 void removeMapLayers(
const QList<QgsMapLayer *> &layers );
834 void removeMapLayer(
const QString &layerId );
870 void removeAllMapLayers();
877 void reloadAllLayers();
896 void setTrustLayerMetadata(
bool trust );
947 QSet<QgsMapLayer *> requiredLayers()
const;
956 void setRequiredLayers(
const QSet<QgsMapLayer *> &layers );
972 void readProject(
const QDomDocument & );
977 void writeProject( QDomDocument & );
987 void readMapLayer(
QgsMapLayer *mapLayer,
const QDomElement &layerNode );
997 void writeMapLayer(
QgsMapLayer *mapLayer, QDomElement &layerElem, QDomDocument &doc );
1002 void projectSaved();
1007 void oldProjectVersionWarning(
const QString & );
1014 void layerLoaded(
int i,
int n );
1017 void loadingLayer(
const QString &layerName );
1025 void loadingLayerMessageReceived(
const QString &layerName,
const QList<QgsReadWriteContext::ReadWriteMessage> &messages );
1028 void nonIdentifiableLayersChanged( QStringList nonIdentifiableLayers );
1031 void fileNameChanged();
1039 void homePathChanged();
1050 void customVariablesChanged();
1066 void ellipsoidChanged(
const QString &ellipsoid );
1075 void transformContextChanged();
1081 void missingDatumTransforms(
const QStringList &missingTransforms );
1089 void transactionGroupsChanged();
1096 void topologicalEditingChanged();
1103 void avoidIntersectionsLayersChanged();
1116 void mapThemeCollectionChanged();
1122 void labelingEngineSettingsChanged();
1130 void metadataChanged();
1143 void layersWillBeRemoved(
const QStringList &layerIds );
1152 void layersWillBeRemoved(
const QList<QgsMapLayer *> &layers );
1163 void layerWillBeRemoved(
const QString &layerId );
1182 void layersRemoved(
const QStringList &layerIds );
1192 void layerRemoved(
const QString &layerId );
1213 void layersAdded(
const QList<QgsMapLayer *> &layers );
1231 void legendLayersAdded(
const QList<QgsMapLayer *> &layers );
1240 void isDirtyChanged(
bool dirty );
1260 void setDirty(
bool b =
true );
1270 void setPresetHomePath(
const QString &path );
1273 void onMapLayersAdded(
const QList<QgsMapLayer *> &layers );
1274 void onMapLayersRemoved(
const QList<QgsMapLayer *> &layers );
1275 void cleanTransactionGroups(
bool force =
false );
1298 bool _getMapLayers(
const QDomDocument &doc, QList<QDomNode> &brokenNodes );
1304 void setError(
const QString &errorMessage )
SIP_SKIP;
1325 bool readProjectFile(
const QString &filename );
1328 bool writeProjectFile(
const QString &filename );
1331 bool unzip(
const QString &filename );
1334 bool zip(
const QString &filename );
1337 bool saveAuxiliaryStorage(
const QString &filename = QString() );
1339 std::unique_ptr< QgsMapLayerStore > mLayerStore;
1341 QString mErrorMessage;
1350 QHash< QString, QPair< QString, bool> > mEmbeddedLayers;
1356 std::unique_ptr<QgsAnnotationManager> mAnnotationManager;
1357 std::unique_ptr<QgsLayoutManager> mLayoutManager;
1366 std::unique_ptr<QgsMapThemeCollection> mMapThemeCollection;
1368 std::unique_ptr<QgsLabelingEngineSettings> mLabelingEngineSettings;
1370 QVariantMap mCustomVariables;
1372 std::unique_ptr<QgsProjectArchive> mArchive;
1374 std::unique_ptr<QgsAuxiliaryStorage> mAuxiliaryStorage;
1384 bool mAutoTransaction =
false;
1385 bool mEvaluateDefaultValues =
false;
1387 bool mDirty =
false;
1388 int mDirtyBlockCount = 0;
1389 bool mTrustLayerMetadata =
false;
1398 friend class QgsConfigCache;
1432 : mProject( project )
1434 mProject->mDirtyBlockCount++;
1445 mProject->mDirtyBlockCount--;
Layer tree group node serves as a container for layers and further groups.
The class is used as a container of context for various read/write operations on other objects...
Base class for all map layer types.
Manages storage of a set of QgsAnnotation annotation objects.
Helper functions for various unit types.
Class providing some utility methods to manage auxiliary storage.
virtual QgsExpressionContext createExpressionContext() const =0
This method needs to be reimplemented in all classes which implement this interface and return an exp...
bool trustLayerMetadata() const
Returns true if the trust option is activated, false otherwise.
Namespace with helper functions for layer tree operations.
CORE_EXPORT bool unzip(const QString &zip, const QString &dir, QStringList &files)
Unzip a zip file in an output directory.
CORE_EXPORT QgsProjectVersion getVersion(QDomDocument const &doc)
Returns the version string found in the given DOM document.
A class to describe the version of a project.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
This is the class is providing tolerance value in map unit values.
Listens to the updates in map layer registry and does changes in layer tree.
Reads and writes project states.
Contains information about the context in which a coordinate transform is executed.
Manages storage of a set of layouts.
Abstract interface for generating an expression context.
Project property key node.
QVector< T > layers() const
Returns a list of registered map layers with a specified layer type.
~QgsProjectDirtyBlocker()
This class manages a set of relations between layers.
Stores global configuration for labeling engine.
This class represents a coordinate reference system (CRS).
Abstract interface for project storage - to be implemented by various backends and registered in QgsP...
QgsProjectDirtyBlocker(QgsProject *project)
Constructor for QgsProjectDirtyBlocker.
Temporarily blocks QgsProject "dirtying" for the lifetime of the object.
A storage object for map layers, in which the layers are owned by the store and have their lifetime b...
Container class that allows storage of map themes consisting of visible map layers and layer styles...
This is a container for configuration of the snapping of the project.
Resolves relative paths into absolute paths and vice versa.
Represents a vector layer which manages a vector based data sets.
CORE_EXPORT bool zip(const QString &zip, const QStringList &files)
Zip the list of files in the zip file.
Interface for classes that handle missing layer files when reading project file.