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);
 
   78       this->CurrentIndex >= 0 && this->CurrentIndex < 
static_cast<int>(this->TimeSteps.size()));
 
   79     this->Reader->UpdateTimeStep(this->TimeSteps[this->CurrentIndex]);
 
   80     this->Mapper->SetInputDataObject(this->Reader->GetOutputDataObject(0));
 
   81     this->Window->Render();
 
   89   switch (iren->GetKeyCode())
 
  108 template <
typename InitializationCallback>
 
  109 int Test(
int argc, 
char* argv[], 
const char* dfile, 
const InitializationCallback& initCallback)
 
  112   char* fname = vtkTestUtilities::ExpandDataFileName(argc, argv, dfile);
 
  113   reader->SetFileName(fname);
 
  116   reader->SetTimeResolution(100);
 
  117   reader->UpdateInformation();
 
  121   const int numTimeSteps = outInfo->
Length(SDDP::TIME_STEPS());
 
  123   if (numTimeSteps != 100)
 
  125     cerr << 
"ERROR: missing timesteps. Potential issue reading the CFG file." << endl;
 
  132   renWin->AddRenderer(renderer);
 
  135   iren->SetRenderWindow(renWin);
 
  138   mapper->SetInputConnection(reader->GetOutputPort());
 
  141   actor->SetMapper(mapper);
 
  142   renderer->AddActor(actor);
 
  144   initCallback(renWin, renderer, reader);
 
  146   std::vector<double> ts(numTimeSteps);
 
  147   outInfo->
Get(SDDP::TIME_STEPS(), &ts[0]);
 
  151   reader->UpdateTimeStep(ts[numTimeSteps / 2]);
 
  152   mapper->SetInputDataObject(reader->GetOutputDataObject(0));
 
  156   if (retVal == vtkTesting::DO_INTERACTOR)
 
  159     data.Window = renWin;
 
  160     data.Reader = reader;
 
  161     data.Mapper = mapper;
 
  163     data.CurrentIndex = numTimeSteps / 2;
 
  166     observer->SetClientData(&
data);
 
  170     cout << 
"Entering interactive mode......" << endl
 
  171          << 
"Supported operations:" << endl
 
  172          << 
"   'z' or 'Z' : go to next time step" << endl
 
  173          << 
"   'x' or 'X' : go to previous time step" << endl
 
  174          << 
"   'c' or 'C' : play animation from start to end" << endl
 
  175          << 
"   'q' or 'Q' : quit" << endl;
 
  179   else if (retVal == vtkTesting::NOT_RUN)
 
  181     return VTK_SKIP_RETURN_CODE;
 
  183   else if (retVal == vtkTesting::PASSED)