VTK  9.4.20241118
vtkImporter.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
33#ifndef vtkImporter_h
34#define vtkImporter_h
35
36#include "vtkDataAssembly.h" // for vtkDataAssembly
37#include "vtkIOImportModule.h" // For export macro
38#include "vtkSmartPointer.h" // for vtkSmartPointer
39
40#include "vtkObject.h"
41
42#include <string> // for std::string
43
44VTK_ABI_NAMESPACE_BEGIN
47class vtkCollection;
48class vtkDataSet;
49class vtkDoubleArray;
51class vtkRenderWindow;
52class vtkRenderer;
53
54class VTKIOIMPORT_EXPORT vtkImporter : public vtkObject
55{
56public:
57 vtkTypeMacro(vtkImporter, vtkObject);
58 void PrintSelf(ostream& os, vtkIndent indent) override;
59
61
65 vtkGetObjectMacro(Renderer, vtkRenderer);
67
69
74 vtkGetObjectMacro(SceneHierarchy, vtkDataAssembly);
76
78
83 vtkActorCollection* GetImportedActors() { return this->ActorCollection.Get(); }
84 vtkCollection* GetImportedCameras() { return this->CameraCollection.Get(); }
85 vtkLightCollection* GetImportedLights() { return this->LightCollection.Get(); }
87
89
98 vtkGetObjectMacro(RenderWindow, vtkRenderWindow);
100
106 bool Update();
107
111 VTK_DEPRECATED_IN_9_4_0("This method is deprected, please use Update instead")
112 void Read() { this->Update(); };
113
118 virtual std::string GetOutputsDescription() { return ""; }
119
125
130 virtual std::string GetAnimationName(vtkIdType vtkNotUsed(animationIndex)) { return ""; }
131
133
136 virtual void EnableAnimation(vtkIdType vtkNotUsed(animationIndex)) {}
137 virtual void DisableAnimation(vtkIdType vtkNotUsed(animationIndex)) {}
138 virtual bool IsAnimationEnabled(vtkIdType vtkNotUsed(animationIndex)) { return false; }
140
145 virtual vtkIdType GetNumberOfCameras() { return 0; }
146
151 virtual std::string GetCameraName(vtkIdType vtkNotUsed(camIndex)) { return ""; }
152
158 virtual void SetCamera(vtkIdType vtkNotUsed(camIndex)) {}
159
170 virtual bool GetTemporalInformation(vtkIdType animationIndex, double frameRate, int& nbTimeSteps,
171 double timeRange[2], vtkDoubleArray* timeSteps);
172
176 VTK_DEPRECATED_IN_9_4_0("This method is deprected, please use UpdateAtTimeValue instead")
177 virtual void UpdateTimeStep(double timeValue);
178
184 virtual bool UpdateAtTimeValue(double timeValue);
185
186protected:
188 ~vtkImporter() override;
189
190 virtual int ImportBegin() { return 1; }
191 virtual void ImportEnd() {}
192 virtual void ImportActors(vtkRenderer*) {}
193 virtual void ImportCameras(vtkRenderer*) {}
194 virtual void ImportLights(vtkRenderer*) {}
196 virtual void ReadData();
197
198 enum class UpdateStatusEnum : bool
199 {
200 SUCCESS,
201 FAILURE
202 };
203
212 {
213 this->UpdateStatus = updateStatus;
214 this->Modified();
215 }
216
220 UpdateStatusEnum GetUpdateStatus() { return this->UpdateStatus; }
221
222 static std::string GetDataSetDescription(vtkDataSet* ds, vtkIndent indent);
223 static std::string GetArrayDescription(vtkAbstractArray* array, vtkIndent indent);
224
225 vtkRenderer* Renderer = nullptr;
226 vtkRenderWindow* RenderWindow = nullptr;
228
232
233private:
234 vtkImporter(const vtkImporter&) = delete;
235 void operator=(const vtkImporter&) = delete;
236
237 bool SetAndCheckUpdateStatus();
238
239 UpdateStatusEnum UpdateStatus = UpdateStatusEnum::SUCCESS;
240};
241
242VTK_ABI_NAMESPACE_END
243#endif
Abstract superclass for all arrays.
an ordered list of actors
create and manipulate ordered lists of objects
hierarchical representation to use with vtkPartitionedDataSetCollection
abstract class to specify dataset behavior
Definition vtkDataSet.h:166
dynamic, self-adjusting array of double
importer abstract class
Definition vtkImporter.h:55
virtual bool IsAnimationEnabled(vtkIdType vtkNotUsed(animationIndex))
Enable/Disable/Get the status of specific animations.
virtual void ImportProperties(vtkRenderer *)
virtual void ReadData()
vtkNew< vtkCollection > CameraCollection
virtual void SetCamera(vtkIdType vtkNotUsed(camIndex))
Enable a specific camera.
virtual void DisableAnimation(vtkIdType vtkNotUsed(animationIndex))
Enable/Disable/Get the status of specific animations.
virtual std::string GetOutputsDescription()
Recover a printable string that let importer implementation Describe their outputs.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void ImportCameras(vtkRenderer *)
UpdateStatusEnum GetUpdateStatus()
Get the update status.
virtual bool GetTemporalInformation(vtkIdType animationIndex, double frameRate, int &nbTimeSteps, double timeRange[2], vtkDoubleArray *timeSteps)
Get temporal information for the provided animationIndex and frameRate.
vtkLightCollection * GetImportedLights()
Get collection of actors, cameras and lights that were imported by this importer.
Definition vtkImporter.h:85
vtkNew< vtkActorCollection > ActorCollection
virtual void ImportActors(vtkRenderer *)
virtual std::string GetCameraName(vtkIdType vtkNotUsed(camIndex))
Get the name of a camera.
vtkSmartPointer< vtkDataAssembly > SceneHierarchy
VTK_UNBLOCKTHREADS bool Update()
Import the actors, cameras, lights and properties into a vtkRenderWindow and return if it was sucessf...
virtual void EnableAnimation(vtkIdType vtkNotUsed(animationIndex))
Enable/Disable/Get the status of specific animations.
vtkActorCollection * GetImportedActors()
Get collection of actors, cameras and lights that were imported by this importer.
Definition vtkImporter.h:83
static std::string GetDataSetDescription(vtkDataSet *ds, vtkIndent indent)
void SetUpdateStatus(UpdateStatusEnum updateStatus)
Set the update status.
static std::string GetArrayDescription(vtkAbstractArray *array, vtkIndent indent)
virtual void ImportEnd()
virtual vtkIdType GetNumberOfAnimations()
Get the number of available animations.
virtual void SetRenderWindow(vtkRenderWindow *)
Set the vtkRenderWindow to contain the imported actors, cameras and lights, If no vtkRenderWindow is ...
vtkCollection * GetImportedCameras()
Get collection of actors, cameras and lights that were imported by this importer.
Definition vtkImporter.h:84
virtual vtkIdType GetNumberOfCameras()
Get the number of available cameras.
virtual void ImportLights(vtkRenderer *)
vtkNew< vtkLightCollection > LightCollection
virtual std::string GetAnimationName(vtkIdType vtkNotUsed(animationIndex))
Get the name of an animation.
a simple class to control print indentation
Definition vtkIndent.h:108
an ordered list of lights
Allocate and hold a VTK object.
Definition vtkNew.h:167
abstract base class for most VTK objects
Definition vtkObject.h:162
virtual void Modified()
Update the modification time for this object.
create a window for renderers to draw into
abstract specification for renderers
Hold a reference to a vtkObjectBase instance.
#define VTK_DEPRECATED_IN_9_4_0(reason)
int vtkIdType
Definition vtkType.h:315
#define VTK_UNBLOCKTHREADS