18 #ifndef QGSMESHLAYERUTILS_H
19 #define QGSMESHLAYERUTILS_H
23 #include "qgis_core.h"
48 class CORE_EXPORT QgsMeshLayerUtils
98 static QVector<QgsVector> griddedVectorValues(
111 static QVector<double> calculateMagnitudes(
const QgsMeshDataBlock &block );
123 static void boundingBoxToScreenRectangle(
125 const QSize &outputSize,
127 int &leftLim,
int &rightLim,
int &topLim,
int &bottomLim );
135 static double interpolateFromVerticesData(
137 double val1,
double val2
161 static double interpolateFromVerticesData(
163 double val1,
double val2,
double val3,
const QgsPointXY &pt
179 static QgsVector interpolateVectorFromVerticesData(
193 static double interpolateFromFacesData(
208 static QgsVector interpolateVectorFromFacesData(
217 static QVector<double> interpolateFromFacesData(
218 QVector<double> valuesOnFaces,
230 static QVector<double> resampleFromVerticesToFaces(
231 const QVector<double> valuesOnVertices,
248 static QVector<double> calculateMagnitudeOnVertices(
271 static QString formatTime(
double hours,
const QDateTime &referenceTime,
const QgsMeshTimeSettings &settings );
281 static QVector<QVector3D> calculateNormals(
283 const QVector<double> &verticalMagnitude,
293 static void createDatasetGroupTreeItems(
const QList<QgsMeshDatasetGroupMetadata> &metadataList,
296 QMap<QString, QgsMeshDatasetGroupTreeItem *> mNameToItem;
297 for (
int i = 0; i < metadataList.count(); ++i )
299 int groupIndex = startingIndex + i;
301 const QString name = meta.
name();
302 const QStringList subdatasets = name.split(
'/' );
304 QString displayName = name;
307 if ( subdatasets.size() == 2 )
309 auto it = mNameToItem.find( subdatasets[0] );
310 if ( it == mNameToItem.end() )
311 QgsDebugMsg( QStringLiteral(
"Unable to find parent group for %1." ).arg( name ) );
314 displayName = subdatasets[1];
318 else if ( subdatasets.size() != 1 )
319 QgsDebugMsg( QStringLiteral(
"Ignoring too deep child group name %1." ).arg( name ) );
323 if ( mNameToItem.contains( name ) )
324 QgsDebugMsg( QStringLiteral(
"Group %1 is not unique" ).arg( displayName ) );
325 mNameToItem[name] = item;
332 #endif // QGSMESHLAYERUTILS_H