VTK  9.1.0
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 =========================================================================*/
76 #ifndef vtkPropCollection_h
77 #define vtkPropCollection_h
78 
79 #include "vtkCollection.h"
80 #include "vtkRenderingCoreModule.h" // For export macro
81 
82 #include "vtkProp.h" // Needed for inline methods
83 
84 class VTKRENDERINGCORE_EXPORT vtkPropCollection : public vtkCollection
85 {
86 public:
89  void PrintSelf(ostream& os, vtkIndent indent) override;
90 
94  void AddItem(vtkProp* a);
95 
99  vtkProp* GetNextProp();
100 
104  vtkProp* GetLastProp();
105 
113 
119  {
120  return static_cast<vtkProp*>(this->GetNextItemAsObject(cookie));
121  }
122 
123 protected:
124  vtkPropCollection() = default;
125  ~vtkPropCollection() override = default;
126 
127 private:
128  // hide the standard AddItem from the user and the compiler.
129  void AddItem(vtkObject* o) { this->vtkCollection::AddItem(o); }
130 
131 private:
132  vtkPropCollection(const vtkPropCollection&) = delete;
133  void operator=(const vtkPropCollection&) = delete;
134 };
135 
137 {
138  this->vtkCollection::AddItem(a);
139 }
140 
142 {
143  return static_cast<vtkProp*>(this->GetNextItemAsObject());
144 }
145 
147 {
148  if (this->Bottom == nullptr)
149  {
150  return nullptr;
151  }
152  else
153  {
154  return static_cast<vtkProp*>(this->Bottom->Item);
155  }
156 }
157 
158 #endif
create and manipulate ordered lists of objects
Definition: vtkCollection.h:53
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
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:67
void * vtkCollectionSimpleIterator
Definition: vtkCollection.h:48