view src/include/vtkplot.hpp @ 61:b3bf4ac981ec default tip

Update the doxygen documentation
author Jordi Gutiérrez Hermoso <jordigh@gmail.com>
date Sat, 29 May 2010 20:01:40 -0500
parents 11395e64852f
children
line wrap: on
line source

/*! \file  vtkplot.hpp
 * \brief VTK plotting utils
 *
 *  \file vtkplot.cpp
 *  \brief Implementations and pinstantiations of the functions and
 *  classes declared in vtkplot.hpp
 */

#pragma once

#include <string>

#include <vtkSmartPointer.h>
#include <vtkProgrammableFilter.h>
#include <vtkRenderWindow.h>
#include <vtkRenderer.h>

#include "interpolator.hpp"

namespace kwantix{

/** \defgroup VTK */
/// \{
///A class for creating VTK plots
class vtkplot{
public:
  /*! \brief Constructor performs a Delaunay triangulation on data
   * \param u - An interpolator on a 2d domain 
   * \param zmin_in - Minimum value this interpolator is expected to take
   *                  (for colouring purposes)
   * \param zmax_in - Maximum value this interpolator is expected to take
   *                  (for colouring purposes)
   * \param offscreen_in - Whether it will be offscreen plotting or not
   */
  template<typename RBF>
  vtkplot(const interpolator<RBF>& u, 
          double zmin_in, double zmax_in,
          bool offscreen_in = false);
  ///Defines the view direction when plotting.
  void set_view_direction(double x, double y, double z);
  ///Without changing the triangulation, update the values.
  void update_values(const interp_values& vals_in);
  ///Enable offscreen plotting.
  void set_offscreen(bool offscreen_in = true);
  ///Set the base filename used for saving, to which numbers are appended.
  void set_base_filename(const std::string& basename);
  ///Actually do the plot, whether offscreen or onscreen.
  void plot() const;

  ///Enable window interaction
  void begin_interaction() const;

  ///The VTK callback for updating the surface points
  void AdjustPoints();
  ///Trampoline function for VTK callback
  static void trampoline(void* this_ptr);

private:
  
  ///Setup the initial pipeline
  template<typename RBF>
  void SetupPipeline(const interpolator<RBF>& u);
  
  ///A VTK callback to insert in the pipeline to modify an existing plotting pipeline
  vtkSmartPointer<vtkProgrammableFilter> programmableFilter;

  ///Setup the pipeline to plot offscreen or not
  void InitOffscreen();

  ///View direction
  double xview, yview, zview;

  ///Min and max ranges (for colour values)
  double zmin, zmax;

  ///Values with which to update the surface data
  interp_values vals;

  /*! \name VTK pipeline endpoints
   *
   * Endpoint of the VTK pipeline
   */
  //@{
  vtkSmartPointer<vtkRenderer> ren1;
	vtkSmartPointer<vtkRenderWindow> renWin;
  //@}

  ///The associated interpolator's hash
  size_t hash;
  ///Base filename
  string basename;
  ///Whether to plot offscreen or not
  bool offscreen;
};

/// \}

} //namespace kwantix
///\}