1 /*========================================================================= 2 3 Program: Visualization Toolkit 4 Module: vtkRendererCollection.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 =========================================================================*/ 15 /** 16 * @class vtkRendererCollection 17 * @brief an ordered list of renderers 18 * 19 * vtkRendererCollection represents and provides methods to manipulate a list 20 * of renderers (i.e., vtkRenderer and subclasses). The list is ordered and 21 * duplicate entries are not prevented. 22 * 23 * @sa 24 * vtkRenderer vtkCollection 25 */ 26 27 #ifndef vtkRendererCollection_h 28 #define vtkRendererCollection_h 29 30 #include "vtkCollection.h" 31 #include "vtkRenderer.h" // Needed for static cast 32 #include "vtkRenderingCoreModule.h" // For export macro 33 34 class VTKRENDERINGCORE_EXPORT vtkRendererCollection : public vtkCollection 35 { 36 public: 37 static vtkRendererCollection* New(); 38 vtkTypeMacro(vtkRendererCollection, vtkCollection); 39 void PrintSelf(ostream& os, vtkIndent indent) override; 40 41 /** 42 * Add a Renderer to the bottom of the list. 43 */ AddItem(vtkRenderer * a)44 void AddItem(vtkRenderer* a) { this->vtkCollection::AddItem(a); } 45 46 /** 47 * Get the next Renderer in the list. 48 * Return NULL when at the end of the list. 49 */ GetNextItem()50 vtkRenderer* GetNextItem() { return static_cast<vtkRenderer*>(this->GetNextItemAsObject()); } 51 52 /** 53 * Forward the Render() method to each renderer in the list. 54 */ 55 void Render(); 56 57 /** 58 * Get the first Renderer in the list. 59 * Return NULL when at the end of the list. 60 */ 61 vtkRenderer* GetFirstRenderer(); 62 63 /** 64 * Reentrant safe way to get an object in a collection. Just pass the 65 * same cookie back and forth. 66 */ GetNextRenderer(vtkCollectionSimpleIterator & cookie)67 vtkRenderer* GetNextRenderer(vtkCollectionSimpleIterator& cookie) 68 { 69 return static_cast<vtkRenderer*>(this->GetNextItemAsObject(cookie)); 70 } 71 72 protected: 73 vtkRendererCollection() = default; 74 ~vtkRendererCollection() override = default; 75 76 private: 77 // hide the standard AddItem from the user and the compiler. AddItem(vtkObject * o)78 void AddItem(vtkObject* o) { this->vtkCollection::AddItem(o); } 79 80 vtkRendererCollection(const vtkRendererCollection&) = delete; 81 void operator=(const vtkRendererCollection&) = delete; 82 }; 83 84 #endif 85