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
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 
25 VTK_ABI_NAMESPACE_BEGIN
26 class vtkProperty;
27 
28 class VTKRENDERINGCORE_EXPORT vtkActorCollection : public vtkPropCollection
29 {
30 public:
31  static vtkActorCollection* New();
33  void PrintSelf(ostream& os, vtkIndent indent) override;
34 
38  void AddItem(vtkActor* a);
39 
43  vtkActor* GetNextActor();
44 
48  vtkActor* GetLastActor();
49 
51 
56  vtkActor* GetNextItem();
57  vtkActor* GetLastItem();
59 
63  void ApplyProperties(vtkProperty* p);
64 
70  {
71  return static_cast<vtkActor*>(this->GetNextItemAsObject(cookie));
72  }
73 
74 protected:
75  vtkActorCollection() = default;
76  ~vtkActorCollection() override = default;
77 
78 private:
79  // hide the standard AddItem from the user and the compiler.
80  void AddItem(vtkObject* o) { this->vtkCollection::AddItem(o); }
81  void AddItem(vtkProp* o) { this->vtkPropCollection::AddItem(o); }
82 
83  vtkActorCollection(const vtkActorCollection&) = delete;
84  void operator=(const vtkActorCollection&) = delete;
85 };
86 
88 {
89  this->vtkCollection::AddItem(a);
90 }
91 
93 {
94  return static_cast<vtkActor*>(this->GetNextItemAsObject());
95 }
96 
98 {
99  if (this->Bottom == nullptr)
100  {
101  return nullptr;
102  }
103  else
104  {
105  return static_cast<vtkActor*>(this->Bottom->Item);
106  }
107 }
108 
110 {
111  return this->GetNextActor();
112 }
113 
115 {
116  return this->GetLastActor();
117 }
118 
119 VTK_ABI_NAMESPACE_END
120 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:45
void * vtkCollectionSimpleIterator
Definition: vtkCollection.h:40
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:40
abstract base class for most VTK objects
Definition: vtkObject.h:51
vtkActor * GetLastItem()
Access routines that are provided for compatibility with previous version of VTK. ...
represent surface properties of a geometric object
Definition: vtkProperty.h:56
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
an ordered list of Props
void AddItem(vtkActor *a)
Add an actor to the bottom of the list.
a simple class to control print indentation
Definition: vtkIndent.h:28
vtkActor * GetLastActor()
Get the last actor in the list.
vtkActor * GetNextActor(vtkCollectionSimpleIterator &cookie)
Reentrant safe way to get an object in a collection.
vtkActor * GetNextItem()
Access routines that are provided for compatibility with previous version of VTK. ...
an ordered list of actors
vtkCollectionElement * Bottom
void AddItem(vtkObject *)
Add an object to the bottom of the list.
void AddItem(vtkProp *a)
Add a Prop to the bottom of the list.
vtkActor * GetNextActor()
Get the next actor in the list.
vtkObject * GetNextItemAsObject()
Get the next item in the collection.
static vtkPropCollection * New()