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; }
159 bool hasSourceLayer(
const QString &name )
const;
162 bool hasReferencedLayers()
const;
171 SourceLayers mSourceLayers;
174 QString mGeometryField;
178 long mGeometrySrid = 0;
bool isReferenced() const
Is it a live layer or not ?
void setFields(const QgsFields &fields)
Set 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
Get 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)
Set the file path.
QString filePath() const
Get 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)
Set the SQL query.
void setGeometryField(const QString &geometryField)
Set the name of the geometry field.
QString geometryField() const
Get the name of the geometry field. Empty if no geometry field.
QgsFields fields() const
Get field definitions.
const QgsVirtualLayerDefinition::SourceLayers & sourceLayers() const
Get access to the source layers.
void setGeometryWkbType(QgsWkbTypes::Type t)
Set 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)
Set the name of the field with unique identifiers.
void setGeometrySrid(long srid)
Set the SRID of the geometry.
QString provider() const
Provider key.
QString query() const
Get the SQL query.
QgsWkbTypes::Type geometryWkbType() const
Get the type of the geometry QgsWkbTypes::NoGeometry to hide any geometry QgsWkbTypes::Unknown for un...
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
Get the SRID of the geometry.