<span class="Apple-style-span" style="font-family: arial, sans-serif, &#39;Arial Unicode MS&#39;; font-size: 13px; border-collapse: collapse; "><div><span class="Apple-style-span" style="font-family: arial, sans-serif, &#39;Arial Unicode MS&#39;; font-size: 13px; border-collapse: collapse; "><span class="Apple-style-span" style="border-collapse: separate; font-family: arial; font-size: small; ">&gt; So since the vtkDenseArray stores everything internally as a<br>
&gt; vtkVariant I guess I&#39;d have to read up on vtkVariant and write a<br>&gt; conversion function from my type to vtkVariant? Is this the way to go?<br><div><div></div></div></span></span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif, &#39;Arial Unicode MS&#39;; font-size: 13px; border-collapse: collapse; "><br>
</span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif, &#39;Arial Unicode MS&#39;; font-size: 13px; border-collapse: collapse; ">Forwarded from vtkArray expert Tim Shead:</span></div><div>
<span class="Apple-style-span" style="font-family: arial, sans-serif, &#39;Arial Unicode MS&#39;; font-size: 13px; border-collapse: collapse; "><br></span></div>First-and-foremost, vtkDenseArray *does not* use vtkVariant for storage.  The vtkArray interface has GetVariantValue(), GetVariantValueN(), SetVariantValue(), and SetVariantValueN() methods that the concrete array types must implement.  The vtkDenseArray and vtkSparseArray implementations assume that your type is implicitly-convertible to vtkVariant, which is true of all the &quot;official&quot; VTK types defined in vtkType.h.  These methods are there as a convenience, and for consistency with vtkAbstractArray.<br>
<br>So, I see several possible avenues to explore:<br><br>* Make your type implicitly convertible to vtkVariant.  As long as you aren&#39;t actually using the vtkVariant get and set methods, this conversion doesn&#39;t have to actually do anything ... i.e. it could be as simple as<br>
<br>struct Point<br>{<br> // Other stuff here ...<br><br> operator vtkVariant() { return vtkVariant(); }<br>};<br><br>* Copy-and-paste vtkDenseArray to create your own array implementation, and replace the vtkVariant get and set methods with non-functioning stubs.<br>
<br>* Convince the VTK developers to get rid of the vtkVariant get and set methods, since they&#39;re imposing the conversion-to-vtkVariant requirement.<br><br>* Convince the VTK developers to refactor vtkVariant so it can contain any type, not just &quot;official&quot; types.  boost::any is an example of how it&#39;s done.<br>
<br>Cheers,<br>Tim</span><br><br>