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
8 // under the terms of the GNU Lesser General Public 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_ToolExternalRefFileIndex.ixx>
20 #include <IGESData_ParamCursor.hxx>
21 #include <IGESData_IGESEntity.hxx>
22 #include <TCollection_HAsciiString.hxx>
23 #include <IGESData_HArray1OfIGESEntity.hxx>
24 #include <Interface_HArray1OfHAsciiString.hxx>
25 #include <IGESData_Dump.hxx>
26 #include <Interface_Macros.hxx>
29 IGESBasic_ToolExternalRefFileIndex::IGESBasic_ToolExternalRefFileIndex () { }
32 void IGESBasic_ToolExternalRefFileIndex::ReadOwnParams
33 (const Handle(IGESBasic_ExternalRefFileIndex)& ent,
34 const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const
36 //Standard_Boolean st; //szv#4:S4163:12Mar99 moved down
37 Standard_Integer num, i;
38 Handle(Interface_HArray1OfHAsciiString) tempNames;
39 Handle(IGESData_HArray1OfIGESEntity) tempEntities;
40 Standard_Boolean st = PR.ReadInteger(PR.Current(), "Number of index entries", num);
43 tempNames = new Interface_HArray1OfHAsciiString(1, num);
44 tempEntities = new IGESData_HArray1OfIGESEntity(1, num);
46 else PR.AddFail("Number of index entries: Not Positive");
47 if (!tempNames.IsNull() && !tempEntities.IsNull())
48 for ( i = 1; i <= num; i++ )
50 Handle(TCollection_HAsciiString) tempNam;
51 if (PR.ReadText(PR.Current(), "External Reference Entity", tempNam)) //szv#4:S4163:12Mar99 `st=` not needed
52 tempNames->SetValue(i, tempNam);
53 Handle(IGESData_IGESEntity) tempEnt;
54 if (PR.ReadEntity(IR, PR.Current(), "Internal Entity", tempEnt)) //szv#4:S4163:12Mar99 `st=` not needed
55 tempEntities->SetValue(i, tempEnt);
57 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
58 ent->Init(tempNames, tempEntities);
61 void IGESBasic_ToolExternalRefFileIndex::WriteOwnParams
62 (const Handle(IGESBasic_ExternalRefFileIndex)& ent, IGESData_IGESWriter& IW) const
64 Standard_Integer i, num;
65 IW.Send(ent->NbEntries());
66 for ( num = ent->NbEntries(), i = 1; i <= num; i++ )
68 IW.Send(ent->Name(i));
69 IW.Send(ent->Entity(i));
73 void IGESBasic_ToolExternalRefFileIndex::OwnShared
74 (const Handle(IGESBasic_ExternalRefFileIndex)& ent, Interface_EntityIterator& iter) const
76 Standard_Integer i, num;
77 for ( num = ent->NbEntries(), i = 1; i <= num; i++ )
78 iter.GetOneItem(ent->Entity(i));
81 void IGESBasic_ToolExternalRefFileIndex::OwnCopy
82 (const Handle(IGESBasic_ExternalRefFileIndex)& another,
83 const Handle(IGESBasic_ExternalRefFileIndex)& ent, Interface_CopyTool& TC) const
85 Standard_Integer num = another->NbEntries();
86 Handle(Interface_HArray1OfHAsciiString) tempNames =
87 new Interface_HArray1OfHAsciiString(1, num);
88 Handle(IGESData_HArray1OfIGESEntity) tempEntities =
89 new IGESData_HArray1OfIGESEntity(1, num);
90 for ( Standard_Integer i = 1; i <= num; i++ )
92 tempNames->SetValue(i, new TCollection_HAsciiString
94 DeclareAndCast(IGESData_IGESEntity, new_item,
95 TC.Transferred(another->Entity(i)));
96 tempEntities->SetValue(i, new_item);
98 ent->Init(tempNames, tempEntities);
101 IGESData_DirChecker IGESBasic_ToolExternalRefFileIndex::DirChecker
102 (const Handle(IGESBasic_ExternalRefFileIndex)& /* ent */ ) const
104 IGESData_DirChecker DC(402, 12);
105 DC.Structure(IGESData_DefVoid);
106 DC.GraphicsIgnored();
107 DC.LineFont(IGESData_DefVoid);
108 DC.LineWeight(IGESData_DefVoid);
109 DC.Color(IGESData_DefVoid);
110 DC.BlankStatusIgnored();
112 DC.HierarchyStatusIgnored();
116 void IGESBasic_ToolExternalRefFileIndex::OwnCheck
117 (const Handle(IGESBasic_ExternalRefFileIndex)& /* ent */,
118 const Interface_ShareTool& , Handle(Interface_Check)& /* ach */) const
122 void IGESBasic_ToolExternalRefFileIndex::OwnDump
123 (const Handle(IGESBasic_ExternalRefFileIndex)& ent, const IGESData_IGESDumper& dumper,
124 const Handle(Message_Messenger)& S, const Standard_Integer level) const
126 Standard_Integer i, num;
127 S << "IGESBasic_ExternalRefFileIndex" << endl;
128 S << "External Reference Names : " << endl;
129 S << "Internal Entities : ";
130 IGESData_DumpEntities(S,dumper,-level,1, ent->NbEntries(),ent->Entity);
133 for ( num = ent->NbEntries(), i = 1; i <= num; i++ )
135 S << "[" << i << "]: ";
136 S << "External Reference Name : ";
137 IGESData_DumpString(S,ent->Name(i));
138 S << " Internal Entity : ";
139 dumper.Dump (ent->Entity(i),S, 1);