VTK  9.7.1
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 "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_6_0
41 #include "vtkIOImportModule.h" // For export macro
42 #include "vtkResourceStream.h" // For Stream
43 #include "vtkSmartPointer.h" // for vtkSmartPointer
44 
45 #include "vtkObject.h"
46 
47 #include <string> // for std::string
48 
49 VTK_ABI_NAMESPACE_BEGIN
50 class vtkAbstractArray;
51 class vtkActorCollection;
52 class vtkCollection;
53 class vtkDataSet;
54 class vtkDoubleArray;
56 class vtkLightCollection;
57 class vtkRenderWindow;
58 class vtkRenderer;
59 
60 class VTKIOIMPORT_EXPORT vtkImporter : public vtkObject
61 {
62 public:
63  vtkTypeMacro(vtkImporter, vtkObject);
64  void PrintSelf(ostream& os, vtkIndent indent) override;
65 
67 
70  vtkSetFilePathMacro(FileName);
71  vtkGetFilePathMacro(FileName);
73 
75 
80  vtkSetSmartPointerMacro(Stream, vtkResourceStream);
81  vtkGetSmartPointerMacro(Stream, vtkResourceStream);
83 
85 
89  vtkGetObjectMacro(Renderer, vtkRenderer);
91 
93 
98  vtkGetObjectMacro(SceneHierarchy, vtkDataAssembly);
100 
102 
107  vtkActorCollection* GetImportedActors() { return this->ActorCollection.Get(); }
108  vtkCollection* GetImportedCameras() { return this->CameraCollection.Get(); }
109  vtkLightCollection* GetImportedLights() { return this->LightCollection.Get(); }
111 
113 
121  virtual void SetRenderWindow(vtkRenderWindow*);
122  vtkGetObjectMacro(RenderWindow, vtkRenderWindow);
124 
130  bool Update();
131 
136  virtual std::string GetOutputsDescription() { return ""; }
137 
138  enum class AnimationSupportLevel : unsigned char
139  {
140  NONE,
141  UNIQUE,
142  SINGLE,
143  MULTI
144  };
145 
159 
164  virtual vtkIdType GetNumberOfAnimations();
165 
170  virtual std::string GetAnimationName(vtkIdType vtkNotUsed(animationIndex)) { return ""; }
171 
173 
176  virtual void EnableAnimation(vtkIdType vtkNotUsed(animationIndex)) {}
177  virtual void DisableAnimation(vtkIdType vtkNotUsed(animationIndex)) {}
178  virtual bool IsAnimationEnabled(vtkIdType vtkNotUsed(animationIndex)) { return false; }
180 
185  virtual vtkIdType GetNumberOfCameras() { return 0; }
186 
191  virtual std::string GetCameraName(vtkIdType vtkNotUsed(camIndex)) { return ""; }
192 
198  virtual void SetCamera(vtkIdType vtkNotUsed(camIndex)) {}
199 
211  VTK_DEPRECATED_IN_9_6_0("Use GetTemporalInformation without framerate parameter instead.")
212  virtual bool GetTemporalInformation(vtkIdType animationIndex, double frameRate, int& nbTimeSteps,
213  double timeRange[2], vtkDoubleArray* timeSteps);
214 
223  virtual bool GetTemporalInformation(
224  vtkIdType animationIndex, double timeRange[2], int& nbTimeSteps, vtkDoubleArray* timeSteps);
225 
231  virtual bool UpdateAtTimeValue(double vtkNotUsed(timeValue)) { return true; };
232 
233  enum class InterpolateAnimationSupportLevel : unsigned char
234  {
235  NEVER,
236  CAPABLE,
237  ALWAYS,
238  };
239 
251  {
252  return InterpolateAnimationSupportLevel::NEVER;
253  }
254 
256 
260  vtkSetMacro(InterpolateBetweenTimeSteps, bool);
261  vtkGetMacro(InterpolateBetweenTimeSteps, bool);
262  vtkBooleanMacro(InterpolateBetweenTimeSteps, bool);
264 
266 
270  vtkSetMacro(ImportArmature, bool);
271  vtkGetMacro(ImportArmature, bool);
272  vtkBooleanMacro(ImportArmature, bool);
274 
275 protected:
276  vtkImporter();
277  ~vtkImporter() override;
278 
279  virtual int ImportBegin() { return 1; }
280  virtual void ImportEnd() {}
281  virtual void ImportActors(vtkRenderer*) {}
282  virtual void ImportCameras(vtkRenderer*) {}
283  virtual void ImportLights(vtkRenderer*) {}
284  virtual void ImportProperties(vtkRenderer*) {}
285  virtual void ReadData();
286 
287  enum class UpdateStatusEnum : bool
288  {
289  SUCCESS,
290  FAILURE
291  };
292 
301  {
302  this->UpdateStatus = updateStatus;
303  this->Modified();
304  }
305 
309  UpdateStatusEnum GetUpdateStatus() { return this->UpdateStatus; }
310 
311  static std::string GetDataSetDescription(vtkDataSet* ds, vtkIndent indent);
312  static std::string GetArrayDescription(vtkAbstractArray* array, vtkIndent indent);
313 
314  vtkRenderer* Renderer = nullptr;
315  vtkRenderWindow* RenderWindow = nullptr;
317 
321 
322 private:
323  vtkImporter(const vtkImporter&) = delete;
324  void operator=(const vtkImporter&) = delete;
325 
326  bool SetAndCheckUpdateStatus();
327 
328  char* FileName = nullptr;
330 
331  UpdateStatusEnum UpdateStatus = UpdateStatusEnum::SUCCESS;
332  bool ImportArmature = false;
333  bool InterpolateBetweenTimeSteps = true;
334 };
335 
336 VTK_ABI_NAMESPACE_END
337 #endif
vtkNew< vtkCollection > CameraCollection
Definition: vtkImporter.h:319
virtual bool IsAnimationEnabled(vtkIdType animationIndex)
Enable/Disable/Get the status of specific animations.
Definition: vtkImporter.h:178
abstract base class for most VTK objects
Definition: vtkObject.h:52
virtual InterpolateAnimationSupportLevel GetInterpolateAnimationSupportLevel()
Get the level of animation interpolation support, this is coming either from the file format or as a ...
Definition: vtkImporter.h:250
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Abstract class used for custom streams.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
Abstract superclass for all arrays.
vtkNew< vtkActorCollection > ActorCollection
Definition: vtkImporter.h:318
InterpolateAnimationSupportLevel
Definition: vtkImporter.h:233
#define VTK_UNBLOCKTHREADS
vtkSmartPointer< vtkDataAssembly > SceneHierarchy
Definition: vtkImporter.h:316
vtkCollection * GetImportedCameras()
Get collection of actors, cameras and lights that were imported by this importer. ...
Definition: vtkImporter.h:108
virtual void EnableAnimation(vtkIdType animationIndex)
Enable/Disable/Get the status of specific animations.
Definition: vtkImporter.h:176
vtkLightCollection * GetImportedLights()
Get collection of actors, cameras and lights that were imported by this importer. ...
Definition: vtkImporter.h:109
virtual void ImportCameras(vtkRenderer *)
Definition: vtkImporter.h:282
abstract specification for renderers
Definition: vtkRenderer.h:63
int vtkIdType
Definition: vtkType.h:363
importer abstract class
Definition: vtkImporter.h:60
vtkActorCollection * GetImportedActors()
Get collection of actors, cameras and lights that were imported by this importer. ...
Definition: vtkImporter.h:107
an ordered list of lights
dynamic, self-adjusting array of double
virtual void ImportEnd()
Definition: vtkImporter.h:280
virtual int ImportBegin()
Definition: vtkImporter.h:279
virtual void DisableAnimation(vtkIdType animationIndex)
Enable/Disable/Get the status of specific animations.
Definition: vtkImporter.h:177
virtual std::string GetAnimationName(vtkIdType animationIndex)
Get the name of an animation.
Definition: vtkImporter.h:170
#define VTK_DEPRECATED_IN_9_6_0(reason)
a simple class to control print indentation
Definition: vtkIndent.h:28
Key for integer values in vtkInformation.
virtual std::string GetOutputsDescription()
Recover a printable string that let importer implementation Describe their outputs.
Definition: vtkImporter.h:136
virtual void Modified()
Update the modification time for this object.
vtkNew< vtkLightCollection > LightCollection
Definition: vtkImporter.h:320
virtual std::string GetCameraName(vtkIdType camIndex)
Get the name of a camera.
Definition: vtkImporter.h:191
virtual void ImportActors(vtkRenderer *)
Definition: vtkImporter.h:281
virtual vtkIdType GetNumberOfCameras()
Get the number of available cameras.
Definition: vtkImporter.h:185
an ordered list of actors
virtual void ImportLights(vtkRenderer *)
Definition: vtkImporter.h:283
void SetUpdateStatus(UpdateStatusEnum updateStatus)
Set the update status.
Definition: vtkImporter.h:300
create a window for renderers to draw into
create and manipulate ordered lists of objects
Definition: vtkCollection.h:39
hierarchical representation to use with vtkPartitionedDataSetCollection
virtual void SetCamera(vtkIdType camIndex)
Enable a specific camera.
Definition: vtkImporter.h:198
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:158
UpdateStatusEnum GetUpdateStatus()
Get the update status.
Definition: vtkImporter.h:309
virtual void ImportProperties(vtkRenderer *)
Definition: vtkImporter.h:284