// 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.

//=================================================================================================

inline bool BOPDS_Tools::HasBRep(const TopAbs_ShapeEnum aTi)
{
  return (aTi == TopAbs_VERTEX || aTi == TopAbs_EDGE || aTi == TopAbs_FACE);
}

//=================================================================================================

inline bool BOPDS_Tools::IsInterfering(const TopAbs_ShapeEnum aTi)
{
  return (BOPDS_Tools::HasBRep(aTi) || aTi == TopAbs_SOLID);
}

//=================================================================================================

inline int BOPDS_Tools::TypeToInteger(const TopAbs_ShapeEnum aType1, const TopAbs_ShapeEnum aType2)
{
  int iRet, iT1, iT2, iX;
  //
  iRet = -1;
  iT1  = BOPDS_Tools::TypeToInteger(aType1);
  iT2  = BOPDS_Tools::TypeToInteger(aType2);
  //
  iX = iT2 * 10 + iT1;
  switch (iX)
  {
    case 77:
      iRet = 0; // VV
      break;
    case 76:
    case 67:
      iRet = 1; // VE
      break;
    case 66:
      iRet = 2; // EE
      break;
    case 74:
    case 47:
      iRet = 3; // VF
      break;
    case 64:
    case 46:
      iRet = 4; // EF
      break;
    case 44:
      iRet = 5; // FF
      break;
    case 72:
    case 27:
      iRet = 6; // VZ
      break;
    case 62:
    case 26:
      iRet = 7; // EZ
      break;
    case 42:
    case 24:
      iRet = 8; // FZ
      break;
    case 22:
      iRet = 9; // ZZ
      break;
    default:
      break;
  }
  return iRet;
}

//=================================================================================================

inline int BOPDS_Tools::TypeToInteger(const TopAbs_ShapeEnum aType1)
{
  int iRet = 9;
  //
  switch (aType1)
  {
    case TopAbs_COMPOUND:
      iRet = 0;
      break;
    case TopAbs_COMPSOLID:
      iRet = 1;
      break;
    case TopAbs_SOLID:
      iRet = 2;
      break;
    case TopAbs_SHELL:
      iRet = 3;
      break;
    case TopAbs_FACE:
      iRet = 4;
      break;
    case TopAbs_WIRE:
      iRet = 5;
      break;
    case TopAbs_EDGE:
      iRet = 6;
      break;
    case TopAbs_VERTEX:
      iRet = 7;
      break;
    case TopAbs_SHAPE:
      iRet = 8;
      break;
    default:
      break;
  }
  return iRet;
}
