1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
|
Usage
Points and cells may sometimes have associated data that are
stored as strings, e.g. many information visualization
projects. This class provides a reasonably clean way to
store and access those.
To create an instance of class vtkStringArray, simply invoke
its constructor as follows
obj = vtkStringArray
Methods
The class vtkStringArray has several methods that can be
used. They are listed below. Note that the documentation is
translated automatically from the VTK sources, and may not
be completely intelligible. When in doubt, consult the VTK
website. In the methods listed below, 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.
* FreeMat_Documentation
* Visualization_Toolkit_Common_Classes
* Generated on Thu Jul 25 2013 17:18:30 for FreeMat by
doxygen_ 1.8.1.1
|