17#ifndef QGSVIRTUALLAYERDEFINITION_H
18#define QGSVIRTUALLAYERDEFINITION_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; }
106 QString toString()
const;
109 void addSource(
const QString &name,
const QString &ref );
112 void addSource(
const QString &name,
const QString &source,
const QString &provider,
const QString &encoding =
"" );
121 QString
query()
const {
return mQuery; }
123 void setQuery(
const QString &query ) { mQuery = query; }
128 void setFilePath(
const QString &filePath ) { mFilePath = filePath; }
131 QString
uid()
const {
return mUid; }
133 void setUid(
const QString &uid ) { mUid = uid; }
178 bool hasSourceLayer(
const QString &name )
const;
181 bool hasReferencedLayers()
const;
193 QString subsetString()
const;
199 void setSubsetString(
const QString &subsetString );
202 SourceLayers mSourceLayers;
205 QString mGeometryField;
210 long mGeometrySrid = 0;
211 QString mSubsetString;
Container of fields for a vector layer.
A SourceLayer is either a reference to a live layer in the registry or all the parameters needed to l...
QString source() const
The source url used by the provider to build the layer.
SourceLayer(const QString &name, const QString &ref)
Constructor variant to build a live layer reference.
QString encoding() const
Optional encoding for the provider.
bool isReferenced() const
Is it a live layer or not ?
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 reference() const
The reference (id) of the live layer.
QString provider() const
Provider key.
QString name() const
Name of the layer.
Class to manipulate the definition of a virtual layer.
QString geometryField() const
Gets the name of the geometry field. Empty if no geometry field.
QString query() const
Gets the SQL query.
QgsFields fields() const
Gets field definitions.
long geometrySrid() const
Gets the SRID of the geometry.
void setUid(const QString &uid)
Sets the name of the field with unique identifiers.
bool hasDefinedGeometry() const
Convenient method to test if the geometry is defined (not NoGeometry and not Unknown)
void setLazy(bool lazy)
Sets the lazy mode.
QList< QgsVirtualLayerDefinition::SourceLayer > SourceLayers
List of source layers.
void setFilePath(const QString &filePath)
Sets the file path.
void setGeometryWkbType(QgsWkbTypes::Type t)
Sets the type of the geometry.
void setGeometrySrid(long srid)
Sets the SRID of the geometry.
void setGeometryField(const QString &geometryField)
Sets the name of the geometry field.
const QgsVirtualLayerDefinition::SourceLayers & sourceLayers() const
Gets access to the source layers.
QString uid() const
Gets the name of the field with unique identifiers.
QString filePath() const
Gets the file path. May be empty.
QgsWkbTypes::Type geometryWkbType() const
Gets the type of the geometry QgsWkbTypes::NoGeometry to hide any geometry QgsWkbTypes::Unknown for u...
void setFields(const QgsFields &fields)
Sets field definitions.
void setQuery(const QString &query)
Sets the SQL query.
bool isLazy() const
Returns the lazy mode.
Type
The WKB type describes the number of dimensions a geometry has.