Commit 07f12d14 authored by William McLendon's avatar William McLendon
Browse files

Added a rowLimit parameter to vtkTable::Dump()

parent 52c9dfdd
......@@ -75,7 +75,7 @@ void vtkTable::PrintSelf(ostream &os, vtkIndent indent)
}
//----------------------------------------------------------------------------
void vtkTable::Dump( unsigned int colWidth )
void vtkTable::Dump( unsigned int colWidth, int rowLimit )
{
if ( ! this->GetNumberOfColumns() )
......@@ -121,31 +121,35 @@ void vtkTable::Dump( unsigned int colWidth )
cout << " |\n"
<< lineStr;
for ( vtkIdType r = 0; r < this->GetNumberOfRows(); ++ r )
if ( rowLimit != 0 )
{
for ( int c = 0; c < this->GetNumberOfColumns(); ++ c )
for ( vtkIdType r = 0; r < this->GetNumberOfRows(); ++ r )
{
cout << "| ";
vtkStdString str = this->GetValue( r, c ).ToString();
if ( colWidth < str.length() )
for ( int c = 0; c < this->GetNumberOfColumns(); ++ c )
{
cout << str.substr( 0, colWidth );
}
else
{
cout << str;
for ( unsigned int i = static_cast<unsigned int>(str.length()); i < colWidth; ++ i )
cout << "| ";
vtkStdString str = this->GetValue( r, c ).ToString();
if ( colWidth < str.length() )
{
cout << " ";
cout << str.substr( 0, colWidth );
}
else
{
cout << str;
for ( unsigned int i = static_cast<unsigned int>(str.length()); i < colWidth; ++ i )
{
cout << " ";
}
}
}
cout << " |\n";
if ( rowLimit != -1 && r >= rowLimit )
break;
}
cout << " |\n";
cout << lineStr;
cout.flush();
}
cout << lineStr;
cout.flush();
}
//----------------------------------------------------------------------------
......
......@@ -62,8 +62,11 @@ public:
void PrintSelf(ostream &os, vtkIndent indent);
// Description:
// Dump table contents.
void Dump( unsigned int colWidth = 16 );
// Dump table contents. If rowLimit is -1 then the full table
// is printed out (Default). If rowLimit is 0 then only the
// header row will be displayed. Otherwise, if rowLimit > 0
// then Dump will print the first rowLimit rows of data.
void Dump( unsigned int colWidth = 16, int rowLimit = -1 );
// Description:
// Return what type of dataset this is.
......
Markdown is supported
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