1 /*=========================================================================
3 Program: Visualization Toolkit
4 Module: $RCSfile: vtkActor2DCollection.h,v $
6 Date: $Date: 2002/12/26 18:24:21 $
7 Version: $Revision: 1.28 $
9 Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
11 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notice for more information.
17 =========================================================================*/
18 // .NAME vtkActor2DCollection
19 // .SECTION Description
20 // vtkActor2DCollection is a subclass of vtkCollection. vtkActor2DCollection
21 // maintains a collection of vtkActor2D objects that is sorted by layer
22 // number, with lower layer numbers at the start of the list. This allows
23 // the vtkActor2D objects to be rendered in the correct order.
26 // vtkActor2D vtkCollection
28 #ifndef __vtkActor2DCollection_h
29 #define __vtkActor2DCollection_h
31 #include "vtkPropCollection.h"
33 #include "vtkActor2D.h" // Needed for inline methods
37 class VTK_COMMON_EXPORT vtkActor2DCollection : public vtkPropCollection
41 // Desctructor for the vtkActor2DCollection class. This removes all
42 // objects from the collection.
43 static vtkActor2DCollection *New();
45 vtkTypeRevisionMacro(vtkActor2DCollection,vtkPropCollection);
48 // Sorts the vtkActor2DCollection by layer number. Smaller layer
49 // numbers are first. Layer numbers can be any integer value.
53 // Add an actor to the list. The new actor is inserted in the list
54 // according to it's layer number.
55 void AddItem(vtkActor2D *a);
58 // Standard Collection methods
59 int IsItemPresent(vtkActor2D *a);
60 vtkActor2D *GetNextActor2D();
61 vtkActor2D *GetLastActor2D();
64 // Access routines that are provided for compatibility with previous
65 // version of VTK. Please use the GetNextActor2D(), GetLastActor2D()
66 // variants where possible.
67 vtkActor2D *GetNextItem();
68 vtkActor2D *GetLastItem();
72 // Sort and then render the collection of 2D actors.
73 void RenderOverlay(vtkViewport* viewport);
77 vtkActor2DCollection() {};
78 ~vtkActor2DCollection();
80 virtual void DeleteElement(vtkCollectionElement *);
83 // hide the standard AddItem from the user and the compiler.
84 void AddItem(vtkObject *o) { this->vtkCollection::AddItem(o); };
85 void AddItem(vtkProp *o) { this->vtkPropCollection::AddItem(o); };
86 int IsItemPresent(vtkObject *o) { return this->vtkCollection::IsItemPresent(o); };
89 vtkActor2DCollection(const vtkActor2DCollection&); // Not implemented.
90 void operator=(const vtkActor2DCollection&); // Not implemented.
93 inline int vtkActor2DCollection::IsItemPresent(vtkActor2D *a)
95 return this->vtkCollection::IsItemPresent((vtkObject *)a);
98 inline vtkActor2D *vtkActor2DCollection::GetNextActor2D()
100 return static_cast<vtkActor2D *>(this->GetNextItemAsObject());
103 inline vtkActor2D *vtkActor2DCollection::GetLastActor2D()
105 if ( this->Bottom == NULL )
111 return static_cast<vtkActor2D *>(this->Bottom->Item);
115 inline vtkActor2D *vtkActor2DCollection::GetNextItem()
117 return this->GetNextActor2D();
120 inline vtkActor2D *vtkActor2DCollection::GetLastItem()
122 return this->GetLastActor2D();