[vtk-developers] MakeObject Deprecated
Berk Geveci
berklist at nycap.rr.com
Thu Dec 5 11:55:34 EST 2002
> It appears that MakeObject is being deprecated
>
> Where once one did
>
> vtkPoints *newPts = (vtkPoints*)(input->GetPoints()->MakeObject());
>
> Does one now do
>
> char *name = input->GetPoints()->GetClassName();
> vtkPoints *newPts =
> dynamic_cast<vtkPoints*>(ObjectFactory::CreateInstance(name));
> if (newPts) newPts->SetDataType(input->GetPoints()->GetDataType());
> else vtkErrorMacro(<<"It used to be so much easier");
>
> Or is there a less tedious way?
>
Yes, there is one. NewInstance(). All classes now have it
since it's in vtkTypeMacro (see vtkSetGet.h). However,
you will have to do the SetDataType() bit yourself.
The problem with MakeObject() was that it was not consistent;
only some classes had it and you could never tell what it
did unless you looked at the implementation(some just created a
new instance of the same type, some also copied some parameters like
data type).
-Berk
More information about the vtk-developers
mailing list