24 #include "qgis_core.h" 33 #include <QStringList> 34 #include <QTranslator> 92 Q_PROPERTY( QStringList nonIdentifiableLayers READ nonIdentifiableLayers WRITE setNonIdentifiableLayers NOTIFY nonIdentifiableLayersChanged )
93 Q_PROPERTY( QString fileName READ fileName WRITE setFileName NOTIFY fileNameChanged )
94 Q_PROPERTY( QString homePath READ homePath WRITE setPresetHomePath NOTIFY homePathChanged )
97 Q_PROPERTY( QString ellipsoid READ ellipsoid WRITE setEllipsoid NOTIFY ellipsoidChanged )
98 Q_PROPERTY(
QgsMapThemeCollection *mapThemeCollection READ mapThemeCollection NOTIFY mapThemeCollectionChanged )
99 Q_PROPERTY(
QgsSnappingConfig snappingConfig READ snappingConfig WRITE setSnappingConfig NOTIFY snappingConfigChanged )
101 Q_PROPERTY( QList<
QgsVectorLayer *> avoidIntersectionsLayers READ avoidIntersectionsLayers WRITE setAvoidIntersectionsLayers NOTIFY avoidIntersectionsLayersChanged )
126 void setTitle( const QString &title );
134 QString title() const;
139 bool isDirty() const;
147 void setFileName( const QString &name );
155 QString fileName() const;
182 QDateTime lastModified() const;
189 QString absoluteFilePath() const;
196 QString absolutePath() const;
202 QString baseName() const;
226 QString ellipsoid() const;
234 void setEllipsoid( const QString &ellipsoid );
271 bool read( const QString &filename );
288 bool readLayer( const QDomNode &layerNode );
298 bool write( const QString &filename );
316 bool writeEntry( const QString &scope, const QString &key,
bool value )
SIP_PYNAME( writeEntryBool );
327 bool writeEntry( const QString &scope, const QString &key,
double value )
SIP_PYNAME( writeEntryDouble );
337 bool writeEntry( const QString &scope, const QString &key,
int value );
347 bool writeEntry( const QString &scope, const QString &key, const QString &value );
357 bool writeEntry( const QString &scope, const QString &key, const QStringList &value );
365 QStringList readListEntry( const QString &scope, const QString &key, const QStringList &def = QStringList(),
bool *ok =
nullptr ) const;
367 QString readEntry( const QString &scope, const QString &key, const QString &def = QString(),
bool *ok =
nullptr ) const;
368 int readNumEntry( const QString &scope, const QString &key,
int def = 0,
bool *ok =
nullptr ) const;
369 double readDoubleEntry( const QString &scope, const QString &key,
double def = 0,
bool *ok =
nullptr ) const;
370 bool readBoolEntry( const QString &scope, const QString &key,
bool def = false,
bool *ok =
nullptr ) const;
374 bool removeEntry( const QString &scope, const QString &key );
382 QStringList entryList( const QString &scope, const QString &key ) const;
389 QStringList subkeyList( const QString &scope, const QString &key ) const;
397 void dumpProperties() const;
411 QString writePath( const QString &filename ) const;
414 QString readPath( const QString &filename ) const;
417 QString error() const;
426 QString layerIsEmbedded( const QString &
id ) const;
433 bool createEmbeddedLayer( const QString &layerId, const QString &projectFilePath, QList<QDomNode> &brokenNodes,
440 QgsLayerTreeGroup *createEmbeddedGroup( const QString &groupName, const QString &projectFilePath, const QStringList &invisibleLayers );
443 void setTopologicalEditing(
bool enabled );
446 bool topologicalEditing() const;
462 void setDistanceUnits(
QgsUnitTypes::DistanceUnit unit );
491 QString homePath() const;
505 QString presetHomePath() const;
559 Q_DECL_DEPRECATED
void setNonIdentifiableLayers(
const QList<QgsMapLayer *> &layers );
565 Q_DECL_DEPRECATED
void setNonIdentifiableLayers(
const QStringList &layerIds );
571 Q_DECL_DEPRECATED QStringList nonIdentifiableLayers()
const;
580 bool autoTransaction()
const;
591 void setAutoTransaction(
bool autoTransaction );
610 QgsTransactionGroup *transactionGroup(
const QString &providerKey,
const QString &connString );
617 bool evaluateDefaultValues()
const;
624 void setEvaluateDefaultValues(
bool evaluateDefaultValues );
640 QList<QgsVectorLayer *> avoidIntersectionsLayers()
const;
647 void setAvoidIntersectionsLayers(
const QList<QgsVectorLayer *> &layers );
654 QVariantMap customVariables()
const;
660 void setCustomVariables(
const QVariantMap &customVariables );
700 QgsMapLayer *mapLayer(
const QString &layerId )
const;
709 QList<QgsMapLayer *> mapLayersByName(
const QString &layerName )
const;
717 QMap<QString, QgsMapLayer *> mapLayers()
const;
722 bool isZipped()
const;
737 template <
typename T>
740 return mLayerStore->layers<T>();
769 QList<QgsMapLayer *> addMapLayers(
const QList<QgsMapLayer *> &mapLayers
SIP_TRANSFER,
770 bool addToLegend =
true,
801 bool addToLegend =
true,
818 void removeMapLayers(
const QStringList &layerIds );
834 void removeMapLayers(
const QList<QgsMapLayer *> &layers );
849 void removeMapLayer(
const QString &layerId );
885 void removeAllMapLayers();
892 void reloadAllLayers();
911 void setTrustLayerMetadata(
bool trust );
963 Q_DECL_DEPRECATED QSet<QgsMapLayer *> requiredLayers()
const;
973 Q_DECL_DEPRECATED
void setRequiredLayers(
const QSet<QgsMapLayer *> &layers );
979 void generateTsFile(
const QString &locale );
991 QString
translate(
const QString &context,
const QString &sourceText,
const char *disambiguation =
nullptr,
int n = -1 )
const override;
1007 void readProject(
const QDomDocument & );
1017 void writeProject( QDomDocument & );
1027 void readMapLayer(
QgsMapLayer *mapLayer,
const QDomElement &layerNode );
1037 void writeMapLayer(
QgsMapLayer *mapLayer, QDomElement &layerElem, QDomDocument &doc );
1042 void projectSaved();
1047 void oldProjectVersionWarning(
const QString & );
1054 void layerLoaded(
int i,
int n );
1057 void loadingLayer(
const QString &layerName );
1065 void loadingLayerMessageReceived(
const QString &layerName,
const QList<QgsReadWriteContext::ReadWriteMessage> &messages );
1071 Q_DECL_DEPRECATED
void nonIdentifiableLayersChanged( QStringList nonIdentifiableLayers );
1074 void fileNameChanged();
1082 void homePathChanged();
1093 void customVariablesChanged();
1109 void ellipsoidChanged(
const QString &ellipsoid );
1118 void transformContextChanged();
1124 void missingDatumTransforms(
const QStringList &missingTransforms );
1132 void transactionGroupsChanged();
1139 void topologicalEditingChanged();
1146 void avoidIntersectionsLayersChanged();
1159 void mapThemeCollectionChanged();
1165 void labelingEngineSettingsChanged();
1173 void metadataChanged();
1186 void layersWillBeRemoved(
const QStringList &layerIds );
1195 void layersWillBeRemoved(
const QList<QgsMapLayer *> &layers );
1206 void layerWillBeRemoved(
const QString &layerId );
1225 void layersRemoved(
const QStringList &layerIds );
1235 void layerRemoved(
const QString &layerId );
1256 void layersAdded(
const QList<QgsMapLayer *> &layers );
1274 void legendLayersAdded(
const QList<QgsMapLayer *> &layers );
1283 void isDirtyChanged(
bool dirty );
1303 void setDirty(
bool b =
true );
1313 void setPresetHomePath(
const QString &path );
1335 void onMapLayersAdded(
const QList<QgsMapLayer *> &layers );
1336 void onMapLayersRemoved(
const QList<QgsMapLayer *> &layers );
1337 void cleanTransactionGroups(
bool force =
false );
1360 bool _getMapLayers(
const QDomDocument &doc, QList<QDomNode> &brokenNodes );
1366 void setError(
const QString &errorMessage )
SIP_SKIP;
1387 bool readProjectFile(
const QString &filename );
1390 bool writeProjectFile(
const QString &filename );
1393 bool unzip(
const QString &filename );
1396 bool zip(
const QString &filename );
1399 bool saveAuxiliaryStorage(
const QString &filename = QString() );
1401 std::unique_ptr< QgsMapLayerStore > mLayerStore;
1403 QString mErrorMessage;
1412 QHash< QString, QPair< QString, bool> > mEmbeddedLayers;
1418 std::unique_ptr<QgsAnnotationManager> mAnnotationManager;
1419 std::unique_ptr<QgsLayoutManager> mLayoutManager;
1428 std::unique_ptr<QgsMapThemeCollection> mMapThemeCollection;
1430 std::unique_ptr<QgsLabelingEngineSettings> mLabelingEngineSettings;
1432 QVariantMap mCustomVariables;
1434 std::unique_ptr<QgsProjectArchive> mArchive;
1436 std::unique_ptr<QgsAuxiliaryStorage> mAuxiliaryStorage;
1446 bool mAutoTransaction =
false;
1447 bool mEvaluateDefaultValues =
false;
1449 bool mDirty =
false;
1450 int mDirtyBlockCount = 0;
1451 bool mTrustLayerMetadata =
false;
1457 std::unique_ptr< QTranslator > mTranslator;
1499 : mProject( project )
1501 mProject->mDirtyBlockCount++;
1512 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.
bool trustLayerMetadata() const
Returns true if the trust option is activated, false otherwise.
const QgsCoordinateReferenceSystem & crs
virtual QgsExpressionContext createExpressionContext() const =0
This method needs to be reimplemented in all classes which implement this interface and return an exp...
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.
Wherever an object of this class is available, the derived translate function can be called from...
Manages storage of a set of layouts.
Used for the collecting of strings from projects for translation and creation of ts files...
Abstract interface for generating an expression context.
virtual QString translate(const QString &context, const QString &sourceText, const char *disambiguation=nullptr, int n=-1) const =0
The derived translate() translates with QTranslator and qm file the sourceText.
A registry / canonical manager of data providers.
Project property key node.
Cache for server configuration.
~QgsProjectDirtyBlocker()
QVector< T > layers() const
Returns a list of registered map layers with a specified layer type.
This class manages a set of relations between layers.
Stores global configuration for labeling engine.
This class represents a coordinate reference system (CRS).
This is a container for attribute editors, used to group them visually in the attribute form if it is...
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.