VTK  9.3.1
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
18 #ifndef vtkPropCollection_h
19 #define vtkPropCollection_h
20 
21 #include "vtkCollection.h"
22 #include "vtkRenderingCoreModule.h" // For export macro
23 
24 #include "vtkProp.h" // Needed for inline methods
25 
26 VTK_ABI_NAMESPACE_BEGIN
27 class VTKRENDERINGCORE_EXPORT vtkPropCollection : public vtkCollection
28 {
29 public:
30  static vtkPropCollection* New();
32  void PrintSelf(ostream& os, vtkIndent indent) override;
33 
37  void AddItem(vtkProp* a);
38 
42  vtkProp* GetNextProp();
43 
47  vtkProp* GetLastProp();
48 
55  int GetNumberOfPaths();
56 
62  {
63  return static_cast<vtkProp*>(this->GetNextItemAsObject(cookie));
64  }
65 
66 protected:
67  vtkPropCollection() = default;
68  ~vtkPropCollection() override = default;
69 
70 private:
71  // hide the standard AddItem from the user and the compiler.
72  void AddItem(vtkObject* o) { this->vtkCollection::AddItem(o); }
73 
74  vtkPropCollection(const vtkPropCollection&) = delete;
75  void operator=(const vtkPropCollection&) = delete;
76 };
77 
79 {
80  this->vtkCollection::AddItem(a);
81 }
82 
84 {
85  return static_cast<vtkProp*>(this->GetNextItemAsObject());
86 }
87 
89 {
90  if (this->Bottom == nullptr)
91  {
92  return nullptr;
93  }
94  else
95  {
96  return static_cast<vtkProp*>(this->Bottom->Item);
97  }
98 }
99 
100 VTK_ABI_NAMESPACE_END
101 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:45
void * vtkCollectionSimpleIterator
Definition: vtkCollection.h:40
vtkProp * GetNextProp(vtkCollectionSimpleIterator &cookie)
Reentrant safe way to get an object in a collection.
abstract base class for most VTK objects
Definition: vtkObject.h:51
an ordered list of Props
a simple class to control print indentation
Definition: vtkIndent.h:28
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkCollection * New()
Construct with empty list.
vtkProp * GetLastProp()
Get the last Prop in the list.
vtkCollectionElement * Bottom
void AddItem(vtkObject *)
Add an object to the bottom of the list.
void AddItem(vtkProp *a)
Add a Prop to the bottom of the list.
create and manipulate ordered lists of objects
Definition: vtkCollection.h:44
vtkProp * GetNextProp()
Get the next Prop in the list.
vtkObject * GetNextItemAsObject()
Get the next item in the collection.