0023948: Wrong intersection between a surface of revolution and a plane.
[occt.git] / src / RWStepShape / RWStepShape_RWAngularLocation.cxx
1 // Created on: 2000-04-18
2 // Created by: Andrey BETENEV
3 // Copyright (c) 2000-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) V1.0
17
18 #include <RWStepShape_RWAngularLocation.ixx>
19
20 //=======================================================================
21 //function : RWStepShape_RWAngularLocation
22 //purpose  : 
23 //=======================================================================
24
25 RWStepShape_RWAngularLocation::RWStepShape_RWAngularLocation ()
26 {
27 }
28
29 //=======================================================================
30 //function : ReadStep
31 //purpose  : 
32 //=======================================================================
33
34 void RWStepShape_RWAngularLocation::ReadStep (const Handle(StepData_StepReaderData)& data,
35                                               const Standard_Integer num,
36                                               Handle(Interface_Check)& ach,
37                                               const Handle(StepShape_AngularLocation) &ent) const
38 {
39   // Check number of parameters
40   if ( ! data->CheckNbParams(num,5,ach,"angular_location") ) return;
41
42   // Inherited fields of ShapeAspectRelationship
43
44   Handle(TCollection_HAsciiString) aShapeAspectRelationship_Name;
45   data->ReadString (num, 1, "shape_aspect_relationship.name", ach, aShapeAspectRelationship_Name);
46
47   Handle(TCollection_HAsciiString) aShapeAspectRelationship_Description;
48   Standard_Boolean hasShapeAspectRelationship_Description = Standard_True;
49   if ( data->IsParamDefined (num,2) ) {
50     data->ReadString (num, 2, "shape_aspect_relationship.description", ach, aShapeAspectRelationship_Description);
51   }
52   else {
53     hasShapeAspectRelationship_Description = Standard_False;
54   }
55
56   Handle(StepRepr_ShapeAspect) aShapeAspectRelationship_RelatingShapeAspect;
57   data->ReadEntity (num, 3, "shape_aspect_relationship.relating_shape_aspect", ach, STANDARD_TYPE(StepRepr_ShapeAspect), aShapeAspectRelationship_RelatingShapeAspect);
58
59   Handle(StepRepr_ShapeAspect) aShapeAspectRelationship_RelatedShapeAspect;
60   data->ReadEntity (num, 4, "shape_aspect_relationship.related_shape_aspect", ach, STANDARD_TYPE(StepRepr_ShapeAspect), aShapeAspectRelationship_RelatedShapeAspect);
61
62   // Own fields of AngularLocation
63
64 // PTV 16.09.2000
65 // defaul value set as StepShape_Small, cause there wasn`t default value, but may be situation when
66 // value will not be initialized and returnd in ent->Init.
67   StepShape_AngleRelator aAngleSelection = StepShape_Small;
68   if (data->ParamType (num, 5) == Interface_ParamEnum) {
69     Standard_CString text = data->ParamCValue(num, 5);
70     if      (strcmp(text, ".EQUAL.") == 0) aAngleSelection = StepShape_Equal;
71     else if (strcmp(text, ".LARGE.") == 0) aAngleSelection = StepShape_Large;
72     else if (strcmp(text, ".SMALL.") == 0) aAngleSelection = StepShape_Small;
73     else ach->AddFail("Parameter #5 (angle_selection) has not allowed value");
74   }
75   else ach->AddFail("Parameter #5 (angle_selection) is not enumeration");
76
77   // Initialize entity
78   ent->Init(aShapeAspectRelationship_Name,
79             hasShapeAspectRelationship_Description,
80             aShapeAspectRelationship_Description,
81             aShapeAspectRelationship_RelatingShapeAspect,
82             aShapeAspectRelationship_RelatedShapeAspect,
83             aAngleSelection);
84 }
85
86 //=======================================================================
87 //function : WriteStep
88 //purpose  : 
89 //=======================================================================
90
91 void RWStepShape_RWAngularLocation::WriteStep (StepData_StepWriter& SW,
92                                                const Handle(StepShape_AngularLocation) &ent) const
93 {
94
95   // Inherited fields of ShapeAspectRelationship
96
97   SW.Send (ent->StepRepr_ShapeAspectRelationship::Name());
98
99   if ( ent->StepRepr_ShapeAspectRelationship::HasDescription() ) {
100     SW.Send (ent->StepRepr_ShapeAspectRelationship::Description());
101   }
102   else SW.SendUndef();
103
104   SW.Send (ent->StepRepr_ShapeAspectRelationship::RelatingShapeAspect());
105
106   SW.Send (ent->StepRepr_ShapeAspectRelationship::RelatedShapeAspect());
107
108   // Own fields of AngularLocation
109
110   switch (ent->AngleSelection()) {
111     case StepShape_Equal: SW.SendEnum (".EQUAL."); break;
112     case StepShape_Large: SW.SendEnum (".LARGE."); break;
113     case StepShape_Small: SW.SendEnum (".SMALL."); break;
114   }
115 }
116
117 //=======================================================================
118 //function : Share
119 //purpose  : 
120 //=======================================================================
121
122 void RWStepShape_RWAngularLocation::Share (const Handle(StepShape_AngularLocation) &ent,
123                                            Interface_EntityIterator& iter) const
124 {
125
126   // Inherited fields of ShapeAspectRelationship
127
128   iter.AddItem (ent->StepRepr_ShapeAspectRelationship::RelatingShapeAspect());
129
130   iter.AddItem (ent->StepRepr_ShapeAspectRelationship::RelatedShapeAspect());
131
132   // Own fields of AngularLocation
133 }