0024428: Implementation of LGPL license
[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
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.
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 //function : TypeToInteger
24 //purpose  : 
25 //=======================================================================
26 inline Standard_Integer BOPDS_Tools::TypeToInteger(const TopAbs_ShapeEnum aType1,
27                                                    const TopAbs_ShapeEnum aType2)
28 {
29   Standard_Integer iRet, iT1, iT2, iX;
30   //
31   iRet=-1;
32   iT1=BOPDS_Tools::TypeToInteger(aType1);
33   iT2=BOPDS_Tools::TypeToInteger(aType2);
34   //
35   iX=iT2*10+iT1;
36   switch (iX) {
37     case 77:
38       iRet=0; // VV
39       break;
40     case 76:
41     case 67:
42       iRet=1; // VE
43       break;
44     case 66:
45       iRet=2; // EE
46       break;
47     case 74:
48     case 47:
49       iRet=3; // VF
50       break;
51     case 64:
52     case 46:
53       iRet=4; // EF
54       break;
55     case 44:
56       iRet=5; // FF
57       break;
58     default:
59       break;
60   }
61   return iRet; 
62 }
63 //=======================================================================
64 //function : TypeToInteger
65 //purpose  : 
66 //=======================================================================
67 inline 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 }