0023948: Wrong intersection between a surface of revolution and a plane.
[occt.git] / src / RWStepShape / RWStepShape_RWDefinitionalRepresentationAndShapeRepresentation.cxx
1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
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.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14 #include <RWStepShape_RWDefinitionalRepresentationAndShapeRepresentation.ixx>
15 #include <StepShape_DefinitionalRepresentationAndShapeRepresentation.hxx>
16 #include <Interface_EntityIterator.hxx>
17 #include <StepRepr_HArray1OfRepresentationItem.hxx>
18
19 RWStepShape_RWDefinitionalRepresentationAndShapeRepresentation::RWStepShape_RWDefinitionalRepresentationAndShapeRepresentation () {}
20
21 void RWStepShape_RWDefinitionalRepresentationAndShapeRepresentation::ReadStep
22         (const Handle(StepData_StepReaderData)& data,
23          const Standard_Integer num0,
24          Handle(Interface_Check)& ach,
25          const Handle(StepShape_DefinitionalRepresentationAndShapeRepresentation)& ent) const
26 {
27
28         Standard_Integer num = num0;
29
30         // skip definitional_representation
31         
32         num = data->NextForComplex(num);
33
34
35         // --- Instance of plex componant definitional_representation ---
36
37         if (!data->CheckNbParams(num,3,ach,"representation")) return;
38
39         // --- inherited field : name ---
40
41         Handle(TCollection_HAsciiString) aName;
42         data->ReadString (num,1,"name",ach,aName);
43
44         // --- inherited field : items ---
45
46         Handle(StepRepr_HArray1OfRepresentationItem) aItems;
47         Handle(StepRepr_RepresentationItem) anent2;
48         Standard_Integer nsub2;
49         if (data->ReadSubList (num,2,"items",ach,nsub2)) {
50           Standard_Integer nb2 = data->NbParams(nsub2);
51           aItems = new StepRepr_HArray1OfRepresentationItem (1, nb2);
52           for (Standard_Integer i2 = 1; i2 <= nb2; i2 ++) {
53             if (data->ReadEntity (nsub2, i2,"representation_item", ach, STANDARD_TYPE(StepRepr_RepresentationItem), anent2))
54               aItems->SetValue(i2, anent2);
55           }
56         }
57
58         // --- inherited field : contextOfItems ---
59
60         Handle(StepRepr_RepresentationContext) aContextOfItems;
61         data->ReadEntity(num, 3,"context_of_items", ach, STANDARD_TYPE(StepRepr_RepresentationContext), aContextOfItems);
62
63         // skip shape_representation
64         num = data->NextForComplex(num);
65
66         //--- Initialisation of the read entity ---
67         ent->Init(aName, aItems, aContextOfItems);
68
69 }
70
71
72 void RWStepShape_RWDefinitionalRepresentationAndShapeRepresentation::WriteStep
73         (StepData_StepWriter& SW,
74          const Handle(StepShape_DefinitionalRepresentationAndShapeRepresentation)& ent) const
75 {
76
77         // --- Instance of plex componant ConversionBasedUnit ---
78
79         SW.StartEntity("DEFINITIONAL_REPRESENTATION");
80
81         SW.StartEntity("REPRESENTATION");
82
83         // --- inherited field name ---
84
85         SW.Send(ent->Name());
86
87         // --- inherited field items ---
88
89         SW.OpenSub();
90         for (Standard_Integer i2 = 1;  i2 <= ent->NbItems();  i2 ++) {
91           SW.Send(ent->ItemsValue(i2));
92         }
93         SW.CloseSub();
94
95         // --- inherited field contextOfItems ---
96
97         SW.Send(ent->ContextOfItems());
98
99         // --- Instance of plex componant LengthUnit ---
100
101         SW.StartEntity("SHAPE_REPRESENTATION");
102
103 }
104
105
106 void RWStepShape_RWDefinitionalRepresentationAndShapeRepresentation::Share(const Handle(StepShape_DefinitionalRepresentationAndShapeRepresentation)& ent, 
107                                                                            Interface_EntityIterator& iter) const
108 {
109
110         Standard_Integer nbElem1 = ent->NbItems();
111         for (Standard_Integer is1=1; is1<=nbElem1; is1 ++) {
112           iter.GetOneItem(ent->ItemsValue(is1));
113         }
114
115
116
117         iter.GetOneItem(ent->ContextOfItems());
118 }
119