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:
45  static vtkActor2DCollection* New();
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:
96  ~vtkActor2DCollection() override;
97 
98  void DeleteElement(vtkCollectionElement*) override;
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
vtkActor2DCollection::IsItemPresent
int IsItemPresent(vtkActor2D *a)
Standard Collection methods.
Definition: vtkActor2DCollection.h:111
vtkCollection::DeleteElement
virtual void DeleteElement(vtkCollectionElement *)
vtkCollectionSimpleIterator
void * vtkCollectionSimpleIterator
Definition: vtkCollection.h:48
vtkActor2DCollection::GetLastActor2D
vtkActor2D * GetLastActor2D()
Definition: vtkActor2DCollection.h:121
vtkActor2DCollection::GetLastItem
vtkActor2D * GetLastItem()
Definition: vtkActor2DCollection.h:138
vtkCollection::IsItemPresent
int IsItemPresent(vtkObject *a)
Search for an object and return location in list.
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:62
vtkActor2DCollection::vtkActor2DCollection
vtkActor2DCollection()
Definition: vtkActor2DCollection.h:95
vtkCollectionElement::Item
vtkObject * Item
Definition: vtkCollection.h:45
vtkCollection::GetNextItemAsObject
vtkObject * GetNextItemAsObject()
Get the next item in the collection.
Definition: vtkCollection.h:179
vtkActor2DCollection::GetNextItem
vtkActor2D * GetNextItem()
Access routines that are provided for compatibility with previous version of VTK.
Definition: vtkActor2DCollection.h:133
vtkActor2DCollection::GetNextActor2D
vtkActor2D * GetNextActor2D()
Definition: vtkActor2DCollection.h:116
vtkCollection::Bottom
vtkCollectionElement * Bottom
Definition: vtkCollection.h:166
vtkPropCollection::AddItem
void AddItem(vtkProp *a)
Add a Prop to the bottom of the list.
Definition: vtkPropCollection.h:86
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:44
vtkActor2DCollection::GetNextActor2D
vtkActor2D * GetNextActor2D(vtkCollectionSimpleIterator &cookie)
Reentrant safe way to get an object in a collection.
Definition: vtkActor2DCollection.h:89
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:53
vtkActor2D
a actor that draws 2D data
Definition: vtkActor2D.h:39
vtkActor2D.h
vtkPropCollection::New
static vtkPropCollection * New()
vtkActor2DCollection
a list of 2D actors
Definition: vtkActor2DCollection.h:38
vtkCollection::AddItem
void AddItem(vtkObject *)
Add an object to the bottom of the list.
vtkCollectionElement
Definition: vtkCollection.h:37
vtkPropCollection
an ordered list of Props
Definition: vtkPropCollection.h:35
vtkPropCollection.h