VTK  9.7.1
vtkProp3DCollection.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 vtkProp3DCollection_h
19 #define vtkProp3DCollection_h
20 
21 #include "vtkProp3D.h" // Needed for inline methods
22 #include "vtkPropCollection.h"
23 #include "vtkRenderingCoreModule.h" // For export macro
24 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
25 
26 VTK_ABI_NAMESPACE_BEGIN
27 class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkProp3DCollection : public vtkPropCollection
28 {
29 public:
30  static vtkProp3DCollection* New();
32  void PrintSelf(ostream& os, vtkIndent indent) override;
33 
37  void AddItem(vtkProp3D* p);
38 
42  vtkProp3D* GetNextProp3D();
43 
47  vtkProp3D* GetLastProp3D();
48 
54  {
55  return static_cast<vtkProp3D*>(this->GetNextItemAsObject(cookie));
56  }
57 
58 protected:
59  vtkProp3DCollection() = default;
60  ~vtkProp3DCollection() override = default;
61 
62 private:
63  // hide the standard AddItem from the user and the compiler.
64  void AddItem(vtkObject* o) { this->vtkCollection::AddItem(o); }
65  void AddItem(vtkProp* o) { this->vtkPropCollection::AddItem(o); }
66 
68  void operator=(const vtkProp3DCollection&) = delete;
69 };
70 
72 {
73  this->vtkCollection::AddItem(a);
74 }
75 
77 {
78  return static_cast<vtkProp3D*>(this->GetNextItemAsObject());
79 }
80 
82 {
83  int numItems = this->GetNumberOfItems();
84  if (numItems == 0)
85  {
86  return nullptr;
87  }
88  else
89  {
90  return static_cast<vtkProp3D*>(this->GetItemAsObject(numItems - 1));
91  }
92 }
93 
94 VTK_ABI_NAMESPACE_END
95 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:49
void * vtkCollectionSimpleIterator
Definition: vtkCollection.h:35
abstract base class for most VTK objects
Definition: vtkObject.h:52
int GetNumberOfItems() VTK_FUTURE_CONST
Return the number of items in the collection.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:39
vtkProp3D * GetNextProp3D(vtkCollectionSimpleIterator &cookie)
Reentrant safe way to get an object in a collection.
an ordered list of Props
a simple class to control print indentation
Definition: vtkIndent.h:28
vtkObject * GetItemAsObject(int i) VTK_FUTURE_CONST
Get the i'th item in the collection.
an ordered list of 3D props
void AddItem(vtkObject *)
Add given item to the bottom (end) of the collection.
void AddItem(vtkProp *a)
Add a Prop to the bottom of the list.
vtkProp3D * GetNextProp3D()
Get the next actor in the list.
#define VTK_MARSHALAUTO
vtkObject * GetNextItemAsObject()
Get the next item in the collection.
static vtkPropCollection * New()
void AddItem(vtkProp3D *p)
Add an actor to the bottom of the list.
vtkProp3D * GetLastProp3D()
Get the last actor in the list.