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 #include <RWStepShape_RWDefinitionalRepresentationAndShapeRepresentation.ixx>
15 #include <StepShape_DefinitionalRepresentationAndShapeRepresentation.hxx>
16 #include <Interface_EntityIterator.hxx>
17 #include <StepRepr_HArray1OfRepresentationItem.hxx>
19 RWStepShape_RWDefinitionalRepresentationAndShapeRepresentation::RWStepShape_RWDefinitionalRepresentationAndShapeRepresentation () {}
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
28 Standard_Integer num = num0;
30 // skip definitional_representation
32 num = data->NextForComplex(num);
35 // --- Instance of plex componant definitional_representation ---
37 if (!data->CheckNbParams(num,3,ach,"representation")) return;
39 // --- inherited field : name ---
41 Handle(TCollection_HAsciiString) aName;
42 data->ReadString (num,1,"name",ach,aName);
44 // --- inherited field : items ---
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);
58 // --- inherited field : contextOfItems ---
60 Handle(StepRepr_RepresentationContext) aContextOfItems;
61 data->ReadEntity(num, 3,"context_of_items", ach, STANDARD_TYPE(StepRepr_RepresentationContext), aContextOfItems);
63 // skip shape_representation
64 num = data->NextForComplex(num);
66 //--- Initialisation of the read entity ---
67 ent->Init(aName, aItems, aContextOfItems);
72 void RWStepShape_RWDefinitionalRepresentationAndShapeRepresentation::WriteStep
73 (StepData_StepWriter& SW,
74 const Handle(StepShape_DefinitionalRepresentationAndShapeRepresentation)& ent) const
77 // --- Instance of plex componant ConversionBasedUnit ---
79 SW.StartEntity("DEFINITIONAL_REPRESENTATION");
81 SW.StartEntity("REPRESENTATION");
83 // --- inherited field name ---
87 // --- inherited field items ---
90 for (Standard_Integer i2 = 1; i2 <= ent->NbItems(); i2 ++) {
91 SW.Send(ent->ItemsValue(i2));
95 // --- inherited field contextOfItems ---
97 SW.Send(ent->ContextOfItems());
99 // --- Instance of plex componant LengthUnit ---
101 SW.StartEntity("SHAPE_REPRESENTATION");
106 void RWStepShape_RWDefinitionalRepresentationAndShapeRepresentation::Share(const Handle(StepShape_DefinitionalRepresentationAndShapeRepresentation)& ent,
107 Interface_EntityIterator& iter) const
110 Standard_Integer nbElem1 = ent->NbItems();
111 for (Standard_Integer is1=1; is1<=nbElem1; is1 ++) {
112 iter.GetOneItem(ent->ItemsValue(is1));
117 iter.GetOneItem(ent->ContextOfItems());