VTK  9.2.6
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 =========================================================================*/
39 #ifndef vtkPropCollection_h
40 #define vtkPropCollection_h
41 
42 #include "vtkCollection.h"
43 #include "vtkRenderingCoreModule.h" // For export macro
44 
45 #include "vtkProp.h" // Needed for inline methods
46 
47 class VTKRENDERINGCORE_EXPORT vtkPropCollection : public vtkCollection
48 {
49 public:
52  void PrintSelf(ostream& os, vtkIndent indent) override;
53 
57  void AddItem(vtkProp* a);
58 
62  vtkProp* GetNextProp();
63 
67  vtkProp* GetLastProp();
68 
76 
82  {
83  return static_cast<vtkProp*>(this->GetNextItemAsObject(cookie));
84  }
85 
86 protected:
87  vtkPropCollection() = default;
88  ~vtkPropCollection() override = default;
89 
90 private:
91  // hide the standard AddItem from the user and the compiler.
92  void AddItem(vtkObject* o) { this->vtkCollection::AddItem(o); }
93 
94 private:
95  vtkPropCollection(const vtkPropCollection&) = delete;
96  void operator=(const vtkPropCollection&) = delete;
97 };
98 
100 {
101  this->vtkCollection::AddItem(a);
102 }
103 
105 {
106  return static_cast<vtkProp*>(this->GetNextItemAsObject());
107 }
108 
110 {
111  if (this->Bottom == nullptr)
112  {
113  return nullptr;
114  }
115  else
116  {
117  return static_cast<vtkProp*>(this->Bottom->Item);
118  }
119 }
120 
121 #endif
create and manipulate ordered lists of objects
Definition: vtkCollection.h:56
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:49
abstract base class for most VTK objects
Definition: vtkObject.h:72
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:51