0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / IGESAppli / IGESAppli_ToolLevelToPWBLayerMap.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 <IGESAppli_LevelToPWBLayerMap.hxx>
20#include <IGESAppli_ToolLevelToPWBLayerMap.hxx>
21#include <IGESData_DirChecker.hxx>
22#include <IGESData_Dump.hxx>
23#include <IGESData_IGESDumper.hxx>
24#include <IGESData_IGESReaderData.hxx>
25#include <IGESData_IGESWriter.hxx>
7fd59977 26#include <IGESData_ParamCursor.hxx>
42cf5bc1 27#include <IGESData_ParamReader.hxx>
28#include <Interface_Check.hxx>
29#include <Interface_CopyTool.hxx>
30#include <Interface_EntityIterator.hxx>
7fd59977 31#include <Interface_HArray1OfHAsciiString.hxx>
7fd59977 32#include <Interface_Macros.hxx>
42cf5bc1 33#include <Interface_ShareTool.hxx>
34#include <Message_Messenger.hxx>
35#include <Standard_DomainError.hxx>
36#include <TCollection_HAsciiString.hxx>
37#include <TColStd_HArray1OfInteger.hxx>
7fd59977 38
39IGESAppli_ToolLevelToPWBLayerMap::IGESAppli_ToolLevelToPWBLayerMap () { }
40
41
42void IGESAppli_ToolLevelToPWBLayerMap::ReadOwnParams
43 (const Handle(IGESAppli_LevelToPWBLayerMap)& ent,
44 const Handle(IGESData_IGESReaderData)& /* IR */, IGESData_ParamReader& PR) const
45{
46 //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
47 Standard_Integer num, i;
48 Standard_Integer tempNbPropertyValues;
49 Handle(TColStd_HArray1OfInteger) tempExchangeFileLevelNumber;
50 Handle(Interface_HArray1OfHAsciiString) tempNativeLevel;
51 Handle(TColStd_HArray1OfInteger) tempPhysicalLayerNumber;
52 Handle(Interface_HArray1OfHAsciiString) tempExchangeFileLevelIdent;
53 //szv#4:S4163:12Mar99 `st=` not needed
54 PR.ReadInteger(PR.Current(), "Number of property values", tempNbPropertyValues);
55 if (!PR.ReadInteger(PR.Current(), "Number of definitions", num)) num = 0;
56 if (num > 0) {
57 tempExchangeFileLevelNumber =
58 new TColStd_HArray1OfInteger(1, num);
59 tempNativeLevel = new Interface_HArray1OfHAsciiString(1, num);
60 tempPhysicalLayerNumber = new TColStd_HArray1OfInteger(1, num);
61 tempExchangeFileLevelIdent = new Interface_HArray1OfHAsciiString(1, num);
62 }
63 else PR.AddFail("Number of definitions: Not Positive");
64
65 if (!tempExchangeFileLevelNumber.IsNull() &&
66 !tempNativeLevel.IsNull() &&
67 !tempPhysicalLayerNumber.IsNull() &&
68 !tempExchangeFileLevelIdent.IsNull() )
69 for ( i = 1; i <= num; i++ )
70 {
71 Standard_Integer tempEFLN;
72 //szv#4:S4163:12Mar99 moved in if
73 if (PR.ReadInteger(PR.Current(), "Exchange File Level Number", tempEFLN))
74 tempExchangeFileLevelNumber->SetValue(i, tempEFLN);
75 Handle(TCollection_HAsciiString) tempNL;
76 if (PR.ReadText(PR.Current(), "Native Level Identification", tempNL))
77 tempNativeLevel->SetValue(i, tempNL);
78 Standard_Integer tempPLN;
79 if (PR.ReadInteger(PR.Current(), "Physical Layer Number", tempPLN))
80 tempPhysicalLayerNumber->SetValue(i, tempPLN);
81 Handle(TCollection_HAsciiString) tempEFLI;
82 if (PR.ReadText(PR.Current(), "Exchange File Level Identification", tempEFLI))
83 tempExchangeFileLevelIdent->SetValue(i, tempEFLI);
84 }
85 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
86 ent->Init(tempNbPropertyValues, tempExchangeFileLevelNumber,
87 tempNativeLevel, tempPhysicalLayerNumber, tempExchangeFileLevelIdent);
88}
89
90void IGESAppli_ToolLevelToPWBLayerMap::WriteOwnParams
91 (const Handle(IGESAppli_LevelToPWBLayerMap)& ent, IGESData_IGESWriter& IW) const
92{
93 Standard_Integer i, num;
94 IW.Send(ent->NbPropertyValues());
95 IW.Send(ent->NbLevelToLayerDefs());
96 for ( num = ent->NbLevelToLayerDefs(), i = 1; i <= num; i++ )
97 {
98 IW.Send(ent->ExchangeFileLevelNumber(i));
99 IW.Send(ent->NativeLevel(i));
100 IW.Send(ent->PhysicalLayerNumber(i));
101 IW.Send(ent->ExchangeFileLevelIdent(i));
102 }
103}
104
105void IGESAppli_ToolLevelToPWBLayerMap::OwnShared
106 (const Handle(IGESAppli_LevelToPWBLayerMap)& /* ent */, Interface_EntityIterator& /* iter */) const
107{
108}
109
110void IGESAppli_ToolLevelToPWBLayerMap::OwnCopy
111 (const Handle(IGESAppli_LevelToPWBLayerMap)& another,
112 const Handle(IGESAppli_LevelToPWBLayerMap)& ent, Interface_CopyTool& /* TC */) const
113{
114 Standard_Integer tempNbPropertyValues = another->NbPropertyValues();
115 Standard_Integer num = another->NbLevelToLayerDefs();
116 Handle(TColStd_HArray1OfInteger) tempExchangeFileLevelNumber =
117 new TColStd_HArray1OfInteger(1, num);
118 Handle(Interface_HArray1OfHAsciiString) tempNativeLevel =
119 new Interface_HArray1OfHAsciiString(1, num);
120 Handle(TColStd_HArray1OfInteger) tempPhysicalLayerNumber =
121 new TColStd_HArray1OfInteger(1, num);
122 Handle(Interface_HArray1OfHAsciiString) tempExchangeFileLevelIdent =
123 new Interface_HArray1OfHAsciiString(1, num);
124 for ( Standard_Integer i = 1; i <= num; i++ )
125 {
126 tempExchangeFileLevelNumber->SetValue(i,another->ExchangeFileLevelNumber(i));
127 tempNativeLevel->SetValue
128 (i, new TCollection_HAsciiString(another->NativeLevel(i)));
129 tempPhysicalLayerNumber->SetValue(i, another->PhysicalLayerNumber(i));
130 tempExchangeFileLevelIdent->SetValue
131 (i,new TCollection_HAsciiString
132 (another->ExchangeFileLevelIdent(i)));
133 }
134 ent->Init (tempNbPropertyValues, tempExchangeFileLevelNumber, tempNativeLevel,
135 tempPhysicalLayerNumber, tempExchangeFileLevelIdent);
136}
137
138IGESData_DirChecker IGESAppli_ToolLevelToPWBLayerMap::DirChecker
139 (const Handle(IGESAppli_LevelToPWBLayerMap)& /* ent */ ) const
140{
141 IGESData_DirChecker DC(406, 24);
142 DC.Structure(IGESData_DefVoid);
143 DC.GraphicsIgnored();
144 DC.LineFont(IGESData_DefVoid);
145 DC.LineWeight(IGESData_DefVoid);
146 DC.Color(IGESData_DefVoid);
147 DC.BlankStatusIgnored();
148 DC.UseFlagIgnored();
149 DC.HierarchyStatusIgnored();
150 return DC;
151}
152
153void IGESAppli_ToolLevelToPWBLayerMap::OwnCheck
154 (const Handle(IGESAppli_LevelToPWBLayerMap)& /* ent */,
155 const Interface_ShareTool& , Handle(Interface_Check)& /* ach */) const
156{
157}
158
159void IGESAppli_ToolLevelToPWBLayerMap::OwnDump
160 (const Handle(IGESAppli_LevelToPWBLayerMap)& ent, const IGESData_IGESDumper& /* dumper */,
161 const Handle(Message_Messenger)& S, const Standard_Integer level) const
162{
163 Standard_Integer i, num;
164 S << "IGESAppli_LevelToPWBLayerMap" << endl;
165 S << "Number of property values : " << ent->NbPropertyValues() << endl;
166 S << "Exchange File Level Number : " << endl;
167 S << "Native Level Identification : " << endl;
168 S << "Physical Layer Number : " << endl;
169 S << "Exchange File Level Identification : ";
170 IGESData_DumpStrings
171 (S,-level,1, ent->NbLevelToLayerDefs(),ent->ExchangeFileLevelIdent);
172 S << endl;
173 if (level > 4)
174 for ( num = ent->NbLevelToLayerDefs(), i = 1; i <= num; i++ )
175 {
176 S << "[" << i << "]: " << endl;
177 S << "Exchange File Level Number : "
178 << ent->ExchangeFileLevelNumber(i) << endl;
179 S << "Native Level Identification : ";
180 IGESData_DumpString(S,ent->NativeLevel(i));
181 S << endl;
182 S << "Physical Layer Number : " << ent->PhysicalLayerNumber(i) << endl;
183 S << "Exchange File Level Identification : ";
184 IGESData_DumpString(S,ent->ExchangeFileLevelIdent(i));
185 S << endl;
186 }
187}