17 #ifndef QGSVIRTUALLAYERDEFINITION_H 18 #define QGSVIRTUALLAYERDEFINITION_H 20 #include "qgis_core.h" 49 SourceLayer(
const QString &name,
const QString &source,
const QString &provider,
const QString &encoding )
52 , mProvider( provider )
53 , mEncoding( encoding )
63 QString
name()
const {
return mName; }
69 QString
source()
const {
return mSource; }
105 QString toString()
const;
108 void addSource(
const QString &name,
const QString &ref );
111 void addSource(
const QString &name,
const QString &source,
const QString &provider,
const QString &encoding =
"" );
120 QString
query()
const {
return mQuery; }
122 void setQuery(
const QString &query ) { mQuery = query; }
127 void setFilePath(
const QString &filePath ) { mFilePath = filePath; }
130 QString
uid()
const {
return mUid; }
132 void setUid(
const QString &uid ) { mUid = uid; }
177 bool hasSourceLayer(
const QString &name )
const;
180 bool hasReferencedLayers()
const;
189 SourceLayers mSourceLayers;
192 QString mGeometryField;
197 long mGeometrySrid = 0;
QString geometryField() const
Gets the name of the geometry field. Empty if no geometry field.
void setFields(const QgsFields &fields)
Sets field definitions.
QList< QgsVirtualLayerDefinition::SourceLayer > SourceLayers
List of source layers.
QString query() const
Gets the SQL query.
SourceLayer(const QString &name, const QString &source, const QString &provider, const QString &encoding)
Constructor variant to build a layer with a provider and a source.
Container of fields for a vector layer.
QString source() const
The source url used by the provider to build the layer.
void setFilePath(const QString &filePath)
Sets the file path.
bool isLazy() const
Returns the lazy mode.
Type
The WKB type describes the number of dimensions a geometry has.
QString uid() const
Gets the name of the field with unique identifiers.
void setQuery(const QString &query)
Sets the SQL query.
QgsFields fields() const
Gets field definitions.
void setGeometryField(const QString &geometryField)
Sets the name of the geometry field.
bool hasDefinedGeometry() const
Convenient method to test if the geometry is defined (not NoGeometry and not Unknown) ...
QString provider() const
Provider key.
QString name() const
Name of the layer.
void setGeometryWkbType(QgsWkbTypes::Type t)
Sets the type of the geometry.
SourceLayer(const QString &name, const QString &ref)
Constructor variant to build a live layer reference.
void setUid(const QString &uid)
Sets the name of the field with unique identifiers.
void setGeometrySrid(long srid)
Sets the SRID of the geometry.
QgsWkbTypes::Type geometryWkbType() const
Gets the type of the geometry QgsWkbTypes::NoGeometry to hide any geometry QgsWkbTypes::Unknown for u...
bool isReferenced() const
Is it a live layer or not ?
long geometrySrid() const
Gets the SRID of the geometry.
void setLazy(bool lazy)
Sets the lazy mode.
QString reference() const
The reference (id) of the live layer.
const QgsVirtualLayerDefinition::SourceLayers & sourceLayers() const
Gets access to the source layers.
QString filePath() const
Gets the file path. May be empty.
QString encoding() const
Optional encoding for the provider.
A SourceLayer is either a reference to a live layer in the registry or all the parameters needed to l...
Class to manipulate the definition of a virtual layer.