0023948: Wrong intersection between a surface of revolution and a plane.
[occt.git] / src / RWStepShape / RWStepShape_RWFacetedBrepShapeRepresentation.cxx
CommitLineData
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.
7fd59977 13
14#include <RWStepShape_RWFacetedBrepShapeRepresentation.ixx>
15#include <StepRepr_HArray1OfRepresentationItem.hxx>
16#include <StepRepr_RepresentationItem.hxx>
17#include <StepRepr_RepresentationContext.hxx>
18
19
20#include <Interface_EntityIterator.hxx>
21
22
23#include <StepShape_FacetedBrepShapeRepresentation.hxx>
24
25
26RWStepShape_RWFacetedBrepShapeRepresentation::RWStepShape_RWFacetedBrepShapeRepresentation () {}
27
28void RWStepShape_RWFacetedBrepShapeRepresentation::ReadStep
29 (const Handle(StepData_StepReaderData)& data,
30 const Standard_Integer num,
31 Handle(Interface_Check)& ach,
32 const Handle(StepShape_FacetedBrepShapeRepresentation)& ent) const
33{
34
35
36 // --- Number of Parameter Control ---
37
38 if (!data->CheckNbParams(num,3,ach,"faceted_brep_shape_representation")) return;
39
40 // --- inherited field : name ---
41
42 Handle(TCollection_HAsciiString) aName;
43 //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed
44 data->ReadString (num,1,"name",ach,aName);
45
46 // --- inherited field : items ---
47
48 Handle(StepRepr_HArray1OfRepresentationItem) aItems;
49 Handle(StepRepr_RepresentationItem) anent2;
50 Standard_Integer nsub2;
51 if (data->ReadSubList (num,2,"items",ach,nsub2)) {
52 Standard_Integer nb2 = data->NbParams(nsub2);
53 aItems = new StepRepr_HArray1OfRepresentationItem (1, nb2);
54 for (Standard_Integer i2 = 1; i2 <= nb2; i2 ++) {
55 //szv#4:S4163:12Mar99 `Standard_Boolean stat2 =` not needed
56 if (data->ReadEntity (nsub2, i2,"representation_item", ach,
57 STANDARD_TYPE(StepRepr_RepresentationItem), anent2))
58 aItems->SetValue(i2, anent2);
59 }
60 }
61
62 // --- inherited field : contextOfItems ---
63
64 Handle(StepRepr_RepresentationContext) aContextOfItems;
65 //szv#4:S4163:12Mar99 `Standard_Boolean stat3 =` not needed
66 data->ReadEntity(num, 3,"context_of_items", ach, STANDARD_TYPE(StepRepr_RepresentationContext), aContextOfItems);
67
68 //--- Initialisation of the read entity ---
69
70
71 ent->Init(aName, aItems, aContextOfItems);
72}
73
74
75void RWStepShape_RWFacetedBrepShapeRepresentation::WriteStep
76 (StepData_StepWriter& SW,
77 const Handle(StepShape_FacetedBrepShapeRepresentation)& ent) const
78{
79
80 // --- inherited field name ---
81
82 SW.Send(ent->Name());
83
84 // --- inherited field items ---
85
86 SW.OpenSub();
87 for (Standard_Integer i2 = 1; i2 <= ent->NbItems(); i2 ++) {
88 SW.Send(ent->ItemsValue(i2));
89 }
90 SW.CloseSub();
91
92 // --- inherited field contextOfItems ---
93
94 SW.Send(ent->ContextOfItems());
95}
96
97
98void RWStepShape_RWFacetedBrepShapeRepresentation::Share(const Handle(StepShape_FacetedBrepShapeRepresentation)& ent, Interface_EntityIterator& iter) const
99{
100
101 Standard_Integer nbElem1 = ent->NbItems();
102 for (Standard_Integer is1=1; is1<=nbElem1; is1 ++) {
103 iter.GetOneItem(ent->ItemsValue(is1));
104 }
105
106
107
108 iter.GetOneItem(ent->ContextOfItems());
109}
110