Commit 73bc830b authored by Jeff Baumes's avatar Jeff Baumes
Browse files

BUG: Do the right thing when a user calls SetFieldData() (set the number of rows appropriately).

parent 1ffa0099
......@@ -28,7 +28,7 @@
// Standard functions
//
vtkCxxRevisionMacro(vtkTable, "1.3");
vtkCxxRevisionMacro(vtkTable, "1.4");
vtkStandardNewMacro(vtkTable);
//----------------------------------------------------------------------------
......@@ -46,6 +46,24 @@ void vtkTable::PrintSelf(ostream &os, vtkIndent indent)
os << indent << "Number Of Rows: " << this->Rows << endl;
}
//----------------------------------------------------------------------------
void vtkTable::SetFieldData(vtkFieldData* data)
{
// Set the Rows field to the appropriate value
if (data != NULL && data->GetNumberOfArrays() > 0)
{
this->Rows = data->GetAbstractArray(0)->GetNumberOfTuples();
}
else
{
this->Rows = 0;
}
this->Superclass::SetFieldData(data);
}
//----------------------------------------------------------------------------
void vtkTable::Initialize()
{
this->Superclass::Initialize();
......
......@@ -21,6 +21,14 @@
// has the same number of entries, and provides row access (using vtkVariantArray)
// and single entry access (using vtkVariant).
//
// .SECTION Caveats
// You should use the vtkTable API to change the table data. Performing
// vtkFieldData operations on the object returned by GetFieldData() may
// yield unexpected results. vtkTable does allow the user to set the field
// data using SetFieldData(); the number of rows in the table is determined
// by the number of tuples in the first array (it is assumed that all arrays
// are the same length).
//
// .SECTION Thanks
// Thanks to Patricia Crossno, Ken Moreland, Andrew Wilson and Brian Wylie from
// Sandia National Laboratories for their help in developing this class API.
......@@ -41,6 +49,10 @@ public:
vtkTypeRevisionMacro(vtkTable, vtkDataObject);
void PrintSelf(ostream &os, vtkIndent indent);
// Description:
// Sets the field data for the table.
virtual void SetFieldData(vtkFieldData* data);
//
// Row functions
//
......
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