QGIS/python/core/qgsvirtuallayerdefinition.sip.in

235 lines
6.3 KiB
Plaintext
Raw Normal View History

2017-05-23 09:45:57 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsvirtuallayerdefinition.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
2015-12-15 19:12:35 +02:00
class QgsVirtualLayerDefinition
{
2017-05-23 09:45:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Class to manipulate the definition of a virtual layer
2017-05-23 09:45:57 +02:00
2017-12-15 10:36:55 -04:00
It is used to extract parameters from an initial virtual layer definition as well as
to store the complete, expanded definition once types have been detected.
2017-05-23 09:45:57 +02:00
%End
2015-12-15 19:12:35 +02:00
%TypeHeaderCode
2017-05-23 09:45:57 +02:00
#include "qgsvirtuallayerdefinition.h"
2015-12-15 19:12:35 +02:00
%End
public:
2017-05-23 09:45:57 +02:00
2015-12-15 19:12:35 +02:00
class SourceLayer
2017-05-23 09:45:57 +02:00
{
%Docstring
2017-12-15 10:36:55 -04:00
A SourceLayer is either a reference to a live layer in the registry
or all the parameters needed to load it (provider key, source, etc.)
2017-05-23 09:45:57 +02:00
%End
%TypeHeaderCode
#include "qgsvirtuallayerdefinition.h"
%End
2015-12-15 19:12:35 +02:00
public:
SourceLayer( const QString &name, const QString &ref );
2017-05-23 09:45:57 +02:00
%Docstring
Constructor variant to build a live layer reference
%End
SourceLayer( const QString &name, const QString &source, const QString &provider, const QString &encoding );
2017-05-23 09:45:57 +02:00
%Docstring
Constructor variant to build a layer with a provider and a source
%End
2015-12-15 19:12:35 +02:00
bool isReferenced() const;
2017-05-23 09:45:57 +02:00
%Docstring
Is it a live layer or not ?
%End
2015-12-15 19:12:35 +02:00
QString reference() const;
2017-05-23 09:45:57 +02:00
%Docstring
The reference (id) of the live layer
%End
2015-12-15 19:12:35 +02:00
QString name() const;
2017-05-23 09:45:57 +02:00
%Docstring
Name of the layer
%End
2015-12-15 19:12:35 +02:00
QString provider() const;
2017-05-23 09:45:57 +02:00
%Docstring
Provider key
%End
2015-12-15 19:12:35 +02:00
QString source() const;
2017-05-23 09:45:57 +02:00
%Docstring
The source url used by the provider to build the layer
%End
2015-12-15 19:12:35 +02:00
QString encoding() const;
2017-05-23 09:45:57 +02:00
%Docstring
Optional encoding for the provider
%End
2015-12-15 19:12:35 +02:00
};
QgsVirtualLayerDefinition( const QString &filePath = "" );
2017-05-23 09:45:57 +02:00
%Docstring
Constructor with an optional file path
%End
2015-12-15 19:12:35 +02:00
static QgsVirtualLayerDefinition fromUrl( const QUrl &url );
2017-05-23 09:45:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Constructor to build a definition from a QUrl
The path part of the URL is extracted as well as the following optional keys:
layer_ref=layer_id[:name] represents a live layer referenced by its ID. An optional name can be given
layer=provider:source[:name[:encoding]] represents a layer given by its provider key, its source url (URL-encoded).
An optional name and encoding can be given
geometry=column_name[:type:srid] gives the definition of the geometry column.
Type can be either a WKB type code or a string (point, linestring, etc.)
srid is an integer
uid=column_name is the name of a column with unique integer values.
nogeometry is a flag to force the layer to be a non-geometry layer
query=sql represents the SQL query. Must be URL-encoded
field=column_name:[int|real|text] represents a field with its name and its type
2017-05-23 09:45:57 +02:00
%End
2015-12-15 19:12:35 +02:00
QUrl toUrl() const;
2017-05-23 09:45:57 +02:00
%Docstring
Convert the definition into a QUrl
%End
2015-12-15 19:12:35 +02:00
QString toString() const;
2017-05-23 09:45:57 +02:00
%Docstring
Convert into a QString that can be read by the virtual layer provider
%End
2015-12-15 19:12:35 +02:00
void addSource( const QString &name, const QString &ref );
2017-05-23 09:45:57 +02:00
%Docstring
Add a live layer source layer
%End
2015-12-15 19:12:35 +02:00
void addSource( const QString &name, const QString &source, const QString &provider, const QString &encoding = "" );
2017-05-23 09:45:57 +02:00
%Docstring
Add a layer with a source, a provider and an encoding
%End
2015-12-15 19:12:35 +02:00
typedef QList<QgsVirtualLayerDefinition::SourceLayer> SourceLayers;
2017-05-23 09:45:57 +02:00
const QgsVirtualLayerDefinition::SourceLayers &sourceLayers() const;
%Docstring
Get access to the source layers
%End
2015-12-15 19:12:35 +02:00
QString query() const;
2017-05-23 09:45:57 +02:00
%Docstring
Get the SQL query
%End
void setQuery( const QString &query );
2017-05-23 09:45:57 +02:00
%Docstring
Set the SQL query
%End
2015-12-15 19:12:35 +02:00
QString filePath() const;
2017-05-23 09:45:57 +02:00
%Docstring
Get the file path. May be empty
%End
void setFilePath( const QString &filePath );
2017-05-23 09:45:57 +02:00
%Docstring
Set the file path
%End
2015-12-15 19:12:35 +02:00
QString uid() const;
2017-05-23 09:45:57 +02:00
%Docstring
Get the name of the field with unique identifiers
%End
void setUid( const QString &uid );
2017-05-23 09:45:57 +02:00
%Docstring
Set the name of the field with unique identifiers
%End
2015-12-15 19:12:35 +02:00
2018-01-23 07:53:42 +00:00
void setPostpone( bool postpone );
2018-01-23 10:08:19 +00:00
%Docstring
Sets the postpone mode. If ``postpone`` is true, then the loading is
delayed until an explicit reloading of the layer.
:param postpone: True to delay the loading, false otherwise
.. versionadded:: 3.2
%End
2018-01-23 07:53:42 +00:00
bool postpone() const;
2018-01-23 10:08:19 +00:00
%Docstring
Returns the postpone mode.
:return: True if the loading is delayed, false otherwise.
.. versionadded:: 3.2
%End
2018-01-23 07:53:42 +00:00
2015-12-15 19:12:35 +02:00
QString geometryField() const;
2017-05-23 09:45:57 +02:00
%Docstring
Get the name of the geometry field. Empty if no geometry field
%End
void setGeometryField( const QString &geometryField );
2017-05-23 09:45:57 +02:00
%Docstring
Set the name of the geometry field
%End
2015-12-15 19:12:35 +02:00
QgsWkbTypes::Type geometryWkbType() const;
2017-05-23 09:45:57 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Get the type of the geometry
QgsWkbTypes.NoGeometry to hide any geometry
QgsWkbTypes.Unknown for unknown types
2017-05-23 09:45:57 +02:00
%End
void setGeometryWkbType( QgsWkbTypes::Type t );
2017-05-23 09:45:57 +02:00
%Docstring
Set the type of the geometry
%End
2015-12-15 19:12:35 +02:00
long geometrySrid() const;
2017-05-23 09:45:57 +02:00
%Docstring
Get the SRID of the geometry
%End
2015-12-15 19:12:35 +02:00
void setGeometrySrid( long srid );
2017-05-23 09:45:57 +02:00
%Docstring
Set the SRID of the geometry
%End
2015-12-15 19:12:35 +02:00
2017-05-23 09:45:57 +02:00
QgsFields fields() const;
%Docstring
Get field definitions
%End
void setFields( const QgsFields &fields );
2017-05-23 09:45:57 +02:00
%Docstring
Set field definitions
%End
2015-12-15 19:12:35 +02:00
bool hasSourceLayer( const QString &name ) const;
2017-05-23 09:45:57 +02:00
%Docstring
Convenience method to test if a given source layer is part of the definition
%End
2015-12-15 19:12:35 +02:00
2016-02-14 03:50:23 +01:00
bool hasReferencedLayers() const;
2017-05-23 09:45:57 +02:00
%Docstring
Convenience method to test whether the definition has referenced (live) layers
%End
2015-12-15 19:12:35 +02:00
2016-02-14 03:50:23 +01:00
bool hasDefinedGeometry() const;
2017-05-23 09:45:57 +02:00
%Docstring
Convenient method to test if the geometry is defined (not NoGeometry and not Unknown)
%End
2015-12-15 19:12:35 +02:00
};
2017-09-25 14:20:39 +10:00
2017-05-23 09:45:57 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsvirtuallayerdefinition.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/