VTK  9.6.20260221
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
15
16#ifndef vtkActor2DCollection_h
17#define vtkActor2DCollection_h
18
19#include "vtkPropCollection.h"
20#include "vtkRenderingCoreModule.h" // For export macro
21#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
22
23#include "vtkActor2D.h" // Needed for inline methods
24
25VTK_ABI_NAMESPACE_BEGIN
26class vtkViewport;
27
28class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkActor2DCollection : public vtkPropCollection
29{
30public:
36
38 void PrintSelf(ostream& os, vtkIndent indent) override;
39
44 void Sort();
45
51
53
61
63
71
75 void RenderOverlay(vtkViewport* viewport);
76
82 {
83 return static_cast<vtkActor2D*>(this->GetNextItemAsObject(cookie));
84 }
85
86protected:
89
90private:
91 // hide the standard AddItem from the user and the compiler.
92 void AddItem(vtkObject* o) { this->vtkCollection::AddItem(o); }
93 void AddItem(vtkProp* o) { this->vtkPropCollection::AddItem(o); }
94 int IsItemPresent(vtkObject* o) { return this->vtkCollection::IsItemPresent(o); }
95 int IndexOfFirstOccurrence(vtkObject* o)
96 {
98 }
99
100 vtkActor2DCollection(const vtkActor2DCollection&) = delete;
101 void operator=(const vtkActor2DCollection&) = delete;
102};
103
108
113
115{
116 return static_cast<vtkActor2D*>(this->GetNextItemAsObject());
117}
118
120{
121 int numItems = this->GetNumberOfItems();
122 if (numItems == 0)
123 {
124 return nullptr;
125 }
126 else
127 {
128 return static_cast<vtkActor2D*>(this->GetItemAsObject(numItems - 1));
129 }
130}
131
133{
134 return this->GetNextActor2D();
135}
136
138{
139 return this->GetLastActor2D();
140}
141
142VTK_ABI_NAMESPACE_END
143#endif
vtkActor2DCollection()=default
void AddItem(vtkActor2D *a)
Add an actor to the list.
static vtkActor2DCollection * New()
Destructor for the vtkActor2DCollection class.
vtkActor2D * GetLastActor2D()
Standard Collection methods.
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 IndexOfFirstOccurrence(vtkActor2D *a)
Standard Collection methods.
vtkActor2D * GetNextActor2D(vtkCollectionSimpleIterator &cookie)
Reentrant safe way to get an object in a collection.
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:145
int IndexOfFirstOccurrence(vtkObject *a) const
Search for the given item and return the 0-based index of its first occurrence in the collection.
int IsItemPresent(vtkObject *a) VTK_FUTURE_CONST
Search for the given item and return the 1-based index of its first occurrence in the collection.
void AddItem(vtkObject *)
Add given item to the bottom (end) of the collection.
int GetNumberOfItems() VTK_FUTURE_CONST
Return the number of items in the collection.
vtkObject * GetItemAsObject(int i) VTK_FUTURE_CONST
Get the i'th item in the collection.
vtkObject * GetNextItemAsObject()
Get the next item in the collection.
a simple class to control print indentation
Definition vtkIndent.h:108
vtkPropCollection()=default
void AddItem(vtkProp *a)
Add a Prop to the bottom of the list.
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:69
abstract specification for Viewports
Definition vtkViewport.h:66
void * vtkCollectionSimpleIterator
#define VTK_MARSHALAUTO