VTK  9.7.0
vtkActorCollection.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
17
18#ifndef vtkActorCollection_h
19#define vtkActorCollection_h
20
21#include "vtkActor.h" // For inline methods
22#include "vtkPropCollection.h"
23#include "vtkRenderingCoreModule.h" // For export macro
24#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
25
26VTK_ABI_NAMESPACE_BEGIN
27class vtkProperty;
28
29class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkActorCollection : public vtkPropCollection
30{
31public:
34 void PrintSelf(ostream& os, vtkIndent indent) override;
35
39 void AddItem(vtkActor* a);
40
45
50
52
60
65
71 {
72 return static_cast<vtkActor*>(this->GetNextItemAsObject(cookie));
73 }
74
75protected:
76 vtkActorCollection() = default;
77 ~vtkActorCollection() override = default;
78
79private:
80 // hide the standard AddItem from the user and the compiler.
81 void AddItem(vtkObject* o) { this->vtkCollection::AddItem(o); }
82 void AddItem(vtkProp* o) { this->vtkPropCollection::AddItem(o); }
83
84 vtkActorCollection(const vtkActorCollection&) = delete;
85 void operator=(const vtkActorCollection&) = delete;
86};
87
89{
91}
92
94{
95 return static_cast<vtkActor*>(this->GetNextItemAsObject());
96}
97
99{
100 int numItems = this->GetNumberOfItems();
101 if (numItems == 0)
102 {
103 return nullptr;
104 }
105 else
106 {
107 return static_cast<vtkActor*>(this->GetItemAsObject(numItems - 1));
108 }
109}
110
112{
113 return this->GetNextActor();
114}
115
117{
118 return this->GetLastActor();
119}
120
121VTK_ABI_NAMESPACE_END
122#endif
static vtkActorCollection * New()
void AddItem(vtkActor *a)
Add an actor to the bottom of the list.
vtkActor * GetNextItem()
Access routines that are provided for compatibility with previous version of VTK.
vtkActorCollection()=default
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void ApplyProperties(vtkProperty *p)
Apply properties to all actors in this collection.
vtkActor * GetNextActor()
Get the next actor in the list.
vtkActor * GetLastActor()
Get the last actor in the list.
~vtkActorCollection() override=default
vtkActor * GetLastItem()
Access routines that are provided for compatibility with previous version of VTK.
vtkActor * GetNextActor(vtkCollectionSimpleIterator &cookie)
Reentrant safe way to get an object in a collection.
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:42
void AddItem(vtkObject *)
Add given item to the bottom (end) of the collection.
int GetNumberOfItems() VTK_FUTURE_CONST
Return the number of items in the collection.
vtkObject * GetItemAsObject(int i) VTK_FUTURE_CONST
Get the i'th item in the collection.
vtkObject * GetNextItemAsObject()
Get the next item in the collection.
a simple class to control print indentation
Definition vtkIndent.h:29
vtkPropCollection()=default
void AddItem(vtkProp *a)
Add a Prop to the bottom of the list.
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:50
represent surface properties of a geometric object
Definition vtkProperty.h:60
void * vtkCollectionSimpleIterator
#define VTK_MARSHALAUTO