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;
bool isReferenced() const
Is it a live layer or not ?
void setFields(const QgsFields &fields)
Sets field definitions.
QList< QgsVirtualLayerDefinition::SourceLayer > SourceLayers
List of source layers.
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.
QString name() const
Name of the layer.
QString uid() const
Gets the name of the field with unique identifiers.
QString encoding() const
Optional encoding for the provider.
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.
QString filePath() const
Gets the file path. May be empty.
Type
The WKB type describes the number of dimensions a geometry has.
QString reference() const
The reference (id) of the live layer.
void setQuery(const QString &query)
Sets the SQL query.
void setGeometryField(const QString &geometryField)
Sets the name of the geometry field.
bool isLazy() const
Returns the lazy mode.
QString geometryField() const
Gets the name of the geometry field. Empty if no geometry field.
QgsFields fields() const
Gets field definitions.
const QgsVirtualLayerDefinition::SourceLayers & sourceLayers() const
Gets access to the source layers.
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.
bool hasDefinedGeometry() const
Convenient method to test if the geometry is defined (not NoGeometry and not Unknown) ...
void setUid(const QString &uid)
Sets the name of the field with unique identifiers.
void setGeometrySrid(long srid)
Sets the SRID of the geometry.
QString provider() const
Provider key.
QString query() const
Gets the SQL query.
void setLazy(bool lazy)
Sets the lazy mode.
QgsWkbTypes::Type geometryWkbType() const
Gets the type of the geometry QgsWkbTypes::NoGeometry to hide any geometry QgsWkbTypes::Unknown for u...
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.
long geometrySrid() const
Gets the SRID of the geometry.