VTK  9.7.1
vtkMultiVolume.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
26 #ifndef vtkMultiVolume_h
27 #define vtkMultiVolume_h
28 #include <array> // for std::array
29 #include <unordered_map> // For std::unordered_map
30 
31 #include "vtkMatrix4x4.h" // For Matrix
32 #include "vtkRenderingVolumeModule.h" // For export macro
33 #include "vtkSmartPointer.h" // For vtkSmartPointer
34 #include "vtkVolume.h"
35 #include "vtkWrappingHints.h" // For VTK_MARSHALMANUAL
36 
37 VTK_ABI_NAMESPACE_BEGIN
39 class vtkBoundingBox;
40 class vtkMatrix4x4;
41 class vtkRenderer;
42 class vtkVolumeProperty;
43 class vtkWindow;
44 class vtkVolumeProperty;
46 
47 class VTKRENDERINGVOLUME_EXPORT VTK_MARSHALMANUAL vtkMultiVolume : public vtkVolume
48 {
49 public:
50  static vtkMultiVolume* New();
51  vtkTypeMacro(vtkMultiVolume, vtkVolume);
52  void PrintSelf(ostream& os, vtkIndent indent) override;
53 
55 
58  void SetVolume(vtkVolume* volume, int port = 0);
59  vtkVolume* GetVolume(int port = 0);
60  void RemoveVolume(int port) { this->SetVolume(nullptr, port); }
62 
64 
71  void SetProperty(vtkVolumeProperty* property) override;
72  vtkVolumeProperty* GetProperty() override;
74 
75  std::unordered_map<int, vtkVolume*>& GetAllVolumes() { return this->Volumes; }
76  void SetAllVolumes(std::unordered_map<int, vtkVolume*>& volumes);
77 
84  double* GetBounds() override;
85 
89  vtkMTimeType GetMTime() override;
90 
96  void ShallowCopy(vtkProp* prop) override;
97 
106  using vtkVolume::GetMatrix;
107  vtkMatrix4x4* GetMatrix() override { return this->Matrix; }
108 
114  vtkMatrix4x4* GetTextureMatrix() { return this->TexToBBox.GetPointer(); }
115 
119  double* GetDataBounds() { return this->DataBounds.data(); }
120 
121  vtkMTimeType GetBoundsTime() { return this->BoundsComputeTime.GetMTime(); }
122 
129  int RenderVolumetricGeometry(vtkViewport* vp) override;
130 
134  double* GetDataGeometry() { return this->DataGeometry.data(); }
135 
136 protected:
137  vtkMultiVolume();
138  ~vtkMultiVolume() override;
139 
146  void ComputeMatrix() override {}
147 
151  vtkVolume* FindVolume(int port);
152 
157  bool VolumesChanged();
158 
165  std::array<double, 6> ComputeAABounds(double bounds[6], vtkMatrix4x4* T) const;
166 
167  std::array<double, 6> DataBounds;
168  std::array<double, 24> DataGeometry;
169  std::unordered_map<int, vtkVolume*> Volumes;
172 
173 private:
174  vtkMultiVolume(const vtkMultiVolume&) = delete;
175  void operator=(const vtkMultiVolume&) = delete;
176 };
177 VTK_ABI_NAMESPACE_END
178 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:49
vtkMatrix4x4 * GetMatrix() override
Get a pointer to an internal vtkMatrix4x4.
vtkSmartPointer< vtkMatrix4x4 > TexToBBox
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:40
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:31
double * GetDataGeometry()
Return the eight corners of the volume.
virtual void SetProperty(vtkVolumeProperty *property)
Set/Get the volume property.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:318
abstract specification for Viewports
Definition: vtkViewport.h:46
vtkMatrix4x4 * GetTextureMatrix()
Returns the transformation from texture coordinates to data coordinates of the bounding-box.
record modification and/or execution time
Definition: vtkTimeStamp.h:24
vtkTimeStamp BoundsComputeTime
void RemoveVolume(int port)
Add / Remove a vtkVolume instance.
void ShallowCopy(vtkProp *prop) override
Shallow copy of this vtkVolume.
std::unordered_map< int, vtkVolume * > & GetAllVolumes()
virtual vtkVolumeProperty * GetProperty()
Set/Get the volume property.
Abstract class for a volume mapper.
abstract specification for renderers
Definition: vtkRenderer.h:63
window superclass for vtkRenderWindow
Definition: vtkWindow.h:41
#define VTK_MARSHALMANUAL
a simple class to control print indentation
Definition: vtkIndent.h:28
std::array< double, 24 > DataGeometry
vtkMTimeType GetMTime() override
Return the MTime also considering the property etc.
static vtkVolume * New()
Creates a Volume with the following defaults: origin(0,0,0) position=(0,0,0) scale=1 visibility=1 pic...
std::array< double, 6 > DataBounds
represents the common properties for rendering a volume.
vtkMatrix4x4 * GetMatrix() override
Get a pointer to an internal vtkMatrix4x4.
Definition: vtkProp3D.h:331
Represents a world axis-aligned bounding-box containing a set of volumes in a rendered scene...
void ComputeMatrix() override
The transformation matrix of this vtkProp3D is not user-definable, (only the registered vtkVolume ins...
std::unordered_map< int, vtkVolume * > Volumes
vtkMTimeType GetBoundsTime()
int RenderVolumetricGeometry(vtkViewport *viewport) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
double * GetDataBounds()
Total bounds in data coordinates.
double * GetBounds() override
Get the bounds - either all six at once (xmin, xmax, ymin, ymax, zmin, zmax) or one at a time...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkMatrix4x4 * Matrix
Definition: vtkProp3D.h:392
Fast, simple class for representing and operating on 3D bounds.