VTK  9.0.20210227
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 =========================================================================*/
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 class vtkProperty;
35 
36 class VTKRENDERINGCORE_EXPORT vtkActorCollection : public vtkPropCollection
37 {
38 public:
39  static vtkActorCollection* New();
41  void PrintSelf(ostream& os, vtkIndent indent) override;
42 
46  void AddItem(vtkActor* a);
47 
51  vtkActor* GetNextActor();
52 
56  vtkActor* GetLastActor();
57 
59 
64  vtkActor* GetNextItem();
65  vtkActor* GetLastItem();
67 
71  void ApplyProperties(vtkProperty* p);
72 
78  {
79  return static_cast<vtkActor*>(this->GetNextItemAsObject(cookie));
80  }
81 
82 protected:
83  vtkActorCollection() = default;
84  ~vtkActorCollection() override = default;
85 
86 private:
87  // hide the standard AddItem from the user and the compiler.
88  void AddItem(vtkObject* o) { this->vtkCollection::AddItem(o); }
89  void AddItem(vtkProp* o) { this->vtkPropCollection::AddItem(o); }
90 
91 private:
92  vtkActorCollection(const vtkActorCollection&) = delete;
93  void operator=(const vtkActorCollection&) = delete;
94 };
95 
97 {
98  this->vtkCollection::AddItem(a);
99 }
100 
102 {
103  return static_cast<vtkActor*>(this->GetNextItemAsObject());
104 }
105 
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 
119 {
120  return this->GetNextActor();
121 }
122 
124 {
125  return this->GetLastActor();
126 }
127 
128 #endif
vtkActorCollection::GetLastActor
vtkActor * GetLastActor()
Get the last actor in the list.
Definition: vtkActorCollection.h:106
vtkCollectionSimpleIterator
void * vtkCollectionSimpleIterator
Definition: vtkCollection.h:48
vtkActorCollection::GetNextActor
vtkActor * GetNextActor(vtkCollectionSimpleIterator &cookie)
Reentrant safe way to get an object in a collection.
Definition: vtkActorCollection.h:77
vtkActorCollection::GetNextItem
vtkActor * GetNextItem()
Access routines that are provided for compatibility with previous version of VTK.
Definition: vtkActorCollection.h:118
vtkActorCollection::AddItem
void AddItem(vtkActor *a)
Add an actor to the bottom of the list.
Definition: vtkActorCollection.h:96
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:62
vtkCollectionElement::Item
vtkObject * Item
Definition: vtkCollection.h:45
vtkCollection::GetNextItemAsObject
vtkObject * GetNextItemAsObject()
Get the next item in the collection.
Definition: vtkCollection.h:179
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:45
vtkCollection::Bottom
vtkCollectionElement * Bottom
Definition: vtkCollection.h:166
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkPropCollection::AddItem
void AddItem(vtkProp *a)
Add a Prop to the bottom of the list.
Definition: vtkPropCollection.h:86
vtkActor.h
vtkActorCollection::GetLastItem
vtkActor * GetLastItem()
Definition: vtkActorCollection.h:123
vtkActorCollection::GetNextActor
vtkActor * GetNextActor()
Get the next actor in the list.
Definition: vtkActorCollection.h:101
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:56
vtkActorCollection
an ordered list of actors
Definition: vtkActorCollection.h:36
vtkPropCollection::New
static vtkPropCollection * New()
vtkCollection::AddItem
void AddItem(vtkObject *)
Add an object to the bottom of the list.
vtkCollection::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkProperty
represent surface properties of a geometric object
Definition: vtkProperty.h:61
vtkPropCollection
an ordered list of Props
Definition: vtkPropCollection.h:35
vtkPropCollection.h