[vtkusers] Need Help

David Doria daviddoria at gmail.com
Fri Jun 28 09:25:12 EDT 2013


On Fri, Jun 28, 2013 at 5:42 AM, rahul indoria <rahulindoria5 at gmail.com> wrote:
> Hi,
>    i am new on vtk and facing many problems in understanding VTK  examples.
>
> could you please tell me the meaning of this statement:
>
>
>  vtkSmartPointer< vtkImageReader2Factory > imageFactory = vtkSmartPointer<
> vtkImageReader2Factory >::New();
>
>
> Looking forward your reply soon.
>
>
>
> rahul indoria

This is implementing the "Factory Pattern" from OOP:
http://en.wikipedia.org/wiki/Factory_method_pattern

In this case it just creates the type of reader you need automatically
based on the file name you provide it. (Rather than having to say "if
.png, create a PNGReader, if .jpg..." yourself in your code.)

David



More information about the vtkusers mailing list