17 #ifndef QGSVIRTUALLAYERDEFINITION_H
18 #define QGSVIRTUALLAYERDEFINITION_H
20 #include "qgis_core.h"
44 SourceLayer(
const QString &name,
const QString &ref )
49 SourceLayer(
const QString &name,
const QString &source,
const QString &provider,
const QString &encoding )
52 , mProvider( provider )
53 , mEncoding( encoding )
57 bool isReferenced()
const {
return !mRef.isEmpty(); }
60 QString reference()
const {
return mRef; }
63 QString name()
const {
return mName; }
66 QString provider()
const {
return mProvider; }
69 QString source()
const {
return mSource; }
72 QString encoding()
const {
return mEncoding; }
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 =
"" );
115 typedef QList<QgsVirtualLayerDefinition::SourceLayer>
SourceLayers;
121 QString query()
const {
return mQuery; }
123 void setQuery(
const QString &query ) { mQuery = query; }
126 QString filePath()
const {
return mFilePath; }
128 void setFilePath(
const QString &filePath ) { mFilePath = filePath; }
131 QString uid()
const {
return mUid; }
133 void setUid(
const QString &uid ) { mUid = uid; }
143 void setLazy(
bool lazy ) { mLazy = lazy; }
151 bool isLazy()
const {
return mLazy; }
154 QString geometryField()
const {
return mGeometryField; }
156 void setGeometryField(
const QString &geometryField ) { mGeometryField = geometryField; }
168 long geometrySrid()
const {
return mGeometrySrid; }
170 void setGeometrySrid(
long srid ) { mGeometrySrid = srid; }
173 QgsFields fields()
const {
return mFields; }
175 void setFields(
const QgsFields &fields ) { mFields = fields; }
178 bool hasSourceLayer(
const QString &name )
const;
181 bool hasReferencedLayers()
const;
184 bool hasDefinedGeometry()
const
193 QString subsetString()
const;
199 void setSubsetString(
const QString &subsetString );
202 SourceLayers mSourceLayers;
205 QString mGeometryField;
210 long mGeometrySrid = 0;
211 QString mSubsetString;