0027961: Visualization - remove unused and no more working OpenGl_AVIWriter
[occt.git] / src / IGESBasic / IGESBasic_ToolExternalRefFileIndex.cxx
CommitLineData
b311480e 1// Created by: CKY / Contract Toubro-Larsen
2// Copyright (c) 1993-1999 Matra Datavision
973c2be1 3// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
7fd59977 6//
d5f74e42 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
973c2be1 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.
7fd59977 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
b311480e 15
16//--------------------------------------------------------------------
7fd59977 17//--------------------------------------------------------------------
18
42cf5bc1 19#include <IGESBasic_ExternalRefFileIndex.hxx>
20#include <IGESBasic_ToolExternalRefFileIndex.hxx>
21#include <IGESData_DirChecker.hxx>
22#include <IGESData_Dump.hxx>
7fd59977 23#include <IGESData_HArray1OfIGESEntity.hxx>
42cf5bc1 24#include <IGESData_IGESDumper.hxx>
25#include <IGESData_IGESEntity.hxx>
26#include <IGESData_IGESReaderData.hxx>
27#include <IGESData_IGESWriter.hxx>
28#include <IGESData_ParamCursor.hxx>
29#include <IGESData_ParamReader.hxx>
30#include <Interface_Check.hxx>
31#include <Interface_CopyTool.hxx>
32#include <Interface_EntityIterator.hxx>
7fd59977 33#include <Interface_HArray1OfHAsciiString.hxx>
7fd59977 34#include <Interface_Macros.hxx>
42cf5bc1 35#include <Interface_ShareTool.hxx>
36#include <Message_Messenger.hxx>
37#include <Standard_DomainError.hxx>
38#include <TCollection_HAsciiString.hxx>
7fd59977 39
40IGESBasic_ToolExternalRefFileIndex::IGESBasic_ToolExternalRefFileIndex () { }
41
42
43void IGESBasic_ToolExternalRefFileIndex::ReadOwnParams
44 (const Handle(IGESBasic_ExternalRefFileIndex)& ent,
45 const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const
46{
47 //Standard_Boolean st; //szv#4:S4163:12Mar99 moved down
48 Standard_Integer num, i;
49 Handle(Interface_HArray1OfHAsciiString) tempNames;
50 Handle(IGESData_HArray1OfIGESEntity) tempEntities;
51 Standard_Boolean st = PR.ReadInteger(PR.Current(), "Number of index entries", num);
52 if (st && num > 0)
53 {
54 tempNames = new Interface_HArray1OfHAsciiString(1, num);
55 tempEntities = new IGESData_HArray1OfIGESEntity(1, num);
56 }
57 else PR.AddFail("Number of index entries: Not Positive");
58 if (!tempNames.IsNull() && !tempEntities.IsNull())
59 for ( i = 1; i <= num; i++ )
60 {
61 Handle(TCollection_HAsciiString) tempNam;
62 if (PR.ReadText(PR.Current(), "External Reference Entity", tempNam)) //szv#4:S4163:12Mar99 `st=` not needed
63 tempNames->SetValue(i, tempNam);
64 Handle(IGESData_IGESEntity) tempEnt;
65 if (PR.ReadEntity(IR, PR.Current(), "Internal Entity", tempEnt)) //szv#4:S4163:12Mar99 `st=` not needed
66 tempEntities->SetValue(i, tempEnt);
67 }
68 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
69 ent->Init(tempNames, tempEntities);
70}
71
72void IGESBasic_ToolExternalRefFileIndex::WriteOwnParams
73 (const Handle(IGESBasic_ExternalRefFileIndex)& ent, IGESData_IGESWriter& IW) const
74{
75 Standard_Integer i, num;
76 IW.Send(ent->NbEntries());
77 for ( num = ent->NbEntries(), i = 1; i <= num; i++ )
78 {
79 IW.Send(ent->Name(i));
80 IW.Send(ent->Entity(i));
81 }
82}
83
84void IGESBasic_ToolExternalRefFileIndex::OwnShared
85 (const Handle(IGESBasic_ExternalRefFileIndex)& ent, Interface_EntityIterator& iter) const
86{
87 Standard_Integer i, num;
88 for ( num = ent->NbEntries(), i = 1; i <= num; i++ )
89 iter.GetOneItem(ent->Entity(i));
90}
91
92void IGESBasic_ToolExternalRefFileIndex::OwnCopy
93 (const Handle(IGESBasic_ExternalRefFileIndex)& another,
94 const Handle(IGESBasic_ExternalRefFileIndex)& ent, Interface_CopyTool& TC) const
95{
96 Standard_Integer num = another->NbEntries();
97 Handle(Interface_HArray1OfHAsciiString) tempNames =
98 new Interface_HArray1OfHAsciiString(1, num);
99 Handle(IGESData_HArray1OfIGESEntity) tempEntities =
100 new IGESData_HArray1OfIGESEntity(1, num);
101 for ( Standard_Integer i = 1; i <= num; i++ )
102 {
103 tempNames->SetValue(i, new TCollection_HAsciiString
104 (another->Name(i)));
105 DeclareAndCast(IGESData_IGESEntity, new_item,
106 TC.Transferred(another->Entity(i)));
107 tempEntities->SetValue(i, new_item);
108 }
109 ent->Init(tempNames, tempEntities);
110}
111
112IGESData_DirChecker IGESBasic_ToolExternalRefFileIndex::DirChecker
113 (const Handle(IGESBasic_ExternalRefFileIndex)& /* ent */ ) const
114{
115 IGESData_DirChecker DC(402, 12);
116 DC.Structure(IGESData_DefVoid);
117 DC.GraphicsIgnored();
118 DC.LineFont(IGESData_DefVoid);
119 DC.LineWeight(IGESData_DefVoid);
120 DC.Color(IGESData_DefVoid);
121 DC.BlankStatusIgnored();
122 DC.UseFlagIgnored();
123 DC.HierarchyStatusIgnored();
124 return DC;
125}
126
127void IGESBasic_ToolExternalRefFileIndex::OwnCheck
128 (const Handle(IGESBasic_ExternalRefFileIndex)& /* ent */,
129 const Interface_ShareTool& , Handle(Interface_Check)& /* ach */) const
130{
131}
132
133void IGESBasic_ToolExternalRefFileIndex::OwnDump
134 (const Handle(IGESBasic_ExternalRefFileIndex)& ent, const IGESData_IGESDumper& dumper,
135 const Handle(Message_Messenger)& S, const Standard_Integer level) const
136{
137 Standard_Integer i, num;
138 S << "IGESBasic_ExternalRefFileIndex" << endl;
139 S << "External Reference Names : " << endl;
140 S << "Internal Entities : ";
141 IGESData_DumpEntities(S,dumper,-level,1, ent->NbEntries(),ent->Entity);
142 S << endl;
143 if (level > 4)
144 for ( num = ent->NbEntries(), i = 1; i <= num; i++ )
145 {
146 S << "[" << i << "]: ";
147 S << "External Reference Name : ";
148 IGESData_DumpString(S,ent->Name(i));
149 S << " Internal Entity : ";
150 dumper.Dump (ent->Entity(i),S, 1);
151 S << endl;
152 }
153 S << endl;
154}