[vtkusers] Table/array swizzling

David Doria daviddoria+vtk at gmail.com
Wed May 26 15:36:45 EDT 2010


On Wed, May 26, 2010 at 3:27 PM, Shepherd, Jason F <jfsheph at sandia.gov> wrote:
> Hey guys,
>
> I'm looking for a couple of easy answers…
>
> 1.  I have an array (or a column in a table) generated from a database that
> is named "TEXT".  I'd like to rename the array (or column) to "text".  What
> is the easiest way to do this?
>
> 2.  The previously mentioned array is of type vtkStringArray.  I'd like it
> to be vtkUnicodeStringArray.  Is there an easy way to convert types of whole
> arrays?
>
> Thanks!
>
> Jason

I hope I didn't totally miss the point and give you wayy too simple of
answers, but here goes:

1) There is a SetName function in vtkAbstractArray (which
vtkDoubleArray, vtkStringArray, etc) are derived from. If I understood
you correctly, you can simply do

yourArray->SetName("text");

2) I don't think there is any "mass cast" like this. It should be too
bad to loop through the array and cast each member individually and
add it to the other type of array.

Hope that helps,

David



More information about the vtkusers mailing list