VTK  9.2.20220701
vtkActorCollection.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkActorCollection.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
89 #ifndef vtkActorCollection_h
90 #define vtkActorCollection_h
91 
92 #include "vtkActor.h" // For inline methods
93 #include "vtkPropCollection.h"
94 #include "vtkRenderingCoreModule.h" // For export macro
95 
96 class vtkProperty;
97 
98 class VTKRENDERINGCORE_EXPORT vtkActorCollection : public vtkPropCollection
99 {
100 public:
103  void PrintSelf(ostream& os, vtkIndent indent) override;
104 
108  void AddItem(vtkActor* a);
109 
113  vtkActor* GetNextActor();
114 
118  vtkActor* GetLastActor();
119 
121 
126  vtkActor* GetNextItem();
127  vtkActor* GetLastItem();
129 
134 
140  {
141  return static_cast<vtkActor*>(this->GetNextItemAsObject(cookie));
142  }
143 
144 protected:
145  vtkActorCollection() = default;
146  ~vtkActorCollection() override = default;
147 
148 private:
149  // hide the standard AddItem from the user and the compiler.
150  void AddItem(vtkObject* o) { this->vtkCollection::AddItem(o); }
151  void AddItem(vtkProp* o) { this->vtkPropCollection::AddItem(o); }
152 
153 private:
154  vtkActorCollection(const vtkActorCollection&) = delete;
155  void operator=(const vtkActorCollection&) = delete;
156 };
157 
159 {
160  this->vtkCollection::AddItem(a);
161 }
162 
164 {
165  return static_cast<vtkActor*>(this->GetNextItemAsObject());
166 }
167 
169 {
170  if (this->Bottom == nullptr)
171  {
172  return nullptr;
173  }
174  else
175  {
176  return static_cast<vtkActor*>(this->Bottom->Item);
177  }
178 }
179 
181 {
182  return this->GetNextActor();
183 }
184 
186 {
187  return this->GetLastActor();
188 }
189 
190 #endif
an ordered list of actors
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.
static vtkActorCollection * New()
vtkActor * GetNextActor(vtkCollectionSimpleIterator &cookie)
Reentrant safe way to get an object in a collection.
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.
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:161
vtkCollectionElement * Bottom
void AddItem(vtkObject *)
Add an object to the bottom of the list.
vtkObject * GetNextItemAsObject()
Get the next item in the collection.
a simple class to control print indentation
Definition: vtkIndent.h:119
abstract base class for most VTK objects
Definition: vtkObject.h:82
an ordered list of Props
void AddItem(vtkProp *a)
Add a Prop to the bottom of the list.
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:76
represent surface properties of a geometric object
Definition: vtkProperty.h:177
void * vtkCollectionSimpleIterator
Definition: vtkCollection.h:51