// Created on: 1995-01-03
// Created by: Laurent BUCHARD
// 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 <Standard_DomainError.hxx>

//=======================================================================
// Function : SetPoints
// Purpose  : Sets the first and the second points of the domain.
//=======================================================================

inline void HatchGen_Domain::SetPoints (const HatchGen_PointOnHatching& P1,
				 const HatchGen_PointOnHatching& P2)
{
  myHasFirstPoint  = Standard_True ;
  myFirstPoint     = P1 ;
  myHasSecondPoint = Standard_True ;
  mySecondPoint    = P2 ;
}

//=======================================================================
// Function : SetPoints
// Purpose  : Sets the first and the second points of the domain at the
//            infinite.
//=======================================================================

inline void HatchGen_Domain::SetPoints ()
{
  myHasFirstPoint  = Standard_False ;
  myHasSecondPoint = Standard_False ;
}

//=======================================================================
// Function : SetFirstPoint
// Purpose  : Sets the first point of the domain.
//=======================================================================

inline void HatchGen_Domain::SetFirstPoint (const HatchGen_PointOnHatching& P)
{
  myHasFirstPoint  = Standard_True ;
  myFirstPoint     = P ;
}

//=======================================================================
// Function : SetFirstPoint
// Purpose  : Sets the first point of the domain at the infinite.
//=======================================================================

inline void HatchGen_Domain::SetFirstPoint ()
{
  myHasFirstPoint  = Standard_False ;
}

//=======================================================================
// Function : SetSecondPoint
// Purpose  : Sets the second point of the domain.
//=======================================================================

inline void HatchGen_Domain::SetSecondPoint (const HatchGen_PointOnHatching& P)
{
  myHasSecondPoint = Standard_True ;
  mySecondPoint    = P ;
}

//=======================================================================
// Function : SetSecondPoint
// Purpose  : Sets the second point of the domain at the infinite.
//=======================================================================

inline void HatchGen_Domain::SetSecondPoint ()
{
  myHasSecondPoint = Standard_False ;
}

//=======================================================================
// Function : HasFirstPoint
// Purpose  : Returns True if the domain has a first point.
//=======================================================================

inline Standard_Boolean HatchGen_Domain::HasFirstPoint () const
{
  return myHasFirstPoint ;
}

//=======================================================================
// Function : FirstPoint
// Purpose  : Returns the first point of the domain.
//=======================================================================

inline const HatchGen_PointOnHatching& HatchGen_Domain::FirstPoint () const
{
  Standard_DomainError_Raise_if (!myHasFirstPoint, "HatchGen_Domain::FirstPoint") ;
  return myFirstPoint ;
}

//=======================================================================
// Function : HasSecondPoint
// Purpose  : Returns True if the domain has a second point.
//=======================================================================

inline Standard_Boolean HatchGen_Domain::HasSecondPoint () const
{
  return myHasSecondPoint ;
}

//=======================================================================
// Function : SecondPoint
// Purpose  : Returns the second of the domain.
//=======================================================================

inline const HatchGen_PointOnHatching& HatchGen_Domain::SecondPoint () const
{
  Standard_DomainError_Raise_if (!myHasSecondPoint, "HatchGen_Domain::SecondPoint") ;
  return mySecondPoint ;
}
