Commit ecae449f authored by Berk Geveci's avatar Berk Geveci
Browse files

ENH: Added methods to access individual datasets in a multiblock

parent a77ac58d
......@@ -20,7 +20,7 @@
#include "vtkObjectFactory.h"
vtkCxxRevisionMacro(vtkMultiBlockDataSet, "1.1");
vtkCxxRevisionMacro(vtkMultiBlockDataSet, "1.2");
vtkStandardNewMacro(vtkMultiBlockDataSet);
//----------------------------------------------------------------------------
......@@ -36,13 +36,30 @@ vtkMultiBlockDataSet::~vtkMultiBlockDataSet()
}
//----------------------------------------------------------------------------
void vtkMultiBlockDataSet::AddDataSet(vtkDataObject* data)
unsigned int vtkMultiBlockDataSet::GetNumberOfDataSets()
{
return this->Internal->DataSets.size();
}
//----------------------------------------------------------------------------
vtkDataObject* vtkMultiBlockDataSet::GetDataSet(unsigned int idx)
{
if ( idx >= this->Internal->DataSets.size() )
{
return 0;
}
return this->Internal->DataSets[idx];
}
//----------------------------------------------------------------------------
unsigned int vtkMultiBlockDataSet::AddDataSet(vtkDataObject* data)
{
if (data)
{
this->Internal->DataSets.push_back(data);
this->Modified();
}
return this->Internal->DataSets.size() - 1;
}
//----------------------------------------------------------------------------
......
......@@ -51,13 +51,22 @@ public:
virtual int GetDataObjectType() {return VTK_MULTI_BLOCK_DATA_SET;}
// Description:
// Add a dataset to the collection.
void AddDataSet(vtkDataObject* data);
// Add a dataset to the collection. Returns the index of
// the added dataset.
unsigned int AddDataSet(vtkDataObject* data);
// Rescription:
// Description:
// Restore data object to initial state,
virtual void Initialize();
// Description:
// Returns the number of datasets
unsigned int GetNumberOfDataSets();
// Description:
// Returns dataset with given id
vtkDataObject* GetDataSet(unsigned int idx);
//BTX
// Note that vtkMultiBlockDataIterator is dependent on the implementation
// of the data structure in this class. Changes to the data structure
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment