Go to the documentation of this file.
15 #ifndef TestMotionFXCFGReaderCommon_h
16 #define TestMotionFXCFGReaderCommon_h
29 #include <vtkTestUtilities.h>
30 #include <vtkTesting.h>
49 cout <<
"Go to next" << endl;
51 std::min(static_cast<int>(this->TimeSteps.size()) - 1, this->CurrentIndex + 1);
57 cout <<
"Go to prev" << endl;
58 this->CurrentIndex =
std::max(0, this->CurrentIndex - 1);
65 for (
size_t cc = 0; cc < this->TimeSteps.size(); ++cc)
69 this->CurrentIndex = static_cast<int>(cc);
77 assert(this->CurrentIndex >= 0 && this->CurrentIndex < static_cast<int>(this->TimeSteps.size()));
88 switch (iren->GetKeyCode())
107 template <
typename InitializationCallback>
108 int Test(
int argc,
char* argv[],
const char* dfile,
const InitializationCallback& initCallback)
111 char* fname = vtkTestUtilities::ExpandDataFileName(argc, argv, dfile);
120 const int numTimeSteps = outInfo->
Length(SDDP::TIME_STEPS());
122 if (numTimeSteps != 100)
124 cerr <<
"ERROR: missing timesteps. Potential issue reading the CFG file." << endl;
143 initCallback(renWin, renderer, reader);
145 std::vector<double> ts(numTimeSteps);
146 outInfo->
Get(SDDP::TIME_STEPS(), &ts[0]);
155 if (retVal == vtkTesting::DO_INTERACTOR)
158 data.Window = renWin;
159 data.Reader = reader;
160 data.Mapper = mapper;
162 data.CurrentIndex = numTimeSteps / 2;
169 cout <<
"Entering interactive mode......" << endl
170 <<
"Supported operations:" << endl
171 <<
" 'z' or 'Z' : go to next time step" << endl
172 <<
" 'x' or 'X' : go to previous time step" << endl
173 <<
" 'c' or 'C' : play animation from start to end" << endl
174 <<
" 'q' or 'Q' : quit" << endl;
178 else if (retVal == vtkTesting::NOT_RUN)
180 return VTK_SKIP_RETURN_CODE;
182 else if (retVal == vtkTesting::PASSED)
void SetRenderWindow(vtkRenderWindow *aren)
Set/Get the rendering window being controlled by this object.
virtual int UpdateTimeStep(double time, int piece=-1, int numPieces=1, int ghostLevels=0, const int extents[6]=nullptr)
Convenience method to update an algorithm after passing requests to its first output port.
static void CharEventCallback(vtkObject *caller, unsigned long, void *clientdata, void *)
void AddActor(vtkProp *p)
Add/Remove different types of props to the renderer.
virtual void SetCallback(void(*f)(vtkObject *caller, unsigned long eid, void *clientdata, void *calldata))
abstract base class for most VTK objects
unsigned long AddObserver(unsigned long event, vtkCommand *, float priority=0.0f)
Allow people to add/remove/invoke observers (callbacks) to any VTK object.
vtkDataObject * GetOutputDataObject(int port)
Get the data object that will contain the algorithm output for the given port.
vtkSmartPointer< vtkCompositePolyDataMapper2 > Mapper
int Test(int argc, char *argv[], const char *dfile, const InitializationCallback &initCallback)
vtkAlgorithmOutput * GetOutputPort(int index)
Get a proxy object corresponding to the given output port of this algorithm.
void SetFileName(const char *fname)
Get/Set the filename.
virtual void AddRenderer(vtkRenderer *)
Add a renderer to the list of renderers.
void Render() override
Ask each renderer owned by this RenderWindow to render its image and synchronize this process.
Allocate and hold a VTK object.
virtual void SetInputConnection(int port, vtkAlgorithmOutput *input)
Set the connection for the given input port index.
vtkSmartPointer< vtkMotionFXCFGReader > Reader
vtkSmartPointer< vtkRenderWindow > Window
virtual void UpdateInformation()
Bring the algorithm's information up-to-date.
virtual void Start()
Start the event loop.
virtual void SetClientData(void *cd)
Methods to set and get client and callback information, and the callback function.
virtual void SetMapper(vtkMapper *)
This is the method that is used to connect an actor to the end of a visualization pipeline,...
std::vector< double > TimeSteps
Executive supporting partial updates.
static vtkRenderWindowInteractor * SafeDownCast(vtkObjectBase *o)
virtual void SetTimeResolution(int)
Get/Set the time resolution for timesteps produced by the reader.
virtual void SetInputDataObject(int port, vtkDataObject *data)
Sets the data-object as an input on the given port index.
vtkInformation * GetOutputInformation(int port)
Return the information object that is associated with a particular output port.