1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
|
/*=========================================================================
Program: Visualization Toolkit
Module: vtkMotionFXCFGReader.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#ifndef vtkMotionFXCFGReader_h
#define vtkMotionFXCFGReader_h
#include "vtkIOMotionFXModule.h" // for export macro
#include "vtkMultiBlockDataSetAlgorithm.h"
#include <string> // for std::string
/**
* @class vtkMotionFXCFGReader
* @brief reader for MotionFX motion definitions cfg files.
*
* MotionFX files comprise of `motion`s for a collection of STL files. The
* motions define the transformations to apply to STL geometry to emulate
* motion like translation, rotation, planetary motion, etc.
*
* This reader reads such a CFG file and produces a temporal output for the time
* range defined in the file. The resolution of time can be controlled using the
* `SetTimeResolution` method. The output is a multiblock dataset with blocks
* for each of bodies, identified by an STL file, in the cfg file.
*
* The reader uses PEGTL (https://github.com/taocpp/PEGTL)
* to define and parse the grammar for the CFG file.
*/
VTK_ABI_NAMESPACE_BEGIN
class VTKIOMOTIONFX_EXPORT vtkMotionFXCFGReader : public vtkMultiBlockDataSetAlgorithm
{
public:
static vtkMotionFXCFGReader* New();
vtkTypeMacro(vtkMotionFXCFGReader, vtkMultiBlockDataSetAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent) override;
///@{
/**
* Get/Set the filename.
*/
void SetFileName(VTK_FILEPATH const char* fname);
VTK_FILEPATH const char* GetFileName() const
{
return this->FileName.empty() ? nullptr : this->FileName.c_str();
}
///@}
///@{
/**
* Get/Set the time resolution for timesteps produced by the reader.
*/
vtkSetClampMacro(TimeResolution, int, 1, VTK_INT_MAX);
vtkGetMacro(TimeResolution, int);
///@}
protected:
vtkMotionFXCFGReader();
~vtkMotionFXCFGReader() override;
int RequestInformation(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
/**
* Reads meta-data. Returns false if file not readable.
*/
bool ReadMetaData();
std::string FileName;
int TimeResolution;
vtkTimeStamp FileNameMTime;
vtkTimeStamp MetaDataMTime;
private:
vtkMotionFXCFGReader(const vtkMotionFXCFGReader&) = delete;
void operator=(const vtkMotionFXCFGReader&) = delete;
class vtkInternals;
vtkInternals* Internals;
};
VTK_ABI_NAMESPACE_END
#endif
|