VTK  9.7.20260726
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
35
36#ifndef vtkImporter_h
37#define vtkImporter_h
38
39#include "vtkDataAssembly.h" // for vtkDataAssembly
40#include "vtkIOImportModule.h" // For export macro
41#include "vtkResourceStream.h" // For Stream
42#include "vtkSmartPointer.h" // for vtkSmartPointer
43
44#include "vtkObject.h"
45
46#include <string> // for std::string
47
48VTK_ABI_NAMESPACE_BEGIN
51class vtkCollection;
52class vtkDataSet;
53class vtkDoubleArray;
56class vtkRenderWindow;
57class vtkRenderer;
58
59class VTKIOIMPORT_EXPORT vtkImporter : public vtkObject
60{
61public:
62 vtkTypeMacro(vtkImporter, vtkObject);
63 void PrintSelf(ostream& os, vtkIndent indent) override;
64
66
72
74
79 vtkSetSmartPointerMacro(Stream, vtkResourceStream);
80 vtkGetSmartPointerMacro(Stream, vtkResourceStream);
82
84
88 vtkGetObjectMacro(Renderer, vtkRenderer);
90
92
97 vtkGetObjectMacro(SceneHierarchy, vtkDataAssembly);
99
101
110
112
121 vtkGetObjectMacro(RenderWindow, vtkRenderWindow);
123
129 bool Update();
130
135 virtual std::string GetOutputsDescription() { return ""; }
136
137 enum class AnimationSupportLevel : unsigned char
138 {
143 };
144
158
164
169 virtual std::string GetAnimationName(vtkIdType vtkNotUsed(animationIndex)) { return ""; }
170
172
175 virtual void EnableAnimation(vtkIdType vtkNotUsed(animationIndex)) {}
176 virtual void DisableAnimation(vtkIdType vtkNotUsed(animationIndex)) {}
177 virtual bool IsAnimationEnabled(vtkIdType vtkNotUsed(animationIndex)) { return false; }
179
184 virtual vtkIdType GetNumberOfCameras() { return 0; }
185
190 virtual std::string GetCameraName(vtkIdType vtkNotUsed(camIndex)) { return ""; }
191
197 virtual void SetCamera(vtkIdType vtkNotUsed(camIndex)) {}
198
208 vtkIdType animationIndex, double timeRange[2], int& nbTimeSteps, vtkDoubleArray* timeSteps);
209
215 virtual bool UpdateAtTimeValue(double vtkNotUsed(timeValue)) { return true; };
216
217 enum class InterpolateAnimationSupportLevel : unsigned char
218 {
222 };
223
238
240
244 vtkSetMacro(InterpolateBetweenTimeSteps, bool);
245 vtkGetMacro(InterpolateBetweenTimeSteps, bool);
246 vtkBooleanMacro(InterpolateBetweenTimeSteps, bool);
248
250
254 vtkSetMacro(ImportArmature, bool);
255 vtkGetMacro(ImportArmature, bool);
256 vtkBooleanMacro(ImportArmature, bool);
258
259protected:
261 ~vtkImporter() override;
262
263 virtual int ImportBegin() { return 1; }
264 virtual void ImportEnd() {}
265 virtual void ImportActors(vtkRenderer*) {}
266 virtual void ImportCameras(vtkRenderer*) {}
267 virtual void ImportLights(vtkRenderer*) {}
269 virtual void ReadData();
270
271 enum class UpdateStatusEnum : bool
272 {
275 };
276
285 {
286 this->UpdateStatus = updateStatus;
287 this->Modified();
288 }
289
293 UpdateStatusEnum GetUpdateStatus() { return this->UpdateStatus; }
294
295 static std::string GetDataSetDescription(vtkDataSet* ds, vtkIndent indent);
296 static std::string GetArrayDescription(vtkAbstractArray* array, vtkIndent indent);
297
301
305
306private:
307 vtkImporter(const vtkImporter&) = delete;
308 void operator=(const vtkImporter&) = delete;
309
310 bool SetAndCheckUpdateStatus();
311
312 char* FileName = nullptr;
314
316 bool ImportArmature = false;
317 bool InterpolateBetweenTimeSteps = true;
318};
319
320VTK_ABI_NAMESPACE_END
321#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
virtual void DisableAnimation(vtkIdType animationIndex)
Enable/Disable/Get the status of specific animations.
InterpolateAnimationSupportLevel
virtual void ImportProperties(vtkRenderer *)
virtual void EnableAnimation(vtkIdType animationIndex)
Enable/Disable/Get the status of specific animations.
virtual bool UpdateAtTimeValue(double timeValue)
Import the actors, camera, lights and properties at a specific time value.
virtual void ReadData()
vtkNew< vtkCollection > CameraCollection
vtkRenderWindow * RenderWindow
virtual std::string GetOutputsDescription()
Recover a printable string that let importer implementation Describe their outputs.
virtual std::string GetAnimationName(vtkIdType animationIndex)
Get the name of an animation.
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.
vtkSetFilePathMacro(FileName)
Specify file name of the file to read.
vtkLightCollection * GetImportedLights()
Get collection of actors, cameras and lights that were imported by this importer.
bool Update()
Import the actors, cameras, lights and properties into a vtkRenderWindow and return if it was success...
vtkNew< vtkActorCollection > ActorCollection
virtual void ImportActors(vtkRenderer *)
vtkSmartPointer< vtkDataAssembly > SceneHierarchy
vtkGetFilePathMacro(FileName)
Specify file name of the file to read.
vtkActorCollection * GetImportedActors()
Get collection of actors, cameras and lights that were imported by this importer.
virtual std::string GetCameraName(vtkIdType camIndex)
Get the name of a camera.
virtual AnimationSupportLevel GetAnimationSupportLevel()
Get the level of animation support, this is coming either from the file format or as a limitation of ...
virtual int ImportBegin()
static std::string GetDataSetDescription(vtkDataSet *ds, vtkIndent indent)
void SetUpdateStatus(UpdateStatusEnum updateStatus)
Set the update status.
static std::string GetArrayDescription(vtkAbstractArray *array, vtkIndent indent)
vtkRenderer * Renderer
virtual void SetCamera(vtkIdType camIndex)
Enable a specific camera.
virtual void ImportEnd()
virtual InterpolateAnimationSupportLevel GetInterpolateAnimationSupportLevel()
Get the level of animation interpolation support, this is coming either from the file format or as a ...
~vtkImporter() override
virtual bool GetTemporalInformation(vtkIdType animationIndex, double timeRange[2], int &nbTimeSteps, vtkDoubleArray *timeSteps)
Get temporal information for the provided animationIndex.
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.
virtual vtkIdType GetNumberOfCameras()
Get the number of available cameras.
virtual void ImportLights(vtkRenderer *)
virtual bool IsAnimationEnabled(vtkIdType animationIndex)
Enable/Disable/Get the status of specific animations.
vtkNew< vtkLightCollection > LightCollection
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:168
virtual void Modified()
Update the modification time for this object.
create a window for renderers to draw into
abstract specification for renderers
Abstract class used for custom streams.
Hold a reference to a vtkObjectBase instance.
int vtkIdType
Definition vtkType.h:363
#define VTK_UNBLOCKTHREADS