VTK  9.0.20210730
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 =========================================================================*/
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 class VTKRENDERINGCORE_EXPORT vtkPropCollection : public vtkCollection
36 {
37 public:
40  void PrintSelf(ostream& os, vtkIndent indent) override;
41 
45  void AddItem(vtkProp* a);
46 
50  vtkProp* GetNextProp();
51 
55  vtkProp* GetLastProp();
56 
64 
70  {
71  return static_cast<vtkProp*>(this->GetNextItemAsObject(cookie));
72  }
73 
74 protected:
75  vtkPropCollection() = default;
76  ~vtkPropCollection() override = default;
77 
78 private:
79  // hide the standard AddItem from the user and the compiler.
80  void AddItem(vtkObject* o) { this->vtkCollection::AddItem(o); }
81 
82 private:
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 #endif
vtkCollectionSimpleIterator
void * vtkCollectionSimpleIterator
Definition: vtkCollection.h:48
vtkPropCollection::vtkPropCollection
vtkPropCollection()=default
vtkCollection.h
vtkPropCollection::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkPropCollection::GetNextProp
vtkProp * GetNextProp(vtkCollectionSimpleIterator &cookie)
Reentrant safe way to get an object in a collection.
Definition: vtkPropCollection.h:69
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:63
vtkProp.h
vtkCollectionElement::Item
vtkObject * Item
Definition: vtkCollection.h:45
vtkCollection::GetNextItemAsObject
vtkObject * GetNextItemAsObject()
Get the next item in the collection.
Definition: vtkCollection.h:179
vtkPropCollection::GetLastProp
vtkProp * GetLastProp()
Get the last Prop in the list.
Definition: vtkPropCollection.h:97
vtkCollection
create and manipulate ordered lists of objects
Definition: vtkCollection.h:53
vtkCollection::Bottom
vtkCollectionElement * Bottom
Definition: vtkCollection.h:166
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:34
vtkPropCollection::~vtkPropCollection
~vtkPropCollection() override=default
vtkPropCollection::AddItem
void AddItem(vtkProp *a)
Add a Prop to the bottom of the list.
Definition: vtkPropCollection.h:87
vtkPropCollection::GetNumberOfPaths
int GetNumberOfPaths()
Get the number of paths contained in this list.
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:57
vtkPropCollection::New
static vtkPropCollection * New()
vtkCollection::AddItem
void AddItem(vtkObject *)
Add an object to the bottom of the list.
vtkPropCollection
an ordered list of Props
Definition: vtkPropCollection.h:36
vtkPropCollection::GetNextProp
vtkProp * GetNextProp()
Get the next Prop in the list.
Definition: vtkPropCollection.h:92