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)
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 AddActor(vtkProp *p)
Add/Remove different types of props to the renderer.
vtkSmartPointer< vtkCompositePolyDataMapper2 > Mapper
std::vector< double > TimeSteps
virtual void SetClientData(void *cd)
Methods to set and get client and callback information, and the callback function.
virtual void SetTimeResolution(int)
Get/Set the time resolution for timesteps produced by the reader.
abstract base class for most VTK objects
vtkAlgorithmOutput * GetOutputPort(int index)
Get a proxy object corresponding to the given output port of this algorithm.
static vtkRenderWindowInteractor * SafeDownCast(vtkObjectBase *o)
static void CharEventCallback(vtkObject *caller, unsigned long, void *clientdata, void *)
virtual void UpdateInformation()
Bring the algorithm's information up-to-date.
vtkSmartPointer< vtkMotionFXCFGReader > Reader
void SetRenderWindow(vtkRenderWindow *aren)
Set/Get the rendering window being controlled by this object.
vtkDataObject * GetOutputDataObject(int port)
Get the data object that will contain the algorithm output for the given port.
virtual void AddRenderer(vtkRenderer *)
Add a renderer to the list of renderers.
unsigned long AddObserver(unsigned long event, vtkCommand *, float priority=0.0f)
Allow people to add/remove/invoke observers (callbacks) to any VTK object.
void Render() override
Ask each renderer owned by this RenderWindow to render its image and synchronize this process...
virtual void SetInputDataObject(int port, vtkDataObject *data)
Sets the data-object as an input on the given port index.
void SetFileName(const char *fname)
Get/Set the filename.
virtual void Start()
Start the event loop.
vtkSmartPointer< vtkRenderWindow > Window
int Test(int argc, char *argv[], const char *dfile, const InitializationCallback &initCallback)
virtual void SetInputConnection(int port, vtkAlgorithmOutput *input)
Set the connection for the given input port index.
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...
Allocate and hold a VTK object.
virtual void SetMapper(vtkMapper *)
This is the method that is used to connect an actor to the end of a visualization pipeline...
Executive supporting partial updates.
vtkInformation * GetOutputInformation(int port)
Return the information object that is associated with a particular output port.
virtual void SetCallback(void(*f)(vtkObject *caller, unsigned long eid, void *clientdata, void *calldata))