VTK  9.2.20220809
vtkPropCollection.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPropCollection.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 =========================================================================*/
79 #ifndef vtkPropCollection_h
80 #define vtkPropCollection_h
81 
82 #include "vtkCollection.h"
83 #include "vtkRenderingCoreModule.h" // For export macro
84 
85 #include "vtkProp.h" // Needed for inline methods
86 
87 class VTKRENDERINGCORE_EXPORT vtkPropCollection : public vtkCollection
88 {
89 public:
92  void PrintSelf(ostream& os, vtkIndent indent) override;
93 
97  void AddItem(vtkProp* a);
98 
102  vtkProp* GetNextProp();
103 
107  vtkProp* GetLastProp();
108 
116 
122  {
123  return static_cast<vtkProp*>(this->GetNextItemAsObject(cookie));
124  }
125 
126 protected:
127  vtkPropCollection() = default;
128  ~vtkPropCollection() override = default;
129 
130 private:
131  // hide the standard AddItem from the user and the compiler.
132  void AddItem(vtkObject* o) { this->vtkCollection::AddItem(o); }
133 
134 private:
135  vtkPropCollection(const vtkPropCollection&) = delete;
136  void operator=(const vtkPropCollection&) = delete;
137 };
138 
140 {
141  this->vtkCollection::AddItem(a);
142 }
143 
145 {
146  return static_cast<vtkProp*>(this->GetNextItemAsObject());
147 }
148 
150 {
151  if (this->Bottom == nullptr)
152  {
153  return nullptr;
154  }
155  else
156  {
157  return static_cast<vtkProp*>(this->Bottom->Item);
158  }
159 }
160 
161 #endif
create and manipulate ordered lists of objects
Definition: vtkCollection.h:56
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
vtkPropCollection()=default
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkProp * GetNextProp(vtkCollectionSimpleIterator &cookie)
Reentrant safe way to get an object in a collection.
void AddItem(vtkProp *a)
Add a Prop to the bottom of the list.
static vtkPropCollection * New()
int GetNumberOfPaths()
Get the number of paths contained in this list.
~vtkPropCollection() override=default
vtkProp * GetLastProp()
Get the last Prop in the list.
vtkProp * GetNextProp()
Get the next Prop in the list.
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:76
void * vtkCollectionSimpleIterator
Definition: vtkCollection.h:51