[vtkusers] matrix output VERY hard to read

David Gobbi david.gobbi at gmail.com
Wed Oct 21 18:52:49 EDT 2009


I agree with Jeff that a method for pretty-printing would be handy.  A
generic way of doing this is to create a "formatting" object that can
be sent to PrintSelf:

void PrintSelf(ostream& os, vtkIndent indent, vtkPrintFormat *format);

The "format" object could provide information about precision, column
widths, and "level of detail" i.e. whether to print all attributes or
just the important ones i.e. the data values.

This would be an optional method, i.e. if any object that didn't
define the new form of PrintSelf would fall back to the old PrintSelf.
 The reason to modify PrintSelf, instead of adding new methods, is
because it makes it easy to convert relevant object (matrix,
transform, array) over to the new system.

There could be two ways of invoking the pretty-print methods:

vtkPrintFormat::Print(ostream &stream, vtkObject *object);

vtkObject::Print(ostream &stream, vtkPrintFormat *format);

Overall, this would be fairly easy to implement and would be very
general-purpose.  In fact it is general enough to even encompass such
things as serialization of VTK objects.

    David



More information about the vtkusers mailing list