2018-04-06 16:11:50 +02:00
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
|
|
|
* src/core/mesh/qgsmeshlayer.h *
|
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-04-20 09:19:11 +02:00
|
|
|
|
2018-04-06 16:11:50 +02:00
|
|
|
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.
|
|
|
|
|
2018-04-20 10:39:28 +02:00
|
|
|
\section mesh_providers Mesh data providers
|
2018-04-06 16:11:50 +02:00
|
|
|
|
2018-04-20 10:39:28 +02:00
|
|
|
\subsection mesh_memory Memory data providerType (mesh_memory)
|
2018-04-06 16:11:50 +02:00
|
|
|
|
|
|
|
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");
|
|
|
|
|
2018-05-10 18:56:08 -04:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
The API is considered EXPERIMENTAL and can be changed without a notice
|
|
|
|
|
|
|
|
|
2018-04-06 16:11:50 +02:00
|
|
|
.. versionadded:: 3.2
|
|
|
|
%End
|
|
|
|
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgsmeshlayer.h"
|
|
|
|
%End
|
|
|
|
public:
|
|
|
|
|
2018-05-21 11:10:34 +10:00
|
|
|
struct LayerOptions
|
|
|
|
{
|
2018-05-27 17:52:22 +02:00
|
|
|
int unused; //! @todo remove me once there are actual members here (breaks SIP <4.19)
|
2018-05-21 11:10:34 +10:00
|
|
|
};
|
|
|
|
|
|
|
|
explicit QgsMeshLayer( const QString &path = QString(), const QString &baseName = QString(), const QString &providerLib = "mesh_memory",
|
|
|
|
const QgsMeshLayer::LayerOptions &options = QgsMeshLayer::LayerOptions() );
|
2018-04-06 16:11:50 +02:00
|
|
|
%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.
|
|
|
|
|
2018-05-27 16:42:41 +10:00
|
|
|
:param path: The path or url of the parameter. Typically this encodes
|
2018-05-27 16:33:02 +10:00
|
|
|
parameters used by the data provider as url query items.
|
2018-04-06 16:11:50 +02:00
|
|
|
:param baseName: The name used to represent the layer in the legend
|
2018-05-27 16:42:41 +10:00
|
|
|
:param providerLib: The name of the data provider, e.g., "mesh_memory", "mdal"
|
2018-05-21 16:27:00 +10:00
|
|
|
:param options: general mesh layer options
|
2018-04-06 16:11:50 +02:00
|
|
|
%End
|
|
|
|
~QgsMeshLayer();
|
|
|
|
|
|
|
|
|
|
|
|
virtual QgsMeshDataProvider *dataProvider();
|
|
|
|
|
|
|
|
%Docstring
|
2018-04-19 16:42:01 +02:00
|
|
|
QgsMeshLayer cannot be copied.
|
2018-04-06 16:11:50 +02:00
|
|
|
%End
|
|
|
|
virtual QgsMeshLayer *clone() const /Factory/;
|
|
|
|
|
|
|
|
virtual QgsRectangle extent() const;
|
|
|
|
|
|
|
|
virtual QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) /Factory/;
|
2018-05-22 14:32:20 +02:00
|
|
|
|
2018-09-07 14:32:59 -04:00
|
|
|
virtual bool readSymbology( const QDomNode &node, QString &errorMessage,
|
2018-09-12 11:38:37 -04:00
|
|
|
QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllCategories );
|
2018-09-07 14:32:59 -04:00
|
|
|
virtual bool writeSymbology( QDomNode &node, QDomDocument &doc, QString &errorMessage,
|
2018-09-12 11:38:37 -04:00
|
|
|
const QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllCategories ) const;
|
2018-05-03 12:10:54 +02:00
|
|
|
virtual QString encodedSource( const QString &source, const QgsReadWriteContext &context ) const;
|
|
|
|
|
|
|
|
virtual QString decodedSource( const QString &source, const QString &provider, const QgsReadWriteContext &context ) const;
|
|
|
|
|
|
|
|
virtual bool readXml( const QDomNode &layer_node, QgsReadWriteContext &context );
|
|
|
|
|
|
|
|
virtual bool writeXml( QDomNode &layer_node, QDomDocument &doc, const QgsReadWriteContext &context ) const;
|
|
|
|
|
2018-04-06 16:11:50 +02:00
|
|
|
|
|
|
|
QString providerType() const;
|
|
|
|
%Docstring
|
2018-05-15 12:39:03 +02:00
|
|
|
Returns the provider type for this layer
|
2018-04-06 16:11:50 +02:00
|
|
|
%End
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-08-10 23:28:32 +02:00
|
|
|
QgsMeshRendererSettings rendererSettings() const;
|
2018-04-06 16:11:50 +02:00
|
|
|
%Docstring
|
2018-05-22 14:32:20 +02:00
|
|
|
Returns renderer settings
|
2018-04-06 16:11:50 +02:00
|
|
|
%End
|
2018-08-10 23:28:32 +02:00
|
|
|
void setRendererSettings( const QgsMeshRendererSettings &settings );
|
2018-05-15 12:39:03 +02:00
|
|
|
%Docstring
|
2018-08-10 23:28:32 +02:00
|
|
|
Sets new renderer settings
|
2018-08-09 10:40:49 +02:00
|
|
|
%End
|
|
|
|
|
|
|
|
QgsMeshDatasetValue datasetValue( const QgsMeshDatasetIndex &index, const QgsPointXY &point ) const;
|
|
|
|
%Docstring
|
|
|
|
Interpolates the value on the given point from given dataset.
|
|
|
|
|
2018-08-10 14:40:46 +02:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
It uses previously cached and indexed triangular mesh
|
|
|
|
and so if the layer has not been rendered previously
|
|
|
|
(e.g. when used in a script) it returns NaN value
|
|
|
|
|
|
|
|
:param index: dataset index specifying group and dataset to extract value from
|
|
|
|
:param point: point to query in map coordinates
|
|
|
|
|
|
|
|
:return: interpolated value at the point. Returns NaN values for values
|
|
|
|
outside the mesh layer, nodata values and in case triangular mesh was not
|
|
|
|
previously used for rendering
|
|
|
|
|
2018-08-10 09:24:31 +02:00
|
|
|
|
|
|
|
.. versionadded:: 3.4
|
2018-08-09 10:40:49 +02:00
|
|
|
%End
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
2018-08-10 14:40:46 +02:00
|
|
|
void activeScalarDatasetChanged( const QgsMeshDatasetIndex &index );
|
2018-08-09 10:40:49 +02:00
|
|
|
%Docstring
|
|
|
|
Emitted when active scalar dataset is changed
|
|
|
|
|
|
|
|
.. versionadded:: 3.4
|
|
|
|
%End
|
|
|
|
|
2018-08-10 14:40:46 +02:00
|
|
|
void activeVectorDatasetChanged( const QgsMeshDatasetIndex &index );
|
2018-08-09 10:40:49 +02:00
|
|
|
%Docstring
|
|
|
|
Emitted when active vector dataset is changed
|
|
|
|
|
|
|
|
.. versionadded:: 3.4
|
2018-05-15 12:39:03 +02:00
|
|
|
%End
|
2018-05-10 18:56:08 -04:00
|
|
|
|
2018-04-19 16:42:01 +02:00
|
|
|
private: // Private methods
|
2018-04-06 16:11:50 +02:00
|
|
|
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 *
|
|
|
|
************************************************************************/
|