// Copyright (c) 1995-1999 Matra Datavision
// 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 "StdFail_NotDone.hxx"
#include "gp_Pnt.hxx"
#include "NCollection_Array2.hxx"
#include "NCollection_HArray2.hxx"
#include "gp_Pnt2d.hxx"
#include "NCollection_Array1.hxx"
#include "NCollection_HArray1.hxx"
#include "Standard_Integer.hxx"

inline bool AppBlend_AppSurf::IsDone() const
{
  return done;
}

inline int AppBlend_AppSurf::UDegree() const
{
  if (!done)
  {
    throw StdFail_NotDone();
  }
  return udeg;
}

inline int AppBlend_AppSurf::VDegree() const
{
  if (!done)
  {
    throw StdFail_NotDone();
  }
  return vdeg;
}

inline const NCollection_Array2<gp_Pnt>& AppBlend_AppSurf::SurfPoles() const
{
  if (!done)
  {
    throw StdFail_NotDone();
  }
  return tabPoles->Array2();
}

inline const NCollection_Array2<double>& AppBlend_AppSurf::SurfWeights() const
{
  if (!done)
  {
    throw StdFail_NotDone();
  }
  return tabWeights->Array2();
}

inline const NCollection_Array1<double>& AppBlend_AppSurf::SurfUKnots() const
{
  if (!done)
  {
    throw StdFail_NotDone();
  }
  return tabUKnots->Array1();
}

inline const NCollection_Array1<double>& AppBlend_AppSurf::SurfVKnots() const
{
  if (!done)
  {
    throw StdFail_NotDone();
  }
  return tabVKnots->Array1();
}

inline const NCollection_Array1<int>& AppBlend_AppSurf::SurfUMults() const
{
  if (!done)
  {
    throw StdFail_NotDone();
  }
  return tabUMults->Array1();
}

inline const NCollection_Array1<int>& AppBlend_AppSurf::SurfVMults() const
{
  if (!done)
  {
    throw StdFail_NotDone();
  }
  return tabVMults->Array1();
}

inline int AppBlend_AppSurf::NbCurves2d() const
{
  if (!done)
  {
    throw StdFail_NotDone();
  }
  return seqPoles2d.Length();
}

inline int AppBlend_AppSurf::Curves2dDegree() const
{
  if (!done)
  {
    throw StdFail_NotDone();
  }
  if (seqPoles2d.Length() == 0)
  {
    throw Standard_DomainError();
  }
  return vdeg;
}

inline const NCollection_Array1<gp_Pnt2d>& AppBlend_AppSurf::Curve2dPoles(const int Index) const
{
  if (!done)
  {
    throw StdFail_NotDone();
  }
  if (seqPoles2d.Length() == 0)
  {
    throw Standard_DomainError();
  }
  return seqPoles2d(Index)->Array1();
}

inline const NCollection_Array1<double>& AppBlend_AppSurf::Curves2dKnots() const
{
  if (!done)
  {
    throw StdFail_NotDone();
  }
  if (seqPoles2d.Length() == 0)
  {
    throw Standard_DomainError();
  }
  return tabVKnots->Array1();
}

inline const NCollection_Array1<int>& AppBlend_AppSurf::Curves2dMults() const
{
  if (!done)
  {
    throw StdFail_NotDone();
  }
  if (seqPoles2d.Length() == 0)
  {
    throw Standard_DomainError();
  }
  return tabVMults->Array1();
}

inline void AppBlend_AppSurf::TolReached(double& Tol3d, double& Tol2d) const
{
  if (!done)
  {
    throw StdFail_NotDone();
  }
  Tol3d = tol3dreached;
  Tol2d = tol2dreached;
}
