1 // Created on: 2000-04-18
2 // Created by: Andrey BETENEV
3 // Copyright (c) 2000-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 // Generator: ExpToCas (EXPRESS -> CASCADE/XSTEP Translator) V1.0
18 #include <RWStepShape_RWAngularLocation.ixx>
20 //=======================================================================
21 //function : RWStepShape_RWAngularLocation
23 //=======================================================================
25 RWStepShape_RWAngularLocation::RWStepShape_RWAngularLocation ()
29 //=======================================================================
32 //=======================================================================
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
39 // Check number of parameters
40 if ( ! data->CheckNbParams(num,5,ach,"angular_location") ) return;
42 // Inherited fields of ShapeAspectRelationship
44 Handle(TCollection_HAsciiString) aShapeAspectRelationship_Name;
45 data->ReadString (num, 1, "shape_aspect_relationship.name", ach, aShapeAspectRelationship_Name);
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);
53 hasShapeAspectRelationship_Description = Standard_False;
56 Handle(StepRepr_ShapeAspect) aShapeAspectRelationship_RelatingShapeAspect;
57 data->ReadEntity (num, 3, "shape_aspect_relationship.relating_shape_aspect", ach, STANDARD_TYPE(StepRepr_ShapeAspect), aShapeAspectRelationship_RelatingShapeAspect);
59 Handle(StepRepr_ShapeAspect) aShapeAspectRelationship_RelatedShapeAspect;
60 data->ReadEntity (num, 4, "shape_aspect_relationship.related_shape_aspect", ach, STANDARD_TYPE(StepRepr_ShapeAspect), aShapeAspectRelationship_RelatedShapeAspect);
62 // Own fields of AngularLocation
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");
75 else ach->AddFail("Parameter #5 (angle_selection) is not enumeration");
78 ent->Init(aShapeAspectRelationship_Name,
79 hasShapeAspectRelationship_Description,
80 aShapeAspectRelationship_Description,
81 aShapeAspectRelationship_RelatingShapeAspect,
82 aShapeAspectRelationship_RelatedShapeAspect,
86 //=======================================================================
87 //function : WriteStep
89 //=======================================================================
91 void RWStepShape_RWAngularLocation::WriteStep (StepData_StepWriter& SW,
92 const Handle(StepShape_AngularLocation) &ent) const
95 // Inherited fields of ShapeAspectRelationship
97 SW.Send (ent->StepRepr_ShapeAspectRelationship::Name());
99 if ( ent->StepRepr_ShapeAspectRelationship::HasDescription() ) {
100 SW.Send (ent->StepRepr_ShapeAspectRelationship::Description());
104 SW.Send (ent->StepRepr_ShapeAspectRelationship::RelatingShapeAspect());
106 SW.Send (ent->StepRepr_ShapeAspectRelationship::RelatedShapeAspect());
108 // Own fields of AngularLocation
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;
117 //=======================================================================
120 //=======================================================================
122 void RWStepShape_RWAngularLocation::Share (const Handle(StepShape_AngularLocation) &ent,
123 Interface_EntityIterator& iter) const
126 // Inherited fields of ShapeAspectRelationship
128 iter.AddItem (ent->StepRepr_ShapeAspectRelationship::RelatingShapeAspect());
130 iter.AddItem (ent->StepRepr_ShapeAspectRelationship::RelatedShapeAspect());
132 // Own fields of AngularLocation