I'm not sure what you mean. The vector is a C++ "vector" object,<div>so you can iterate over it just like you can with any STL container.</div><div><br></div><div> David<br><br><div class="gmail_quote">On Fri, Nov 26, 2010 at 3:20 PM, Ambar C <span dir="ltr"><<a href="mailto:ambarc@gmail.com">ambarc@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Thanks David.<br>
<br>
How does the iteration for the vector work? Does it happen in the same<br>
order as the insertion did?<br>
<br>
Best,<br>
<font color="#888888">Ambar<br>
</font><div><div></div><div class="h5"><br>
On Fri, Nov 26, 2010 at 1:09 PM, David Gobbi <<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>> wrote:<br>
> Hi Ambar,<br>
> There is a VTK class called vtkCollection that can hold an array of<br>
> vtkObjects, but it has a poor user interface so I can't really recommend it.<br>
> Most people use a vector of smart pointers, like this:<br>
> vtkstd::vector<vtkSmartPointer<vtkPoints> > pointVector;<br>
> You can add to the vector like this:<br>
> points = vtkPoints::New();<br>
> // add all points<br>
> pointVector.push_back(points);<br>
> points->Delete();<br>
> The "Delete()" is bookkeeping for the garbage collector. After you push the<br>
> points onto pointsVector, the pointsVector owns the reference so you have to<br>
> delete the local reference.<br>
> David<br>
><br>
> On Fri, Nov 26, 2010 at 1:27 PM, Ambar C <<a href="mailto:ambarc@gmail.com">ambarc@gmail.com</a>> wrote:<br>
>><br>
>> Hello,<br>
>><br>
>> I'm currently coding a project that needs me to keep creating vtkPoint<br>
>> objects in a loop as I get data. I don't know how much data I'm going<br>
>> to get so I need a way to keep track of all of my different point<br>
>> groups. Is there some kind of stack or array in vtk that will allow me<br>
>> to keep adding on my points (while creating vtkPoint inside the loop)<br>
>> and still having them in scope after the loop? Please feel free to ask<br>
>> questions.<br>
>><br>
>> Cheers.<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<br>
>> <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:<br>
>> <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>
><br>
><br>
</div></div></blockquote></div><br></div>