QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
Go to the documentation of this file.
23 : mGroupIndex( group ), mDatasetIndex( dataset )
64 if ( std::isnan( mY ) )
68 else if ( std::isnan( mX ) )
70 return std::numeric_limits<double>::quiet_NaN();
74 return std::sqrt( ( mX ) * ( mX ) + ( mY ) * ( mY ) );
105 bool equal = std::isnan( mX ) == std::isnan( other.
x() );
106 equal &= std::isnan( mY ) == std::isnan( other.
y() );
110 if ( std::isnan( mY ) )
128 int maximumVerticalLevels,
129 const QDateTime &referenceTime,
131 const QMap<QString, QString> &extraOptions )
133 , mIsScalar( isScalar )
134 , mDataType( dataType )
135 , mMinimumValue( minimum )
136 , mMaximumValue( maximum )
137 , mExtraOptions( extraOptions )
138 , mMaximumVerticalLevelsCount( maximumVerticalLevels )
139 , mReferenceTime( referenceTime )
140 , mIsTemporal( isTemporal )
146 return mExtraOptions;
176 return mMinimumValue;
181 return mMaximumValue;
186 return mMaximumVerticalLevelsCount;
191 return mReferenceTime;
199 int maximumVerticalLevels )
201 , mIsValid( isValid )
202 , mMinimumValue( minimum )
203 , mMaximumValue( maximum )
204 , mMaximumVerticalLevelsCount( maximumVerticalLevels )
220 return mMinimumValue;
225 return mMaximumValue;
230 return mMaximumVerticalLevelsCount;
234 : mType( ActiveFlagInteger )
256 return (
count() > 0 ) && ( mIsValid );
270 mDoubleBuffer[2 * index],
271 mDoubleBuffer[2 * index + 1]
282 if ( mIntegerBuffer.empty() )
285 return bool( mIntegerBuffer[index] );
291 Q_ASSERT( vals.size() ==
count() );
293 mIntegerBuffer = vals;
300 return mIntegerBuffer;
307 return mDoubleBuffer;
315 mDoubleBuffer = vals;
330 , mIsVector( isVector )
351 if ( mFaceToVolumeIndex.empty() )
353 return mFaceToVolumeIndex[0];
358 if ( mFaceToVolumeIndex.empty() || mVerticalLevelsCount.empty() )
360 const int lastVolumeStartIndex = mFaceToVolumeIndex[mFaceToVolumeIndex.size() - 1];
361 const int volumesCountInLastRow = mVerticalLevelsCount[mVerticalLevelsCount.size() - 1];
362 return lastVolumeStartIndex + volumesCountInLastRow;
373 return mVerticalLevelsCount;
391 return mVerticalLevels;
403 return mFaceToVolumeIndex;
409 return mDoubleBuffer;
421 mDoubleBuffer[2 * volumeIndex],
422 mDoubleBuffer[2 * volumeIndex + 1]
429 mDoubleBuffer = doubleBuffer;
442 : mProviderName( defaultName )
443 , mIsVector( isVector )
444 , mDatasetGroupIndex( index )
451 if ( itemElement.hasAttribute( QStringLiteral(
"display-name" ) ) )
452 mUserName = itemElement.attribute( QStringLiteral(
"display-name" ), mUserName );
454 if ( itemElement.hasAttribute( QStringLiteral(
"provider-name" ) ) )
455 mProviderName = itemElement.attribute( QStringLiteral(
"provider-name" ), mProviderName );
457 if ( itemElement.hasAttribute( QStringLiteral(
"is-vector" ) ) )
458 mIsVector = itemElement.attribute( QStringLiteral(
"is-vector" ) ).toInt();
460 if ( itemElement.hasAttribute( QStringLiteral(
"dataset-index" ) ) )
461 mDatasetGroupIndex = itemElement.attribute( QStringLiteral(
"dataset-index" ) ).toInt();
463 if ( itemElement.hasAttribute( QStringLiteral(
"is-enabled" ) ) )
464 mIsEnabled = itemElement.attribute( QStringLiteral(
"is-enabled" ) ).toInt();
466 QDomElement childElement = itemElement.firstChildElement( QStringLiteral(
"mesh-dataset-group-tree-item" ) );
467 while ( !childElement.isNull() )
470 childElement = childElement.nextSiblingElement( QStringLiteral(
"mesh-dataset-group-tree-item" ) );
477 qDeleteAll( mChildren );
483 other->mUserName = mUserName;
484 other->mIsEnabled = mIsEnabled;
486 if ( !mChildren.empty() )
487 for (
int i = 0; i < mChildren.count(); ++i )
495 mChildren.append( item );
496 item->mParent =
this;
502 if (
row < mChildren.count() )
503 return mChildren.at(
row );
510 if ( mDatasetGroupIndexToChild.empty() )
513 QMap<int, QgsMeshDatasetGroupTreeItem *>::iterator it = mDatasetGroupIndexToChild.find( index );
515 if ( it != mDatasetGroupIndexToChild.end() )
520 for (
int i = 0; i < mChildren.count(); ++i )
522 item = mChildren.at( i )->childFromDatasetGroupIndex( index );
532 return mChildren.count();
538 for (
int i = 0; i < mChildren.count(); ++i )
541 count += mChildren.at( i )->totalChildCount();
561 if ( mUserName.isEmpty() )
562 return mProviderName;
574 return mDatasetGroupIndex;
584 mIsEnabled = enabled;
589 return mProviderName;
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 );
603 for (
int i = 0; i < mChildren.count(); ++i )
604 itemElement.appendChild( mChildren.at( i )->writeXml( doc, context ) );
int dataset() const
Returns a dataset index within group()
QVector< int > faceToVolumeIndex() const
Returns the indexing between faces and volumes.
void setValues(const QVector< double > &doubleBuffer)
Sets the values at volume centers.
int totalChildCount() const
Returns the total count of children, that is included deeper children.
QgsMeshDataBlock()
Constructs an invalid block.
void setY(double y)
Sets Y value.
@ ScalarDouble
Scalar double values.
QVector< int > active() const
Returns active flag array.
QgsMeshDatasetGroupTreeItem * parentItem() const
Returns the parent item, nullptr if it is root item.
bool isValid() const
Whether the block is valid.
~QgsMesh3dDataBlock()
Dtor.
QString defaultName() const
void setVerticalLevelsCount(const QVector< int > &verticalLevelsCount)
Sets the vertical level counts.
QVector< double > values() const
Returns the values at volume centers.
bool operator!=(QgsMeshDatasetIndex other) const
Inequality operator.
QgsMeshDatasetIndex(int group=-1, int dataset=-1)
Creates an index. -1 represents invalid group/dataset.
QgsMeshDatasetGroupTreeItem * clone() const
Clones the item.
DataType type() const
Type of data stored in the block.
int lastVolumeIndex() const
Index of the last volume stored in the buffer (absolute)
QgsMesh3dDataBlock()
Constructs an invalid block.
int group() const
Returns a group index.
QgsMeshDatasetGroupTreeItem()
Constructor for an empty dataset group tree item.
int childCount() const
Returns the count of children.
QgsMeshDatasetGroupTreeItem * childFromDatasetGroupIndex(int index)
Returns the child with dataset group index Searches as depper as needed on the child hierarchy.
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
QVector< int > verticalLevelsCount() const
Returns number of vertical level above 2d faces.
QString name() const
Returns the name of the item This mame is the default name if the name has not been overrided (.
bool isValid() const
Returns whether index is valid, ie at least groups is set.
bool isVector() const
Whether we store vector values.
void set(double scalar)
Sets scalar value.
bool operator==(QgsMeshDatasetIndex other) const
Equality operator.
double x() const
Returns x value.
DataType
Type of data stored in the block.
int count() const
Number of 2d faces for which the volume data is stored in the block.
void setFaceToVolumeIndex(const QVector< int > &faceToVolumeIndex)
Sets the indexing between faces and volumes.
void setValid(bool valid)
Sets block validity.
void setActive(const QVector< int > &vals)
Sets active flag values.
QVector< double > values() const
Returns buffer to the array with values For vector it is pairs (x1, y1, x2, y2, .....
@ ActiveFlagInteger
Integer boolean flag whether face is active.
void appendChild(QgsMeshDatasetGroupTreeItem *item)
Appends a item child.
int volumesCount() const
Returns number of volumes stored in the buffer.
void setValues(const QVector< double > &vals)
Sets values.
bool operator==(QgsMeshDatasetValue other) const
double y() const
Returns y value.
QDomElement writeXml(QDomDocument &doc, const QgsReadWriteContext &context)
Write the item and its children in a DOM document.
QVector< double > verticalLevels() const
Returns the vertical levels height.
void setX(double x)
Sets X value.
int datasetGroupIndex() const
~QgsMeshDatasetGroupTreeItem()
Destructor, destructs also the chilren.
QgsMeshDatasetValue value(int index) const
Returns a value represented by the index For active flag the behavior is undefined.
void setName(const QString &name)
Overrides the default name with the name to display.
int firstVolumeIndex() const
Index of the first volume stored in the buffer (absolute)
void setIsEnabled(bool isEnabled)
Sets whether the item is enabled, that is if it is displayed in view.
QgsMeshDatasetValue value(int volumeIndex) const
Returns the value at volume centers.
QgsMeshDatasetGroupTreeItem * child(int row) const
Returns a child.
double scalar() const
Returns magnitude of vector for vector data or scalar value for scalar data.
void setValid(bool valid)
Sets block validity.
void setVerticalLevels(const QVector< double > &verticalLevels)
Sets the vertical levels height.
QgsMeshDatasetValue()=default
Default Ctor, initialize to NaN.
int row() const
Returns the position of the item in the parent.
bool isValid() const
Whether the block is valid.
int count() const
Number of items stored in the block.