Commit 3ca702d5 authored by Timothy M. Shead's avatar Timothy M. Shead
Browse files

ENH: Update vtkTable::Dump() to handle vtkUnicodeStringArray columns.

parent 88695d53
......@@ -646,6 +646,10 @@ vtkStdString vtkVariant::ToString() const
{
return vtkStdString(*(this->Data.String));
}
if (this->IsUnicodeString())
{
return vtkUnicodeString(*(this->Data.UnicodeString)).utf8_str();
}
if (this->IsFloat())
{
vtksys_ios::ostringstream ostr;
......
......@@ -28,13 +28,14 @@
#include "vtkInformationVector.h"
#include "vtkObjectFactory.h"
#include "vtkStringArray.h"
#include "vtkUnicodeStringArray.h"
#include "vtkVariantArray.h"
//
// Standard functions
//
vtkCxxRevisionMacro(vtkTable, "1.22");
vtkCxxRevisionMacro(vtkTable, "1.23");
vtkStandardNewMacro(vtkTable);
vtkCxxSetObjectMacro(vtkTable, RowData, vtkDataSetAttributes);
......@@ -519,6 +520,24 @@ vtkVariant vtkTable::GetValueByName(vtkIdType row, const char* col)
return v;
}
}
else if (vtkUnicodeStringArray::SafeDownCast(arr))
{
vtkUnicodeStringArray* data = vtkUnicodeStringArray::SafeDownCast(arr);
if (comps == 1)
{
return vtkVariant(data->GetValue(row));
}
else
{
// Create a variant holding a vtkStringArray with one tuple.
vtkUnicodeStringArray* sa = vtkUnicodeStringArray::New();
sa->SetNumberOfComponents(comps);
sa->InsertNextTuple(row, data);
vtkVariant v(sa);
sa->Delete();
return v;
}
}
else if (vtkVariantArray::SafeDownCast(arr))
{
vtkVariantArray* data = vtkVariantArray::SafeDownCast(arr);
......
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