//=========================================================================
//#
//#  vtkActorToPFTranslator.h                         ##   ##
//#                                                   ##   ## 
//#  Authors: Paul Rajlich                            #######
//#  Email: prajlich@ncsa.uiuc.edu                    ##   ##
//#  Date created:                                    ##   ##
//#
//#  Description: translator class that encapsulates translation and
//#    updating process. Preserves vtk's implicit control of execution
//#    model. Changes in the vtk pipeline automatically propogate into
//#    the Performer scenegraph.
//#
//=========================================================================
//# Copyright (C) 1997-2006 Paul Rajlich, NCSA
//# Distributed under the terms of the GNU Library General Public License (LGPL)
//# as published by the Free Software Foundation
//=========================================================================

#ifndef __vtkActorToPFTranslator_h
#define __vtkActorToPFTranslator_h

#include "vtkActorToPF.h"

// pre-traversal callback declaration.
int updateVTKFunc(pfTraverser *trav, void *userData);

class VTK_EXPORT vtkActorToPFTranslator : public vtkObject
{
  public:
  vtkActorToPFTranslator();

  static vtkActorToPFTranslator *New() {
    return new vtkActorToPFTranslator();
  } 
  static vtkActorToPFTranslator *New(vtkActor *actor, pfGeode *geode = NULL) {
    vtkActorToPFTranslator *newT = new vtkActorToPFTranslator();
    newT->SetActor(actor);
    newT->SetGeode(geode);
    newT->Init();
    return newT;
  }

  const char *GetClassName() {return "vtkActorToPFTranslator";}
  void PrintSelf(ostream& os, vtkIndent indent);

  // init... do first translation and register Performer callback
  virtual void Init();

  // update vtk pipeline and translate (Execute()) if necessary
  // you should not have to call this explicitly, it will be done
  // in the callback.
  virtual void Update();

  // must be done before Init()...
  void SetActor(vtkActor *actor) {
    theActor = actor;
    this->Modified();
  }
  vtkActor *GetActor() {
    return theActor;
  }

  // set theGeode to existing geode. WARNING: geode's GSets will be
  // replaced with those from translation.
  void SetGeode(pfGeode *geode) {
    theGeode = geode;
    this->Modified();
  }
  pfGeode *GetGeode() {
    return theGeode;
  }

  // Turn on/off all of the debugging output
  vtkSetMacro(Verbose, int);
  vtkGetMacro(Verbose, int);
  vtkBooleanMacro(Verbose, int);

  // public so that translation can be called explicitly...
  void Execute();

  protected:
  vtkTimeStamp ExecuteTime; // look at vtkSource class
  vtkActor *theActor;
  pfGeode *theGeode;
  int Verbose;
};

#endif
