VTK  9.0.1
vtkActor2DCollection.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkActor2DCollection.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 =========================================================================*/
28 #ifndef vtkActor2DCollection_h
29 #define vtkActor2DCollection_h
30 
31 #include "vtkPropCollection.h"
32 #include "vtkRenderingCoreModule.h" // For export macro
33 
34 #include "vtkActor2D.h" // Needed for inline methods
35 
36 class vtkViewport;
37 
38 class VTKRENDERINGCORE_EXPORT vtkActor2DCollection : public vtkPropCollection
39 {
40 public:
46 
48 
53  void Sort();
54 
59  void AddItem(vtkActor2D* a);
60 
62 
65  int IsItemPresent(vtkActor2D* a);
66  vtkActor2D* GetNextActor2D();
67  vtkActor2D* GetLastActor2D();
69 
71 
76  vtkActor2D* GetNextItem();
77  vtkActor2D* GetLastItem();
79 
83  void RenderOverlay(vtkViewport* viewport);
84 
90  {
91  return static_cast<vtkActor2D*>(this->GetNextItemAsObject(cookie));
92  }
93 
94 protected:
97 
99 
100 private:
101  // hide the standard AddItem from the user and the compiler.
102  void AddItem(vtkObject* o) { this->vtkCollection::AddItem(o); }
103  void AddItem(vtkProp* o) { this->vtkPropCollection::AddItem(o); }
104  int IsItemPresent(vtkObject* o) { return this->vtkCollection::IsItemPresent(o); }
105 
106 private:
108  void operator=(const vtkActor2DCollection&) = delete;
109 };
110 
112 {
113  return this->vtkCollection::IsItemPresent(a);
114 }
115 
117 {
118  return static_cast<vtkActor2D*>(this->GetNextItemAsObject());
119 }
120 
122 {
123  if (this->Bottom == nullptr)
124  {
125  return nullptr;
126  }
127  else
128  {
129  return static_cast<vtkActor2D*>(this->Bottom->Item);
130  }
131 }
132 
134 {
135  return this->GetNextActor2D();
136 }
137 
139 {
140  return this->GetLastActor2D();
141 }
142 
143 #endif
144 
145 // VTK-HeaderTest-Exclude: vtkActor2DCollection.h
a list of 2D actors
void AddItem(vtkActor2D *a)
Add an actor to the list.
static vtkActor2DCollection * New()
Destructor for the vtkActor2DCollection class.
void DeleteElement(vtkCollectionElement *) override
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
void RenderOverlay(vtkViewport *viewport)
Sort and then render the collection of 2D actors.
int IsItemPresent(vtkActor2D *a)
Standard Collection methods.
a actor that draws 2D data
Definition: vtkActor2D.h:40
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.
abstract base class for most VTK objects
Definition: vtkObject.h:54
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:48
abstract specification for Viewports
Definition: vtkViewport.h:45
void * vtkCollectionSimpleIterator
Definition: vtkCollection.h:48