973c2be1 |
1 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
2 | // |
973c2be1 |
3 | // This file is part of Open CASCADE Technology software library. |
b311480e |
4 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
10 | // |
973c2be1 |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
b311480e |
13 | |
7fd59977 |
14 | //:k4 abv 30.11.98: TR9: warnings for BWV |
15 | |
42cf5bc1 |
16 | #include <Interface_Check.hxx> |
7fd59977 |
17 | #include <Interface_EntityIterator.hxx> |
42cf5bc1 |
18 | #include <Interface_ShareTool.hxx> |
19 | #include <RWStepShape_RWBrepWithVoids.hxx> |
20 | #include <StepData_StepReaderData.hxx> |
21 | #include <StepData_StepWriter.hxx> |
7fd59977 |
22 | #include <StepShape_BrepWithVoids.hxx> |
42cf5bc1 |
23 | #include <StepShape_ClosedShell.hxx> |
24 | #include <StepShape_HArray1OfOrientedClosedShell.hxx> |
25 | #include <StepShape_OrientedClosedShell.hxx> |
7fd59977 |
26 | |
27 | RWStepShape_RWBrepWithVoids::RWStepShape_RWBrepWithVoids () {} |
28 | |
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 |
34 | { |
35 | |
36 | |
37 | // --- Number of Parameter Control --- |
38 | |
39 | if (!data->CheckNbParams(num,3,ach,"brep_with_voids")) return; |
40 | |
41 | // --- inherited field : name --- |
42 | |
43 | Handle(TCollection_HAsciiString) aName; |
44 | //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed |
45 | data->ReadString (num,1,"name",ach,aName); |
46 | |
47 | // --- inherited field : outer --- |
48 | |
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); |
52 | |
53 | // --- own field : voids --- |
54 | |
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); |
66 | } |
67 | } |
68 | |
69 | //--- Initialisation of the read entity --- |
70 | |
71 | |
72 | ent->Init(aName, aOuter, aVoids); |
73 | } |
74 | |
75 | |
76 | void RWStepShape_RWBrepWithVoids::WriteStep |
77 | (StepData_StepWriter& SW, |
78 | const Handle(StepShape_BrepWithVoids)& ent) const |
79 | { |
80 | |
81 | // --- inherited field name --- |
82 | |
83 | SW.Send(ent->Name()); |
84 | |
85 | // --- inherited field outer --- |
86 | |
87 | SW.Send(ent->Outer()); |
88 | |
89 | // --- own field : voids --- |
90 | |
91 | SW.OpenSub(); |
92 | for (Standard_Integer i3 = 1; i3 <= ent->NbVoids(); i3 ++) { |
93 | SW.Send(ent->VoidsValue(i3)); |
94 | } |
95 | SW.CloseSub(); |
96 | } |
97 | |
98 | |
99 | void RWStepShape_RWBrepWithVoids::Share(const Handle(StepShape_BrepWithVoids)& ent, Interface_EntityIterator& iter) const |
100 | { |
101 | |
102 | iter.GetOneItem(ent->Outer()); |
103 | |
104 | |
105 | Standard_Integer nbElem2 = ent->NbVoids(); |
106 | for (Standard_Integer is2=1; is2<=nbElem2; is2 ++) { |
107 | iter.GetOneItem(ent->VoidsValue(is2)); |
108 | } |
109 | |
110 | } |
111 | |
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 |
117 | { |
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"); |
121 | break; |
122 | } |
123 | } |