VTK  9.5.2
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
115 VTK_DEPRECATED_IN_9_4_0("This method is deprecated, please use Update instead")
116 void Read() { this->Update(); };
117
122 virtual std::string GetOutputsDescription() { return ""; }
123
124 enum class AnimationSupportLevel : unsigned char
125 {
126 NONE,
127 UNIQUE,
128 SINGLE,
129 MULTI
130 };
131
144 virtual AnimationSupportLevel GetAnimationSupportLevel() { return AnimationSupportLevel::NONE; }
145
151
156 virtual std::string GetAnimationName(vtkIdType vtkNotUsed(animationIndex)) { return ""; }
157
159
162 virtual void EnableAnimation(vtkIdType vtkNotUsed(animationIndex)) {}
163 virtual void DisableAnimation(vtkIdType vtkNotUsed(animationIndex)) {}
164 virtual bool IsAnimationEnabled(vtkIdType vtkNotUsed(animationIndex)) { return false; }
166
171 virtual vtkIdType GetNumberOfCameras() { return 0; }
172
177 virtual std::string GetCameraName(vtkIdType vtkNotUsed(camIndex)) { return ""; }
178
184 virtual void SetCamera(vtkIdType vtkNotUsed(camIndex)) {}
185
196 virtual bool GetTemporalInformation(vtkIdType animationIndex, double frameRate, int& nbTimeSteps,
197 double timeRange[2], vtkDoubleArray* timeSteps);
198
202 VTK_DEPRECATED_IN_9_4_0("This method is deprecated, please use UpdateAtTimeValue instead")
203 virtual void UpdateTimeStep(double timeValue);
204
210 virtual bool UpdateAtTimeValue(double timeValue);
211
213
216 vtkSetMacro(ImportArmature, bool);
217 vtkGetMacro(ImportArmature, bool);
218 vtkBooleanMacro(ImportArmature, bool);
220
221protected:
223 ~vtkImporter() override;
224
225 virtual int ImportBegin() { return 1; }
226 virtual void ImportEnd() {}
227 virtual void ImportActors(vtkRenderer*) {}
228 virtual void ImportCameras(vtkRenderer*) {}
229 virtual void ImportLights(vtkRenderer*) {}
231 virtual void ReadData();
232
233 enum class UpdateStatusEnum : bool
234 {
235 SUCCESS,
236 FAILURE
237 };
238
247 {
248 this->UpdateStatus = updateStatus;
249 this->Modified();
250 }
251
255 UpdateStatusEnum GetUpdateStatus() { return this->UpdateStatus; }
256
257 static std::string GetDataSetDescription(vtkDataSet* ds, vtkIndent indent);
258 static std::string GetArrayDescription(vtkAbstractArray* array, vtkIndent indent);
259
260 vtkRenderer* Renderer = nullptr;
261 vtkRenderWindow* RenderWindow = nullptr;
263
267
268private:
269 vtkImporter(const vtkImporter&) = delete;
270 void operator=(const vtkImporter&) = delete;
271
272 bool SetAndCheckUpdateStatus();
273
274 UpdateStatusEnum UpdateStatus = UpdateStatusEnum::SUCCESS;
275 bool ImportArmature = false;
276};
277
278VTK_ABI_NAMESPACE_END
279#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 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:89
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:87
virtual AnimationSupportLevel GetAnimationSupportLevel()
Get the level of animation support, this is coming either from the file format or as a limitation of ...
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:88
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:332
#define VTK_UNBLOCKTHREADS