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 =========================================================================*/
30 #ifndef vtkPropCollection_h
31 #define vtkPropCollection_h
32 
33 #include "vtkCollection.h"
34 #include "vtkRenderingCoreModule.h" // For export macro
35 
36 #include "vtkProp.h" // Needed for inline methods
37 
38 class VTKRENDERINGCORE_EXPORT vtkPropCollection : public vtkCollection
39 {
40 public:
41  static vtkPropCollection* New();
43  void PrintSelf(ostream& os, vtkIndent indent) override;
44 
48  void AddItem(vtkProp* a);
49 
53  vtkProp* GetNextProp();
54 
58  vtkProp* GetLastProp();
59 
66  int GetNumberOfPaths();
67 
73  {
74  return static_cast<vtkProp*>(this->GetNextItemAsObject(cookie));
75  }
76 
77 protected:
78  vtkPropCollection() = default;
79  ~vtkPropCollection() override = default;
80 
81 private:
82  // hide the standard AddItem from the user and the compiler.
83  void AddItem(vtkObject* o) { this->vtkCollection::AddItem(o); }
84 
85 private:
86  vtkPropCollection(const vtkPropCollection&) = delete;
87  void operator=(const vtkPropCollection&) = delete;
88 };
89 
91 {
92  this->vtkCollection::AddItem(a);
93 }
94 
96 {
97  return static_cast<vtkProp*>(this->GetNextItemAsObject());
98 }
99 
101 {
102  if (this->Bottom == nullptr)
103  {
104  return nullptr;
105  }
106  else
107  {
108  return static_cast<vtkProp*>(this->Bottom->Item);
109  }
110 }
111 
112 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:56
void * vtkCollectionSimpleIterator
Definition: vtkCollection.h:51
vtkProp * GetNextProp(vtkCollectionSimpleIterator &cookie)
Reentrant safe way to get an object in a collection.
abstract base class for most VTK objects
Definition: vtkObject.h:62
an ordered list of Props
a simple class to control print indentation
Definition: vtkIndent.h:39
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:55
vtkProp * GetNextProp()
Get the next Prop in the list.
vtkObject * GetNextItemAsObject()
Get the next item in the collection.