////////////////////////////////////////////////////////////////
//
// drawable.h
// Copyright (c) 2002 by Wesley H. Huang.  All rights reserved.
//
// This file contains declarations for a "drawableObject" class which
// is a base class for objects that you want to draw on the screen.
// The derived classes must contain the information about the object
// (such as its shape, name, and any other additional attributes).
//
////////////////////////////////////////////////////////////////
#ifndef DRAWABLE_H
#define DRAWABLE_H

#include <string>
using namespace std;

// drawableObject
//
// This is an abstract class, meaning that it defines an interface for
// objects that are derived from this class.  The pure virtual
// functions declared in this class must be defined in a derived class
// in order for instances of that class to be created. 
//
// This base class contains all the information that we need to know
// in order to draw an object using OpenGL.
// 
class drawableObject {
public:
  enum shapeType {polygon, ellipse};

protected:
  bool _drawBorder;	   // draw the border of a polygon?
  bool _closed;		   // should the border be closed?
  float _width;		   // width of polygon border or line, size of point
  bool _fill;		   // fill a polygon?
  string _lineColor, _bodyColor;// name of color

  shapeType _type;

public:
  shapeType type() const { return _type;}

  virtual int numPoints() const = 0;
  virtual void getPoint(int i, double *x, double *y) const = 0;

  virtual bool drawBorder() const { return _drawBorder;}
  virtual bool closed() const { return _closed;}
  virtual float width() const { return _width;}
  virtual bool fill() const { return _fill;}
  virtual const string& lineColor() const { return _lineColor;}
  virtual const string& bodyColor() const { return _bodyColor;}

  // functions for ellipses.  (need to have some definition here... yuck)
  virtual double ellipseOrientation() const { return 0.0;}
  virtual double ellipseAspectRatio() const { return 1.0;}
  virtual double ellipseMajorRadius() const { return 1.0;}

  // the compiler wants a virtual destructor, so here it is:
  virtual ~drawableObject() {}
};

#endif
