VTK/Examples/Broken/DataObjectToTable

From KitwarePublic

Jump to: navigation, search

How to get point coordinates into the table?

DataObjectToTable.cxx

#include <vtkSmartPointer.h>
#include <vtkSphereSource.h>
#include <vtkPolyData.h>
#include <vtkDataObjectToTable.h>
#include <vtkTable.h>
 
int main(int argc, char *argv[])
{
 
  //Create a sphere
  vtkSmartPointer<vtkSphereSource> sphereSource = 
      vtkSmartPointer<vtkSphereSource>::New();
  sphereSource->Update();
 
  vtkSmartPointer<vtkDataObjectToTable> dataObjectToTable = 
      vtkSmartPointer<vtkDataObjectToTable>::New();
  dataObjectToTable->SetInputConnection(sphereSource->GetOutputPort());
  //dataObjectToTable->SetFieldType(vtkDataObjectToTable::POINT_DATA);
  //dataObjectToTable->SetFieldType(vtkDataObjectToTable::CELL_DATA);
  dataObjectToTable->Update();
 
  vtkSmartPointer<vtkTable> table = dataObjectToTable->GetOutput();
  table->Dump();
 
  return EXIT_SUCCESS;
}

CMakeLists.txt

cmake_minimum_required(VERSION 2.6)
 
PROJECT(DataObjectToTable)
 
FIND_PACKAGE(VTK REQUIRED)
INCLUDE(${VTK_USE_FILE})
 
ADD_EXECUTABLE(DataObjectToTable DataObjectToTable.cxx)
 
TARGET_LINK_LIBRARIES(DataObjectToTable vtkHybrid vtkInfovis)
Personal tools