VTK  9.5.20251014
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
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
106 vtkActorCollection* GetImportedActors() { return this->ActorCollection.Get(); }
107 vtkCollection* GetImportedCameras() { return this->CameraCollection.Get(); }
108 vtkLightCollection* GetImportedLights() { return this->LightCollection.Get(); }
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 {
139 NONE,
140 UNIQUE,
141 SINGLE,
142 MULTI
143 };
144
157 virtual AnimationSupportLevel GetAnimationSupportLevel() { return AnimationSupportLevel::NONE; }
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
209 virtual bool GetTemporalInformation(vtkIdType animationIndex, double frameRate, int& nbTimeSteps,
210 double timeRange[2], vtkDoubleArray* timeSteps);
211
217 virtual bool UpdateAtTimeValue(double vtkNotUsed(timeValue)) { return true; };
218
220
223 vtkSetMacro(ImportArmature, bool);
224 vtkGetMacro(ImportArmature, bool);
225 vtkBooleanMacro(ImportArmature, bool);
227
228protected:
230 ~vtkImporter() override;
231
232 virtual int ImportBegin() { return 1; }
233 virtual void ImportEnd() {}
234 virtual void ImportActors(vtkRenderer*) {}
235 virtual void ImportCameras(vtkRenderer*) {}
236 virtual void ImportLights(vtkRenderer*) {}
238 virtual void ReadData();
239
240 enum class UpdateStatusEnum : bool
241 {
242 SUCCESS,
243 FAILURE
244 };
245
254 {
255 this->UpdateStatus = updateStatus;
256 this->Modified();
257 }
258
262 UpdateStatusEnum GetUpdateStatus() { return this->UpdateStatus; }
263
264 static std::string GetDataSetDescription(vtkDataSet* ds, vtkIndent indent);
265 static std::string GetArrayDescription(vtkAbstractArray* array, vtkIndent indent);
266
267 vtkRenderer* Renderer = nullptr;
268 vtkRenderWindow* RenderWindow = nullptr;
270
274
275private:
276 vtkImporter(const vtkImporter&) = delete;
277 void operator=(const vtkImporter&) = delete;
278
279 bool SetAndCheckUpdateStatus();
280
281 char* FileName = nullptr;
283
284 UpdateStatusEnum UpdateStatus = UpdateStatusEnum::SUCCESS;
285 bool ImportArmature = false;
286};
287
288VTK_ABI_NAMESPACE_END
289#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:60
virtual void DisableAnimation(vtkIdType animationIndex)
Enable/Disable/Get the status of specific animations.
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
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.
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.
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)
virtual void SetCamera(vtkIdType camIndex)
Enable a specific camera.
virtual void ImportEnd()
~vtkImporter() override
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: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
Abstract class used for custom streams.
Hold a reference to a vtkObjectBase instance.
int vtkIdType
Definition vtkType.h:367
#define VTK_UNBLOCKTHREADS