Print debug info by vtk macro

How to show vtk object’s debug information?
I introduce how to show vtk object’s debug information by the custom class which inherits vtkPolyDataAlgorithm, relevant article: 【VTK】Create source class which is derived from vtkPolyDataAlgorithm
We just need to Star->DebugOn() and use vtkDebugMacro as std::cout.

        vtkDebugMacro( << "works, output getNumberOfCells "
                       << output->GetNumberOfCells() );

Run it, program outputs all debug info

Debug: In /Users/weiyang/code/diff/main.cpp, line 79
StarSource (0x7fb0c8c0bb60): works, output getNumberOfCells 5

The different debug macros such as vtkWarningMacro, vtkDebugMacro and vtkErrorMacro and their definitions are in vtkSetGet.h

PrintSelf in vtkObjectBase

The interface vtkObjectBase::Print contains PrintSelf, that means print does more than vtkObjectBase::PrintSelf

void vtkObjectBase::Print(ostream& os)
{
  vtkIndent indent;

  this->PrintHeader(os,vtkIndent(0));
  this->PrintSelf(os, indent.GetNextIndent());
  this->PrintTrailer(os,vtkIndent(0));
}

We can use it like:

Star->Print( std::cout );

Star->PrintSelf( std::cout, vtkIndent() );

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments

Tex To PDF
: convert the Latex file which suffix is tex to a PDF file

X
0
Would love your thoughts, please comment.x
()
x