0026377: Passing Handle objects as arguments to functions as non-const reference...
[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//
d5f74e42 6// This library is free software; you can redistribute it and/or modify it under
7// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 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);
ceaa5e27 22}
23//=======================================================================
24// function: IsInterfering
25// purpose:
26//=======================================================================
27inline Standard_Boolean BOPDS_Tools::IsInterfering
28 (const TopAbs_ShapeEnum aTi)
29{
30 return (BOPDS_Tools::HasBRep(aTi) || aTi==TopAbs_SOLID);
31}
32//=======================================================================
4e57c75e 33//function : TypeToInteger
7fd59977 34//purpose :
35//=======================================================================
72e88cf7 36inline Standard_Integer BOPDS_Tools::TypeToInteger(const TopAbs_ShapeEnum aType1,
37 const TopAbs_ShapeEnum aType2)
7fd59977 38{
4e57c75e 39 Standard_Integer iRet, iT1, iT2, iX;
40 //
41 iRet=-1;
72e88cf7 42 iT1=BOPDS_Tools::TypeToInteger(aType1);
43 iT2=BOPDS_Tools::TypeToInteger(aType2);
4e57c75e 44 //
45 iX=iT2*10+iT1;
46 switch (iX) {
47 case 77:
c1fe53c6 48 iRet=0; // VV
4e57c75e 49 break;
50 case 76:
51 case 67:
c1fe53c6 52 iRet=1; // VE
53 break;
54 case 66:
55 iRet=2; // EE
4e57c75e 56 break;
57 case 74:
58 case 47:
c1fe53c6 59 iRet=3; // VF
4e57c75e 60 break;
61 case 64:
62 case 46:
c1fe53c6 63 iRet=4; // EF
4e57c75e 64 break;
65 case 44:
c1fe53c6 66 iRet=5; // FF
4e57c75e 67 break;
ceaa5e27 68 case 72:
69 case 27:
70 iRet=6; // VZ
71 break;
72 case 62:
73 case 26:
74 iRet=7; // EZ
75 break;
76 case 42:
77 case 24:
78 iRet=8; // FZ
79 break;
80 case 22:
81 iRet=9; // ZZ
82 break;
4e57c75e 83 default:
84 break;
85 }
86 return iRet;
7fd59977 87}
72e88cf7 88//=======================================================================
89//function : TypeToInteger
90//purpose :
91//=======================================================================
92inline Standard_Integer BOPDS_Tools::TypeToInteger(const TopAbs_ShapeEnum aType1)
93{
94 Standard_Integer iRet=9;
95 //
96 switch(aType1) {
97 case TopAbs_COMPOUND:
98 iRet=0;
99 break;
100 case TopAbs_COMPSOLID:
101 iRet=1;
102 break;
103 case TopAbs_SOLID:
104 iRet=2;
105 break;
106 case TopAbs_SHELL:
107 iRet=3;
108 break;
109 case TopAbs_FACE:
110 iRet=4;
111 break;
112 case TopAbs_WIRE:
113 iRet=5;
114 break;
115 case TopAbs_EDGE:
116 iRet=6;
117 break;
118 case TopAbs_VERTEX:
119 iRet=7;
120 break;
121 case TopAbs_SHAPE:
122 iRet=8;
123 break;
124 default:
125 break;
126 }
127 return iRet;
128
129}