Section: Visualization Toolkit Common Classes
To create an instance of class vtkStringArray, simply invoke its constructor as follows
obj = vtkStringArray
obj
is an instance of the vtkStringArray class.
string = obj.GetClassName ()
int = obj.IsA (string name)
vtkStringArray = obj.NewInstance ()
vtkStringArray = obj.SafeDownCast (vtkObject o)
int = obj.GetDataType ()
int = obj.IsNumeric ()
- Release storage and reset array to initial state.
obj.Initialize ()
- Release storage and reset array to initial state.
int = obj.GetDataTypeSize ()
- Return the size of the data type. WARNING: This may not mean
what you expect with strings. It will return
sizeof(vtkstd::string) and not take into account the data
included in any particular string.
obj.Squeeze ()
- Resize the array while conserving the data.
int = obj.Resize (vtkIdType numTuples)
- Resize the array while conserving the data.
obj.SetTuple (vtkIdType i, vtkIdType j, vtkAbstractArray source)
- Set the tuple at the ith location using the jth tuple in the source array.
This method assumes that the two arrays have the same type
and structure. Note that range checking and memory allocation is not
performed; use in conjunction with SetNumberOfTuples() to allocate space.
obj.InsertTuple (vtkIdType i, vtkIdType j, vtkAbstractArray source)
- Insert the jth tuple in the source array, at ith location in this array.
Note that memory allocation is performed as necessary to hold the data.
vtkIdType = obj.InsertNextTuple (vtkIdType j, vtkAbstractArray source)
- Insert the jth tuple in the source array, at the end in this array.
Note that memory allocation is performed as necessary to hold the data.
Returns the location at which the data was inserted.
obj.InterpolateTuple (vtkIdType i, vtkIdList ptIndices, vtkAbstractArray source, double weights)
- Set the ith tuple in this array as the interpolated tuple value,
given the ptIndices in the source array and associated
interpolation weights.
This method assumes that the two arrays are of the same type
and strcuture.
obj.InterpolateTuple (vtkIdType i, vtkIdType id1, vtkAbstractArray source1, vtkIdType id2, vtkAbstractArray source2, double t)
obj.GetTuples (vtkIdList ptIds, vtkAbstractArray output)
- Given a list of indices, return an array of values. You must
insure that the output array has been previously allocated with
enough space to hold the data and that the types match
sufficiently to allow conversion (if necessary).
obj.GetTuples (vtkIdType p1, vtkIdType p2, vtkAbstractArray output)
- Get the values for the range of indices specified (i.e.,
p1->p2 inclusive). You must insure that the output array has been
previously allocated with enough space to hold the data and that
the type of the output array is compatible with the type of this
array.
int = obj.Allocate (vtkIdType sz, vtkIdType ext)
- Allocate memory for this array. Delete old storage only if necessary.
Note that ext is no longer used.
vtkStdString = obj.&GetValue (vtkIdType id)
- Get the data at a particular index.
obj.SetValue (vtkIdType id, string value)
- Set the data at a particular index. Does not do range checking. Make sure
you use the method SetNumberOfValues() before inserting data.
obj.SetNumberOfTuples (vtkIdType number)
- Specify the number of values for this object to hold. Does an
allocation as well as setting the MaxId ivar. Used in conjunction with
SetValue() method for fast insertion.
obj.SetNumberOfValues (vtkIdType number)
- Specify the number of values for this object to hold. Does an
allocation as well as setting the MaxId ivar. Used in conjunction with
SetValue() method for fast insertion.
vtkIdType = obj.GetNumberOfValues ()
int = obj.GetNumberOfElementComponents ()
int = obj.GetElementComponentSize ()
- Insert data at a specified position in the array.
obj.InsertValue (vtkIdType id, string val)
- Insert data at a specified position in the array.
vtkIdType = obj.InsertNextValue (string f)
- Insert data at the end of the array. Return its location in the array.
obj.DeepCopy (vtkAbstractArray aa)
- Deep copy of another string array. Will complain and change nothing
if the array passed in is not a vtkStringArray.
long = obj.GetActualMemorySize ()
- Return the memory in kilobytes consumed by this data array. Used to
support streaming and reading/writing data. The value returned is
guaranteed to be greater than or equal to the memory required to
actually represent the data represented by this object. The
information returned is valid only after the pipeline has
been updated.
This function takes into account the size of the contents of the
strings as well as the string containers themselves.
vtkArrayIterator = obj.NewIterator ()
- Returns a vtkArrayIteratorTemplate<vtkStdString>.
vtkIdType = obj.GetDataSize ()
- Returns the size of the data in DataTypeSize units. Thus, the number of bytes
for the data can be computed by GetDataSize() * GetDataTypeSize().
The size computation includes the string termination character for each string.
vtkIdType = obj.LookupValue (string value)
obj.LookupValue (string value, vtkIdList ids)
obj.DataChanged ()
- Tell the array explicitly that the data has changed.
This is only necessary to call when you modify the array contents
without using the array's API (i.e. you retrieve a pointer to the
data and modify the array contents). You need to call this so that
the fast lookup will know to rebuild itself. Otherwise, the lookup
functions will give incorrect results.
obj.DataElementChanged (vtkIdType id)
- Tell the array explicitly that a single data element has
changed. Like DataChanged(), then is only necessary when you
modify the array contents without using the array's API.
obj.ClearLookup ()
- Delete the associated fast lookup data structure on this array,
if it exists. The lookup will be rebuilt on the next call to a lookup
function.