18#ifndef QGSAUXILIARYSTORAGE_H
19#define QGSAUXILIARYSTORAGE_H
81 SIP_PYOBJECT __repr__();
83 QString
str = QStringLiteral(
"<QgsAuxiliaryLayer: '%1'>" ).arg( sipCpp->name() );
84 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
422 void initTmpFileName();
424 static QString filenameForProject(
const QgsProject &project );
427 static bool tableExists(
const QString &table,
sqlite3 *handler );
428 static bool createTable(
const QString &type,
const QString &table,
sqlite3 *handler, QString &errorMsg );
430 static bool exec(
const QString &sql,
sqlite3 *handler );
431 static QString debugMsg(
const QString &sql,
sqlite3 *handler );
437 QString mTmpFileName;
439 mutable QString mErrorString;
Class allowing to manage the auxiliary storage for a vector layer.
static QString nameFromProperty(const QgsPropertyDefinition &def, bool joined=false)
Returns the name of the auxiliary field for a property definition.
static QgsField createAuxiliaryField(const QgsPropertyDefinition &definition)
Creates a new auxiliary field from a property definition.
static QgsPropertyDefinition propertyDefinitionFromField(const QgsField &field)
Returns the property definition from an auxiliary field.
bool clear()
Deletes all features from the layer.
bool addAuxiliaryField(const QgsPropertyDefinition &definition)
Adds an auxiliary field for the given property.
bool isHiddenProperty(int index) const
Returns true if the underlying field has to be hidden from editing tools like attribute table,...
QgsVectorLayer * toSpatialLayer() const
An auxiliary layer is not spatial.
bool deleteAttribute(int attr) override
Removes attribute from the layer and commits changes.
QgsFields auxiliaryFields() const
Returns a list of all auxiliary fields currently managed by the layer.
QgsAuxiliaryLayer(const QString &pkField, const QString &filename, const QString &table, QgsVectorLayer *vlayer)
Constructor.
bool save()
Commits changes and starts editing then.
int propertyFromIndex(int index) const
Returns the underlying property key for the field index.
static int createProperty(QgsDiagramLayerSettings::Property property, QgsVectorLayer *vlayer, bool overwriteExisting=true)
Creates if necessary a new auxiliary field for a diagram's property and activates this property in se...
QgsVectorLayerJoinInfo joinInfo() const
Returns information to use for joining with primary key and so on.
QgsPropertyDefinition propertyDefinitionFromIndex(int index) const
Returns the property definition for the underlying field index.
bool exists(const QgsPropertyDefinition &definition) const
Returns true if the property is stored in the layer already, false otherwise.
static int createProperty(QgsCallout::Property property, QgsVectorLayer *vlayer, bool overwriteExisting=true)
Creates if necessary a new auxiliary field for a callout's property and activates this property in se...
static int createProperty(QgsPalLayerSettings::Property property, QgsVectorLayer *vlayer, bool overwriteExisting=true)
Creates if necessary a new auxiliary field for a PAL property and activates this property in settings...
QgsAuxiliaryLayer & operator=(QgsAuxiliaryLayer const &rhs)=delete
QgsAuxiliaryLayer * clone(QgsVectorLayer *layer) const
Returns a new instance equivalent to this one.
static QgsField createAuxiliaryField(const QgsField &field)
Creates a new auxiliary field from a field.
int indexOfPropertyDefinition(const QgsPropertyDefinition &definition) const
Returns the index of the auxiliary field for a specific property definition.
QgsAuxiliaryLayer(const QgsAuxiliaryLayer &rhs)=delete
Class providing some utility methods to manage auxiliary storage.
QgsAuxiliaryStorage(const QString &filename=QString(), bool copy=true)
Constructor.
static QString extension()
Returns the extension used for auxiliary databases.
QString errorString() const
Returns the underlying error string describing potential errors happening in saveAs().
bool save() const
Saves the current database.
static bool exists(const QgsProject &project)
Returns true if the auxiliary database yet exists for a project, false otherwise.
QgsAuxiliaryLayer * createAuxiliaryLayer(const QgsField &field, QgsVectorLayer *layer) const
Creates an auxiliary layer for a vector layer.
virtual ~QgsAuxiliaryStorage()
bool saveAs(const QString &filename)
Saves the current database to a new path.
bool isValid() const
Returns the status of the auxiliary storage currently defined.
QString currentFileName() const
Returns the path of the current database used.
QgsAuxiliaryStorage(const QgsProject &project, bool copy=true)
Constructor.
QString fileName() const
Returns the target filename of the database.
static bool deleteTable(const QgsDataSourceUri &uri)
Removes a table from the auxiliary storage.
bool saveAs(const QgsProject &project)
Saves the current database to a new path for a specific project.
static bool duplicateTable(const QgsDataSourceUri &uri, const QString &newTable)
Duplicates a table and its content.
Property
Data definable properties.
Class for storing the component parts of a RDBMS data source URI (e.g.
Property
Data definable properties.
Encapsulate a field in an attribute table or data source.
Container of fields for a vector layer.
Property
Data definable properties.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition for a property.
Defines left outer join from our vector layer to some other vector layer.
Represents a vector layer which manages a vector based data sets.
QgsVectorLayer * clone() const override
Returns a new instance equivalent to this one.
Unique pointer for sqlite3 databases, which automatically closes the database when the pointer goes o...