#ifndef TREEINDEXEDD2TEST_H
#define TREEINDEXEDD2TEST_H

#include <bsptreeD2.h>
#include <gobj.h>
#include <graphmisc.h>

#include <boxOBBhalfspaceD2.h>
#include <menusystem.h>
#include <point.h>
#include <treeindexedD2.h>
#include <typedefs.h>

/*!
\brief Test treeindexedD2 classes.

This class has small unit tests and two interactive
 graphics programs test03 and test05.  

The graphics aims to visually impart information about
 the data structures(WYSIWYG). 
*/
class treeindexedD2test
{
public:
  typedef point2<double> pt2;

private:
  /** Global graphics stream. */
  gobjContainer xGraphics;

  static point2<double> targetprev;
  static point2<double> target;

  static gobjContainer * targetg;
  static gobjMySphereDraw * targetsphere;

  static bsptreeD2<pt2,double,uint> bsp;

  /** Toggle the help menu. */
  static bool * help;

  static double keyboarddelta;

  /** Update test03. */
  static void update03();
  /** Update the moving ball in test03. */
  static void keyboard03(unsigned char key, int x, int y);
  /** Special character keyboard handler. */
  static void special03(int key, int x, int y);
  /** Displays the gobj::global with double buffering. */
  static void display01();
  /** Update test03. */
  static void update05();
  /** Handle test05 input. */
  static void keyboard05(unsigned char key, int x, int y);
  /** Special character keyboard handler. */
  static void special05(int key, int x, int y);


  static vector< boxOBBhalfspaceD2< pt2, double > > viboxes;

  static vector< vector<uint> > viboxesintersections;

  static menusystem* messages;

  /** Build some boxes. */
  void viboxesbuild();

  //void menu05();
public:

  /** Basic printing and inserting. */
  static void test01();
  /** Building and printing a simple tree. */
  static void test02();
  /** Visually see and interact with a bsp tree. */
  void test03(int argc, char** argv);
  /** Testing treeindexedD2iter.h classes. */
  static void test04();
  /** Passageway collision detection. */
  int test05(int argc, char** argv);


  /** Reading a tree from a text file. */
  static int unittest01(int argc, char** argv);
  /** Build a bsp tree in 2D. Test 5 points in their 
      5 regions. */
  static int unittest02();
  /** Testing move(T const bpath,T const nsteps). */
  static int unittest04();

};


#endif


