1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
15 #include <Interface_Check.hxx>
16 #include <Interface_EntityIterator.hxx>
17 #include <RWStepShape_RWLoopAndPath.hxx>
18 #include <StepData_StepReaderData.hxx>
19 #include <StepData_StepWriter.hxx>
20 #include <StepShape_HArray1OfOrientedEdge.hxx>
21 #include <StepShape_Loop.hxx>
22 #include <StepShape_LoopAndPath.hxx>
23 #include <StepShape_OrientedEdge.hxx>
24 #include <StepShape_Path.hxx>
26 RWStepShape_RWLoopAndPath::RWStepShape_RWLoopAndPath () {}
28 void RWStepShape_RWLoopAndPath::ReadStep
29 (const Handle(StepData_StepReaderData)& data,
30 const Standard_Integer num0,
31 Handle(Interface_Check)& ach,
32 const Handle(StepShape_LoopAndPath)& ent) const
35 Standard_Integer num = num0;
38 // --- Instance of plex componant Loop ---
40 if (!data->CheckNbParams(num,0,ach,"loop")) return;
42 num = data->NextForComplex(num);
44 // --- Instance of plex componant Path ---
46 if (!data->CheckNbParams(num,1,ach,"path")) return;
48 // --- field : edgeList ---
50 Handle(StepShape_HArray1OfOrientedEdge) aEdgeList;
51 Handle(StepShape_OrientedEdge) anent1;
52 Standard_Integer nsub1;
53 if (data->ReadSubList (num,1,"edge_list",ach,nsub1)) {
54 Standard_Integer nb1 = data->NbParams(nsub1);
55 aEdgeList = new StepShape_HArray1OfOrientedEdge (1, nb1);
56 for (Standard_Integer i1 = 1; i1 <= nb1; i1 ++) {
57 //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed
58 if (data->ReadEntity (nsub1, i1,"oriented_edge", ach, STANDARD_TYPE(StepShape_OrientedEdge), anent1))
59 aEdgeList->SetValue(i1, anent1);
63 num = data->NextForComplex(num);
65 // --- Instance of plex componant RepresentationItem ---
67 if (!data->CheckNbParams(num,1,ach,"representation_item")) return;
69 // --- field : name ---
71 Handle(TCollection_HAsciiString) aName;
72 //szv#4:S4163:12Mar99 `Standard_Boolean stat2 =` not needed
73 data->ReadString (num,1,"name",ach,aName);
75 num = data->NextForComplex(num);
77 // --- Instance of common supertype TopologicalRepresentationItem ---
79 if (!data->CheckNbParams(num,0,ach,"topological_representation_item")) return;
81 //--- Initialisation of the red entity ---
83 ent->Init(aName,aEdgeList);
87 void RWStepShape_RWLoopAndPath::WriteStep
88 (StepData_StepWriter& SW,
89 const Handle(StepShape_LoopAndPath)& ent) const
92 // --- Instance of plex componant Loop ---
94 SW.StartEntity("LOOP");
96 // --- Instance of plex componant Path ---
98 SW.StartEntity("PATH");
99 // --- field : edgeList ---
102 for (Standard_Integer i1 = 1; i1 <= ent->NbEdgeList(); i1 ++) {
103 SW.Send(ent->EdgeListValue(i1));
107 // --- Instance of plex componant RepresentationItem ---
109 SW.StartEntity("REPRESENTATION_ITEM");
110 // --- field : name ---
112 SW.Send(ent->Name());
114 // --- Instance of common supertype TopologicalRepresentationItem ---
116 SW.StartEntity("TOPOLOGICAL_REPRESENTATION_ITEM");
120 void RWStepShape_RWLoopAndPath::Share(const Handle(StepShape_LoopAndPath)& ent, Interface_EntityIterator& iter) const
123 Standard_Integer nbElem1 = ent->NbEdgeList();
124 for (Standard_Integer is1=1; is1<=nbElem1; is1 ++) {
125 iter.GetOneItem(ent->EdgeListValue(is1));