VTK  9.2.6
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 =========================================================================*/
39 #ifndef vtkActorCollection_h
40 #define vtkActorCollection_h
41 
42 #include "vtkActor.h" // For inline methods
43 #include "vtkPropCollection.h"
44 #include "vtkRenderingCoreModule.h" // For export macro
45 
46 class vtkProperty;
47 
48 class VTKRENDERINGCORE_EXPORT vtkActorCollection : public vtkPropCollection
49 {
50 public:
53  void PrintSelf(ostream& os, vtkIndent indent) override;
54 
58  void AddItem(vtkActor* a);
59 
63  vtkActor* GetNextActor();
64 
68  vtkActor* GetLastActor();
69 
71 
76  vtkActor* GetNextItem();
77  vtkActor* GetLastItem();
79 
84 
90  {
91  return static_cast<vtkActor*>(this->GetNextItemAsObject(cookie));
92  }
93 
94 protected:
95  vtkActorCollection() = default;
96  ~vtkActorCollection() override = default;
97 
98 private:
99  // hide the standard AddItem from the user and the compiler.
100  void AddItem(vtkObject* o) { this->vtkCollection::AddItem(o); }
101  void AddItem(vtkProp* o) { this->vtkPropCollection::AddItem(o); }
102 
103 private:
104  vtkActorCollection(const vtkActorCollection&) = delete;
105  void operator=(const vtkActorCollection&) = delete;
106 };
107 
109 {
110  this->vtkCollection::AddItem(a);
111 }
112 
114 {
115  return static_cast<vtkActor*>(this->GetNextItemAsObject());
116 }
117 
119 {
120  if (this->Bottom == nullptr)
121  {
122  return nullptr;
123  }
124  else
125  {
126  return static_cast<vtkActor*>(this->Bottom->Item);
127  }
128 }
129 
131 {
132  return this->GetNextActor();
133 }
134 
136 {
137  return this->GetLastActor();
138 }
139 
140 #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:61
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:49
abstract base class for most VTK objects
Definition: vtkObject.h:72
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:66
represent surface properties of a geometric object
Definition: vtkProperty.h:77
void * vtkCollectionSimpleIterator
Definition: vtkCollection.h:51