<div dir="ltr">If you want to return dataset don't don't create dataset with smartPointer.<br><br>simply use<br><br>vtkDataSet* dataSet=vtkDataSet::New();<br><br>Jothy<br><br><div class="gmail_quote">On Thu, Feb 9, 2012 at 1:52 PM, <span dir="ltr"><<a href="mailto:ycollette.nospam@free.fr">ycollette.nospam@free.fr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
Thanks for all these advices. Now it works:<br>
<br>
bool VTKContainer::read_file(const char * Filename)<br>
{<br>
//vtkDataObjectReader * do_reader = vtkSmartPointer<vtkDataObjectReader>::New();<br>
<div class="im"> vtkDataObjectReader * do_reader = vtkDataObjectReader::New();<br>
<br>
</div> do_reader->SetFileName(Filename);<br>
<br>
do_reader->ReadAllFieldsOn();<br>
<br>
dataSet = do_reader->GetOutput()->GetFieldData();<br>
<br>
return (dataSet!=NULL);<br>
}<br>
<br>
There is still 1 thing:<br>
- The smart pointer version doesn't work: it hangs when calling SetFileName.<br>
<div class="im"><br>
YC<br>
<br>
----- Mail original -----<br>
</div>De: "David Doria" <<a href="mailto:daviddoria@gmail.com">daviddoria@gmail.com</a>><br>
Ā: "ycollette nospam" <<a href="mailto:ycollette.nospam@free.fr">ycollette.nospam@free.fr</a>><br>
Cc: <a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a><br>
Envoyé: Jeudi 9 Février 2012 14:44:21<br>
Objet: Re: [vtkusers] How to use vtkDataObjectReader in C++<br>
<div><div></div><div class="h5"><br>
On Thu, Feb 9, 2012 at 8:04 AM, <<a href="mailto:ycollette.nospam@free.fr">ycollette.nospam@free.fr</a>> wrote:<br>
> Hello,<br>
><br>
> I tried to compile the following code under C++, but the compiler complains about not being able to access protected members (the contructor and the destructor).<br>
> Here is the peice of code:<br>
><br>
> vtkFieldData * dataSet = NULL;<br>
> vtkDataObjectReader * do_reader = new vtkDataObjectReader;<br>
><br>
> do_reader->ReadAllFieldsOn();<br>
> do_reader->SetFileName(Filename);<br>
> dataSet = do_reader->ReadFieldData();<br>
><br>
><br>
> My question is: how to use vtkDataObjectReader in C++ ?<br>
><br>
> Best regards,<br>
><br>
> YC<br>
<br>
Once you get this working it would be great if you could make a short<br>
example an post it on the wiki:<br>
<a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx" target="_blank">http://www.vtk.org/Wiki/VTK/Examples/Cxx</a><br>
<br>
David<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr">Jothy<br></div><br>
</div>