VTK  9.3.20240327
vtkActor2DCollection.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
16 #ifndef vtkActor2DCollection_h
17 #define vtkActor2DCollection_h
18 
19 #include "vtkPropCollection.h"
20 #include "vtkRenderingCoreModule.h" // For export macro
21 
22 #include "vtkActor2D.h" // Needed for inline methods
23 
24 VTK_ABI_NAMESPACE_BEGIN
25 class vtkViewport;
26 
27 class VTKRENDERINGCORE_EXPORT vtkActor2DCollection : public vtkPropCollection
28 {
29 public:
35 
37  void PrintSelf(ostream& os, vtkIndent indent) override;
38 
43  void Sort();
44 
49  void AddItem(vtkActor2D* a);
50 
52 
55  int IsItemPresent(vtkActor2D* a);
57  vtkActor2D* GetNextActor2D();
58  vtkActor2D* GetLastActor2D();
60 
62 
67  vtkActor2D* GetNextItem();
68  vtkActor2D* GetLastItem();
70 
74  void RenderOverlay(vtkViewport* viewport);
75 
81  {
82  return static_cast<vtkActor2D*>(this->GetNextItemAsObject(cookie));
83  }
84 
85 protected:
86  vtkActor2DCollection() = default;
88 
90 
91 private:
92  // hide the standard AddItem from the user and the compiler.
93  void AddItem(vtkObject* o) { this->vtkCollection::AddItem(o); }
94  void AddItem(vtkProp* o) { this->vtkPropCollection::AddItem(o); }
95  int IsItemPresent(vtkObject* o) { return this->vtkCollection::IsItemPresent(o); }
97 
99  void operator=(const vtkActor2DCollection&) = delete;
100 };
101 
103 {
104  return this->vtkCollection::IsItemPresent(a);
105 }
106 
108 {
109  return this->vtkCollection::IndexOfFirstOccurence(a);
110 }
111 
113 {
114  return static_cast<vtkActor2D*>(this->GetNextItemAsObject());
115 }
116 
118 {
119  if (this->Bottom == nullptr)
120  {
121  return nullptr;
122  }
123  else
124  {
125  return static_cast<vtkActor2D*>(this->Bottom->Item);
126  }
127 }
128 
130 {
131  return this->GetNextActor2D();
132 }
133 
135 {
136  return this->GetLastActor2D();
137 }
138 
139 VTK_ABI_NAMESPACE_END
140 #endif
a list of 2D actors
vtkActor2DCollection()=default
void AddItem(vtkActor2D *a)
Add an actor to the list.
static vtkActor2DCollection * New()
Destructor for the vtkActor2DCollection class.
void DeleteElement(vtkCollectionElement *) override
vtkActor2D * GetLastActor2D()
Standard Collection methods.
vtkActor2D * GetNextActor2D(vtkCollectionSimpleIterator &cookie)
Reentrant safe way to get an object in a collection.
void Sort()
Sorts the vtkActor2DCollection by layer number.
vtkActor2D * GetNextItem()
Access routines that are provided for compatibility with previous version of VTK.
~vtkActor2DCollection() override
int IndexOfFirstOccurence(vtkActor2D *a)
Standard Collection methods.
void RenderOverlay(vtkViewport *viewport)
Sort and then render the collection of 2D actors.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkActor2D * GetNextActor2D()
Standard Collection methods.
int IsItemPresent(vtkActor2D *a)
Standard Collection methods.
vtkActor2D * GetLastItem()
Access routines that are provided for compatibility with previous version of VTK.
a actor that draws 2D data
Definition: vtkActor2D.h:144
int IndexOfFirstOccurence(vtkObject *a)
Search for an object and return location in list.
vtkCollectionElement * Bottom
void AddItem(vtkObject *)
Add an object to the bottom of the list.
vtkObject * GetNextItemAsObject()
Get the next item in the collection.
int IsItemPresent(vtkObject *a)
Search for an object and return location in list.
a simple class to control print indentation
Definition: vtkIndent.h:108
abstract base class for most VTK objects
Definition: vtkObject.h:161
an ordered list of Props
void AddItem(vtkProp *a)
Add a Prop to the bottom of the list.
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:65
abstract specification for Viewports
Definition: vtkViewport.h:64
void * vtkCollectionSimpleIterator
Definition: vtkCollection.h:40