QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgsmeshdataset.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmeshdataset.cpp
3  -----------------------
4  begin : April 2018
5  copyright : (C) 2018 by Peter Petrik
6  email : zilolv at gmail dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #include "qgsmeshdataset.h"
19 #include "qgsrectangle.h"
20 #include "qgis.h"
21 
23  : mGroupIndex( group ), mDatasetIndex( dataset )
24 {}
25 
27 {
28  return mGroupIndex;
29 }
30 
32 {
33  return mDatasetIndex;
34 }
35 
37 {
38  return ( group() > -1 ) && ( dataset() > -1 );
39 }
40 
42 {
43  if ( isValid() && other.isValid() )
44  return other.group() == group() && other.dataset() == dataset();
45  else
46  return isValid() == other.isValid();
47 }
48 
50 {
51  return !( operator==( other ) );
52 }
53 
55  : mX( x ), mY( y )
56 {}
57 
59  : mX( scalar )
60 {}
61 
63 {
64  if ( std::isnan( mY ) )
65  {
66  return mX;
67  }
68  else if ( std::isnan( mX ) )
69  {
70  return std::numeric_limits<double>::quiet_NaN();
71  }
72  else
73  {
74  return std::sqrt( ( mX ) * ( mX ) + ( mY ) * ( mY ) );
75  }
76 }
77 
78 void QgsMeshDatasetValue::set( double scalar )
79 {
80  setX( scalar );
81 }
82 
83 void QgsMeshDatasetValue::setX( double x )
84 {
85  mX = x;
86 }
87 
88 void QgsMeshDatasetValue::setY( double y )
89 {
90  mY = y;
91 }
92 
93 double QgsMeshDatasetValue::x() const
94 {
95  return mX;
96 }
97 
98 double QgsMeshDatasetValue::y() const
99 {
100  return mY;
101 }
102 
104 {
105  bool equal = std::isnan( mX ) == std::isnan( other.x() );
106  equal &= std::isnan( mY ) == std::isnan( other.y() );
107 
108  if ( equal )
109  {
110  if ( std::isnan( mY ) )
111  {
112  equal &= qgsDoubleNear( other.x(), mX, 1E-8 );
113  }
114  else
115  {
116  equal &= qgsDoubleNear( other.x(), mX, 1E-8 );
117  equal &= qgsDoubleNear( other.y(), mY, 1E-8 );
118  }
119  }
120  return equal;
121 }
122 
124  bool isScalar,
125  DataType dataType,
126  double minimum,
127  double maximum,
128  int maximumVerticalLevels,
129  const QDateTime &referenceTime,
130  bool isTemporal,
131  const QMap<QString, QString> &extraOptions )
132  : mName( name )
133  , mIsScalar( isScalar )
134  , mDataType( dataType )
135  , mMinimumValue( minimum )
136  , mMaximumValue( maximum )
137  , mExtraOptions( extraOptions )
138  , mMaximumVerticalLevelsCount( maximumVerticalLevels )
139  , mReferenceTime( referenceTime )
140  , mIsTemporal( isTemporal )
141 {
142 }
143 
144 QMap<QString, QString> QgsMeshDatasetGroupMetadata::extraOptions() const
145 {
146  return mExtraOptions;
147 }
148 
150 {
151  return !mIsScalar;
152 }
153 
155 {
156  return mIsScalar;
157 }
158 
160 {
161  return mIsTemporal;
162 }
163 
165 {
166  return mName;
167 }
168 
170 {
171  return mDataType;
172 }
173 
175 {
176  return mMinimumValue;
177 }
178 
180 {
181  return mMaximumValue;
182 }
183 
185 {
186  return mMaximumVerticalLevelsCount;
187 }
188 
190 {
191  return mReferenceTime;
192 }
193 
195  double time,
196  bool isValid,
197  double minimum,
198  double maximum,
199  int maximumVerticalLevels )
200  : mTime( time )
201  , mIsValid( isValid )
202  , mMinimumValue( minimum )
203  , mMaximumValue( maximum )
204  , mMaximumVerticalLevelsCount( maximumVerticalLevels )
205 {
206 }
207 
209 {
210  return mTime;
211 }
212 
214 {
215  return mIsValid;
216 }
217 
219 {
220  return mMinimumValue;
221 }
222 
224 {
225  return mMaximumValue;
226 }
227 
229 {
230  return mMaximumVerticalLevelsCount;
231 }
232 
234  : mType( ActiveFlagInteger )
235 {
236 }
237 
239  : mType( type ),
240  mSize( count )
241 {
242 }
243 
245 {
246  return mType;
247 }
248 
250 {
251  return mSize;
252 }
253 
255 {
256  return ( count() > 0 ) && ( mIsValid );
257 }
258 
260 {
261  if ( !isValid() )
262  return QgsMeshDatasetValue();
263 
264  Q_ASSERT( mType != ActiveFlagInteger );
265 
266  if ( mType == ScalarDouble )
267  return QgsMeshDatasetValue( mDoubleBuffer[index] );
268 
269  return QgsMeshDatasetValue(
270  mDoubleBuffer[2 * index],
271  mDoubleBuffer[2 * index + 1]
272  );
273 }
274 
275 bool QgsMeshDataBlock::active( int index ) const
276 {
277  if ( !isValid() )
278  return false;
279 
280  Q_ASSERT( mType == ActiveFlagInteger );
281 
282  if ( mIntegerBuffer.empty() )
283  return true;
284  else
285  return bool( mIntegerBuffer[index] );
286 }
287 
288 void QgsMeshDataBlock::setActive( const QVector<int> &vals )
289 {
290  Q_ASSERT( mType == ActiveFlagInteger );
291  Q_ASSERT( vals.size() == count() );
292 
293  mIntegerBuffer = vals;
294  setValid( true );
295 }
296 
297 QVector<int> QgsMeshDataBlock::active() const
298 {
299  Q_ASSERT( mType == ActiveFlagInteger );
300  return mIntegerBuffer;
301 }
302 
303 QVector<double> QgsMeshDataBlock::values() const
304 {
305  Q_ASSERT( mType != ActiveFlagInteger );
306 
307  return mDoubleBuffer;
308 }
309 
310 void QgsMeshDataBlock::setValues( const QVector<double> &vals )
311 {
312  Q_ASSERT( mType != ActiveFlagInteger );
313  Q_ASSERT( mType == ScalarDouble ? vals.size() == count() : vals.size() == 2 * count() );
314 
315  mDoubleBuffer = vals;
316  setValid( true );
317 }
318 
319 void QgsMeshDataBlock::setValid( bool valid )
320 {
321  mIsValid = valid;
322 }
323 
325 
327 
328 QgsMesh3dDataBlock::QgsMesh3dDataBlock( int count, bool isVector )
329  : mSize( count )
330  , mIsVector( isVector )
331 {
332 }
333 
335 {
336  return mIsValid;
337 }
338 
340 {
341  return mIsVector;
342 }
343 
345 {
346  return mSize;
347 }
348 
350 {
351  if ( mFaceToVolumeIndex.empty() )
352  return -1;
353  return mFaceToVolumeIndex[0];
354 }
355 
357 {
358  if ( mFaceToVolumeIndex.empty() || mVerticalLevelsCount.empty() )
359  return -1;
360  const int lastVolumeStartIndex = mFaceToVolumeIndex[mFaceToVolumeIndex.size() - 1];
361  const int volumesCountInLastRow = mVerticalLevelsCount[mVerticalLevelsCount.size() - 1];
362  return lastVolumeStartIndex + volumesCountInLastRow;
363 }
364 
366 {
367  return lastVolumeIndex() - firstVolumeIndex();
368 }
369 
371 {
372  Q_ASSERT( isValid() );
373  return mVerticalLevelsCount;
374 }
375 
376 void QgsMesh3dDataBlock::setFaceToVolumeIndex( const QVector<int> &faceToVolumeIndex )
377 {
378  Q_ASSERT( faceToVolumeIndex.size() == count() );
379  mFaceToVolumeIndex = faceToVolumeIndex;
380 }
381 
382 void QgsMesh3dDataBlock::setVerticalLevelsCount( const QVector<int> &verticalLevelsCount )
383 {
384  Q_ASSERT( verticalLevelsCount.size() == count() );
385  mVerticalLevelsCount = verticalLevelsCount;
386 }
387 
388 QVector<double> QgsMesh3dDataBlock::verticalLevels() const
389 {
390  Q_ASSERT( isValid() );
391  return mVerticalLevels;
392 }
393 
394 void QgsMesh3dDataBlock::setVerticalLevels( const QVector<double> &verticalLevels )
395 {
396  Q_ASSERT( verticalLevels.size() == volumesCount() + count() );
397  mVerticalLevels = verticalLevels;
398 }
399 
401 {
402  Q_ASSERT( isValid() );
403  return mFaceToVolumeIndex;
404 }
405 
406 QVector<double> QgsMesh3dDataBlock::values() const
407 {
408  Q_ASSERT( isValid() );
409  return mDoubleBuffer;
410 }
411 
413 {
414  if ( !isValid() )
415  return QgsMeshDatasetValue();
416 
417  if ( !mIsVector )
418  return QgsMeshDatasetValue( mDoubleBuffer[volumeIndex] );
419 
420  return QgsMeshDatasetValue(
421  mDoubleBuffer[2 * volumeIndex],
422  mDoubleBuffer[2 * volumeIndex + 1]
423  );
424 }
425 
426 void QgsMesh3dDataBlock::setValues( const QVector<double> &doubleBuffer )
427 {
428  Q_ASSERT( doubleBuffer.size() == ( isVector() ? 2 * volumesCount() : volumesCount() ) );
429  mDoubleBuffer = doubleBuffer;
430 }
431 
433 {
434  mIsValid = valid;
435 }
436 
438 
440  bool isVector,
441  int index )
442  : mProviderName( defaultName )
443  , mIsVector( isVector )
444  , mDatasetGroupIndex( index )
445 {
446 }
447 
448 QgsMeshDatasetGroupTreeItem::QgsMeshDatasetGroupTreeItem( const QDomElement &itemElement, const QgsReadWriteContext &context )
449 {
450  Q_UNUSED( context );
451  if ( itemElement.hasAttribute( QStringLiteral( "display-name" ) ) )
452  mUserName = itemElement.attribute( QStringLiteral( "display-name" ), mUserName );
453 
454  if ( itemElement.hasAttribute( QStringLiteral( "provider-name" ) ) )
455  mProviderName = itemElement.attribute( QStringLiteral( "provider-name" ), mProviderName );
456 
457  if ( itemElement.hasAttribute( QStringLiteral( "is-vector" ) ) )
458  mIsVector = itemElement.attribute( QStringLiteral( "is-vector" ) ).toInt();
459 
460  if ( itemElement.hasAttribute( QStringLiteral( "dataset-index" ) ) )
461  mDatasetGroupIndex = itemElement.attribute( QStringLiteral( "dataset-index" ) ).toInt();
462 
463  if ( itemElement.hasAttribute( QStringLiteral( "is-enabled" ) ) )
464  mIsEnabled = itemElement.attribute( QStringLiteral( "is-enabled" ) ).toInt();
465 
466  QDomElement childElement = itemElement.firstChildElement( QStringLiteral( "mesh-dataset-group-tree-item" ) );
467  while ( !childElement.isNull() )
468  {
469  appendChild( new QgsMeshDatasetGroupTreeItem( childElement, context ) );
470  childElement = childElement.nextSiblingElement( QStringLiteral( "mesh-dataset-group-tree-item" ) );
471  }
472 
473 }
474 
476 {
477  qDeleteAll( mChildren );
478 }
479 
481 {
482  QgsMeshDatasetGroupTreeItem *other = new QgsMeshDatasetGroupTreeItem( mProviderName, mIsVector, mDatasetGroupIndex );
483  other->mUserName = mUserName;
484  other->mIsEnabled = mIsEnabled;
485 
486  if ( !mChildren.empty() )
487  for ( int i = 0; i < mChildren.count(); ++i )
488  other->appendChild( mChildren.at( i )->clone() );
489 
490  return other;
491 }
492 
494 {
495  mChildren.append( item );
496  item->mParent = this;
497  mDatasetGroupIndexToChild[item->datasetGroupIndex()] = item;
498 }
499 
501 {
502  if ( row < mChildren.count() )
503  return mChildren.at( row );
504  else
505  return nullptr;
506 }
507 
509 {
510  if ( mDatasetGroupIndexToChild.empty() )
511  return nullptr;
512 
513  QMap<int, QgsMeshDatasetGroupTreeItem *>::iterator it = mDatasetGroupIndexToChild.find( index );
514 
515  if ( it != mDatasetGroupIndexToChild.end() )
516  return it.value();
517  else
518  {
519  QgsMeshDatasetGroupTreeItem *item = nullptr;
520  for ( int i = 0; i < mChildren.count(); ++i )
521  {
522  item = mChildren.at( i )->childFromDatasetGroupIndex( index );
523  if ( item )
524  break;
525  }
526  return item;
527  }
528 }
529 
531 {
532  return mChildren.count();
533 }
534 
536 {
537  int count = 0;
538  for ( int i = 0; i < mChildren.count(); ++i )
539  {
540  count++;
541  count += mChildren.at( i )->totalChildCount();
542  }
543  return count;
544 }
545 
547 {
548  return mParent;
549 }
550 
552 {
553  if ( mParent )
554  return mParent->mChildren.indexOf( const_cast<QgsMeshDatasetGroupTreeItem *>( this ) );
555 
556  return 0;
557 }
558 
560 {
561  if ( mUserName.isEmpty() )
562  return mProviderName;
563  else
564  return mUserName;
565 }
566 
568 {
569  return mIsVector;
570 }
571 
573 {
574  return mDatasetGroupIndex;
575 }
576 
578 {
579  return mIsEnabled;
580 }
581 
583 {
584  mIsEnabled = enabled;
585 }
586 
588 {
589  return mProviderName;
590 }
591 
592 QDomElement QgsMeshDatasetGroupTreeItem::writeXml( QDomDocument &doc, const QgsReadWriteContext &context )
593 {
594  Q_UNUSED( context );
595 
596  QDomElement itemElement = doc.createElement( QStringLiteral( "mesh-dataset-group-tree-item" ) );
597  itemElement.setAttribute( QStringLiteral( "display-name" ), mUserName );
598  itemElement.setAttribute( QStringLiteral( "provider-name" ), mProviderName );
599  itemElement.setAttribute( QStringLiteral( "is-vector" ), mIsVector ? true : false );
600  itemElement.setAttribute( QStringLiteral( "dataset-index" ), mDatasetGroupIndex );
601  itemElement.setAttribute( QStringLiteral( "is-enabled" ), mIsEnabled ? true : false );
602 
603  for ( int i = 0; i < mChildren.count(); ++i )
604  itemElement.appendChild( mChildren.at( i )->writeXml( doc, context ) );
605 
606  return itemElement;
607 }
608 
609 void QgsMeshDatasetGroupTreeItem::setName( const QString &name )
610 {
611  mUserName = name;
612 }
613 
QgsMeshDatasetGroupMetadata::minimum
double minimum() const
Returns minimum scalar value/vector magnitude present for whole dataset group.
Definition: qgsmeshdataset.cpp:174
QgsMeshDatasetIndex::dataset
int dataset() const
Returns a dataset index within group()
Definition: qgsmeshdataset.cpp:31
QgsMesh3dDataBlock::faceToVolumeIndex
QVector< int > faceToVolumeIndex() const
Returns the indexing between faces and volumes.
Definition: qgsmeshdataset.cpp:400
QgsMeshDatasetMetadata::maximumVerticalLevelsCount
int maximumVerticalLevelsCount() const
Returns maximum number of vertical levels for 3d stacked meshes.
Definition: qgsmeshdataset.cpp:228
QgsMesh3dDataBlock::setValues
void setValues(const QVector< double > &doubleBuffer)
Sets the values at volume centers.
Definition: qgsmeshdataset.cpp:426
QgsMeshDatasetMetadata::minimum
double minimum() const
Returns minimum scalar value/vector magnitude present for the dataset.
Definition: qgsmeshdataset.cpp:218
QgsMeshDatasetGroupTreeItem::totalChildCount
int totalChildCount() const
Returns the total count of children, that is included deeper children.
Definition: qgsmeshdataset.cpp:535
QgsMeshDataBlock::QgsMeshDataBlock
QgsMeshDataBlock()
Constructs an invalid block.
Definition: qgsmeshdataset.cpp:233
QgsReadWriteContext
Definition: qgsreadwritecontext.h:34
QgsMeshDatasetValue::setY
void setY(double y)
Sets Y value.
Definition: qgsmeshdataset.cpp:88
QgsMeshDataBlock::ScalarDouble
@ ScalarDouble
Scalar double values.
Definition: qgsmeshdataset.h:141
qgsrectangle.h
QgsMeshDataBlock::active
QVector< int > active() const
Returns active flag array.
Definition: qgsmeshdataset.cpp:297
QgsMeshDatasetGroupTreeItem::parentItem
QgsMeshDatasetGroupTreeItem * parentItem() const
Returns the parent item, nullptr if it is root item.
Definition: qgsmeshdataset.cpp:546
QgsMesh3dDataBlock::isValid
bool isValid() const
Whether the block is valid.
Definition: qgsmeshdataset.cpp:334
QgsMesh3dDataBlock::~QgsMesh3dDataBlock
~QgsMesh3dDataBlock()
Dtor.
Definition: qgsmeshdataset.cpp:326
QgsMeshDatasetValue
Definition: qgsmeshdataset.h:76
QgsMeshDatasetGroupTreeItem::isVector
bool isVector() const
Definition: qgsmeshdataset.cpp:567
QgsMeshDatasetGroupTreeItem::isEnabled
bool isEnabled() const
Definition: qgsmeshdataset.cpp:577
qgis.h
QgsMeshDatasetGroupTreeItem::defaultName
QString defaultName() const
Definition: qgsmeshdataset.cpp:587
QgsMesh3dDataBlock::setVerticalLevelsCount
void setVerticalLevelsCount(const QVector< int > &verticalLevelsCount)
Sets the vertical level counts.
Definition: qgsmeshdataset.cpp:382
QgsMeshDatasetGroupTreeItem
Definition: qgsmeshdataset.h:546
QgsMeshDatasetMetadata::isValid
bool isValid() const
Returns whether dataset is valid.
Definition: qgsmeshdataset.cpp:213
QgsMesh3dDataBlock::values
QVector< double > values() const
Returns the values at volume centers.
Definition: qgsmeshdataset.cpp:406
QgsMeshDatasetIndex::operator!=
bool operator!=(QgsMeshDatasetIndex other) const
Inequality operator.
Definition: qgsmeshdataset.cpp:49
QgsMeshDatasetMetadata::time
double time() const
Returns the time value for this dataset.
Definition: qgsmeshdataset.cpp:208
QgsMeshDatasetIndex::QgsMeshDatasetIndex
QgsMeshDatasetIndex(int group=-1, int dataset=-1)
Creates an index. -1 represents invalid group/dataset.
Definition: qgsmeshdataset.cpp:22
QgsMeshDatasetGroupTreeItem::clone
QgsMeshDatasetGroupTreeItem * clone() const
Clones the item.
Definition: qgsmeshdataset.cpp:480
QgsMeshDataBlock::type
DataType type() const
Type of data stored in the block.
Definition: qgsmeshdataset.cpp:244
QgsMesh3dDataBlock::lastVolumeIndex
int lastVolumeIndex() const
Index of the last volume stored in the buffer (absolute)
Definition: qgsmeshdataset.cpp:356
QgsMesh3dDataBlock::QgsMesh3dDataBlock
QgsMesh3dDataBlock()
Constructs an invalid block.
QgsMeshDatasetIndex::group
int group() const
Returns a group index.
Definition: qgsmeshdataset.cpp:26
QgsMeshDatasetGroupTreeItem::QgsMeshDatasetGroupTreeItem
QgsMeshDatasetGroupTreeItem()
Constructor for an empty dataset group tree item.
QgsMeshDatasetGroupTreeItem::childCount
int childCount() const
Returns the count of children.
Definition: qgsmeshdataset.cpp:530
QgsMeshDatasetGroupTreeItem::childFromDatasetGroupIndex
QgsMeshDatasetGroupTreeItem * childFromDatasetGroupIndex(int index)
Returns the child with dataset group index Searches as depper as needed on the child hierarchy.
Definition: qgsmeshdataset.cpp:508
QgsMeshDatasetIndex
Definition: qgsmeshdataset.h:45
qgsDoubleNear
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
Definition: qgis.h:315
QgsMesh3dDataBlock::verticalLevelsCount
QVector< int > verticalLevelsCount() const
Returns number of vertical level above 2d faces.
Definition: qgsmeshdataset.cpp:370
QgsMeshDatasetGroupMetadata::maximumVerticalLevelsCount
int maximumVerticalLevelsCount() const
Returns maximum number of vertical levels for 3d stacked meshes.
Definition: qgsmeshdataset.cpp:184
QgsMeshDatasetGroupTreeItem::name
QString name() const
Returns the name of the item This mame is the default name if the name has not been overrided (.
Definition: qgsmeshdataset.cpp:559
QgsMeshDatasetIndex::isValid
bool isValid() const
Returns whether index is valid, ie at least groups is set.
Definition: qgsmeshdataset.cpp:36
QgsMesh3dDataBlock::isVector
bool isVector() const
Whether we store vector values.
Definition: qgsmeshdataset.cpp:339
QgsMeshDatasetValue::set
void set(double scalar)
Sets scalar value.
Definition: qgsmeshdataset.cpp:78
QgsMeshDatasetIndex::operator==
bool operator==(QgsMeshDatasetIndex other) const
Equality operator.
Definition: qgsmeshdataset.cpp:41
QgsMeshDatasetValue::x
double x() const
Returns x value.
Definition: qgsmeshdataset.cpp:93
QgsMeshDataBlock::DataType
DataType
Type of data stored in the block.
Definition: qgsmeshdataset.h:138
QgsMesh3dDataBlock::count
int count() const
Number of 2d faces for which the volume data is stored in the block.
Definition: qgsmeshdataset.cpp:344
QgsMesh3dDataBlock::setFaceToVolumeIndex
void setFaceToVolumeIndex(const QVector< int > &faceToVolumeIndex)
Sets the indexing between faces and volumes.
Definition: qgsmeshdataset.cpp:376
QgsMeshDatasetGroupMetadata::name
QString name() const
Returns name of the dataset group.
Definition: qgsmeshdataset.cpp:164
QgsMeshDataBlock::setValid
void setValid(bool valid)
Sets block validity.
Definition: qgsmeshdataset.cpp:319
QgsMeshDatasetGroupMetadata::dataType
DataType dataType() const
Returns whether dataset group data is defined on vertices or faces or volumes.
Definition: qgsmeshdataset.cpp:169
QgsMeshDataBlock::setActive
void setActive(const QVector< int > &vals)
Sets active flag values.
Definition: qgsmeshdataset.cpp:288
QgsMeshDatasetGroupMetadata::isTemporal
bool isTemporal() const
Returns whether the dataset group is temporal (contains time-related dataset)
Definition: qgsmeshdataset.cpp:159
QgsMeshDatasetGroupMetadata::extraOptions
QMap< QString, QString > extraOptions() const
Returns extra metadata options, for example description.
Definition: qgsmeshdataset.cpp:144
QgsMeshDatasetGroupMetadata::referenceTime
QDateTime referenceTime() const
Returns the reference time.
Definition: qgsmeshdataset.cpp:189
QgsMeshDataBlock::values
QVector< double > values() const
Returns buffer to the array with values For vector it is pairs (x1, y1, x2, y2, .....
Definition: qgsmeshdataset.cpp:303
QgsMeshDatasetGroupMetadata::isScalar
bool isScalar() const
Returns whether dataset group has scalar data.
Definition: qgsmeshdataset.cpp:154
QgsMeshDatasetGroupMetadata::maximum
double maximum() const
Returns maximum scalar value/vector magnitude present for whole dataset group.
Definition: qgsmeshdataset.cpp:179
QgsMeshDatasetGroupMetadata::DataType
DataType
Location of where data is specified for datasets in the dataset group.
Definition: qgsmeshdataset.h:353
QgsMeshDataBlock::ActiveFlagInteger
@ ActiveFlagInteger
Integer boolean flag whether face is active.
Definition: qgsmeshdataset.h:140
QgsMeshDatasetGroupTreeItem::appendChild
void appendChild(QgsMeshDatasetGroupTreeItem *item)
Appends a item child.
Definition: qgsmeshdataset.cpp:493
QgsMesh3dDataBlock::volumesCount
int volumesCount() const
Returns number of volumes stored in the buffer.
Definition: qgsmeshdataset.cpp:365
qgsmeshdataset.h
QgsMeshDataBlock::setValues
void setValues(const QVector< double > &vals)
Sets values.
Definition: qgsmeshdataset.cpp:310
QgsMeshDatasetValue::operator==
bool operator==(QgsMeshDatasetValue other) const
Definition: qgsmeshdataset.cpp:103
QgsMeshDatasetValue::y
double y() const
Returns y value.
Definition: qgsmeshdataset.cpp:98
QgsMeshDatasetGroupTreeItem::writeXml
QDomElement writeXml(QDomDocument &doc, const QgsReadWriteContext &context)
Write the item and its children in a DOM document.
Definition: qgsmeshdataset.cpp:592
QgsMesh3dDataBlock::verticalLevels
QVector< double > verticalLevels() const
Returns the vertical levels height.
Definition: qgsmeshdataset.cpp:388
QgsMeshDatasetValue::setX
void setX(double x)
Sets X value.
Definition: qgsmeshdataset.cpp:83
QgsMeshDatasetGroupTreeItem::datasetGroupIndex
int datasetGroupIndex() const
Definition: qgsmeshdataset.cpp:572
QgsMeshDatasetMetadata::maximum
double maximum() const
Returns maximum scalar value/vector magnitude present for the dataset.
Definition: qgsmeshdataset.cpp:223
QgsMeshDatasetGroupTreeItem::~QgsMeshDatasetGroupTreeItem
~QgsMeshDatasetGroupTreeItem()
Destructor, destructs also the chilren.
Definition: qgsmeshdataset.cpp:475
QgsMeshDatasetGroupMetadata::isVector
bool isVector() const
Returns whether dataset group has vector data.
Definition: qgsmeshdataset.cpp:149
QgsMeshDatasetMetadata::QgsMeshDatasetMetadata
QgsMeshDatasetMetadata()=default
Constructs an empty metadata object.
QgsMeshDataBlock::value
QgsMeshDatasetValue value(int index) const
Returns a value represented by the index For active flag the behavior is undefined.
Definition: qgsmeshdataset.cpp:259
QgsMeshDatasetGroupTreeItem::setName
void setName(const QString &name)
Overrides the default name with the name to display.
Definition: qgsmeshdataset.cpp:609
QgsMesh3dDataBlock::firstVolumeIndex
int firstVolumeIndex() const
Index of the first volume stored in the buffer (absolute)
Definition: qgsmeshdataset.cpp:349
QgsMeshDatasetGroupTreeItem::setIsEnabled
void setIsEnabled(bool isEnabled)
Sets whether the item is enabled, that is if it is displayed in view.
Definition: qgsmeshdataset.cpp:582
QgsMesh3dDataBlock::value
QgsMeshDatasetValue value(int volumeIndex) const
Returns the value at volume centers.
Definition: qgsmeshdataset.cpp:412
QgsMeshDatasetGroupTreeItem::child
QgsMeshDatasetGroupTreeItem * child(int row) const
Returns a child.
Definition: qgsmeshdataset.cpp:500
QgsMeshDatasetValue::scalar
double scalar() const
Returns magnitude of vector for vector data or scalar value for scalar data.
Definition: qgsmeshdataset.cpp:62
QgsMesh3dDataBlock::setValid
void setValid(bool valid)
Sets block validity.
Definition: qgsmeshdataset.cpp:432
QgsMesh3dDataBlock::setVerticalLevels
void setVerticalLevels(const QVector< double > &verticalLevels)
Sets the vertical levels height.
Definition: qgsmeshdataset.cpp:394
QgsMeshDatasetGroupMetadata::QgsMeshDatasetGroupMetadata
QgsMeshDatasetGroupMetadata()=default
Constructs an empty metadata object.
QgsMeshDatasetValue::QgsMeshDatasetValue
QgsMeshDatasetValue()=default
Default Ctor, initialize to NaN.
QgsMeshDatasetGroupTreeItem::row
int row() const
Returns the position of the item in the parent.
Definition: qgsmeshdataset.cpp:551
QgsMeshDataBlock::isValid
bool isValid() const
Whether the block is valid.
Definition: qgsmeshdataset.cpp:254
QgsMeshDataBlock::count
int count() const
Number of items stored in the block.
Definition: qgsmeshdataset.cpp:249