// Created by: Peter KURNEV
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.

#include <BOPDS_PaveBlock.hxx>

//=======================================================================
//function : 
//purpose  : 
//=======================================================================
  inline BOPDS_Curve::BOPDS_Curve()
:
  myAllocator(NCollection_BaseAllocator::CommonBaseAllocator()),
  myPaveBlocks(myAllocator),
  myTechnoVertices(myAllocator),
  myTolerance(0.)
{
}
//=======================================================================
//function : 
//purpose  : 
//=======================================================================
  inline BOPDS_Curve::BOPDS_Curve(const Handle(NCollection_BaseAllocator)& theAllocator)
:
  myAllocator(theAllocator),
  myPaveBlocks(myAllocator),
  myTechnoVertices(myAllocator),
  myTolerance(0.)
{
}
//=======================================================================
//function : 
//purpose  : 
//=======================================================================
  inline BOPDS_Curve::~BOPDS_Curve()
{
}
//=======================================================================
//function : SetCurve
//purpose  : 
//=======================================================================
  inline void BOPDS_Curve::SetCurve(const IntTools_Curve& theCurve)
{
  myCurve=theCurve;
}
//=======================================================================
//function : Curve
//purpose  : 
//=======================================================================
  inline const IntTools_Curve& BOPDS_Curve::Curve()const
{
  return myCurve;
}
//=======================================================================
//function : SetPaveBlocks
//purpose  : 
//=======================================================================
  inline void BOPDS_Curve::SetPaveBlocks(const BOPDS_ListOfPaveBlock& theLPB)
{
  BOPDS_ListIteratorOfListOfPaveBlock aIt;
  //
  myPaveBlocks.Clear();
  aIt.Initialize(theLPB);
  for (; aIt.More(); aIt.Next()) {
    myPaveBlocks.Append(aIt.Value());
  }
}
//=======================================================================
//function : PaveBlocks
//purpose  : 
//=======================================================================
  inline const BOPDS_ListOfPaveBlock& BOPDS_Curve::PaveBlocks()const
{
  return myPaveBlocks;
}
//=======================================================================
//function : ChangePaveBlocks
//purpose  : 
//=======================================================================
  inline BOPDS_ListOfPaveBlock& BOPDS_Curve::ChangePaveBlocks()
{
  return myPaveBlocks;
}
//=======================================================================
//function : InitPaveBlock1
//purpose  : 
//=======================================================================
  inline void BOPDS_Curve::InitPaveBlock1()
{
  if (!myPaveBlocks.Extent()) {
    Handle(BOPDS_PaveBlock) aPB=new BOPDS_PaveBlock;
    myPaveBlocks.Append(aPB);
  }
}
//=======================================================================
//function : ChangePaveBlock1
//purpose  : 
//=======================================================================
  inline Handle(BOPDS_PaveBlock)& BOPDS_Curve::ChangePaveBlock1()
{
  Handle(BOPDS_PaveBlock)* pPB=(Handle(BOPDS_PaveBlock)*)&myPaveBlocks.First();
  return *pPB;
}
//=======================================================================
//function : TechnoVertices
//purpose  : 
//=======================================================================
  inline const TColStd_ListOfInteger& BOPDS_Curve::TechnoVertices()const
{
  return myTechnoVertices;
}
//=======================================================================
//function : ChangeTechnoVertices
//purpose  : 
//=======================================================================
  inline TColStd_ListOfInteger& BOPDS_Curve::ChangeTechnoVertices()
{
  return myTechnoVertices;
}
//=======================================================================
//function : SetBox
//purpose  : 
//=======================================================================
  inline void BOPDS_Curve::SetBox(const Bnd_Box& theBox)
{
  myBox=theBox;
}
//=======================================================================
//function : Box
//purpose  : 
//=======================================================================
  inline const Bnd_Box& BOPDS_Curve::Box()const
{
  return myBox;
}
//=======================================================================
//function : ChangeBox
//purpose  : 
//=======================================================================
  inline Bnd_Box& BOPDS_Curve::ChangeBox()
{
  return myBox;
}
//=======================================================================
//function : HasEdge
//purpose  : 
//=======================================================================
  inline Standard_Boolean BOPDS_Curve::HasEdge()const
{
  Standard_Boolean bFlag;
  BOPDS_ListIteratorOfListOfPaveBlock aItPB;
  //
  bFlag=Standard_False;
  aItPB.Initialize(myPaveBlocks);
  for (; aItPB.More(); aItPB.Next()) {
    const Handle(BOPDS_PaveBlock)& aPB=aItPB.Value();
    bFlag=aPB->HasEdge();
    if (bFlag) {
      break;
    }
  }
  return bFlag;
}
