QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgsmeshdatasetgroupstore.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsmeshdatasetgroupstore.cpp
3  ---------------------
4  begin : June 2020
5  copyright : (C) 2020 by Vincent Cloarec
6  email : vcloarec 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 
19 #include "qgsmeshlayer.h"
20 #include "qgsmeshlayerutils.h"
21 #include "qgsapplication.h"
23 #include "qgslogger.h"
24 
26 {
27  return mRegistery.keys();
28 }
29 
31 {
32  return mDatasetGroupTreeRootItem->enabledDatasetGroupIndexes();
33 }
34 
36 {
37  return mRegistery.count();
38 }
39 
41 {
42  return mExtraDatasets->datasetGroupCount();
43 }
44 
46  mLayer( layer ),
47  mExtraDatasets( new QgsMeshExtraDatasetStore ),
48  mDatasetGroupTreeRootItem( new QgsMeshDatasetGroupTreeItem )
49 {}
50 
51 void QgsMeshDatasetGroupStore::setPersistentProvider( QgsMeshDataProvider *provider, const QStringList &extraDatasetUri )
52 {
53  removePersistentProvider();
54  mPersistentProvider = provider;
55  if ( !mPersistentProvider )
56  return;
57  for ( const QString &uri : extraDatasetUri )
58  mPersistentProvider->addDataset( uri );
59 
60  onPersistentDatasetAdded( mPersistentProvider->datasetGroupCount() );
61 
62  checkDatasetConsistency( mPersistentProvider );
63  removeUnregisteredItemFromTree();
64 
65  //Once everything is in place, initialize the extra dataset groups
66  if ( mExtraDatasets )
67  {
68  const int groupCount = mExtraDatasets->datasetGroupCount();
69  for ( int i = 0; i < groupCount; ++i )
70  if ( mExtraDatasets->datasetGroup( i ) )
71  mExtraDatasets->datasetGroup( i )->initialize();
72  }
73 
74  mExtraDatasets->updateTemporalCapabilities();
75 
76  connect( mPersistentProvider, &QgsMeshDataProvider::datasetGroupsAdded, this, &QgsMeshDatasetGroupStore::onPersistentDatasetAdded );
77 }
78 
79 QgsMeshDatasetGroupStore::DatasetGroup QgsMeshDatasetGroupStore::datasetGroup( int index ) const
80 {
81  if ( mRegistery.contains( index ) )
82  return mRegistery[index];
83  else
84  return DatasetGroup{nullptr, -1};
85 }
86 
88 {
89  if ( !mPersistentProvider )
90  return false;
91  return mPersistentProvider->addDataset( path ) ;
92 }
93 
95 {
96  if ( !mExtraDatasets && !mLayer )
97  return false;
98 
99  switch ( group->dataType() )
100  {
102  if ( ! group->checkValueCountPerDataset( mLayer->meshFaceCount() ) )
103  return false;
104  break;
106  if ( ! group->checkValueCountPerDataset( mLayer->meshVertexCount() ) )
107  return false;
108  break;
110  return false; // volume not supported for extra dataset
111  break;
113  if ( ! group->checkValueCountPerDataset( mLayer->meshEdgeCount() ) )
114  return false;
115  break;
116  }
117 
118  int nativeIndex = mExtraDatasets->addDatasetGroup( group );
119  int groupIndex = registerDatasetGroup( DatasetGroup{mExtraDatasets.get(), nativeIndex} );
120  QList<int> groupIndexes;
121  groupIndexes.append( groupIndex );
122  createDatasetGroupTreeItems( groupIndexes );
123  syncItemToDatasetGroup( groupIndex );
124 
125  emit datasetGroupsAdded( groupIndexes );
126 
127  return true;
128 }
129 
131 {
132  mDatasetGroupTreeRootItem.reset( new QgsMeshDatasetGroupTreeItem );
133  createDatasetGroupTreeItems( datasetGroupIndexes() );
134  QList<int> groupIndexes = datasetGroupIndexes();
135  for ( int groupIndex : groupIndexes )
136  syncItemToDatasetGroup( groupIndex );
137 }
138 
140 {
141  return mDatasetGroupTreeRootItem.get();
142 }
143 
145 {
146  if ( rootItem )
147  mDatasetGroupTreeRootItem.reset( rootItem->clone() );
148  else
149  mDatasetGroupTreeRootItem.reset();
150 
151  unregisterGroupNotPresentInTree();
152 }
153 
155 {
156  QgsMeshDatasetGroupStore::DatasetGroup group = datasetGroup( index.group() );
157  if ( group.first )
158  return group.first->datasetGroupMetadata( group.second );
159  else
161 }
162 
163 int QgsMeshDatasetGroupStore::datasetCount( int groupIndex ) const
164 {
165  QgsMeshDatasetGroupStore::DatasetGroup group = datasetGroup( groupIndex );
166  if ( group.first )
167  return group.first->datasetCount( group.second );
168  else
169  return 0;
170 }
171 
173 {
174  QgsMeshDatasetGroupStore::DatasetGroup group = datasetGroup( index.group() );
175  if ( group.first )
176  return group.first->datasetMetadata( QgsMeshDatasetIndex( group.second, index.dataset() ) );
177  else
178  return QgsMeshDatasetMetadata();
179 }
180 
182 {
183  QgsMeshDatasetGroupStore::DatasetGroup group = datasetGroup( index.group() );
184  if ( group.first )
185  return group.first->datasetValue( QgsMeshDatasetIndex( group.second, index.dataset() ), valueIndex );
186  else
187  return QgsMeshDatasetValue();
188 }
189 
190 QgsMeshDataBlock QgsMeshDatasetGroupStore::datasetValues( const QgsMeshDatasetIndex &index, int valueIndex, int count ) const
191 {
192  QgsMeshDatasetGroupStore::DatasetGroup group = datasetGroup( index.group() );
193  if ( group.first )
194  return group.first->datasetValues( QgsMeshDatasetIndex( group.second, index.dataset() ), valueIndex, count );
195  else
196  return QgsMeshDataBlock();
197 }
198 
200 {
201  QgsMeshDatasetGroupStore::DatasetGroup group = datasetGroup( index.group() );
202  if ( group.first )
203  return group.first->dataset3dValues( QgsMeshDatasetIndex( group.second, index.dataset() ), faceIndex, count );
204  else
205  return QgsMesh3dDataBlock();
206 }
207 
209 {
210  QgsMeshDatasetGroupStore::DatasetGroup group = datasetGroup( index.group() );
211  if ( group.first )
212  return group.first->areFacesActive( QgsMeshDatasetIndex( group.second, index.dataset() ), faceIndex, count );
213  else
214  return QgsMeshDataBlock();
215 }
216 
217 bool QgsMeshDatasetGroupStore::isFaceActive( const QgsMeshDatasetIndex &index, int faceIndex ) const
218 {
219  QgsMeshDatasetGroupStore::DatasetGroup group = datasetGroup( index.group() );
220  if ( group.first )
221  return group.first->isFaceActive( QgsMeshDatasetIndex( group.second, index.dataset() ), faceIndex );
222  else
223  return false;
224 }
225 
227  qint64 time,
229 {
230  QgsMeshDatasetGroupStore::DatasetGroup group = datasetGroup( groupIndex );
231  if ( !group.first )
232  return QgsMeshDatasetIndex();
233 
234  const QDateTime &referenceTime = mPersistentProvider ? mPersistentProvider->temporalCapabilities()->referenceTime() : QDateTime();
235 
236  return QgsMeshDatasetIndex( groupIndex,
237  group.first->datasetIndexAtTime( referenceTime, group.second, time, method ).dataset() );
238 }
239 
241  qint64 time1,
242  qint64 time2,
243  int groupIndex ) const
244 {
245  const QgsMeshDatasetGroupStore::DatasetGroup group = datasetGroup( groupIndex );
246  if ( !group.first )
247  return QList<QgsMeshDatasetIndex>();
248 
249  const QDateTime &referenceTime = mPersistentProvider ? mPersistentProvider->temporalCapabilities()->referenceTime() : QDateTime();
250 
251  const QList<QgsMeshDatasetIndex> datasetIndexes = group.first->datasetIndexInTimeInterval( referenceTime, group.second, time1, time2 );
252 
253  QList<QgsMeshDatasetIndex> ret;
254  ret.reserve( datasetIndexes.count() );
255 
256  for ( const QgsMeshDatasetIndex &sourceDatasetIndex : datasetIndexes )
257  ret.append( QgsMeshDatasetIndex( groupIndex, sourceDatasetIndex.dataset() ) );
258 
259  return ret;
260 }
261 
263 {
264  QgsMeshDatasetGroupStore::DatasetGroup group = datasetGroup( index.group() );
265  if ( !group.first || group.second < 0 )
266  return INVALID_MESHLAYER_TIME;
267 
268  QgsMeshDatasetIndex nativeIndex( group.second, index.dataset() );
269 
270  if ( group.first == mPersistentProvider )
271  return mPersistentProvider->temporalCapabilities()->datasetTime( nativeIndex );
272  else if ( group.first == mExtraDatasets.get() )
273  return mExtraDatasets->datasetRelativeTime( nativeIndex );
274 
275  return INVALID_MESHLAYER_TIME;
276 
277 }
278 
280 {
281  return ( mPersistentProvider && mPersistentProvider->temporalCapabilities()->hasTemporalCapabilities() ) ||
282  ( mExtraDatasets && mExtraDatasets->hasTemporalCapabilities() );
283 }
284 
285 QDomElement QgsMeshDatasetGroupStore::writeXml( QDomDocument &doc, const QgsReadWriteContext &context )
286 {
287  Q_UNUSED( context );
288  QDomElement storeElement = doc.createElement( QStringLiteral( "mesh-dataset-groups-store" ) );
289  storeElement.appendChild( mDatasetGroupTreeRootItem->writeXml( doc, context ) );
290 
291  QMap < int, DatasetGroup>::const_iterator it = mRegistery.constBegin();
292  while ( it != mRegistery.constEnd() )
293  {
294  QDomElement elemDataset;
295  if ( it.value().first == mPersistentProvider )
296  {
297  elemDataset = doc.createElement( QStringLiteral( "mesh-dataset" ) );
298  elemDataset.setAttribute( QStringLiteral( "global-index" ), it.key() );
299  elemDataset.setAttribute( QStringLiteral( "source-type" ), QStringLiteral( "persitent-provider" ) );
300  elemDataset.setAttribute( QStringLiteral( "source-index" ), it.value().second );
301  }
302  else if ( it.value().first == mExtraDatasets.get() )
303  {
304  QgsMeshDatasetGroupTreeItem *item = mDatasetGroupTreeRootItem->childFromDatasetGroupIndex( it.key() );
305  if ( item )
306  {
307  elemDataset = mExtraDatasets->writeXml( it.value().second, doc, context );
308  if ( !elemDataset.isNull() )
309  elemDataset.setAttribute( QStringLiteral( "global-index" ), it.key() );
310  }
311  }
312 
313  if ( !elemDataset.isNull() )
314  storeElement.appendChild( elemDataset );
315  ++it;
316  }
317 
318  return storeElement;
319 }
320 
321 void QgsMeshDatasetGroupStore::readXml( const QDomElement &storeElem, const QgsReadWriteContext &context )
322 {
323  Q_UNUSED( context );
324  mRegistery.clear();
325  QDomElement datasetElem = storeElem.firstChildElement( "mesh-dataset" );
326  QMap<int, QgsMeshDatasetGroup *> extraDatasetGroups;
327  while ( !datasetElem.isNull() )
328  {
329  int globalIndex = datasetElem.attribute( QStringLiteral( "global-index" ) ).toInt();
330  int sourceIndex = -1;
331  QgsMeshDatasetSourceInterface *source = nullptr;
332  const QString sourceType = datasetElem.attribute( QStringLiteral( "source-type" ) );
333  if ( sourceType == QLatin1String( "persitent-provider" ) )
334  {
335  source = mPersistentProvider;
336  sourceIndex = datasetElem.attribute( QStringLiteral( "source-index" ) ).toInt();
337  mPersistentExtraDatasetGroupIndexes.append( globalIndex );
338  }
339  else if ( sourceType == QLatin1String( "virtual" ) )
340  {
341  source = mExtraDatasets.get();
342  QString name = datasetElem.attribute( QStringLiteral( "name" ) );
343  QString formula = datasetElem.attribute( QStringLiteral( "formula" ) );
344  qint64 startTime = datasetElem.attribute( QStringLiteral( "start-time" ) ).toLongLong();
345  qint64 endTime = datasetElem.attribute( QStringLiteral( "end-time" ) ).toLongLong();
346 
347  QgsMeshDatasetGroup *dsg = new QgsMeshVirtualDatasetGroup( name, formula, mLayer, startTime, endTime );
348  extraDatasetGroups[globalIndex] = dsg;
349  sourceIndex = mExtraDatasets->addDatasetGroup( dsg );
350  }
351  else
352  {
353  QgsDebugMsg( QStringLiteral( "Unhandled source-type: %1." ).arg( sourceType ) );
354  }
355  if ( source )
356  {
357  mRegistery[globalIndex] = DatasetGroup{source, sourceIndex};
358  }
359 
360  datasetElem = datasetElem.nextSiblingElement( QStringLiteral( "mesh-dataset" ) );
361  }
362 
363  QDomElement rootTreeItemElem = storeElem.firstChildElement( QStringLiteral( "mesh-dataset-group-tree-item" ) );
364  if ( !rootTreeItemElem.isNull() )
365  {
366  const QgsMeshDatasetGroupTreeItem groupTreeItem( rootTreeItemElem, context );
367  setDatasetGroupTreeItem( &groupTreeItem );
368  }
369 }
370 
372 {
373  for ( QMap<int, DatasetGroup>::const_iterator it = mRegistery.cbegin(); it != mRegistery.cend(); ++it )
374  {
375  if ( it.value().first == source && it.value().second == nativeGroupIndex )
376  return it.key();
377  }
378 
379  return -1;
380 }
381 
382 bool QgsMeshDatasetGroupStore::saveDatasetGroup( QString filePath, int groupIndex, QString driver )
383 {
384  DatasetGroup group = datasetGroup( groupIndex );
385 
386  bool fail = true;
387  if ( group.first && group.second >= 0 )
388  fail = mPersistentProvider->persistDatasetGroup( filePath, driver, group.first, group.second );
389 
390  if ( !fail )
391  {
392  eraseDatasetGroup( group );
393  group.first = mPersistentProvider;
394  group.second = mPersistentProvider->datasetGroupCount() - 1;
395  mRegistery[groupIndex] = group;
396  //update the item type
397  if ( mDatasetGroupTreeRootItem )
398  {
399  QgsMeshDatasetGroupTreeItem *item = mDatasetGroupTreeRootItem->childFromDatasetGroupIndex( groupIndex );
400  if ( item )
401  item->setPersistentDatasetGroup( filePath );
402  }
403  }
404 
405  return fail;
406 }
407 
408 void QgsMeshDatasetGroupStore::onPersistentDatasetAdded( int count )
409 {
410  Q_ASSERT( mPersistentProvider );
411 
412  int providerTotalCount = mPersistentProvider->datasetGroupCount();
413  int providerBeginIndex = mPersistentProvider->datasetGroupCount() - count;
414  QList<int> newGroupIndexes;
415  for ( int i = providerBeginIndex; i < providerTotalCount; ++i )
416  {
417  if ( i < mPersistentExtraDatasetGroupIndexes.count() )
418  mRegistery[mPersistentExtraDatasetGroupIndexes.at( i )] = DatasetGroup( mPersistentProvider, i );
419  else
420  newGroupIndexes.append( registerDatasetGroup( DatasetGroup{mPersistentProvider, i} ) );
421  }
422 
423  if ( !newGroupIndexes.isEmpty() )
424  {
425  createDatasetGroupTreeItems( newGroupIndexes );
426  mPersistentExtraDatasetGroupIndexes.append( newGroupIndexes );
427 
428  for ( int groupIndex : std::as_const( newGroupIndexes ) )
429  syncItemToDatasetGroup( groupIndex );
430 
431  emit datasetGroupsAdded( newGroupIndexes );
432  }
433 }
434 
435 void QgsMeshDatasetGroupStore::removePersistentProvider()
436 {
437  if ( !mPersistentProvider )
438  return;
439 
440  disconnect( mPersistentProvider, &QgsMeshDataProvider::datasetGroupsAdded, this, &QgsMeshDatasetGroupStore::onPersistentDatasetAdded );
441 
442  QMap < int, DatasetGroup>::iterator it = mRegistery.begin();
443  while ( it != mRegistery.end() )
444  {
445  if ( it.value().first == mPersistentProvider )
446  it = mRegistery.erase( it );
447  else
448  ++it;
449  }
450 
451  mPersistentProvider = nullptr;
452 }
453 
454 int QgsMeshDatasetGroupStore::newIndex()
455 {
456  int index = 0;
457  QMap < int, DatasetGroup>::iterator it = mRegistery.begin();
458  while ( it != mRegistery.end() )
459  {
460  if ( index <= it.key() )
461  index = it.key() + 1;
462  ++it;
463  }
464  return index;
465 }
466 
467 int QgsMeshDatasetGroupStore::registerDatasetGroup( const QgsMeshDatasetGroupStore::DatasetGroup &group )
468 {
469  int groupIndex = newIndex();
470  mRegistery[newIndex()] = group;
471  return groupIndex;
472 }
473 
474 void QgsMeshDatasetGroupStore::eraseDatasetGroup( const QgsMeshDatasetGroupStore::DatasetGroup &group )
475 {
476  if ( group.first == mPersistentProvider )
477  return; //removing persistent dataset group from the store is not allowed
478  else if ( group.first == mExtraDatasets.get() )
479  eraseExtraDataset( group.second );
480 }
481 
482 void QgsMeshDatasetGroupStore::eraseExtraDataset( int indexInExtraStore )
483 {
484  mExtraDatasets->removeDatasetGroup( indexInExtraStore );
485 
486  //search dataset with index greater than indexInExtraStore and decrement it
487  QMap < int, DatasetGroup>::iterator it = mRegistery.begin();
488  while ( it != mRegistery.end() )
489  {
490  int localIndex = it.value().second;
491  if ( it.value().first == mExtraDatasets.get() && localIndex > indexInExtraStore )
492  it->second = localIndex - 1;
493  ++it;
494  }
495 }
496 
497 int QgsMeshDatasetGroupStore::nativeIndexToGroupIndex( QgsMeshDatasetSourceInterface *source, int nativeIndex )
498 {
499  QMap < int, DatasetGroup>::const_iterator it = mRegistery.constBegin();
500  while ( it != mRegistery.constEnd() )
501  {
502  if ( it.value() == DatasetGroup{source, nativeIndex} )
503  return it.key();
504  ++it;
505  }
506  return -1;
507 }
508 
509 void QgsMeshDatasetGroupStore::checkDatasetConsistency( QgsMeshDatasetSourceInterface *source )
510 {
511  // check if datasets of source are present, if not, add them
512  QList<int> indexes;
513  for ( int i = 0; i < source->datasetGroupCount(); ++i )
514  if ( nativeIndexToGroupIndex( source, i ) == -1 )
515  indexes.append( registerDatasetGroup( DatasetGroup{source, i} ) );
516 
517  if ( !indexes.isEmpty() )
518  createDatasetGroupTreeItems( indexes );
519 
520  for ( int globalIndex : mRegistery.keys() )
521  {
522  if ( mRegistery.value( globalIndex ).first == source )
523  syncItemToDatasetGroup( globalIndex );
524  }
525 }
526 
527 void QgsMeshDatasetGroupStore::removeUnregisteredItemFromTree()
528 {
529  QList<QgsMeshDatasetGroupTreeItem *> itemsToCheck;
530  QList<int> indexItemToRemove;
531  for ( int i = 0; i < mDatasetGroupTreeRootItem->childCount(); ++i )
532  itemsToCheck.append( mDatasetGroupTreeRootItem->child( i ) );
533 
534  while ( !itemsToCheck.isEmpty() )
535  {
536  QgsMeshDatasetGroupTreeItem *item = itemsToCheck.takeFirst();
537  int globalIndex = item->datasetGroupIndex();
538  if ( !mRegistery.contains( globalIndex ) )
539  indexItemToRemove.append( globalIndex );
540  for ( int i = 0; i < item->childCount(); ++i )
541  itemsToCheck.append( item->child( i ) );
542  }
543 
544  for ( int i : indexItemToRemove )
545  {
546  QgsMeshDatasetGroupTreeItem *item = mDatasetGroupTreeRootItem->childFromDatasetGroupIndex( i );
547  if ( item )
548  item->parentItem()->removeChild( item );
549  }
550 }
551 
552 void QgsMeshDatasetGroupStore::unregisterGroupNotPresentInTree()
553 {
554  if ( !mDatasetGroupTreeRootItem )
555  {
556  mRegistery.clear();
557  return;
558  }
559 
560  QMap < int, DatasetGroup>::iterator it = mRegistery.begin();
561  while ( it != mRegistery.end() )
562  {
563  DatasetGroup datasetGroup = it.value();
564  int globalIndex = it.key();
565  if ( ! mDatasetGroupTreeRootItem->childFromDatasetGroupIndex( globalIndex ) // Not in the tree item
566  && datasetGroup.first != mPersistentProvider ) // and not persistent
567  {
568  it = mRegistery.erase( it ); //remove from registery
569  eraseDatasetGroup( datasetGroup ); //remove from where the dataset group is stored
570  }
571  else
572  ++it;
573  }
574 }
575 
576 void QgsMeshDatasetGroupStore::syncItemToDatasetGroup( int groupIndex )
577 {
578  if ( !mDatasetGroupTreeRootItem )
579  return;
580  DatasetGroup group = datasetGroup( groupIndex );
581  QgsMeshDatasetGroupTreeItem *item = mDatasetGroupTreeRootItem->childFromDatasetGroupIndex( groupIndex );
582  if ( group.first == mPersistentProvider && mPersistentProvider )
583  {
584  QgsMeshDatasetGroupMetadata meta = mPersistentProvider->datasetGroupMetadata( group.second );
585  if ( item )
586  item->setPersistentDatasetGroup( meta.uri() );
587  }
588  else if ( group.first == mExtraDatasets.get() )
589  {
590  if ( item )
591  item->setDatasetGroup( mExtraDatasets->datasetGroup( group.second ) );
592  }
593 }
594 
595 void QgsMeshDatasetGroupStore::createDatasetGroupTreeItems( const QList<int> &indexes )
596 {
597  QMap<QString, QgsMeshDatasetGroupTreeItem *> mNameToItem;
598 
599  for ( int i = 0; i < indexes.count(); ++i )
600  {
601  int groupIndex = indexes.at( i );
602  const QgsMeshDatasetGroupMetadata meta = datasetGroupMetadata( groupIndex );
603  const QString name = meta.name();
604  const QStringList subdatasets = name.split( '/' );
605 
606  QString displayName = name;
607  QgsMeshDatasetGroupTreeItem *parent = mDatasetGroupTreeRootItem.get();
608 
609  if ( subdatasets.size() == 2 )
610  {
611  auto it = mNameToItem.find( subdatasets[0] );
612  if ( it == mNameToItem.end() )
613  QgsDebugMsg( QStringLiteral( "Unable to find parent group for %1." ).arg( name ) );
614  else
615  {
616  displayName = subdatasets[1];
617  parent = it.value();
618  }
619  }
620  else if ( subdatasets.size() != 1 )
621  QgsDebugMsg( QStringLiteral( "Ignoring too deep child group name %1." ).arg( name ) );
622 
623  QgsMeshDatasetGroupTreeItem *item = new QgsMeshDatasetGroupTreeItem( displayName, name, meta.isVector(), groupIndex );
624  parent->appendChild( item );
625  if ( mNameToItem.contains( name ) )
626  QgsDebugMsg( QStringLiteral( "Group %1 is not unique" ).arg( displayName ) );
627  mNameToItem[name] = item;
628  }
629 }
630 
632 {
633  int groupIndex = mGroups.size();
634  mGroups.push_back( std::unique_ptr<QgsMeshDatasetGroup>( datasetGroup ) );
635 
636  if ( datasetGroup->datasetCount() > 1 )
637  {
638  mTemporalCapabilities->setHasTemporalCapabilities( true );
639  for ( int i = 0; i < datasetGroup->datasetCount(); ++i )
640  mTemporalCapabilities->addDatasetTime( groupIndex, datasetGroup->datasetMetadata( i ).time() );
641  }
642 
643  return mGroups.size() - 1;
644 }
645 
647 {
648  if ( index < datasetGroupCount() )
649  mGroups.erase( mGroups.begin() + index );
650 
651 
653 }
654 
656 {
657  return mTemporalCapabilities->hasTemporalCapabilities();
658 }
659 
661 {
662  return mTemporalCapabilities->datasetTime( index );
663 }
664 
665 QString QgsMeshExtraDatasetStore::description( int groupIndex ) const
666 {
667  if ( groupIndex >= 0 && groupIndex < int( mGroups.size() ) )
668  return mGroups.at( groupIndex )->description();
669  else
670  return QString();
671 }
672 
674 {
675  if ( groupIndex >= 0 && groupIndex < int( mGroups.size() ) )
676  return mGroups[groupIndex].get();
677  else
678  return nullptr;
679 }
680 
681 bool QgsMeshExtraDatasetStore::addDataset( const QString &uri )
682 {
683  Q_UNUSED( uri );
684  return false;
685 }
686 
688 {
689  return QStringList();
690 }
691 
693 {
694  return mGroups.size();
695 }
696 
697 int QgsMeshExtraDatasetStore::datasetCount( int groupIndex ) const
698 {
699  if ( groupIndex >= 0 && groupIndex < datasetGroupCount() )
700  return mGroups.at( groupIndex )->datasetCount();
701  else
702  return 0;
703 }
704 
706 {
707  if ( groupIndex >= 0 && groupIndex < datasetGroupCount() )
708  return mGroups.at( groupIndex )->groupMetadata();
709  else
711 }
712 
714 {
715  int groupIndex = index.group();
716  if ( index.isValid() && groupIndex < datasetGroupCount() )
717  {
718  int datasetIndex = index.dataset();
719  const QgsMeshDatasetGroup *group = mGroups.at( groupIndex ).get();
720  if ( datasetIndex < group->datasetCount() )
721  return group->datasetMetadata( datasetIndex );
722  }
723  return QgsMeshDatasetMetadata();
724 }
725 
727 {
728  int groupIndex = index.group();
729  if ( index.isValid() && groupIndex < datasetGroupCount() )
730  {
731  const QgsMeshDatasetGroup *group = mGroups.at( groupIndex ).get();
732  int datasetIndex = index.dataset();
733  if ( datasetIndex < group->datasetCount() )
734  return group->dataset( datasetIndex )->datasetValue( valueIndex );
735  }
736 
737  return QgsMeshDatasetValue();
738 }
739 
741 {
742  int groupIndex = index.group();
743  if ( index.isValid() && groupIndex < datasetGroupCount() )
744  {
745  const QgsMeshDatasetGroup *group = mGroups.at( groupIndex ).get();
746  int datasetIndex = index.dataset();
747  if ( datasetIndex < group->datasetCount() )
748  return group->dataset( datasetIndex )->datasetValues( group->isScalar(), valueIndex, count );
749  }
750 
751  return QgsMeshDataBlock();
752 }
753 
755 {
756  // Not supported for now
757  Q_UNUSED( index )
758  Q_UNUSED( faceIndex )
759  Q_UNUSED( count )
760  return QgsMesh3dDataBlock();
761 }
762 
764 {
765  int groupIndex = index.group();
766  if ( index.isValid() && groupIndex < datasetGroupCount() )
767  {
768  const QgsMeshDatasetGroup *group = mGroups.at( groupIndex ).get();
769  int datasetIndex = index.dataset();
770  if ( datasetIndex < group->datasetCount() )
771  return group->dataset( datasetIndex )->isActive( faceIndex );
772  }
773 
774  return false;
775 }
776 
778 {
779  int groupIndex = index.group();
780  if ( index.isValid() && groupIndex < datasetGroupCount() )
781  {
782  const QgsMeshDatasetGroup *group = mGroups.at( groupIndex ).get();
783  int datasetIndex = index.dataset();
784  if ( datasetIndex < group->datasetCount() )
785  return group->dataset( datasetIndex )->areFacesActive( faceIndex, count );
786  }
787  return QgsMeshDataBlock();
788 }
789 
790 bool QgsMeshExtraDatasetStore::persistDatasetGroup( const QString &outputFilePath,
791  const QString &outputDriver,
792  const QgsMeshDatasetGroupMetadata &meta,
793  const QVector<QgsMeshDataBlock> &datasetValues,
794  const QVector<QgsMeshDataBlock> &datasetActive,
795  const QVector<double> &times )
796 {
797  Q_UNUSED( outputFilePath )
798  Q_UNUSED( outputDriver )
799  Q_UNUSED( meta )
800  Q_UNUSED( datasetValues )
801  Q_UNUSED( datasetActive )
802  Q_UNUSED( times )
803  return true; // not implemented/supported
804 }
805 
806 bool QgsMeshExtraDatasetStore::persistDatasetGroup( const QString &outputFilePath,
807  const QString &outputDriver,
809  int datasetGroupIndex )
810 {
811  Q_UNUSED( outputFilePath )
812  Q_UNUSED( outputDriver )
813  Q_UNUSED( source )
814  Q_UNUSED( datasetGroupIndex )
815  return true; // not implemented/supported
816 }
817 
818 QDomElement QgsMeshExtraDatasetStore::writeXml( int groupIndex, QDomDocument &doc, const QgsReadWriteContext &context )
819 {
820  if ( groupIndex >= 0 && groupIndex < int( mGroups.size() ) && mGroups[groupIndex] )
821  return mGroups[groupIndex]->writeXml( doc, context );
822  else
823  return QDomElement();
824 }
825 
827 {
828  //update temporal capabilitie
829  mTemporalCapabilities->clear();
830  bool hasTemporal = false;
831  for ( size_t g = 0; g < mGroups.size(); ++g )
832  {
833  const QgsMeshDatasetGroup *group = mGroups[g].get();
834  hasTemporal |= group->datasetCount() > 1;
835  for ( int i = 0; i < group->datasetCount(); ++i )
836  mTemporalCapabilities->addDatasetTime( g, group->datasetMetadata( i ).time() );
837  }
838 
839  mTemporalCapabilities->setHasTemporalCapabilities( hasTemporal );
840 }
QgsMeshDatasetIndex::dataset
int dataset() const
Returns a dataset index within group()
Definition: qgsmeshdataset.cpp:32
qgsmeshlayerutils.h
QgsMeshDatasetSourceInterface::datasetGroupCount
virtual int datasetGroupCount() const =0
Returns number of datasets groups loaded.
QgsMeshExtraDatasetStore::persistDatasetGroup
bool persistDatasetGroup(const QString &outputFilePath, const QString &outputDriver, const QgsMeshDatasetGroupMetadata &meta, const QVector< QgsMeshDataBlock > &datasetValues, const QVector< QgsMeshDataBlock > &datasetActive, const QVector< double > &times) override
Not implemented, always returns true.
Definition: qgsmeshdatasetgroupstore.cpp:790
qgsmeshdatasetgroupstore.h
QgsMeshDatasetGroupStore::writeXml
QDomElement writeXml(QDomDocument &doc, const QgsReadWriteContext &context)
Writes the store's information in a DOM document.
Definition: qgsmeshdatasetgroupstore.cpp:285
QgsMeshDatasetGroupMetadata::DataOnVolumes
@ DataOnVolumes
Data is defined on volumes.
Definition: qgsmeshdataset.h:360
QgsMeshDatasetGroupStore::datasetValue
QgsMeshDatasetValue datasetValue(const QgsMeshDatasetIndex &index, int valueIndex) const
Returns the value of the dataset with global index and valueIndex.
Definition: qgsmeshdatasetgroupstore.cpp:181
QgsMeshLayer::meshEdgeCount
int meshEdgeCount() const
Returns the edges count of the mesh frame.
Definition: qgsmeshlayer.cpp:1166
QgsMeshDatasetGroupStore::setPersistentProvider
void setPersistentProvider(QgsMeshDataProvider *provider, const QStringList &extraDatasetUri)
Sets the persistent mesh data provider with the path of its extra dataset.
Definition: qgsmeshdatasetgroupstore.cpp:51
QgsMeshDatasetGroupStore::dataset3dValues
QgsMesh3dDataBlock dataset3dValues(const QgsMeshDatasetIndex &index, int faceIndex, int count) const
Returns count 3D values of the dataset with global index and from valueIndex.
Definition: qgsmeshdatasetgroupstore.cpp:199
QgsReadWriteContext
The class is used as a container of context for various read/write operations on other objects.
Definition: qgsreadwritecontext.h:34
QgsMeshDatasetGroupStore::setDatasetGroupTreeItem
void setDatasetGroupTreeItem(const QgsMeshDatasetGroupTreeItem *rootItem)
Sets the root of the dataset groups tree item.
Definition: qgsmeshdatasetgroupstore.cpp:144
QgsMeshExtraDatasetStore::description
QString description(int groupIndex) const
Returns information related to the dataset group with groupIndex.
Definition: qgsmeshdatasetgroupstore.cpp:665
QgsMeshDatasetSourceInterface::addDataset
virtual bool addDataset(const QString &uri)=0
Associate dataset with the mesh.
QgsMeshDatasetGroupTreeItem::parentItem
QgsMeshDatasetGroupTreeItem * parentItem() const
Returns the parent item, nullptr if it is root item.
Definition: qgsmeshdataset.cpp:608
QgsMeshExtraDatasetStore::extraDatasets
QStringList extraDatasets() const override
Not implemented, always returns empty list.
Definition: qgsmeshdatasetgroupstore.cpp:687
qgsmeshvirtualdatasetgroup.h
QgsMeshDataset::areFacesActive
virtual QgsMeshDataBlock areFacesActive(int faceIndex, int count) const =0
Returns whether faces are active.
QgsMeshDatasetGroup::datasetCount
virtual int datasetCount() const =0
Returns the count of datasets in the group.
QgsMeshDatasetGroupStore::addDatasetGroup
bool addDatasetGroup(QgsMeshDatasetGroup *group)
Adds a extra dataset group, take ownership.
Definition: qgsmeshdatasetgroupstore.cpp:94
QgsMeshDatasetGroupStore::datasetGroupMetadata
QgsMeshDatasetGroupMetadata datasetGroupMetadata(const QgsMeshDatasetIndex &index) const
Returns the metadata of the dataset group with global index.
Definition: qgsmeshdatasetgroupstore.cpp:154
QgsMeshDatasetValue
QgsMeshDatasetValue represents single dataset value.
Definition: qgsmeshdataset.h:79
QgsMeshDatasetGroupStore::areFacesActive
QgsMeshDataBlock areFacesActive(const QgsMeshDatasetIndex &index, int faceIndex, int count) const
Returns whether faces are active for particular dataset.
Definition: qgsmeshdatasetgroupstore.cpp:208
QgsMeshDataProviderTemporalCapabilities::datasetTime
qint64 datasetTime(const QgsMeshDatasetIndex &index) const
Returns the relative time in milliseconds of the dataset.
Definition: qgsmeshdataprovidertemporalcapabilities.cpp:158
QgsMeshExtraDatasetStore::datasetValues
QgsMeshDataBlock datasetValues(QgsMeshDatasetIndex index, int valueIndex, int count) const override
Returns N vector/scalar values from the index from the dataset.
Definition: qgsmeshdatasetgroupstore.cpp:740
QgsMeshDatasetGroupTreeItem
Tree item for display of the mesh dataset groups. Dataset group is set of datasets with the same name...
Definition: qgsmeshdataset.h:843
QgsMeshDatasetGroupStore::datasetGroupCount
int datasetGroupCount() const
Returns the count of dataset groups.
Definition: qgsmeshdatasetgroupstore.cpp:35
QgsDebugMsg
#define QgsDebugMsg(str)
Definition: qgslogger.h:38
QgsMeshDatasetMetadata
QgsMeshDatasetMetadata is a collection of mesh dataset metadata such as whether the data is valid or ...
Definition: qgsmeshdataset.h:478
QgsMeshDatasetMetadata::time
double time() const
Returns the time value for this dataset.
Definition: qgsmeshdataset.cpp:216
QgsMesh3dDataBlock
QgsMesh3dDataBlock is a block of 3d stacked mesh data related N faces defined on base mesh frame.
Definition: qgsmeshdataset.h:246
QgsMeshDataProvider::temporalCapabilities
QgsMeshDataProviderTemporalCapabilities * temporalCapabilities() override
Returns the provider's temporal capabilities.
Definition: qgsmeshdataprovider.cpp:29
QgsMeshDatasetGroupTreeItem::clone
QgsMeshDatasetGroupTreeItem * clone() const
Clones the item.
Definition: qgsmeshdataset.cpp:522
QgsMeshDatasetGroupStore::globalDatasetGroupIndexInSource
int globalDatasetGroupIndexInSource(QgsMeshDatasetSourceInterface *source, int nativeGroupIndex) const
Returns the global dataset group index of the dataset group with native index globalGroupIndex in the...
Definition: qgsmeshdatasetgroupstore.cpp:371
qgsapplication.h
QgsMeshExtraDatasetStore::writeXml
QDomElement writeXml(int groupIndex, QDomDocument &doc, const QgsReadWriteContext &context)
Writes the store's information in a DOM document.
Definition: qgsmeshdatasetgroupstore.cpp:818
QgsMeshDataset::datasetValue
virtual QgsMeshDatasetValue datasetValue(int valueIndex) const =0
Returns the value with index valueIndex.
QgsMeshExtraDatasetStore::datasetGroup
QgsMeshDatasetGroup * datasetGroup(int groupIndex) const
Returns a pointer to the dataset group.
Definition: qgsmeshdatasetgroupstore.cpp:673
QgsMeshLayer::meshVertexCount
int meshVertexCount() const
Returns the vertices count of the mesh frame.
Definition: qgsmeshlayer.cpp:1148
QgsMeshVirtualDatasetGroup
Represents a dataset group calculated from a formula string.
Definition: qgsmeshvirtualdatasetgroup.h:38
QgsMeshDatasetGroupMetadata::DataOnFaces
@ DataOnFaces
Data is defined on faces.
Definition: qgsmeshdataset.h:358
QgsMeshDatasetGroupMetadata::DataOnVertices
@ DataOnVertices
Data is defined on vertices.
Definition: qgsmeshdataset.h:359
QgsMeshExtraDatasetStore::addDataset
bool addDataset(const QString &uri) override
Not implemented, always returns false.
Definition: qgsmeshdatasetgroupstore.cpp:681
QgsMeshExtraDatasetStore::isFaceActive
bool isFaceActive(QgsMeshDatasetIndex index, int faceIndex) const override
Returns whether the face is active for particular dataset.
Definition: qgsmeshdatasetgroupstore.cpp:763
QgsMeshExtraDatasetStore::areFacesActive
QgsMeshDataBlock areFacesActive(QgsMeshDatasetIndex index, int faceIndex, int count) const override
Returns whether the faces are active for particular dataset.
Definition: qgsmeshdatasetgroupstore.cpp:777
QgsMeshDatasetIndex::group
int group() const
Returns a group index.
Definition: qgsmeshdataset.cpp:27
QgsMeshDatasetGroupStore::extraDatasetGroupCount
int extraDatasetGroupCount() const
Returns the count of extra dataset groups.
Definition: qgsmeshdatasetgroupstore.cpp:40
QgsMeshDatasetGroupTreeItem::removeChild
void removeChild(QgsMeshDatasetGroupTreeItem *item)
Removes a item child if exists.
Definition: qgsmeshdataset.cpp:543
QgsMeshExtraDatasetStore::datasetCount
int datasetCount(int groupIndex) const override
Returns number of datasets loaded in the group.
Definition: qgsmeshdatasetgroupstore.cpp:697
QgsMeshDatasetGroupTreeItem::childCount
int childCount() const
Returns the count of children.
Definition: qgsmeshdataset.cpp:578
QgsMeshDatasetIndex
QgsMeshDatasetIndex is index that identifies the dataset group (e.g. wind speed) and a dataset in thi...
Definition: qgsmeshdataset.h:48
QgsMeshDatasetGroupTreeItem::setPersistentDatasetGroup
void setPersistentDatasetGroup(const QString &uri)
Set parameters of the item in accordance with the persistent dataset group with uri.
Definition: qgsmeshdataset.cpp:683
QgsMeshDatasetGroupStore::datasetGroupTreeItem
QgsMeshDatasetGroupTreeItem * datasetGroupTreeItem() const
Returns a pointer to the root of the dataset groups tree item.
Definition: qgsmeshdatasetgroupstore.cpp:139
QgsMeshDatasetGroupStore::datasetGroupIndexes
QList< int > datasetGroupIndexes() const
Returns a list of all group indexes.
Definition: qgsmeshdatasetgroupstore.cpp:25
QgsMeshLayer
Represents a mesh layer supporting display of data on structured or unstructured meshes.
Definition: qgsmeshlayer.h:98
QgsMeshDatasetSourceInterface::persistDatasetGroup
virtual Q_DECL_DEPRECATED bool persistDatasetGroup(const QString &path, const QgsMeshDatasetGroupMetadata &meta, const QVector< QgsMeshDataBlock > &datasetValues, const QVector< QgsMeshDataBlock > &datasetActive, const QVector< double > &times)
Creates a new dataset group from a data and persists it into a destination path.
Definition: qgsmeshdataprovider.cpp:117
QgsMeshDataset::datasetValues
virtual QgsMeshDataBlock datasetValues(bool isScalar, int valueIndex, int count) const =0
Returns count values from valueIndex.
QgsMeshDatasetIndex::isValid
bool isValid() const
Returns whether index is valid, ie at least groups is set.
Definition: qgsmeshdataset.cpp:37
QgsMeshLayer::meshFaceCount
int meshFaceCount() const
Returns the faces count of the mesh frame.
Definition: qgsmeshlayer.cpp:1157
QgsMeshDatasetGroupStore::resetDatasetGroupTreeItem
void resetDatasetGroupTreeItem()
Resets to default state the dataset groups tree item.
Definition: qgsmeshdatasetgroupstore.cpp:130
QgsMeshDataProvider
Base class for providing data for QgsMeshLayer.
Definition: qgsmeshdataprovider.h:436
QgsMeshDataProviderTemporalCapabilities::MatchingTemporalDatasetMethod
MatchingTemporalDatasetMethod
Method for selection of temporal mesh dataset from a range time.
Definition: qgsmeshdataprovidertemporalcapabilities.h:41
QgsMeshExtraDatasetStore::datasetRelativeTime
quint64 datasetRelativeTime(QgsMeshDatasetIndex index)
Returns the relative times of the dataset index with index, returned value in milliseconds.
Definition: qgsmeshdatasetgroupstore.cpp:660
QgsMeshExtraDatasetStore::datasetGroupCount
int datasetGroupCount() const override
Returns number of datasets groups loaded.
Definition: qgsmeshdatasetgroupstore.cpp:692
QgsMeshDatasetGroupStore::datasetMetadata
QgsMeshDatasetMetadata datasetMetadata(const QgsMeshDatasetIndex &index) const
Returns the metadata of the dataset with global index.
Definition: qgsmeshdatasetgroupstore.cpp:172
QgsMeshDatasetGroupMetadata::DataOnEdges
@ DataOnEdges
Data is defined on edges.
Definition: qgsmeshdataset.h:361
QgsMeshDatasetGroupTreeItem::setDatasetGroup
void setDatasetGroup(QgsMeshDatasetGroup *datasetGroup)
Set parameters of the item in accordance with the dataset group.
Definition: qgsmeshdataset.cpp:664
QgsMeshDatasetSourceInterface
Interface for mesh datasets and dataset groups.
Definition: qgsmeshdataprovider.h:210
QgsMeshDatasetGroupMetadata::name
QString name() const
Returns name of the dataset group.
Definition: qgsmeshdataset.cpp:167
QgsMeshDatasetGroup::dataset
virtual QgsMeshDataset * dataset(int index) const =0
Returns the dataset with index.
QgsMeshDatasetGroup::isScalar
bool isScalar() const
Returns whether the group contain scalar values.
Definition: qgsmeshdataset.cpp:1085
QgsMeshDatasetGroup
Abstract class that represents a dataset group.
Definition: qgsmeshdataset.h:578
QgsMeshDatasetGroup::datasetMetadata
virtual QgsMeshDatasetMetadata datasetMetadata(int datasetIndex) const =0
Returns the metadata of the dataset with index datasetIndex.
qgsmeshlayer.h
QgsMeshExtraDatasetStore::datasetGroupMetadata
QgsMeshDatasetGroupMetadata datasetGroupMetadata(int groupIndex) const override
Returns dataset group metadata.
Definition: qgsmeshdatasetgroupstore.cpp:705
QgsMeshExtraDatasetStore::hasTemporalCapabilities
bool hasTemporalCapabilities() const
Returns whether if the dataset groups have temporal capabilities (a least one dataset group with more...
Definition: qgsmeshdatasetgroupstore.cpp:655
QgsMeshDatasetGroupStore::datasetCount
int datasetCount(int groupIndex) const
Returns the total count of dataset group in the store.
Definition: qgsmeshdatasetgroupstore.cpp:163
QgsMeshDatasetGroupStore::hasTemporalCapabilities
bool hasTemporalCapabilities() const
Returns whether at lea&st one of stored dataset group is temporal.
Definition: qgsmeshdatasetgroupstore.cpp:279
QgsMeshDatasetGroupMetadata
QgsMeshDatasetGroupMetadata is a collection of dataset group metadata such as whether the data is vec...
Definition: qgsmeshdataset.h:351
QgsMeshDatasetGroupStore::isFaceActive
bool isFaceActive(const QgsMeshDatasetIndex &index, int faceIndex) const
Returns whether face is active for particular dataset.
Definition: qgsmeshdatasetgroupstore.cpp:217
QgsMeshExtraDatasetStore::datasetValue
QgsMeshDatasetValue datasetValue(QgsMeshDatasetIndex index, int valueIndex) const override
Returns vector/scalar value associated with the index from the dataset To read multiple continuous va...
Definition: qgsmeshdatasetgroupstore.cpp:726
QgsMeshExtraDatasetStore
Class that can be used to store and access extra dataset group, like memory dataset (temporary) Deriv...
Definition: qgsmeshdatasetgroupstore.h:36
QgsMeshDatasetGroupStore::QgsMeshDatasetGroupStore
QgsMeshDatasetGroupStore(QgsMeshLayer *layer)
Constructor.
Definition: qgsmeshdatasetgroupstore.cpp:45
QgsMeshDatasetGroupTreeItem::appendChild
void appendChild(QgsMeshDatasetGroupTreeItem *item)
Appends a child item.
Definition: qgsmeshdataset.cpp:536
QgsMeshDatasetGroup::dataType
QgsMeshDatasetGroupMetadata::DataType dataType() const
Returns the data type of the dataset group.
Definition: qgsmeshdataset.cpp:1065
QgsMeshExtraDatasetStore::datasetMetadata
QgsMeshDatasetMetadata datasetMetadata(QgsMeshDatasetIndex index) const override
Returns dataset metadata.
Definition: qgsmeshdatasetgroupstore.cpp:713
QgsMeshDataProvider::datasetGroupsAdded
void datasetGroupsAdded(int count)
Emitted when some new dataset groups have been added.
QgsMeshDatasetGroupStore::datasetGroupsAdded
void datasetGroupsAdded(QList< int > indexes)
Emitted after dataset groups are added.
QgsMeshDataBlock
QgsMeshDataBlock is a block of integers/doubles that can be used to retrieve: active flags (e....
Definition: qgsmeshdataset.h:137
QgsMeshDatasetGroupStore::readXml
void readXml(const QDomElement &storeElem, const QgsReadWriteContext &context)
Reads the store's information from a DOM document.
Definition: qgsmeshdatasetgroupstore.cpp:321
QgsMeshDatasetGroupTreeItem::datasetGroupIndex
int datasetGroupIndex() const
Definition: qgsmeshdataset.cpp:634
QgsMeshExtraDatasetStore::addDatasetGroup
int addDatasetGroup(QgsMeshDatasetGroup *datasetGroup)
Adds a dataset group, returns the index of the added dataset group.
Definition: qgsmeshdatasetgroupstore.cpp:631
QgsMeshDatasetGroupStore::saveDatasetGroup
bool saveDatasetGroup(QString filePath, int groupIndex, QString driver)
Saves on a file with filePath the dataset groups index with groupIndex with the specified driver.
Definition: qgsmeshdatasetgroupstore.cpp:382
QgsMeshDatasetGroupStore::addPersistentDatasets
bool addPersistentDatasets(const QString &path)
Adds persistent datasets from a file with path.
Definition: qgsmeshdatasetgroupstore.cpp:87
QgsMeshDatasetGroupStore::datasetValues
QgsMeshDataBlock datasetValues(const QgsMeshDatasetIndex &index, int valueIndex, int count) const
Returns count values of the dataset with global index and from valueIndex.
Definition: qgsmeshdatasetgroupstore.cpp:190
QgsMeshDatasetGroupStore::datasetIndexAtTime
QgsMeshDatasetIndex datasetIndexAtTime(qint64 time, int groupIndex, QgsMeshDataProviderTemporalCapabilities::MatchingTemporalDatasetMethod method) const
Returns the global dataset index of the dataset int the dataset group with groupIndex,...
Definition: qgsmeshdatasetgroupstore.cpp:226
QgsMeshDatasetGroupMetadata::uri
QString uri() const
Returns the uri of the source.
Definition: qgsmeshdataset.cpp:197
QgsDataProviderTemporalCapabilities::hasTemporalCapabilities
bool hasTemporalCapabilities() const
Returns true if the provider has temporal capabilities available.
Definition: qgsdataprovidertemporalcapabilities.h:74
qgslogger.h
QgsMeshDatasetGroupMetadata::isVector
bool isVector() const
Returns whether dataset group has vector data.
Definition: qgsmeshdataset.cpp:152
QgsMeshDatasetGroupTreeItem::child
QgsMeshDatasetGroupTreeItem * child(int row) const
Returns a child.
Definition: qgsmeshdataset.cpp:548
QgsMeshDataset::isActive
virtual bool isActive(int faceIndex) const =0
Returns whether the face is active.
QgsMeshDatasetGroup::checkValueCountPerDataset
bool checkValueCountPerDataset(int count) const
Returns whether all the datasets contain count values.
Definition: qgsmeshdataset.cpp:1022
QgsMeshDatasetGroupStore::enabledDatasetGroupIndexes
QList< int > enabledDatasetGroupIndexes() const
Returns a list of all group indexes that are enabled.
Definition: qgsmeshdatasetgroupstore.cpp:30
QgsMeshDatasetSourceInterface::datasetGroupMetadata
virtual QgsMeshDatasetGroupMetadata datasetGroupMetadata(int groupIndex) const =0
Returns dataset group metadata.
QgsMeshExtraDatasetStore::removeDatasetGroup
void removeDatasetGroup(int index)
Removes the dataset group with the local index.
Definition: qgsmeshdatasetgroupstore.cpp:646
QgsMeshDatasetGroupStore::datasetRelativeTime
qint64 datasetRelativeTime(const QgsMeshDatasetIndex &index) const
Returns the relative time of the dataset from the persistent provider reference time.
Definition: qgsmeshdatasetgroupstore.cpp:262
QgsMeshExtraDatasetStore::updateTemporalCapabilities
void updateTemporalCapabilities()
Updates the temporal capabilities.
Definition: qgsmeshdatasetgroupstore.cpp:826
QgsMeshDatasetGroupStore::datasetIndexInTimeInterval
QList< QgsMeshDatasetIndex > datasetIndexInTimeInterval(qint64 time1, qint64 time2, int groupIndex) const
Returns the global dataset index of the dataset int the dataset group with groupIndex,...
Definition: qgsmeshdatasetgroupstore.cpp:240
QgsMeshDatasetSourceInterface::mTemporalCapabilities
std::unique_ptr< QgsMeshDataProviderTemporalCapabilities > mTemporalCapabilities
Definition: qgsmeshdataprovider.h:422
QgsMeshDataProviderTemporalCapabilities::referenceTime
QDateTime referenceTime() const
Returns the reference time.
Definition: qgsmeshdataprovidertemporalcapabilities.cpp:104
QgsMeshExtraDatasetStore::dataset3dValues
QgsMesh3dDataBlock dataset3dValues(QgsMeshDatasetIndex index, int faceIndex, int count) const override
Returns N vector/scalar values from the face index from the dataset for 3d stacked meshes.
Definition: qgsmeshdatasetgroupstore.cpp:754
INVALID_MESHLAYER_TIME
#define INVALID_MESHLAYER_TIME
Definition: qgsmeshdataprovidertemporalcapabilities.h:25