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.
14 //:k4 abv 30.11.98: TR9: warnings for BWV
16 #include <Interface_Check.hxx>
17 #include <Interface_EntityIterator.hxx>
18 #include <Interface_ShareTool.hxx>
19 #include <RWStepShape_RWBrepWithVoids.hxx>
20 #include <StepData_StepReaderData.hxx>
21 #include <StepData_StepWriter.hxx>
22 #include <StepShape_BrepWithVoids.hxx>
23 #include <StepShape_ClosedShell.hxx>
24 #include <StepShape_HArray1OfOrientedClosedShell.hxx>
25 #include <StepShape_OrientedClosedShell.hxx>
27 RWStepShape_RWBrepWithVoids::RWStepShape_RWBrepWithVoids () {}
29 void RWStepShape_RWBrepWithVoids::ReadStep
30 (const Handle(StepData_StepReaderData)& data,
31 const Standard_Integer num,
32 Handle(Interface_Check)& ach,
33 const Handle(StepShape_BrepWithVoids)& ent) const
37 // --- Number of Parameter Control ---
39 if (!data->CheckNbParams(num,3,ach,"brep_with_voids")) return;
41 // --- inherited field : name ---
43 Handle(TCollection_HAsciiString) aName;
44 //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed
45 data->ReadString (num,1,"name",ach,aName);
47 // --- inherited field : outer ---
49 Handle(StepShape_ClosedShell) aOuter;
50 //szv#4:S4163:12Mar99 `Standard_Boolean stat2 =` not needed
51 data->ReadEntity(num, 2,"outer", ach, STANDARD_TYPE(StepShape_ClosedShell), aOuter);
53 // --- own field : voids ---
55 Handle(StepShape_HArray1OfOrientedClosedShell) aVoids;
56 Handle(StepShape_OrientedClosedShell) anent3;
57 Standard_Integer nsub3;
58 if (data->ReadSubList (num,3,"voids",ach,nsub3)) {
59 Standard_Integer nb3 = data->NbParams(nsub3);
60 aVoids = new StepShape_HArray1OfOrientedClosedShell (1, nb3);
61 for (Standard_Integer i3 = 1; i3 <= nb3; i3 ++) {
62 //szv#4:S4163:12Mar99 `Standard_Boolean stat3 =` not needed
63 if (data->ReadEntity (nsub3, i3,"oriented_closed_shell", ach,
64 STANDARD_TYPE(StepShape_OrientedClosedShell), anent3))
65 aVoids->SetValue(i3, anent3);
69 //--- Initialisation of the read entity ---
72 ent->Init(aName, aOuter, aVoids);
76 void RWStepShape_RWBrepWithVoids::WriteStep
77 (StepData_StepWriter& SW,
78 const Handle(StepShape_BrepWithVoids)& ent) const
81 // --- inherited field name ---
85 // --- inherited field outer ---
87 SW.Send(ent->Outer());
89 // --- own field : voids ---
92 for (Standard_Integer i3 = 1; i3 <= ent->NbVoids(); i3 ++) {
93 SW.Send(ent->VoidsValue(i3));
99 void RWStepShape_RWBrepWithVoids::Share(const Handle(StepShape_BrepWithVoids)& ent, Interface_EntityIterator& iter) const
102 iter.GetOneItem(ent->Outer());
105 Standard_Integer nbElem2 = ent->NbVoids();
106 for (Standard_Integer is2=1; is2<=nbElem2; is2 ++) {
107 iter.GetOneItem(ent->VoidsValue(is2));
112 //:k4 abv 30 Nov 98: ProSTEP TR9: add warning
113 void RWStepShape_RWBrepWithVoids::Check
114 (const Handle(StepShape_BrepWithVoids)& ent,
115 const Interface_ShareTool& ,
116 Handle(Interface_Check)& ach) const
118 for ( Standard_Integer i=1; i <= ent->NbVoids(); i++ )
119 if ( ent->VoidsValue(i)->Orientation() ) {
120 ach->AddWarning ("Void has orientation .T. while .F. is required by API 214");