0024428: Implementation of LGPL license
[occt.git] / src / BOPDS / BOPDS_Tools.lxx
CommitLineData
4e57c75e 1// Created by: Peter KURNEV
973c2be1 2// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 3//
973c2be1 4// This file is part of Open CASCADE Technology software library.
b311480e 5//
973c2be1 6// This library is free software; you can redistribute it and / or modify it
7// under the terms of the GNU Lesser General Public version 2.1 as published
8// by the Free Software Foundation, with special exception defined in the file
9// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10// distribution for complete text of the license and disclaimer of any warranty.
b311480e 11//
973c2be1 12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
b311480e 14
7fd59977 15//=======================================================================
4e57c75e 16// function: HasBRep
17// purpose:
7fd59977 18//=======================================================================
72e88cf7 19inline Standard_Boolean BOPDS_Tools::HasBRep(const TopAbs_ShapeEnum aTi)
7fd59977 20{
4e57c75e 21 return (aTi==TopAbs_VERTEX || aTi==TopAbs_EDGE || aTi==TopAbs_FACE);
22}//=======================================================================
23//function : TypeToInteger
7fd59977 24//purpose :
25//=======================================================================
72e88cf7 26inline Standard_Integer BOPDS_Tools::TypeToInteger(const TopAbs_ShapeEnum aType1,
27 const TopAbs_ShapeEnum aType2)
7fd59977 28{
4e57c75e 29 Standard_Integer iRet, iT1, iT2, iX;
30 //
31 iRet=-1;
72e88cf7 32 iT1=BOPDS_Tools::TypeToInteger(aType1);
33 iT2=BOPDS_Tools::TypeToInteger(aType2);
4e57c75e 34 //
35 iX=iT2*10+iT1;
36 switch (iX) {
37 case 77:
c1fe53c6 38 iRet=0; // VV
4e57c75e 39 break;
40 case 76:
41 case 67:
c1fe53c6 42 iRet=1; // VE
43 break;
44 case 66:
45 iRet=2; // EE
4e57c75e 46 break;
47 case 74:
48 case 47:
c1fe53c6 49 iRet=3; // VF
4e57c75e 50 break;
51 case 64:
52 case 46:
c1fe53c6 53 iRet=4; // EF
4e57c75e 54 break;
55 case 44:
c1fe53c6 56 iRet=5; // FF
4e57c75e 57 break;
58 default:
59 break;
60 }
61 return iRet;
7fd59977 62}
72e88cf7 63//=======================================================================
64//function : TypeToInteger
65//purpose :
66//=======================================================================
67inline Standard_Integer BOPDS_Tools::TypeToInteger(const TopAbs_ShapeEnum aType1)
68{
69 Standard_Integer iRet=9;
70 //
71 switch(aType1) {
72 case TopAbs_COMPOUND:
73 iRet=0;
74 break;
75 case TopAbs_COMPSOLID:
76 iRet=1;
77 break;
78 case TopAbs_SOLID:
79 iRet=2;
80 break;
81 case TopAbs_SHELL:
82 iRet=3;
83 break;
84 case TopAbs_FACE:
85 iRet=4;
86 break;
87 case TopAbs_WIRE:
88 iRet=5;
89 break;
90 case TopAbs_EDGE:
91 iRet=6;
92 break;
93 case TopAbs_VERTEX:
94 iRet=7;
95 break;
96 case TopAbs_SHAPE:
97 iRet=8;
98 break;
99 default:
100 break;
101 }
102 return iRet;
103
104}