1 // Created by: CKY / Contract Toubro-Larsen
2 // Copyright (c) 1993-1999 Matra Datavision
3 // Copyright (c) 1999-2014 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.
16 //--------------------------------------------------------------------
17 //--------------------------------------------------------------------
19 #include <IGESBasic_SubfigureDef.hxx>
20 #include <IGESBasic_ToolSubfigureDef.hxx>
21 #include <IGESData_DirChecker.hxx>
22 #include <IGESData_Dump.hxx>
23 #include <IGESData_HArray1OfIGESEntity.hxx>
24 #include <IGESData_IGESDumper.hxx>
25 #include <IGESData_IGESEntity.hxx>
26 #include <IGESData_IGESReaderData.hxx>
27 #include <IGESData_IGESWriter.hxx>
28 #include <IGESData_ParamReader.hxx>
29 #include <Interface_Check.hxx>
30 #include <Interface_CopyTool.hxx>
31 #include <Interface_EntityIterator.hxx>
32 #include <Interface_Macros.hxx>
33 #include <Interface_ShareTool.hxx>
34 #include <Message_Msg.hxx>
35 #include <Standard_DomainError.hxx>
36 #include <TCollection_HAsciiString.hxx>
39 IGESBasic_ToolSubfigureDef::IGESBasic_ToolSubfigureDef () { }
42 void IGESBasic_ToolSubfigureDef::ReadOwnParams
43 (const Handle(IGESBasic_SubfigureDef)& ent,
44 const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const
47 // Building of messages
48 //========================================
49 // Message_Msg Msg208("XSTEP_208");
50 Message_Msg Msg209("XSTEP_209");
51 // Message_Msg Msg210("XSTEP_210");
52 // Message_Msg Msg211("XSTEP_211");
53 //========================================
55 Standard_Integer tempDepth;
56 Handle(TCollection_HAsciiString) tempName;
57 //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
58 Standard_Integer nbval = 0;
59 Handle(IGESData_HArray1OfIGESEntity) EntArray;
61 if(!PR.ReadInteger(PR.Current(),tempDepth)){ //szv#4:S4163:12Mar99 `st=` not needed
62 Message_Msg Msg208("XSTEP_208");
65 PR.ReadText(PR.Current(),Msg209,tempName); //szv#4:S4163:12Mar99 `st=` not needed
66 if (PR.ReadInteger( PR.Current(), nbval)) { //szv#4:S4163:12Mar99 `st=` not needed
67 Message_Msg Msg211("XSTEP_211");
68 PR.ReadEnts (IR,PR.CurrentList(nbval),Msg211,EntArray); //szv#4:S4163:12Mar99 `st=` not needed
71 Message_Msg Msg210("XSTEP_210");
74 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
75 ent->Init(tempDepth,tempName,EntArray);
78 void IGESBasic_ToolSubfigureDef::WriteOwnParams
79 (const Handle(IGESBasic_SubfigureDef)& ent, IGESData_IGESWriter& IW) const
81 Standard_Integer nb = ent->NbEntities();
83 IW.Send(ent->Depth());
86 for (Standard_Integer i = 1; i <= nb; i ++)
87 IW.Send(ent->AssociatedEntity(i));
90 void IGESBasic_ToolSubfigureDef::OwnShared
91 (const Handle(IGESBasic_SubfigureDef)& ent, Interface_EntityIterator& iter) const
93 Standard_Integer nb = ent->NbEntities();
94 for (Standard_Integer i = 1; i <= nb; i ++)
95 iter.GetOneItem(ent->AssociatedEntity(i));
98 void IGESBasic_ToolSubfigureDef::OwnCopy
99 (const Handle(IGESBasic_SubfigureDef)& another,
100 const Handle(IGESBasic_SubfigureDef)& ent, Interface_CopyTool& TC) const
102 Standard_Integer lower,upper;
103 Standard_Integer aDepth = another->Depth();
104 Handle(TCollection_HAsciiString) aName =
105 new TCollection_HAsciiString(another->Name());
108 upper = another->NbEntities();
109 Handle(IGESData_HArray1OfIGESEntity) EntArray = new
110 IGESData_HArray1OfIGESEntity(lower,upper);
111 for (Standard_Integer i = lower;i <= upper;i++)
113 DeclareAndCast(IGESData_IGESEntity,myentity,
114 TC.Transferred(another->AssociatedEntity(i)));
115 EntArray->SetValue(i,myentity);
117 ent->Init(aDepth,aName,EntArray);
120 IGESData_DirChecker IGESBasic_ToolSubfigureDef::DirChecker
121 (const Handle(IGESBasic_SubfigureDef)& ent ) const
123 IGESData_DirChecker DC(308,0); //TypeNo. 308, Form no. 0
124 DC.Structure(IGESData_DefVoid);
125 if (ent->HierarchyStatus() == 1) DC.GraphicsIgnored(01);
126 // GraphicsIgnored if hierarchy status = 01
129 DC.BlankStatusIgnored();
131 DC.UseFlagRequired(02);
135 void IGESBasic_ToolSubfigureDef::OwnCheck
136 (const Handle(IGESBasic_SubfigureDef)& /* ent */,
137 const Interface_ShareTool& , Handle(Interface_Check)& /* ach */) const
141 void IGESBasic_ToolSubfigureDef::OwnDump
142 (const Handle(IGESBasic_SubfigureDef)& ent, const IGESData_IGESDumper& dumper,
143 Standard_OStream& S, const Standard_Integer level) const
145 S << "IGESBasic_SubfigureDef\n"
146 << "Depth of the subfigure : " << ent->Depth() << "\n"
147 << "Name of subfigure : ";
148 IGESData_DumpString(S,ent->Name());
150 << "The Associated Entities : ";
151 IGESData_DumpEntities(S,dumper,level,1,ent->NbEntities(),ent->AssociatedEntity);