VTK  9.3.20240419
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 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
73 
74 #include "vtkProp.h" // Needed for inline methods
75 
76 VTK_ABI_NAMESPACE_BEGIN
77 class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkPropCollection : public vtkCollection
78 {
79 public:
82  void PrintSelf(ostream& os, vtkIndent indent) override;
83 
87  void AddItem(vtkProp* a);
88 
92  vtkProp* GetNextProp();
93 
97  vtkProp* GetLastProp();
98 
106 
112  {
113  return static_cast<vtkProp*>(this->GetNextItemAsObject(cookie));
114  }
115 
116 protected:
117  vtkPropCollection() = default;
118  ~vtkPropCollection() override = default;
119 
120 private:
121  // hide the standard AddItem from the user and the compiler.
122  void AddItem(vtkObject* o) { this->vtkCollection::AddItem(o); }
123 
124  vtkPropCollection(const vtkPropCollection&) = delete;
125  void operator=(const vtkPropCollection&) = delete;
126 };
127 
129 {
130  this->vtkCollection::AddItem(a);
131 }
132 
134 {
135  return static_cast<vtkProp*>(this->GetNextItemAsObject());
136 }
137 
139 {
140  if (this->Bottom == nullptr)
141  {
142  return nullptr;
143  }
144  else
145  {
146  return static_cast<vtkProp*>(this->Bottom->Item);
147  }
148 }
149 
150 VTK_ABI_NAMESPACE_END
151 #endif
create and manipulate ordered lists of objects
Definition: vtkCollection.h:46
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:162
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:66
void * vtkCollectionSimpleIterator
Definition: vtkCollection.h:41
#define VTK_MARSHALAUTO