VTK: Rendering/Core/vtkActorCollection.h Source File

| VTK 9.3.1

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
27 #ifndef vtkActorCollection_h
28 #define vtkActorCollection_h
29
30 #include "vtkActor.h" // For inline methods
31 #include "vtkPropCollection.h"
32 #include "vtkRenderingCoreModule.h" // For export macro
33
34 VTK_ABI_NAMESPACE_BEGIN
35 class vtkProperty;
36
37 class VTKRENDERINGCORE_EXPORT vtkActorCollection : public vtkPropCollection
38 {
39 public:
40 static vtkActorCollection* New();
41 vtkTypeMacro(vtkActorCollection, vtkPropCollection);
42 void PrintSelf(ostream& os, vtkIndent indent) override;
43
47 void AddItem(vtkActor* a);
48
52 vtkActor* GetNextActor();
53
57 vtkActor* GetLastActor();
58
60
65 vtkActor* GetNextItem();
66 vtkActor* GetLastItem();
68
72 void ApplyProperties(vtkProperty* p);
73
78 vtkActor* GetNextActor(vtkCollectionSimpleIterator& cookie)
79 {
80 return static_cast<vtkActor*>(this->GetNextItemAsObject(cookie));
81 }
82
83 protected:
84 vtkActorCollection() = default;
85 ~vtkActorCollection() override = default;
86
87 private:
88 // hide the standard AddItem from the user and the compiler.
89 void AddItem(vtkObject* o) { this->vtkCollection::AddItem(o); }
90 void AddItem(vtkProp* o) { this->vtkPropCollection::AddItem(o); }
91
92 vtkActorCollection(const vtkActorCollection&) = delete;
93 void operator=(const vtkActorCollection&) = delete;
94 };
95
96 inline void vtkActorCollection::AddItem(vtkActor* a)
97 {
98 this->vtkCollection::AddItem(a);
99 }
100
101 inline vtkActor* vtkActorCollection::GetNextActor()
102 {
103 return static_cast<vtkActor*>(this->GetNextItemAsObject());
104 }
105
106 inline vtkActor* vtkActorCollection::GetLastActor()
107 {
108 if (this->Bottom == nullptr)
109 {
110 return nullptr;
111 }
112 else
113 {
114 return static_cast<vtkActor*>(this->Bottom->Item);
115 }
116 }
117
118 inline vtkActor* vtkActorCollection::GetNextItem()
119 {
120 return this->GetNextActor();
121 }
122
123 inline vtkActor* vtkActorCollection::GetLastItem()
124 {
125 return this->GetLastActor();
126 }
127
128 VTK_ABI_NAMESPACE_END
129 #endif
vtkActorCollection
an ordered list of actors
Definition: vtkActorCollection.h:38
vtkActorCollection::AddItem
void AddItem(vtkActor *a)
Add an actor to the bottom of the list.
Definition: vtkActorCollection.h:96
vtkActorCollection::GetNextItem
vtkActor * GetNextItem()
Access routines that are provided for compatibility with previous version of VTK.
Definition: vtkActorCollection.h:118
vtkActorCollection::New
static vtkActorCollection * New()
vtkActorCollection::GetNextActor
vtkActor * GetNextActor(vtkCollectionSimpleIterator &cookie)
Reentrant safe way to get an object in a collection.
Definition: vtkActorCollection.h:78
vtkActorCollection::vtkActorCollection
vtkActorCollection()=default
vtkActorCollection::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkActorCollection::ApplyProperties
void ApplyProperties(vtkProperty *p)
Apply properties to all actors in this collection.
vtkActorCollection::GetNextActor
vtkActor * GetNextActor()
Get the next actor in the list.
Definition: vtkActorCollection.h:101
vtkActorCollection::GetLastActor
vtkActor * GetLastActor()
Get the last actor in the list.
Definition: vtkActorCollection.h:106
vtkActorCollection::~vtkActorCollection
~vtkActorCollection() override=default
vtkActorCollection::GetLastItem
vtkActor * GetLastItem()
Access routines that are provided for compatibility with previous version of VTK.
Definition: vtkActorCollection.h:123
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:50
vtkCollectionElement::Item
vtkObject * Item
Definition: vtkCollection.h:37
vtkCollection::Bottom
vtkCollectionElement * Bottom
Definition: vtkCollection.h:164
vtkCollection::AddItem
void AddItem(vtkObject *)
Add an object to the bottom of the list.
vtkCollection::GetNextItemAsObject
vtkObject * GetNextItemAsObject()
Get the next item in the collection.
Definition: vtkCollection.h:177
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:61
vtkPropCollection
an ordered list of Props
Definition: vtkPropCollection.h:37
vtkPropCollection::AddItem
void AddItem(vtkProp *a)
Add a Prop to the bottom of the list.
Definition: vtkPropCollection.h:87
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:55
vtkProperty
represent surface properties of a geometric object
Definition: vtkProperty.h:66
vtkActor.h
vtkCollectionSimpleIterator
void * vtkCollectionSimpleIterator
Definition: vtkCollection.h:40
vtkPropCollection.h