2 #include <RWStepShape_RWEdgeLoop.ixx>
4 #include <StepShape_HArray1OfOrientedEdge.hxx>
5 #include <StepShape_OrientedEdge.hxx>
7 RWStepShape_RWEdgeLoop::RWStepShape_RWEdgeLoop () {}
9 void RWStepShape_RWEdgeLoop::ReadStep
10 (const Handle(StepData_StepReaderData)& data,
11 const Standard_Integer num,
12 Handle(Interface_Check)& ach,
13 const Handle(StepShape_EdgeLoop)& ent) const
17 // --- Number of Parameter Control ---
19 if (!data->CheckNbParams(num,2,ach,"edge_loop")) return;
21 // --- inherited field : name ---
23 Handle(TCollection_HAsciiString) aName;
24 //szv#4:S4163:12Mar99 `Standard_Boolean stat0 =` not needed
25 data->ReadString (num,1,"name",ach,aName);
27 // --- own field : edgeList ---
29 Handle(StepShape_HArray1OfOrientedEdge) aEdgeList;
30 Handle(StepShape_OrientedEdge) anent;
31 Standard_Integer nsub1;
32 if (data->ReadSubList (num,2,"edge_list",ach,nsub1)) {
33 Standard_Integer nb1 = data->NbParams(nsub1);
34 aEdgeList = new StepShape_HArray1OfOrientedEdge (1, nb1);
35 for (Standard_Integer i1 = 1; i1 <= nb1; i1 ++) {
36 //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed
37 if (data->ReadEntity (nsub1, i1,"oriented_edge", ach, STANDARD_TYPE(StepShape_OrientedEdge), anent))
38 aEdgeList->SetValue(i1, anent);
42 //--- Initialisation of the read entity ---
44 ent->Init(aName, aEdgeList);
48 void RWStepShape_RWEdgeLoop::WriteStep
49 (StepData_StepWriter& SW,
50 const Handle(StepShape_EdgeLoop)& ent) const
53 // --- inherited field name ---
57 // --- own field : edgeList ---
60 for (Standard_Integer i1 = 1; i1 <= ent->NbEdgeList(); i1 ++) {
61 SW.Send(ent->EdgeListValue(i1));
66 // ============================================================================
68 // ============================================================================
70 void RWStepShape_RWEdgeLoop::Share(const Handle(StepShape_EdgeLoop)& ent, Interface_EntityIterator& iter) const
73 Standard_Integer nbElem1 = ent->NbEdgeList();
74 for (Standard_Integer is1=1; is1<=nbElem1; is1 ++) {
75 iter.GetOneItem(ent->EdgeListValue(is1));
82 void RWStepShape_RWEdgeLoop::Check
83 (const Handle(StepShape_EdgeLoop)& ent,
84 const Interface_ShareTool& ,
85 Handle(Interface_Check)& ach) const
87 // cout << "------ calling CheckEdgeLoop ------" << endl;
88 Standard_Boolean headToTail = Standard_True;
89 //Standard_Boolean noIdentVtx = Standard_True; //szv#4:S4163:12Mar99 unused
90 Standard_Integer nbEdg = ent->NbEdgeList();
91 Handle(StepShape_OrientedEdge) theOE = ent->EdgeListValue(1);
92 Handle(StepShape_Vertex) theVxFrst = theOE->EdgeStart();
93 Handle(StepShape_Vertex) theVxLst = theOE->EdgeEnd();
94 if((nbEdg == 1) && (theVxFrst != theVxLst)){
95 ach->AddFail("Edge loop composed of single Edge : Start and End Vertex of edge are not identical");
97 for(Standard_Integer i = 2; i <= nbEdg; i++)
99 theOE = ent->EdgeListValue(i);
100 Handle(StepShape_Vertex) theVxStrt = theOE->EdgeStart();
101 if(theVxStrt != theVxLst){
102 headToTail = Standard_False;
104 theVxLst = theOE->EdgeEnd();
105 if(theVxStrt == theVxLst){
106 ach->AddWarning("One edge_curve contains identical vertices");
109 if(theVxFrst != theVxLst){
110 headToTail = Standard_False;
113 ach->AddFail("Error : Path does not head to tail");