24 #include "qgis_core.h" 32 #include <QStringList> 33 #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 );
694 int validCount()
const;
703 QgsMapLayer *mapLayer(
const QString &layerId )
const;
725 return qobject_cast<T>( mapLayer( layerId ) );
736 QList<QgsMapLayer *> mapLayersByName(
const QString &layerName )
const;
746 QMap<QString, QgsMapLayer *> mapLayers(
const bool validOnly =
false )
const;
751 bool isZipped()
const;
766 template <
typename T>
769 return mLayerStore->layers<T>();
798 QList<QgsMapLayer *> addMapLayers(
const QList<QgsMapLayer *> &mapLayers
SIP_TRANSFER,
799 bool addToLegend =
true,
830 bool addToLegend =
true,
847 void removeMapLayers(
const QStringList &layerIds );
864 void removeMapLayers(
const QList<QgsMapLayer *> &layers );
879 void removeMapLayer(
const QString &layerId );
915 void removeAllMapLayers();
922 void reloadAllLayers();
941 void setTrustLayerMetadata(
bool trust );
993 Q_DECL_DEPRECATED QSet<QgsMapLayer *> requiredLayers()
const;
1003 Q_DECL_DEPRECATED
void setRequiredLayers(
const QSet<QgsMapLayer *> &layers );
1017 void generateTsFile(
const QString &locale );
1029 QString
translate(
const QString &context,
const QString &sourceText,
const char *disambiguation =
nullptr,
int n = -1 )
const override;
1045 void readProject(
const QDomDocument & );
1055 void writeProject( QDomDocument & );
1065 void readMapLayer(
QgsMapLayer *mapLayer,
const QDomElement &layerNode );
1075 void writeMapLayer(
QgsMapLayer *mapLayer, QDomElement &layerElem, QDomDocument &doc );
1080 void projectSaved();
1085 void oldProjectVersionWarning(
const QString & );
1092 void layerLoaded(
int i,
int n );
1095 void loadingLayer(
const QString &layerName );
1103 void loadingLayerMessageReceived(
const QString &layerName,
const QList<QgsReadWriteContext::ReadWriteMessage> &messages );
1109 Q_DECL_DEPRECATED
void nonIdentifiableLayersChanged( QStringList nonIdentifiableLayers );
1112 void fileNameChanged();
1120 void homePathChanged();
1131 void customVariablesChanged();
1147 void ellipsoidChanged(
const QString &ellipsoid );
1156 void transformContextChanged();
1162 void missingDatumTransforms(
const QStringList &missingTransforms );
1170 void transactionGroupsChanged();
1177 void topologicalEditingChanged();
1184 void avoidIntersectionsLayersChanged();
1197 void mapThemeCollectionChanged();
1203 void labelingEngineSettingsChanged();
1211 void metadataChanged();
1219 void projectColorsChanged();
1232 void layersWillBeRemoved(
const QStringList &layerIds );
1241 void layersWillBeRemoved(
const QList<QgsMapLayer *> &layers );
1252 void layerWillBeRemoved(
const QString &layerId );
1271 void layersRemoved(
const QStringList &layerIds );
1281 void layerRemoved(
const QString &layerId );
1303 void layersAdded(
const QList<QgsMapLayer *> &layers );
1321 void legendLayersAdded(
const QList<QgsMapLayer *> &layers );
1330 void isDirtyChanged(
bool dirty );
1350 void setDirty(
bool b =
true );
1360 void setPresetHomePath(
const QString &path );
1382 void onMapLayersAdded(
const QList<QgsMapLayer *> &layers );
1383 void onMapLayersRemoved(
const QList<QgsMapLayer *> &layers );
1384 void cleanTransactionGroups(
bool force =
false );
1407 bool _getMapLayers(
const QDomDocument &doc, QList<QDomNode> &brokenNodes );
1413 void setError(
const QString &errorMessage )
SIP_SKIP;
1434 bool readProjectFile(
const QString &filename );
1437 bool writeProjectFile(
const QString &filename );
1440 bool unzip(
const QString &filename );
1443 bool zip(
const QString &filename );
1446 bool saveAuxiliaryStorage(
const QString &filename = QString() );
1448 std::unique_ptr< QgsMapLayerStore > mLayerStore;
1450 QString mErrorMessage;
1459 QHash< QString, QPair< QString, bool> > mEmbeddedLayers;
1465 std::unique_ptr<QgsAnnotationManager> mAnnotationManager;
1466 std::unique_ptr<QgsLayoutManager> mLayoutManager;
1475 std::unique_ptr<QgsMapThemeCollection> mMapThemeCollection;
1477 std::unique_ptr<QgsLabelingEngineSettings> mLabelingEngineSettings;
1479 QVariantMap mCustomVariables;
1481 std::unique_ptr<QgsProjectArchive> mArchive;
1483 std::unique_ptr<QgsAuxiliaryStorage> mAuxiliaryStorage;
1493 bool mAutoTransaction =
false;
1494 bool mEvaluateDefaultValues =
false;
1496 bool mDirty =
false;
1497 int mDirtyBlockCount = 0;
1498 bool mTrustLayerMetadata =
false;
1504 std::unique_ptr< QTranslator > mTranslator;
1506 bool mIsBeingDeleted =
false;
1548 : mProject( project )
1550 mProject->mDirtyBlockCount++;
1561 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.
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...
T mapLayer(const QString &layerId) const
Retrieve a pointer to a registered layer by layerId converted to type T.
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.
QList< QPair< QColor, QString > > QgsNamedColorList
List of colors paired with a friendly display name identifying the color.
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.
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).
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.