QGIS/python/core/mesh/qgsmeshlayer.sip.in
Peter Petrik 50422a1165 [FEATURE] QgsMeshLayer part 1: Reading raw mesh
Introducting MDAL, QgsMeshLayer, mesh data providers (mesh_memory, mdal)
to read and visualize raw meshes: vertices and faces. Support dragging
2dm files from browser on canvas to visualize 2dm meshes.
Support for QgsMeshLayer in Python API.
2018-04-19 10:50:33 +02:00

175 lines
5.8 KiB
Plaintext

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/mesh/qgsmeshlayer.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsMeshLayer : QgsMapLayer
{
%Docstring
Represents a mesh layer supporting display of data on structured or unstructured meshes
The QgsMeshLayer is instantiated by specifying the name of a data provider,
such as mdal, and url defining the specific data set to connect to.
The vector layer constructor in turn instantiates a QgsMeshDataProvider subclass
corresponding to the provider type, and passes it the url. The data provider
connects to the data source.
The QgsMeshLayer provides a common interface to the different data types. It does not
yet support editing transactions.
The main data providers supported by QGIS are listed below.
\section providers Mesh data providers
\subsection memory Memory data providerType (mesh_memory)
The memory data provider is used to construct in memory data, for example scratch
data. There is no inherent persistent storage of the data. The data source uri is constructed.
Data can be populated by setMesh(const QString &vertices, const QString &faces), where
vertices and faces is comma separated coordinates and connections for mesh.
E.g. to create mesh with one quad and one triangle
.. code-block::
QString uri(
"1.0, 2.0 \n" \
"2.0, 2.0 \n" \
"3.0, 2.0 \n" \
"2.0, 3.0 \n" \
"1.0, 3.0 \n" \
"---"
"0, 1, 3, 4 \n" \
"1, 2, 3 \n"
);
QgsMeshLayer *scratchLayer = new QgsMeshLayer(uri, "My Scratch layer", "memory_mesh");
\subsection mdal MDAL data provider (mdal)
Accesses data using the MDAL drivers (https://github.com/lutraconsulting/MDAL). The url
is the MDAL connection string. QGIS must be built with MDAL support to allow this provider.
.. code-block::
QString uri = "test/land.2dm";
QgsMeshLayer *scratchLayer = new QgsMeshLayer(uri, "My Scratch Layer", "mdal");
.. versionadded:: 3.2
%End
%TypeHeaderCode
#include "qgsmeshlayer.h"
%End
public:
explicit QgsMeshLayer( const QString &path = QString(), const QString &baseName = QString(), const QString &providerLib = "mesh_memory" );
%Docstring
Constructor - creates a mesh layer
The QgsMeshLayer is constructed by instantiating a data provider. The provider
interprets the supplied path (url) of the data source to connect to and access the
data.
:param path: The path or url of the parameter. Typically this encodes
parameters used by the data provider as url query items.
:param baseName: The name used to represent the layer in the legend
:param providerLib: The name of the data provider, e.g., "mesh_memory", "mdal"
%End
~QgsMeshLayer();
virtual QgsMeshDataProvider *dataProvider();
%Docstring
Return data provider
%End
virtual QgsMeshLayer *clone() const /Factory/;
%Docstring
Returns a new instance equivalent to this one. A new provider is
created for the same data source and renderers are cloned too.
:return: a new layer instance
%End
virtual QgsRectangle extent() const;
%Docstring
Returns the extent of the layer.
%End
virtual QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) /Factory/;
%Docstring
Return new instance of QgsMapLayerRenderer that will be used for rendering of given context
%End
QString providerType() const;
%Docstring
Return the provider type for this layer
%End
QgsSymbol *nativeMeshSymbol();
%Docstring
Returns a line symbol used for rendering native mesh.
%End
QgsSymbol *triangularMeshSymbol();
%Docstring
Returns a line symbol used for rendering of triangular (derived) mesh.
.. seealso:: :py:func:`toggleTriangularMeshRendering`
%End
void toggleTriangularMeshRendering( bool toggle );
%Docstring
Toggle rendering of triangular (derived) mesh. Off by default
%End
bool readSymbology( const QDomNode &node, QString &errorMessage, QgsReadWriteContext &context );
%Docstring
Read the symbology for the current layer from the Dom node supplied.
:param node: node that will contain the symbology definition for this layer.
:param errorMessage: reference to string that will be updated with any error messages
:param context: reading context (used for transform from relative to absolute paths)
:return: true in case of success.
%End
bool writeSymbology( QDomNode &node, QDomDocument &doc, QString &errorMessage, const QgsReadWriteContext &context ) const;
%Docstring
Write the symbology for the layer into the docment provided.
:param node: the node that will have the style element added to it.
:param doc: the document that will have the QDomNode added.
:param errorMessage: reference to string that will be updated with any error messages
:param context: writing context (used for transform from absolute to relative paths)
:return: true in case of success.
%End
private: // Private methods
QgsMeshLayer( const QgsMeshLayer &rhs );
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/mesh/qgsmeshlayer.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/