// 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_Tools.hxx"

//=================================================================================================

inline BOPDS_ShapeInfo::BOPDS_ShapeInfo()
    :

      myType(TopAbs_SHAPE),
      myReference(-1),
      myFlag(-1)
{
}

//=================================================================================================

inline BOPDS_ShapeInfo::BOPDS_ShapeInfo(const occ::handle<NCollection_BaseAllocator>& theAllocator)
    : myType(TopAbs_SHAPE),
      mySubShapes(theAllocator),
      myReference(-1),
      myFlag(-1)
{
}

//=================================================================================================

inline BOPDS_ShapeInfo::~BOPDS_ShapeInfo() = default;

//=================================================================================================

inline void BOPDS_ShapeInfo::SetShape(const TopoDS_Shape& theS)
{
  myShape = theS;
}

//=================================================================================================

inline const TopoDS_Shape& BOPDS_ShapeInfo::Shape() const
{
  return myShape;
}

//=================================================================================================

inline void BOPDS_ShapeInfo::SetShapeType(const TopAbs_ShapeEnum theType)
{
  myType = theType;
}

//=================================================================================================

inline TopAbs_ShapeEnum BOPDS_ShapeInfo::ShapeType() const
{
  return myType;
}

//=================================================================================================

inline void BOPDS_ShapeInfo::SetBox(const Bnd_Box& theBox)
{
  myBox = theBox;
}

//=================================================================================================

inline const Bnd_Box& BOPDS_ShapeInfo::Box() const
{
  return myBox;
}

//=================================================================================================

inline Bnd_Box& BOPDS_ShapeInfo::ChangeBox()
{
  return myBox;
}

//=================================================================================================

inline const NCollection_List<int>& BOPDS_ShapeInfo::SubShapes() const
{
  return mySubShapes;
}

//=================================================================================================

inline NCollection_List<int>& BOPDS_ShapeInfo::ChangeSubShapes()
{
  return mySubShapes;
}

//=================================================================================================

inline bool BOPDS_ShapeInfo::HasSubShape(const int theI) const
{
  return mySubShapes.Contains(theI);
}

//=================================================================================================

inline bool BOPDS_ShapeInfo::HasReference() const
{
  return (myReference >= 0);
}

//=================================================================================================

inline void BOPDS_ShapeInfo::SetReference(const int theI)
{
  myReference = theI;
}

//=================================================================================================

inline int BOPDS_ShapeInfo::Reference() const
{
  return myReference;
}

//=================================================================================================

inline bool BOPDS_ShapeInfo::HasBRep() const
{
  return (BOPDS_Tools::HasBRep(myType));
}

//=================================================================================================

inline bool BOPDS_ShapeInfo::IsInterfering() const
{
  return (HasBRep() || myType == TopAbs_SOLID);
}

//=================================================================================================

inline bool BOPDS_ShapeInfo::HasFlag() const
{
  return (myFlag >= 0);
}

//=================================================================================================

inline bool BOPDS_ShapeInfo::HasFlag(int& theFlag) const
{
  theFlag = myFlag;
  return (myFlag >= 0);
}

//=================================================================================================

inline void BOPDS_ShapeInfo::SetFlag(const int theFlag)
{
  myFlag = theFlag;
}

//=================================================================================================

inline int BOPDS_ShapeInfo::Flag() const
{
  return myFlag;
}
