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

#include <vector>

#include "CgalExtension/cgalConfig.h"
#include "DataStructure/gmafDataStructure.h"
#include "gmafQuad.h"

class gmafPolyhedron;
class gmafQuadVertex;

/**
   gmafQuadMap: The set of the quads
 */
class gmafQuadMap : public gmafDataStructure {
// ENUMS
public:
  enum { UPPER_LEFT = 0,
	 LOWER_LEFT = 1,
	 LOWER_RIGHT = 2,
	 UPPER_RIGHT = 3 };

// VARIABLES
/**@name Class Variables */
//@{
protected:
  /** 
      mpPolyhedron is the polyhedron adapted by QuadMap
  */
  gmafPolyhedron* mpPolyhedron;

  /** 
      mQuadList should have the same sequence of the facet list in 
      the cgal polyhedron
  */
  vector<gmafQuad*> mQuadList;

  /** 
      mVertexList should have the same sequence of the vertex list in 
      the cgal polyhedron
  */
  vector<gmafQuadVertex*> mVertexList;

  
private:

//@}

// METHODS
/**@name Class Methods */
//@{
public:
  /**
     Constructor of gmafQuadMap
  */
  gmafQuadMap(gmafPolyhedron* p);

  /**
     Destructor of gmafQuadMap
  */    
  virtual ~gmafQuadMap();
  
  /**
     Get the the pointer of the polyhedron object.
  */
  inline gmafPolyhedron* getPolyhedron() { return mpPolyhedron; }

  /**
     Get the list of the quads
   */
  inline vector<gmafQuad*>& getQuadList() { return mQuadList; }
  /**
     Get the vertices list of the polyhedron (not just extraordinary vertices).
   */
  inline vector<gmafQuadVertex*>& getVertexList() { return mVertexList; }
  /**
     Return the number of the quads.
   */
  inline int size() { return mQuadList.size(); }
  inline int getCurLayerIdx() { return mQuadList.front()->getCurLayerIdx(); }
  inline void setBlendRatio(float br);
protected:
  
private:

};

#include "gmafQuadIterator.h"
inline void gmafQuadMap::setBlendRatio(float br) {
  for (gmafQuadIterator qitr(this); qitr.valid(); qitr.next()) {
    (qitr.current()).setBlendRatio(br);
  }
}

#endif gmafQuadMap_H
