1 // Created on: 2000-04-18
2 // Created by: Andrey BETENEV
3 // Copyright (c) 2000-2012 OPEN CASCADE SAS
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
20 // Generator: ExpToCas (EXPRESS -> CASCADE/XSTEP Translator) V1.0
22 #include <RWStepShape_RWAngularLocation.ixx>
24 //=======================================================================
25 //function : RWStepShape_RWAngularLocation
27 //=======================================================================
29 RWStepShape_RWAngularLocation::RWStepShape_RWAngularLocation ()
33 //=======================================================================
36 //=======================================================================
38 void RWStepShape_RWAngularLocation::ReadStep (const Handle(StepData_StepReaderData)& data,
39 const Standard_Integer num,
40 Handle(Interface_Check)& ach,
41 const Handle(StepShape_AngularLocation) &ent) const
43 // Check number of parameters
44 if ( ! data->CheckNbParams(num,5,ach,"angular_location") ) return;
46 // Inherited fields of ShapeAspectRelationship
48 Handle(TCollection_HAsciiString) aShapeAspectRelationship_Name;
49 data->ReadString (num, 1, "shape_aspect_relationship.name", ach, aShapeAspectRelationship_Name);
51 Handle(TCollection_HAsciiString) aShapeAspectRelationship_Description;
52 Standard_Boolean hasShapeAspectRelationship_Description = Standard_True;
53 if ( data->IsParamDefined (num,2) ) {
54 data->ReadString (num, 2, "shape_aspect_relationship.description", ach, aShapeAspectRelationship_Description);
57 hasShapeAspectRelationship_Description = Standard_False;
60 Handle(StepRepr_ShapeAspect) aShapeAspectRelationship_RelatingShapeAspect;
61 data->ReadEntity (num, 3, "shape_aspect_relationship.relating_shape_aspect", ach, STANDARD_TYPE(StepRepr_ShapeAspect), aShapeAspectRelationship_RelatingShapeAspect);
63 Handle(StepRepr_ShapeAspect) aShapeAspectRelationship_RelatedShapeAspect;
64 data->ReadEntity (num, 4, "shape_aspect_relationship.related_shape_aspect", ach, STANDARD_TYPE(StepRepr_ShapeAspect), aShapeAspectRelationship_RelatedShapeAspect);
66 // Own fields of AngularLocation
69 // defaul value set as StepShape_Small, cause there wasn`t default value, but may be situation when
70 // value will not be initialized and returnd in ent->Init.
71 StepShape_AngleRelator aAngleSelection = StepShape_Small;
72 if (data->ParamType (num, 5) == Interface_ParamEnum) {
73 Standard_CString text = data->ParamCValue(num, 5);
74 if (strcmp(text, ".EQUAL.")) aAngleSelection = StepShape_Equal;
75 else if (strcmp(text, ".LARGE.")) aAngleSelection = StepShape_Large;
76 else if (strcmp(text, ".SMALL.")) aAngleSelection = StepShape_Small;
77 else ach->AddFail("Parameter #5 (angle_selection) has not allowed value");
79 else ach->AddFail("Parameter #5 (angle_selection) is not enumeration");
82 ent->Init(aShapeAspectRelationship_Name,
83 hasShapeAspectRelationship_Description,
84 aShapeAspectRelationship_Description,
85 aShapeAspectRelationship_RelatingShapeAspect,
86 aShapeAspectRelationship_RelatedShapeAspect,
90 //=======================================================================
91 //function : WriteStep
93 //=======================================================================
95 void RWStepShape_RWAngularLocation::WriteStep (StepData_StepWriter& SW,
96 const Handle(StepShape_AngularLocation) &ent) const
99 // Inherited fields of ShapeAspectRelationship
101 SW.Send (ent->StepRepr_ShapeAspectRelationship::Name());
103 if ( ent->StepRepr_ShapeAspectRelationship::HasDescription() ) {
104 SW.Send (ent->StepRepr_ShapeAspectRelationship::Description());
108 SW.Send (ent->StepRepr_ShapeAspectRelationship::RelatingShapeAspect());
110 SW.Send (ent->StepRepr_ShapeAspectRelationship::RelatedShapeAspect());
112 // Own fields of AngularLocation
114 switch (ent->AngleSelection()) {
115 case StepShape_Equal: SW.SendEnum (".EQUAL."); break;
116 case StepShape_Large: SW.SendEnum (".LARGE."); break;
117 case StepShape_Small: SW.SendEnum (".SMALL."); break;
121 //=======================================================================
124 //=======================================================================
126 void RWStepShape_RWAngularLocation::Share (const Handle(StepShape_AngularLocation) &ent,
127 Interface_EntityIterator& iter) const
130 // Inherited fields of ShapeAspectRelationship
132 iter.AddItem (ent->StepRepr_ShapeAspectRelationship::RelatingShapeAspect());
134 iter.AddItem (ent->StepRepr_ShapeAspectRelationship::RelatedShapeAspect());
136 // Own fields of AngularLocation