/************************************************************************/
/* Copyright 1998 MBARI							*/
/************************************************************************/
#ifndef _ATTITUDEGRAPH_H
#define _ATTITUDEGRAPH_H
static char AttitudeGraph_h_id[] = "$Header: /u/oreilly/rov/tmacs/RCS/AttitudeGraph.h,v 1.2 1998/12/18 21:07:21 oreilly Exp $";

/*
$Log: AttitudeGraph.h,v $
Revision 1.2  1998/12/18 21:07:21  oreilly
Added documentation

Revision 1.1  1996/10/28 09:13:26  oreilly
Initial revision

*/


#include <Vk/VkDoubleBuffer.h>
#include "ErrorHandler.h"
#include "Math.h"

/*
CLASS 
AttitudeGraph

DESCRIPTION
Displays horizon based on roll and pitch values

AUTHOR
Tom O'Reilly
*/
class AttitudeGraph : public VkDoubleBuffer, public ErrorHandler
{
  public:
  
  AttitudeGraph(const char *name, Widget parent, 
		Radians headingRange, Radians pitchRange);

  ~AttitudeGraph();

  virtual const char *className()
  {
    return "AttitudeGraph";
  }
  
  virtual void draw();

  void setRoll(Radians roll);
  void setPitch(Radians pitch);
  void setHeading(Radians heading);

  Radians roll()
  {
    return _roll;
  }
  
  Radians pitch()
  {
    return _pitch;
  }
  
  Radians heading()
  {
    return _heading;
  }
  
  
  protected:
  virtual void drawAxes();
  void drawHorizon();  
  int physicalCoords(double x, double y, int *i, int *j);
  int defineHorizonPolygon(int x1, int y1, int x2, int y2, 
			    Boolean upsideDown);
  
  Radians _roll;
  Radians _pitch;
  Radians _heading;
  Radians _xRange;
  Radians _yRange;
  
  GC _axisGC;
  GC _horizonGC;
  GC _skyGC;
  GC _groundGC;

  Display *_display;
  int _screenNum;
  XPoint _horizonPolygon[10];

  Pixel _skyColor, _horizonColor, _axisColor, _groundColor;
  
  static XtResource _resources[];
};

#endif
