VTK  9.3.20240328
vtkPropCollection.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
67 #ifndef vtkPropCollection_h
68 #define vtkPropCollection_h
69 
70 #include "vtkCollection.h"
71 #include "vtkRenderingCoreModule.h" // For export macro
72 
73 #include "vtkProp.h" // Needed for inline methods
74 
75 VTK_ABI_NAMESPACE_BEGIN
76 class VTKRENDERINGCORE_EXPORT vtkPropCollection : public vtkCollection
77 {
78 public:
81  void PrintSelf(ostream& os, vtkIndent indent) override;
82 
86  void AddItem(vtkProp* a);
87 
91  vtkProp* GetNextProp();
92 
96  vtkProp* GetLastProp();
97 
105 
111  {
112  return static_cast<vtkProp*>(this->GetNextItemAsObject(cookie));
113  }
114 
115 protected:
116  vtkPropCollection() = default;
117  ~vtkPropCollection() override = default;
118 
119 private:
120  // hide the standard AddItem from the user and the compiler.
121  void AddItem(vtkObject* o) { this->vtkCollection::AddItem(o); }
122 
123  vtkPropCollection(const vtkPropCollection&) = delete;
124  void operator=(const vtkPropCollection&) = delete;
125 };
126 
128 {
129  this->vtkCollection::AddItem(a);
130 }
131 
133 {
134  return static_cast<vtkProp*>(this->GetNextItemAsObject());
135 }
136 
138 {
139  if (this->Bottom == nullptr)
140  {
141  return nullptr;
142  }
143  else
144  {
145  return static_cast<vtkProp*>(this->Bottom->Item);
146  }
147 }
148 
149 VTK_ABI_NAMESPACE_END
150 #endif
create and manipulate ordered lists of objects
Definition: vtkCollection.h:45
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:108
abstract base class for most VTK objects
Definition: vtkObject.h:161
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:65
void * vtkCollectionSimpleIterator
Definition: vtkCollection.h:40