VTK  9.5.20250715
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 "vtkSmartPointer.h" // for vtkSmartPointer
42
43#include "vtkObject.h"
44
45#include <string> // for std::string
46
47VTK_ABI_NAMESPACE_BEGIN
50class vtkCollection;
51class vtkDataSet;
52class vtkDoubleArray;
55class vtkRenderWindow;
56class vtkRenderer;
57
58class VTKIOIMPORT_EXPORT vtkImporter : public vtkObject
59{
60public:
61 vtkTypeMacro(vtkImporter, vtkObject);
62 void PrintSelf(ostream& os, vtkIndent indent) override;
63
65
69 vtkGetObjectMacro(Renderer, vtkRenderer);
71
73
78 vtkGetObjectMacro(SceneHierarchy, vtkDataAssembly);
80
82
87 vtkActorCollection* GetImportedActors() { return this->ActorCollection.Get(); }
88 vtkCollection* GetImportedCameras() { return this->CameraCollection.Get(); }
89 vtkLightCollection* GetImportedLights() { return this->LightCollection.Get(); }
91
93
102 vtkGetObjectMacro(RenderWindow, vtkRenderWindow);
104
110 bool Update();
111
116 virtual std::string GetOutputsDescription() { return ""; }
117
118 enum class AnimationSupportLevel : unsigned char
119 {
120 NONE,
121 UNIQUE,
122 SINGLE,
123 MULTI
124 };
125
138 virtual AnimationSupportLevel GetAnimationSupportLevel() { return AnimationSupportLevel::NONE; }
139
145
150 virtual std::string GetAnimationName(vtkIdType vtkNotUsed(animationIndex)) { return ""; }
151
153
156 virtual void EnableAnimation(vtkIdType vtkNotUsed(animationIndex)) {}
157 virtual void DisableAnimation(vtkIdType vtkNotUsed(animationIndex)) {}
158 virtual bool IsAnimationEnabled(vtkIdType vtkNotUsed(animationIndex)) { return false; }
160
165 virtual vtkIdType GetNumberOfCameras() { return 0; }
166
171 virtual std::string GetCameraName(vtkIdType vtkNotUsed(camIndex)) { return ""; }
172
178 virtual void SetCamera(vtkIdType vtkNotUsed(camIndex)) {}
179
190 virtual bool GetTemporalInformation(vtkIdType animationIndex, double frameRate, int& nbTimeSteps,
191 double timeRange[2], vtkDoubleArray* timeSteps);
192
198 virtual bool UpdateAtTimeValue(double vtkNotUsed(timeValue)) { return true; };
199
201
204 vtkSetMacro(ImportArmature, bool);
205 vtkGetMacro(ImportArmature, bool);
206 vtkBooleanMacro(ImportArmature, bool);
208
209protected:
211 ~vtkImporter() override;
212
213 virtual int ImportBegin() { return 1; }
214 virtual void ImportEnd() {}
215 virtual void ImportActors(vtkRenderer*) {}
216 virtual void ImportCameras(vtkRenderer*) {}
217 virtual void ImportLights(vtkRenderer*) {}
219 virtual void ReadData();
220
221 enum class UpdateStatusEnum : bool
222 {
223 SUCCESS,
224 FAILURE
225 };
226
235 {
236 this->UpdateStatus = updateStatus;
237 this->Modified();
238 }
239
243 UpdateStatusEnum GetUpdateStatus() { return this->UpdateStatus; }
244
245 static std::string GetDataSetDescription(vtkDataSet* ds, vtkIndent indent);
246 static std::string GetArrayDescription(vtkAbstractArray* array, vtkIndent indent);
247
248 vtkRenderer* Renderer = nullptr;
249 vtkRenderWindow* RenderWindow = nullptr;
251
255
256private:
257 vtkImporter(const vtkImporter&) = delete;
258 void operator=(const vtkImporter&) = delete;
259
260 bool SetAndCheckUpdateStatus();
261
262 UpdateStatusEnum UpdateStatus = UpdateStatusEnum::SUCCESS;
263 bool ImportArmature = false;
264};
265
266VTK_ABI_NAMESPACE_END
267#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:59
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.
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:89
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
vtkActorCollection * GetImportedActors()
Get collection of actors, cameras and lights that were imported by this importer.
Definition vtkImporter.h:87
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.
Definition vtkImporter.h:88
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
Hold a reference to a vtkObjectBase instance.
int vtkIdType
Definition vtkType.h:332
#define VTK_UNBLOCKTHREADS