VTK  9.7.1
vtkMapperCollection.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
15 #ifndef vtkMapperCollection_h
16 #define vtkMapperCollection_h
17 
18 #include "vtkCollection.h"
19 #include "vtkMapper.h" // Needed for direct access to mapper methods in
20  // inline functions
21 #include "vtkRenderingCoreModule.h" // For export macro
22 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
23 
24 VTK_ABI_NAMESPACE_BEGIN
25 class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkMapperCollection : public vtkCollection
26 {
27 public:
28  static vtkMapperCollection* New();
30  void PrintSelf(ostream& os, vtkIndent indent) override;
31 
35  void AddItem(vtkMapper* a) { this->vtkCollection::AddItem(a); }
36 
40  vtkMapper* GetNextItem() { return static_cast<vtkMapper*>(this->GetNextItemAsObject()); }
41 
46  {
47  int numItems = this->GetNumberOfItems();
48  if (numItems == 0)
49  {
50  return nullptr;
51  }
52  else
53  {
54  return static_cast<vtkMapper*>(this->GetItemAsObject(numItems - 1));
55  }
56  }
57 
63  {
64  return static_cast<vtkMapper*>(this->GetNextItemAsObject(cookie));
65  }
66 
67 protected:
68  vtkMapperCollection() = default;
69  ~vtkMapperCollection() override = default;
70 
71 private:
72  // hide the standard AddItem from the user and the compiler.
73  void AddItem(vtkObject* o) { this->vtkCollection::AddItem(o); }
74 
76  void operator=(const vtkMapperCollection&) = delete;
77 };
78 
79 VTK_ABI_NAMESPACE_END
80 #endif
an ordered list of mappers
void * vtkCollectionSimpleIterator
Definition: vtkCollection.h:35
abstract base class for most VTK objects
Definition: vtkObject.h:52
int GetNumberOfItems() VTK_FUTURE_CONST
Return the number of items in the collection.
vtkMapper * GetNextMapper(vtkCollectionSimpleIterator &cookie)
Reentrant safe way to get an object in a collection.
a simple class to control print indentation
Definition: vtkIndent.h:28
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkCollection * New()
Construct an empty collection.
void AddItem(vtkMapper *a)
Add an mapper to the bottom of the list.
vtkObject * GetItemAsObject(int i) VTK_FUTURE_CONST
Get the i'th item in the collection.
vtkMapper * GetLastItem()
Get the last mapper in the list.
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:77
void AddItem(vtkObject *)
Add given item to the bottom (end) of the collection.
create and manipulate ordered lists of objects
Definition: vtkCollection.h:39
vtkMapper * GetNextItem()
Get the next mapper in the list.
#define VTK_MARSHALAUTO
vtkObject * GetNextItemAsObject()
Get the next item in the collection.