VTK  9.3.0
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
27 #ifndef vtkPropCollection_h
28 #define vtkPropCollection_h
29 
30 #include "vtkCollection.h"
31 #include "vtkRenderingCoreModule.h" // For export macro
32 
33 #include "vtkProp.h" // Needed for inline methods
34 
35 VTK_ABI_NAMESPACE_BEGIN
36 class VTKRENDERINGCORE_EXPORT vtkPropCollection : public vtkCollection
37 {
38 public:
41  void PrintSelf(ostream& os, vtkIndent indent) override;
42 
46  void AddItem(vtkProp* a);
47 
51  vtkProp* GetNextProp();
52 
56  vtkProp* GetLastProp();
57 
65 
71  {
72  return static_cast<vtkProp*>(this->GetNextItemAsObject(cookie));
73  }
74 
75 protected:
76  vtkPropCollection() = default;
77  ~vtkPropCollection() override = default;
78 
79 private:
80  // hide the standard AddItem from the user and the compiler.
81  void AddItem(vtkObject* o) { this->vtkCollection::AddItem(o); }
82 
83  vtkPropCollection(const vtkPropCollection&) = delete;
84  void operator=(const vtkPropCollection&) = delete;
85 };
86 
88 {
89  this->vtkCollection::AddItem(a);
90 }
91 
93 {
94  return static_cast<vtkProp*>(this->GetNextItemAsObject());
95 }
96 
98 {
99  if (this->Bottom == nullptr)
100  {
101  return nullptr;
102  }
103  else
104  {
105  return static_cast<vtkProp*>(this->Bottom->Item);
106  }
107 }
108 
109 VTK_ABI_NAMESPACE_END
110 #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:38
abstract base class for most VTK objects
Definition: vtkObject.h:61
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:55
void * vtkCollectionSimpleIterator
Definition: vtkCollection.h:40