b311480e |
1 | // Created on: 2002-12-10 |
2 | // Created by: data exchange team |
973c2be1 |
3 | // Copyright (c) 2002-2014 OPEN CASCADE SAS |
b311480e |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
b311480e |
6 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
b311480e |
15 | |
7fd59977 |
16 | // Generator: ExpToCas (EXPRESS -> CASCADE/XSTEP Translator) V2.0 |
7fd59977 |
17 | |
42cf5bc1 |
18 | #include <Standard_Transient.hxx> |
19 | #include <StepData_SelectMember.hxx> |
20 | #include <StepElement_MeasureOrUnspecifiedValue.hxx> |
7fd59977 |
21 | #include <StepElement_MeasureOrUnspecifiedValueMember.hxx> |
22 | #include <TCollection_HAsciiString.hxx> |
23 | |
24 | static Standard_CString aCDM = "CONTEXT_DEPENDENT_MEASURE"; |
25 | static Standard_CString anUV = "UNSPECIFIED_VALUE"; |
26 | |
27 | |
28 | //======================================================================= |
29 | //function : StepElement_MeasureOrUnspecifiedValue |
30 | //purpose : |
31 | //======================================================================= |
32 | |
33 | StepElement_MeasureOrUnspecifiedValue::StepElement_MeasureOrUnspecifiedValue () |
34 | { |
35 | } |
36 | |
37 | //======================================================================= |
38 | //function : CaseNum |
39 | //purpose : |
40 | //======================================================================= |
41 | |
35e08fe8 |
42 | Standard_Integer StepElement_MeasureOrUnspecifiedValue::CaseNum (const Handle(Standard_Transient)& /*ent*/) const |
7fd59977 |
43 | { |
44 | return 0; |
45 | } |
46 | |
47 | //======================================================================= |
48 | //function : CaseMem |
49 | //purpose : |
50 | //======================================================================= |
51 | |
52 | Standard_Integer StepElement_MeasureOrUnspecifiedValue::CaseMem (const Handle(StepData_SelectMember)& ent) const |
53 | { |
54 | if(ent.IsNull()) return 0; |
55 | if(ent->Matches(aCDM)) return 1; |
56 | else if(ent->Matches(anUV)) return 2; |
57 | else return 0; |
58 | } |
59 | |
60 | //======================================================================= |
61 | //function : NewMember |
62 | //purpose : |
63 | //======================================================================= |
64 | |
65 | Handle(StepData_SelectMember) StepElement_MeasureOrUnspecifiedValue::NewMember() const |
66 | { |
67 | return new StepElement_MeasureOrUnspecifiedValueMember; |
68 | } |
69 | |
70 | //======================================================================= |
71 | //function : SetContextDependentMeasure |
72 | //purpose : |
73 | //======================================================================= |
74 | |
75 | void StepElement_MeasureOrUnspecifiedValue::SetContextDependentMeasure (const Standard_Real val) |
76 | { |
77 | Handle(StepElement_MeasureOrUnspecifiedValueMember) SelMem = Handle(StepElement_MeasureOrUnspecifiedValueMember)::DownCast(Value()); |
78 | if(SelMem.IsNull()) return; |
79 | Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString("CONTEXT_DEPENDENT_MEASURE"); |
80 | SelMem->SetName(name->ToCString()); |
81 | SelMem->SetReal(val); |
82 | } |
83 | |
84 | //======================================================================= |
85 | //function : ContextDependentMeasure |
86 | //purpose : |
87 | //======================================================================= |
88 | |
89 | Standard_Real StepElement_MeasureOrUnspecifiedValue::ContextDependentMeasure () const |
90 | { |
91 | Handle(StepElement_MeasureOrUnspecifiedValueMember) SelMem = Handle(StepElement_MeasureOrUnspecifiedValueMember)::DownCast(Value()); |
92 | if(SelMem.IsNull()) return 0; |
93 | Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString; |
94 | name->AssignCat(SelMem->Name()); |
95 | Handle(TCollection_HAsciiString) nameitem = new TCollection_HAsciiString("CONTEXT_DEPENDENT_MEASURE"); |
96 | if(name->IsDifferent(nameitem)) return 0; |
97 | Standard_Real val = SelMem->Real(); |
98 | return val; |
99 | } |
100 | |
101 | //======================================================================= |
102 | //function : SetUnspecifiedValue |
103 | //purpose : |
104 | //======================================================================= |
105 | |
106 | void StepElement_MeasureOrUnspecifiedValue::SetUnspecifiedValue (const StepElement_UnspecifiedValue val) |
107 | { |
108 | Handle(StepElement_MeasureOrUnspecifiedValueMember) SelMem = Handle(StepElement_MeasureOrUnspecifiedValueMember)::DownCast(Value()); |
109 | if(SelMem.IsNull()) return; |
110 | Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString("UNSPECIFIED_VALUE"); |
111 | SelMem->SetName(name->ToCString()); |
112 | SelMem->SetEnum((Standard_Integer)val); |
113 | } |
114 | |
115 | //======================================================================= |
116 | //function : UnspecifiedValue |
117 | //purpose : |
118 | //======================================================================= |
119 | |
120 | StepElement_UnspecifiedValue StepElement_MeasureOrUnspecifiedValue::UnspecifiedValue () const |
121 | { |
122 | Handle(StepElement_MeasureOrUnspecifiedValueMember) SelMem = Handle(StepElement_MeasureOrUnspecifiedValueMember)::DownCast(Value()); |
123 | if(SelMem.IsNull()) return StepElement_Unspecified; |
124 | Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString; |
125 | name->AssignCat(SelMem->Name()); |
126 | Handle(TCollection_HAsciiString) nameitem = new TCollection_HAsciiString("UNSPECIFIED_VALUE"); |
127 | if(name->IsDifferent(nameitem)) return StepElement_Unspecified; |
128 | Standard_Integer numit = SelMem->Enum(); |
129 | StepElement_UnspecifiedValue val; |
130 | switch(numit) { |
131 | case 1 : val = StepElement_Unspecified; break; |
132 | default : return StepElement_Unspecified;break; |
133 | } |
134 | return val; |
135 | } |