[vtk-developers] Added new helper class (vtkDataObjectTypes)

Berk Geveci berk.geveci at kitware.com
Mon Mar 5 10:34:31 EST 2007


Hi Folks,

I added a new helper class to cvs vtk called vtkDataObjectTypes. This
class makes it easy to convert between data object class names and
type ids (as defined in vtkType.h, for example VTK_POLY_DATA). It also
provides methods to instantiate data objects given a class name or a
type id. The API looks like this:

  // Description:
  // Given an int (as defined in vtkType.h) identifier for a class
  // return it's classname.
  static const char* GetClassNameFromTypeId(int typeId);

  // Description:
  // Given a data object classname, return it's int identified (as
  // defined in vtkType.h)
  static int GetTypeIdFromClassName(const char* classname);

  // Description:
  // Create (New) and return a data object of the given classname.
  static vtkDataObject* NewDataObject(const char* classname);

  // Description:
  // Create (New) and return a data object of the given type id.
  static vtkDataObject* NewDataObject(int typeId);

Please keep in mind that this class has to be updated whenever a new
data type is added to vtkType.h.

This functionality was duplicated in bunch of classes. I changed
whatever I could find to use vtkDataObjectTypes. Please update any
classes I missed.

-- 
 Berk Geveci
 Kitware Inc.
 28 Corporate Drive
 Clifton Park, NY, 12065



More information about the vtk-developers mailing list