0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
[occt.git] / src / StepElement / StepElement_ElementAspectMember.cxx
1 // Created on: 2002-12-10
2 // Created by: data exchange team
3 // Copyright (c) 2002-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 // Generator:   ExpToCas (EXPRESS -> CASCADE/XSTEP Translator) V2.0
17
18 #include <Standard_Type.hxx>
19 #include <StepElement_ElementAspectMember.hxx>
20 #include <TCollection_HAsciiString.hxx>
21
22 IMPLEMENT_STANDARD_RTTIEXT(StepElement_ElementAspectMember,StepData_SelectNamed)
23
24 static Standard_CString aElementVolume = "ELEMENT_VOLUME";
25 static Standard_CString aVolume3dFace = "VOLUME_3D_FACE";
26 static Standard_CString aVolume2dFace = "VOLUME_2D_FACE";
27 static Standard_CString aVolume3dEdge = "VOLUME_3D_EDGE";
28 static Standard_CString aVolume2dEdge = "VOLUME_2D_EDGE";
29 static Standard_CString aSurface3dFace = "SURFACE_3D_FACE";
30 static Standard_CString aSurface2dFace = "SURFACE_2D_FACE";
31 static Standard_CString aSurface3dEdge = "SURFACE_3D_EDGE";
32 static Standard_CString aSurface2dEdge = "SURFACE_2D_EDGE";
33 static Standard_CString aCurveEdge = "CURVE_EDGE";
34
35 //=======================================================================
36 //function : StepElement_ElementAspectMember
37 //purpose  : 
38 //=======================================================================
39
40 StepElement_ElementAspectMember::StepElement_ElementAspectMember () : mycase(0) 
41 {
42 }
43
44 //=======================================================================
45 //function : HasName
46 //purpose  : 
47 //=======================================================================
48
49 Standard_Boolean StepElement_ElementAspectMember::HasName() const
50 {
51  return mycase >0;
52 }
53
54 //=======================================================================
55 //function : Name
56 //purpose  : 
57 //=======================================================================
58
59 Standard_CString StepElement_ElementAspectMember::Name() const
60 {
61   switch(mycase)  {
62     case 1  : return aElementVolume;
63     case 2  : return aVolume3dFace;
64     case 3  : return aVolume2dFace;
65     case 4  : return aVolume3dEdge;
66     case 5  : return aVolume2dEdge;
67     case 6  : return aSurface3dFace;
68     case 7  : return aSurface2dFace;
69     case 8  : return aSurface3dEdge;
70     case 9  : return aSurface2dEdge;
71     case 10  : return aCurveEdge;
72     default : break;
73   }
74   return "";
75 }
76
77 //=======================================================================
78 //function : CompareNames
79 //purpose  : 
80 //=======================================================================
81
82 static Standard_Integer CompareNames(const Standard_CString name,Standard_Integer &numen) 
83 {
84   Standard_Integer thecase =0;
85   if (!name || name[0] == '\0') thecase = 0;
86    else if(!strcmp (name,aElementVolume)) { 
87      thecase = 1;
88      numen =  1;
89    }
90    else if(!strcmp (name,aVolume3dFace)) thecase = 2;
91    else if(!strcmp (name,aVolume2dFace)) thecase = 3;
92    else if(!strcmp (name,aVolume3dEdge)) thecase = 4;
93    else if(!strcmp (name,aVolume2dEdge)) thecase = 5;
94    else if(!strcmp (name,aSurface3dFace)) thecase = 6;
95    else if(!strcmp (name,aSurface2dFace)) thecase = 7;
96    else if(!strcmp (name,aSurface3dEdge)) thecase = 8;
97    else if(!strcmp (name,aSurface2dEdge)) thecase = 9;
98    else if(!strcmp (name,aCurveEdge)) { 
99      thecase = 10;
100      numen =  1;
101    }
102   return thecase;
103 }
104
105 //=======================================================================
106 //function : SetName
107 //purpose  : 
108 //=======================================================================
109
110 Standard_Boolean StepElement_ElementAspectMember::SetName(const Standard_CString name) 
111 {
112   Standard_Integer numit =0;
113   mycase = CompareNames(name,numit);
114   if(numit) SetInteger(numit);
115   return (mycase >0);
116 }
117
118 //=======================================================================
119 //function : Matches
120 //purpose  : 
121 //=======================================================================
122
123 Standard_Boolean StepElement_ElementAspectMember::Matches(const Standard_CString name) const
124 {
125   Standard_Integer numit =0;
126   Standard_Integer thecase = CompareNames(name,numit);
127   return (mycase==thecase);
128 }