Collection
Introduction
vtkCollection is a container of multiple vtkObject items. This can be useful for encapsulating multiple vtkObjects such as images into a single vtkObject (vtkCollection instance) to be passed as input to other filters and mappers as a single unit.
Methods
addItem
Add item (vtkObject) to the collection
| Argument | Type | Required | Description |
|---|---|---|---|
item | vtkObject | Yes | item to be added to the collection |
empty
Check if the collection is empty
extend
Method used to decorate a given object (publicAPI+model) with vtkCollection characteristics.
| Argument | Type | Required | Description |
|---|---|---|---|
publicAPI | Yes | object on which methods will be bounds (public) | |
model | Yes | object on which data structure will be bounds (protected) | |
initialValues | ICollectionInitialValues | No | (default: {}) |
getItem
get the current item and provided index, returns null if index is out of bounds
getNumberOfItems
Get the total number of items in the collection
insertItem
Add item (vtkObject) to the collection at the given index. This differs from VTK-C++ where insertItem inserts at position after the provided index value.
| Argument | Type | Required | Description |
|---|---|---|---|
idx | number | Yes | index where the new item should be inserted. |
item | vtkObject | Yes | item to be inserted |
isItemPresent
Check if a provided item is already present in the collection
newInstance
Method used to create a new instance of vtkCollection.
| Argument | Type | Required | Description |
|---|---|---|---|
initialValues | ICollectionInitialValues | No | for pre-setting some of its content |
removeAllItems
Remove all items from the collection
removeItem
Remove an existing item from the collection
| Argument | Type | Required | Description |
|---|---|---|---|
inValue | number or vtkObject | Yes | index or reference of an item to be removed |
replaceItem
Replace an existing item (vtkObject) with a new one
| Argument | Type | Required | Description |
|---|---|---|---|
idx | number | Yes | index of item to be replaced |
item | vtkObject | Yes |
updateMTimeWithElements
Check each element for modified time and update the collection's MTime to the latest timestamp from individual items in the collection.