18 #ifndef QGSMESHLAYER_H
19 #define QGSMESHLAYER_H
23 #include "qgis_core.h"
34 struct QgsMeshLayerRendererCache;
114 : transformContext( transformContext )
126 bool loadDefaultStyle =
true;
141 bool skipCrsValidation =
false;
157 explicit QgsMeshLayer(
const QString &path = QString(),
const QString &baseName = QString(),
const QString &providerLib = QStringLiteral(
"mesh_memory" ),
168 SIP_PYOBJECT __repr__();
170 QString
str = QStringLiteral(
"<QgsMeshLayer: '%1' (%2)>" ).arg( sipCpp->name(), sipCpp->dataProvider() ? sipCpp->dataProvider()->name() : QStringLiteral(
"Invalid" ) );
171 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
181 bool readSymbology( const QDomNode &node, QString &errorMessage,
183 bool writeSymbology( QDomNode &node, QDomDocument &doc, QString &errorMessage,
185 bool writeStyle( QDomNode &node, QDomDocument &doc, QString &errorMessage, const
QgsReadWriteContext &context, StyleCategories categories = AllStyleCategories ) const override;
186 bool readStyle( const QDomNode &node, QString &errorMessage,
QgsReadWriteContext &context, StyleCategories categories = AllStyleCategories ) override;
187 QString encodedSource( const QString &source, const
QgsReadWriteContext &context ) const override;
188 QString decodedSource( const QString &source, const QString &provider, const
QgsReadWriteContext &context ) const override;
190 bool writeXml( QDomNode &layer_node, QDomDocument &doc, const
QgsReadWriteContext &context ) const override;
193 void reload() override;
194 QStringList subLayers() const override;
195 QString htmlMetadata() const override;
196 bool isEditable() const override;
197 bool supportsEditing() const override;
198 QString loadDefaultStyle(
bool &resultFlag
SIP_OUT )
FINAL;
201 QString providerType() const;
212 bool addDatasets( const QString &path, const QDateTime &defaultReferenceTime = QDateTime() );
234 bool saveDataset( const QString &path,
int datasetGroupIndex, QString driver );
270 int triangularMeshLevelOfDetailCount() const
SIP_SKIP;
298 QgsMeshLayerRendererCache *rendererCache()
SIP_SKIP;
339 QString formatTime(
double hours );
346 int datasetGroupCount() const;
353 int extraDatasetGroupCount() const;
363 QList<
int> datasetGroupsIndexes() const;
373 QList<
int> enabledDatasetGroupsIndexes() const;
570 QgsMeshDatasetIndex datasetIndexAtTime( const QgsDateTimeRange &timeRange,
int datasetGroupIndex ) const;
670 void setReferenceTime( const QDateTime &referenceTime );
712 QList<
int> selectVerticesByExpression(
QgsExpression expression );
722 QList<
int> selectFacesByExpression(
QgsExpression expression );
753 void resetDatasetGroupTreeItem();
836 bool isModified() const override;
842 bool contains( const
QgsMesh::ElementType &type ) const;
851 int meshVertexCount() const;
860 int meshFaceCount() const;
867 int meshEdgeCount() const;
885 void activeScalarDatasetGroupChanged(
int index );
892 void activeVectorDatasetGroupChanged(
int index );
899 void timeSettingsChanged( );
906 bool isReadOnly()
const override {
return true;}
914 bool setDataProvider( QString
const &provider,
const QgsDataProvider::ProviderOptions &options, QgsDataProvider::ReadFlags flags = QgsDataProvider::ReadFlags() );
920 void fillNativeMesh();
921 void assignDefaultStyleToDatasetGroup(
int groupIndex );
922 void createSimplifiedMeshes();
923 int levelsOfDetailsIndex(
double partOfMeshInView )
const;
925 bool hasSimplifiedMeshes()
const;
931 void onDatasetGroupsAdded(
const QList<int> &datasetGroupIndexes );
939 QStringList mExtraDatasetUri;
941 std::unique_ptr<QgsMeshDatasetGroupStore> mDatasetGroupStore;
944 std::unique_ptr<QgsMesh> mNativeMesh;
947 std::vector<std::unique_ptr<QgsTriangularMesh>> mTriangularMeshes;
950 std::unique_ptr<QgsMeshLayerRendererCache> mRendererCache;
967 int mStaticScalarDatasetIndex = 0;
968 int mStaticVectorDatasetIndex = 0;
972 int closestEdge(
const QgsPointXY &point,
double searchRadius,
QgsPointXY &projectedPoint )
const;
983 void updateActiveDatasetGroups();
985 void setDataSourcePrivate(
const QString &dataSource,
const QString &baseName,
const QString &provider,
989 #endif //QGSMESHLAYER_H