mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-09 00:35:20 -05:00
Implementation of this override method permit to reload mesh end dataset groups when the data changed outside of the QGIS application.
249 lines
7.5 KiB
Plaintext
249 lines
7.5 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 mesh_providers Mesh data providers
|
|
|
|
\subsection mesh_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");
|
|
|
|
.. note::
|
|
|
|
The API is considered EXPERIMENTAL and can be changed without a notice
|
|
|
|
|
|
.. versionadded:: 3.2
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgsmeshlayer.h"
|
|
%End
|
|
public:
|
|
|
|
struct LayerOptions
|
|
{
|
|
|
|
explicit LayerOptions( const QgsCoordinateTransformContext &transformContext = QgsCoordinateTransformContext( ) );
|
|
%Docstring
|
|
Constructor for LayerOptions with optional ``transformContext``.
|
|
|
|
.. note::
|
|
|
|
transformContext argument was added in QGIS 3.8
|
|
%End
|
|
|
|
QgsCoordinateTransformContext transformContext;
|
|
};
|
|
|
|
explicit QgsMeshLayer( const QString &path = QString(), const QString &baseName = QString(), const QString &providerLib = QStringLiteral( "mesh_memory" ),
|
|
const QgsMeshLayer::LayerOptions &options = QgsMeshLayer::LayerOptions() );
|
|
%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"
|
|
:param options: general mesh layer options
|
|
%End
|
|
|
|
~QgsMeshLayer();
|
|
|
|
|
|
virtual QgsMeshDataProvider *dataProvider();
|
|
|
|
%Docstring
|
|
QgsMeshLayer cannot be copied.
|
|
%End
|
|
virtual QgsMeshLayer *clone() const /Factory/;
|
|
|
|
virtual QgsRectangle extent() const;
|
|
|
|
virtual QgsMapLayerRenderer *createMapRenderer( QgsRenderContext &rendererContext ) /Factory/;
|
|
|
|
virtual bool readSymbology( const QDomNode &node, QString &errorMessage,
|
|
QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories );
|
|
virtual bool writeSymbology( QDomNode &node, QDomDocument &doc, QString &errorMessage,
|
|
const QgsReadWriteContext &context, QgsMapLayer::StyleCategories categories = QgsMapLayer::AllStyleCategories ) const;
|
|
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;
|
|
|
|
|
|
virtual void reload();
|
|
|
|
|
|
QString providerType() const;
|
|
%Docstring
|
|
Returns the provider type for this layer
|
|
%End
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QgsMeshRendererSettings rendererSettings() const;
|
|
%Docstring
|
|
Returns renderer settings
|
|
%End
|
|
void setRendererSettings( const QgsMeshRendererSettings &settings );
|
|
%Docstring
|
|
Sets new renderer settings
|
|
%End
|
|
|
|
QgsMeshTimeSettings timeSettings() const;
|
|
%Docstring
|
|
Returns time format settings
|
|
|
|
.. versionadded:: 3.8
|
|
%End
|
|
|
|
void setTimeSettings( const QgsMeshTimeSettings &settings );
|
|
%Docstring
|
|
Sets time format settings
|
|
|
|
.. versionadded:: 3.8
|
|
%End
|
|
|
|
QString formatTime( double hours );
|
|
%Docstring
|
|
Returns (date) time in hours formatted to human readable form
|
|
|
|
:param hours: time in double in hours
|
|
|
|
:return: formatted time string
|
|
|
|
.. versionadded:: 3.8
|
|
%End
|
|
|
|
QgsMeshDatasetValue datasetValue( const QgsMeshDatasetIndex &index, const QgsPointXY &point ) const;
|
|
%Docstring
|
|
Interpolates the value on the given point from given dataset.
|
|
|
|
.. 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
|
|
|
|
|
|
.. versionadded:: 3.4
|
|
%End
|
|
|
|
public slots:
|
|
|
|
virtual void setTransformContext( const QgsCoordinateTransformContext &transformContext );
|
|
|
|
%Docstring
|
|
Sets the coordinate transform context to ``transformContext``.
|
|
|
|
.. versionadded:: 3.8
|
|
%End
|
|
|
|
|
|
signals:
|
|
|
|
void activeScalarDatasetChanged( const QgsMeshDatasetIndex &index );
|
|
%Docstring
|
|
Emitted when active scalar dataset is changed
|
|
|
|
.. versionadded:: 3.4
|
|
%End
|
|
|
|
void activeVectorDatasetChanged( const QgsMeshDatasetIndex &index );
|
|
%Docstring
|
|
Emitted when active vector dataset is changed
|
|
|
|
.. versionadded:: 3.4
|
|
%End
|
|
|
|
void timeSettingsChanged( );
|
|
%Docstring
|
|
Emitted when time format is changed
|
|
|
|
.. versionadded:: 3.8
|
|
%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 *
|
|
************************************************************************/
|