Section: Visualization Toolkit Common Classes
The vtkObjectFactory can be use to override the creation of any object in VTK with a sub-class of that object. The factories can be registered either at run time with the VTK_AUTOLOAD_PATH, or at compile time with the vtkObjectFactory::RegisterFactory method.
To create an instance of class vtkObjectFactory, simply invoke its constructor as follows
obj = vtkObjectFactory
obj
is an instance of the vtkObjectFactory class.
string = obj.GetClassName ()
int = obj.IsA (string name)
vtkObjectFactory = obj.NewInstance ()
vtkObjectFactory = obj.SafeDownCast (vtkObject o)
string = obj.GetVTKSourceVersion ()
- All sub-classes of vtkObjectFactory should must return the version of
VTK they were built with. This should be implemented with the macro
VTK_SOURCE_VERSION and NOT a call to vtkVersion::GetVTKSourceVersion.
As the version needs to be compiled into the file as a string constant.
This is critical to determine possible incompatible dynamic factory loads.
string = obj.GetDescription ()
- Return a descriptive string describing the factory.
int = obj.GetNumberOfOverrides ()
- Return number of overrides this factory can create.
string = obj.GetClassOverrideName (int index)
- Return the name of a class override at the given index.
string = obj.GetClassOverrideWithName (int index)
- Return the name of the class that will override the class
at the given index
int = obj.GetEnableFlag (int index)
- Return the enable flag for the class at the given index.
string = obj.GetOverrideDescription (int index)
- Return the description for a the class override at the given
index.
obj.SetEnableFlag (int flag, string className, string subclassName)
- Set and Get the Enable flag for the specific override of className.
if subclassName is null, then it is ignored.
int = obj.GetEnableFlag (string className, string subclassName)
- Set and Get the Enable flag for the specific override of className.
if subclassName is null, then it is ignored.
int = obj.HasOverride (string className)
- Return 1 if this factory overrides the given class name, 0 otherwise.
int = obj.HasOverride (string className, string subclassName)
- Return 1 if this factory overrides the given class name, 0 otherwise.
obj.Disable (string className)
- Set all enable flags for the given class to 0. This will
mean that the factory will stop producing class with the given
name.
string = obj.GetLibraryPath ()
- This returns the path to a dynamically loaded factory.