VTK  9.2.6
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  void PrintSelf(ostream& os, vtkIndent indent) override;
49 
54  void Sort();
55 
60  void AddItem(vtkActor2D* a);
61 
63 
66  int IsItemPresent(vtkActor2D* a);
67  vtkActor2D* GetNextActor2D();
68  vtkActor2D* GetLastActor2D();
70 
72 
77  vtkActor2D* GetNextItem();
78  vtkActor2D* GetLastItem();
80 
84  void RenderOverlay(vtkViewport* viewport);
85 
91  {
92  return static_cast<vtkActor2D*>(this->GetNextItemAsObject(cookie));
93  }
94 
95 protected:
96  vtkActor2DCollection() = default;
97  ~vtkActor2DCollection() override;
98 
99  void DeleteElement(vtkCollectionElement*) override;
100 
101 private:
102  // hide the standard AddItem from the user and the compiler.
103  void AddItem(vtkObject* o) { this->vtkCollection::AddItem(o); }
104  void AddItem(vtkProp* o) { this->vtkPropCollection::AddItem(o); }
105  int IsItemPresent(vtkObject* o) { return this->vtkCollection::IsItemPresent(o); }
106 
107 private:
109  void operator=(const vtkActor2DCollection&) = delete;
110 };
111 
113 {
114  return this->vtkCollection::IsItemPresent(a);
115 }
116 
118 {
119  return static_cast<vtkActor2D*>(this->GetNextItemAsObject());
120 }
121 
123 {
124  if (this->Bottom == nullptr)
125  {
126  return nullptr;
127  }
128  else
129  {
130  return static_cast<vtkActor2D*>(this->Bottom->Item);
131  }
132 }
133 
135 {
136  return this->GetNextActor2D();
137 }
138 
140 {
141  return this->GetLastActor2D();
142 }
143 
144 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:56
void * vtkCollectionSimpleIterator
Definition: vtkCollection.h:51
a list of 2D actors
abstract base class for most VTK objects
Definition: vtkObject.h:62
virtual void DeleteElement(vtkCollectionElement *)
abstract specification for Viewports
Definition: vtkViewport.h:55
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a actor that draws 2D data
Definition: vtkActor2D.h:45
void Sort(RandomIt bitr, RandomIt eitr, BackToFront< T > &me)
vtkActor2D * GetLastActor2D()
Standard Collection methods.
int IsItemPresent(vtkObject *a)
Search for an object and return location in list.
an ordered list of Props
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkActor2D * GetNextItem()
Access routines that are provided for compatibility with previous version of VTK. ...
vtkCollectionElement * Bottom
void AddItem(vtkObject *)
Add an object to the bottom of the list.
int IsItemPresent(vtkActor2D *a)
Standard Collection methods.
void AddItem(vtkProp *a)
Add a Prop to the bottom of the list.
vtkActor2D * GetNextActor2D(vtkCollectionSimpleIterator &cookie)
Reentrant safe way to get an object in a collection.
vtkActor2D * GetNextActor2D()
Standard Collection methods.
vtkObject * GetNextItemAsObject()
Get the next item in the collection.
static vtkPropCollection * New()
vtkActor2D * GetLastItem()
Access routines that are provided for compatibility with previous version of VTK. ...