VTK  9.4.20250218
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;
52class vtkRenderWindow;
53class vtkRenderer;
54
55class VTKIOIMPORT_EXPORT vtkImporter : public vtkObject
56{
57public:
58 vtkTypeMacro(vtkImporter, vtkObject);
59 void PrintSelf(ostream& os, vtkIndent indent) override;
60
62
66 vtkGetObjectMacro(Renderer, vtkRenderer);
68
70
75 vtkGetObjectMacro(SceneHierarchy, vtkDataAssembly);
77
79
84 vtkActorCollection* GetImportedActors() { return this->ActorCollection.Get(); }
85 vtkCollection* GetImportedCameras() { return this->CameraCollection.Get(); }
86 vtkLightCollection* GetImportedLights() { return this->LightCollection.Get(); }
88
90
99 vtkGetObjectMacro(RenderWindow, vtkRenderWindow);
101
107 bool Update();
108
112 VTK_DEPRECATED_IN_9_4_0("This method is deprecated, please use Update instead")
113 void Read() { this->Update(); };
114
119 virtual std::string GetOutputsDescription() { return ""; }
120
126
131 virtual std::string GetAnimationName(vtkIdType vtkNotUsed(animationIndex)) { return ""; }
132
134
137 virtual void EnableAnimation(vtkIdType vtkNotUsed(animationIndex)) {}
138 virtual void DisableAnimation(vtkIdType vtkNotUsed(animationIndex)) {}
139 virtual bool IsAnimationEnabled(vtkIdType vtkNotUsed(animationIndex)) { return false; }
141
146 virtual vtkIdType GetNumberOfCameras() { return 0; }
147
152 virtual std::string GetCameraName(vtkIdType vtkNotUsed(camIndex)) { return ""; }
153
159 virtual void SetCamera(vtkIdType vtkNotUsed(camIndex)) {}
160
171 virtual bool GetTemporalInformation(vtkIdType animationIndex, double frameRate, int& nbTimeSteps,
172 double timeRange[2], vtkDoubleArray* timeSteps);
173
177 VTK_DEPRECATED_IN_9_4_0("This method is deprecated, please use UpdateAtTimeValue instead")
178 virtual void UpdateTimeStep(double timeValue);
179
185 virtual bool UpdateAtTimeValue(double timeValue);
186
188
191 vtkSetMacro(ImportArmature, bool);
192 vtkGetMacro(ImportArmature, bool);
193 vtkBooleanMacro(ImportArmature, bool);
195
196protected:
198 ~vtkImporter() override;
199
200 virtual int ImportBegin() { return 1; }
201 virtual void ImportEnd() {}
202 virtual void ImportActors(vtkRenderer*) {}
203 virtual void ImportCameras(vtkRenderer*) {}
204 virtual void ImportLights(vtkRenderer*) {}
206 virtual void ReadData();
207
208 enum class UpdateStatusEnum : bool
209 {
210 SUCCESS,
211 FAILURE
212 };
213
222 {
223 this->UpdateStatus = updateStatus;
224 this->Modified();
225 }
226
230 UpdateStatusEnum GetUpdateStatus() { return this->UpdateStatus; }
231
232 static std::string GetDataSetDescription(vtkDataSet* ds, vtkIndent indent);
233 static std::string GetArrayDescription(vtkAbstractArray* array, vtkIndent indent);
234
235 vtkRenderer* Renderer = nullptr;
236 vtkRenderWindow* RenderWindow = nullptr;
238
242
243private:
244 vtkImporter(const vtkImporter&) = delete;
245 void operator=(const vtkImporter&) = delete;
246
247 bool SetAndCheckUpdateStatus();
248
249 UpdateStatusEnum UpdateStatus = UpdateStatusEnum::SUCCESS;
250 bool ImportArmature = false;
251};
252
253VTK_ABI_NAMESPACE_END
254#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:165
dynamic, self-adjusting array of double
importer abstract class
Definition vtkImporter.h:56
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:86
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 success...
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:84
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:85
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
Key for integer values in vtkInformation.
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