0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
[occt.git] / src / BOPDS / BOPDS_Tools.lxx
1 // Created by: Peter KURNEV
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 //
4 // This file is part of Open CASCADE Technology software library.
5 //
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
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.
11 //
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
14
15 //=======================================================================
16 // function: HasBRep
17 // purpose: 
18 //=======================================================================
19 inline Standard_Boolean BOPDS_Tools::HasBRep(const TopAbs_ShapeEnum aTi)
20 {
21   return (aTi==TopAbs_VERTEX || aTi==TopAbs_EDGE || aTi==TopAbs_FACE);
22 }
23 //=======================================================================
24 // function: IsInterfering
25 // purpose: 
26 //=======================================================================
27 inline Standard_Boolean BOPDS_Tools::IsInterfering
28   (const TopAbs_ShapeEnum aTi)
29 {
30   return (BOPDS_Tools::HasBRep(aTi) || aTi==TopAbs_SOLID);
31 }
32 //=======================================================================
33 //function : TypeToInteger
34 //purpose  : 
35 //=======================================================================
36 inline Standard_Integer BOPDS_Tools::TypeToInteger(const TopAbs_ShapeEnum aType1,
37                                                    const TopAbs_ShapeEnum aType2)
38 {
39   Standard_Integer iRet, iT1, iT2, iX;
40   //
41   iRet=-1;
42   iT1=BOPDS_Tools::TypeToInteger(aType1);
43   iT2=BOPDS_Tools::TypeToInteger(aType2);
44   //
45   iX=iT2*10+iT1;
46   switch (iX) {
47     case 77:
48       iRet=0; // VV
49       break;
50     case 76:
51     case 67:
52       iRet=1; // VE
53       break;
54     case 66:
55       iRet=2; // EE
56       break;
57     case 74:
58     case 47:
59       iRet=3; // VF
60       break;
61     case 64:
62     case 46:
63       iRet=4; // EF
64       break;
65     case 44:
66       iRet=5; // FF
67       break;
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;
83     default:
84       break;
85   }
86   return iRet; 
87 }
88 //=======================================================================
89 //function : TypeToInteger
90 //purpose  : 
91 //=======================================================================
92 inline 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 }