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
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
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
Definition: vtkCollection.h:46
hierarchical representation to use with vtkPartitionedDataSetCollection
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
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.
Definition: vtkImporter.h:164
virtual void ImportProperties(vtkRenderer *)
Definition: vtkImporter.h:230
virtual void ReadData()
vtkNew< vtkCollection > CameraCollection
Definition: vtkImporter.h:265
virtual void SetCamera(vtkIdType vtkNotUsed(camIndex))
Enable a specific camera.
Definition: vtkImporter.h:184
virtual void DisableAnimation(vtkIdType vtkNotUsed(animationIndex))
Enable/Disable/Get the status of specific animations.
Definition: vtkImporter.h:163
virtual std::string GetOutputsDescription()
Recover a printable string that let importer implementation Describe their outputs.
Definition: vtkImporter.h:122
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void ImportCameras(vtkRenderer *)
Definition: vtkImporter.h:228
UpdateStatusEnum GetUpdateStatus()
Get the update status.
Definition: vtkImporter.h:255
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
Definition: vtkImporter.h:264
virtual void ImportActors(vtkRenderer *)
Definition: vtkImporter.h:227
virtual std::string GetCameraName(vtkIdType vtkNotUsed(camIndex))
Get the name of a camera.
Definition: vtkImporter.h:177
vtkSmartPointer< vtkDataAssembly > SceneHierarchy
Definition: vtkImporter.h:262
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.
Definition: vtkImporter.h:162
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 ...
Definition: vtkImporter.h:144
static std::string GetDataSetDescription(vtkDataSet *ds, vtkIndent indent)
void SetUpdateStatus(UpdateStatusEnum updateStatus)
Set the update status.
Definition: vtkImporter.h:246
static std::string GetArrayDescription(vtkAbstractArray *array, vtkIndent indent)
virtual void ImportEnd()
Definition: vtkImporter.h:226
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.
Definition: vtkImporter.h:171
virtual void ImportLights(vtkRenderer *)
Definition: vtkImporter.h:229
vtkNew< vtkLightCollection > LightCollection
Definition: vtkImporter.h:266
virtual std::string GetAnimationName(vtkIdType vtkNotUsed(animationIndex))
Get the name of an animation.
Definition: vtkImporter.h:156
a simple class to control print indentation
Definition: vtkIndent.h:29
Key for integer values in vtkInformation.
an ordered list of lights
abstract base class for most VTK objects
Definition: vtkObject.h:53
virtual void Modified()
Update the modification time for this object.
create a window for renderers to draw into
abstract specification for renderers
Definition: vtkRenderer.h:63
@ string
Definition: vtkX3D.h:490
#define VTK_DEPRECATED_IN_9_4_0(reason)
int vtkIdType
Definition: vtkType.h:332
#define VTK_UNBLOCKTHREADS