/****************************************************************************
** GMAF - The Geometry Modeling Algorithms Framework
**
** Created : 03112000
**
** Copyright (C) 2000 by Le-Jeng Shiue.  All rights reserved.
**
****************************************************************************/
#ifndef gmafPolyhedron_H
#define gmafPolyhedron_H

#include <iostream>

#include "CgalExtension/cgalConfig.h"
#include <CGAL/Bbox_3.h>

#include "gmafDataStructure.h"

/**
  gmafPolyhedron contains a pointer to a polyhedron and provide the import 
  finction to create the polyhedron from a VF file.
*/
class gmafPolyhedron : public gmafDataStructure {
// ENUMS
public:

// VARIABLES
/**@name Class Variables */
//@{
protected:
  /** 
      The pointer to the polyhedron, which is newed by constructor and
      delete by destructor. Check the documetation of CGAL.
  */
  Polyhedron* mpPolyhedron;
  /** 
      The pointer to the bounding box of the polyhedron, which is created
      inside Import() right after the polyhedron is created.
  */
  CGAL::Bbox_3* mpBbox;
  /** 
      the mass center of the polyhedron
   */
  Point mCenter;
private:

//@}

// METHODS
/**@name Class Methods */
//@{
public:
  /**
     Constructor of gmafPolyhedron. It will new a Polyhedron object.
  */    
  gmafPolyhedron();
  /**
     Destructor of gmafPolyhedron. It will delete the Polyhedron object.
  */    
  virtual ~gmafPolyhedron();
  
  /**
     Read a VF file into the Polyhedron object. Will be extent to read 
     different format of 3D object file.
     in: the istream of the input file
  */
  void import(std::istream& in);

  /**
     Get the the pointer of the polyhedron object.
  */
  inline Polyhedron* getPolyhedron() { return mpPolyhedron; }
  /**
     Get the bounding box of this polyhedron.
   */
  inline CGAL::Bbox_3* getBbox() { return mpBbox; }
  /**
     Get the mass center of this polyhedron.
   */
  inline Point& getCenter() { return mCenter; }
  /**
     Get the number of the facets/vertices/edges of this polyhedron.
   */
  inline Size getNumFacets() { return mpPolyhedron->size_of_facets(); }
  inline Size getNumVertice() { return mpPolyhedron->size_of_vertices(); }
  inline Size getNumHalfEdges() { return mpPolyhedron->size_of_halfedges(); }

protected:
  void init();

  /**
     Generate the plane equation of f. The equation will directly set into the
     polyhedron object.
     f: the facet which plane equation will generate from 
  */
  static void initFacet(Facet& f);

  /**
     following two function are still empty
  */
  static void initVertex(Vertex& v);
  static void initHalfedge(Halfedge& he);
  
private:
};


#endif gmafPolyhedron_H

