VTK  9.1.0
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 =========================================================================*/
86 #ifndef vtkActorCollection_h
87 #define vtkActorCollection_h
88 
89 #include "vtkActor.h" // For inline methods
90 #include "vtkPropCollection.h"
91 #include "vtkRenderingCoreModule.h" // For export macro
92 
93 class vtkProperty;
94 
95 class VTKRENDERINGCORE_EXPORT vtkActorCollection : public vtkPropCollection
96 {
97 public:
100  void PrintSelf(ostream& os, vtkIndent indent) override;
101 
105  void AddItem(vtkActor* a);
106 
110  vtkActor* GetNextActor();
111 
115  vtkActor* GetLastActor();
116 
118 
123  vtkActor* GetNextItem();
124  vtkActor* GetLastItem();
126 
131 
137  {
138  return static_cast<vtkActor*>(this->GetNextItemAsObject(cookie));
139  }
140 
141 protected:
142  vtkActorCollection() = default;
143  ~vtkActorCollection() override = default;
144 
145 private:
146  // hide the standard AddItem from the user and the compiler.
147  void AddItem(vtkObject* o) { this->vtkCollection::AddItem(o); }
148  void AddItem(vtkProp* o) { this->vtkPropCollection::AddItem(o); }
149 
150 private:
151  vtkActorCollection(const vtkActorCollection&) = delete;
152  void operator=(const vtkActorCollection&) = delete;
153 };
154 
156 {
157  this->vtkCollection::AddItem(a);
158 }
159 
161 {
162  return static_cast<vtkActor*>(this->GetNextItemAsObject());
163 }
164 
166 {
167  if (this->Bottom == nullptr)
168  {
169  return nullptr;
170  }
171  else
172  {
173  return static_cast<vtkActor*>(this->Bottom->Item);
174  }
175 }
176 
178 {
179  return this->GetNextActor();
180 }
181 
183 {
184  return this->GetLastActor();
185 }
186 
187 #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:155
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:113
abstract base class for most VTK objects
Definition: vtkObject.h:73
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:67
represent surface properties of a geometric object
Definition: vtkProperty.h:171
void * vtkCollectionSimpleIterator
Definition: vtkCollection.h:48