1 // Created on: 2016-08-25
2 // Created by: Irina KRYLOVA
3 // Copyright (c) 2016 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
17 #include <Interface_Check.hxx>
18 #include <Interface_EntityIterator.hxx>
19 #include <RWStepVisual_RWCharacterizedObjectAndCharacterizedRepresentationAndDraughtingModelAndRepresentation.hxx>
20 #include <StepData_StepReaderData.hxx>
21 #include <StepData_StepWriter.hxx>
22 #include <StepRepr_RepresentationContext.hxx>
23 #include <StepVisual_CharacterizedObjectAndCharacterizedRepresentationAndDraughtingModelAndRepresentation.hxx>
25 //=======================================================================
26 //function : RWStepVisual_RWChObjAndChReprAndDModelAndRepr
28 //=======================================================================
29 RWStepVisual_RWCharacterizedObjectAndCharacterizedRepresentationAndDraughtingModelAndRepresentation::
30 RWStepVisual_RWCharacterizedObjectAndCharacterizedRepresentationAndDraughtingModelAndRepresentation()
35 //=======================================================================
38 //=======================================================================
40 void RWStepVisual_RWCharacterizedObjectAndCharacterizedRepresentationAndDraughtingModelAndRepresentation::ReadStep
41 (const Handle(StepData_StepReaderData)& data,
42 const Standard_Integer num0, Handle(Interface_Check)& ach,
43 const Handle(StepVisual_CharacterizedObjectAndCharacterizedRepresentationAndDraughtingModelAndRepresentation)& ent) const
45 Standard_Integer num = 0;
46 data->NamedForComplex("REPRESENTATION","RPRSNT", num0, num, ach);
47 if (!data->CheckNbParams(num, 3, ach, "shape_aspect")) return;
50 Handle(TCollection_HAsciiString) aName;
51 data->ReadString(num, 1, "name", ach, aName);
54 Handle(StepRepr_HArray1OfRepresentationItem) anItems;
55 Handle(StepRepr_RepresentationItem) anItem;
56 Standard_Integer nsub;
57 if (data->ReadSubList(num, 2, "items", ach, nsub)) {
58 Standard_Integer nb = data->NbParams(nsub);
59 anItems = new StepRepr_HArray1OfRepresentationItem(1, nb);
60 for (Standard_Integer i = 1; i <= nb; i++) {
61 if (data->ReadEntity(nsub, i, "representation_item", ach,
62 STANDARD_TYPE(StepRepr_RepresentationItem), anItem))
63 anItems->SetValue(i, anItem);
68 Handle(StepRepr_RepresentationContext) aContextOfItems;
69 data->ReadEntity(num, 3, "context_of_items", ach, STANDARD_TYPE(StepRepr_RepresentationContext), aContextOfItems);
71 // Initialize the entity
72 ent->Init(aName, anItems, aContextOfItems);
76 //=======================================================================
77 //function : WriteStep
79 //=======================================================================
81 void RWStepVisual_RWCharacterizedObjectAndCharacterizedRepresentationAndDraughtingModelAndRepresentation::WriteStep
82 (StepData_StepWriter& SW,
83 const Handle(StepVisual_CharacterizedObjectAndCharacterizedRepresentationAndDraughtingModelAndRepresentation)& ent) const
85 SW.StartEntity("CHARACTERIZED_OBJECT");
88 SW.StartEntity("CHARACTERIZED_REPRESENTATION");
89 SW.StartEntity("DRAUGHTING_MODEL");
90 SW.StartEntity("REPRESENTATION");
93 for (Standard_Integer i = 1; i <= ent->NbItems(); i++) {
94 SW.Send(ent->ItemsValue(i));
97 SW.Send(ent->ContextOfItems());
101 //=======================================================================
104 //=======================================================================
106 void RWStepVisual_RWCharacterizedObjectAndCharacterizedRepresentationAndDraughtingModelAndRepresentation::Share
107 (const Handle(StepVisual_CharacterizedObjectAndCharacterizedRepresentationAndDraughtingModelAndRepresentation)& ent,
108 Interface_EntityIterator& iter) const
110 Standard_Integer nbElem = ent->NbItems();
111 for (Standard_Integer i = 1; i <= nbElem; i++) {
112 iter.GetOneItem(ent->ItemsValue(i));
114 iter.GetOneItem(ent->ContextOfItems());