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 <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>
26 #include <IGESData_ParamCursor.hxx>
27 #include <IGESData_ParamReader.hxx>
28 #include <Interface_Check.hxx>
29 #include <Interface_CopyTool.hxx>
30 #include <Interface_EntityIterator.hxx>
31 #include <Interface_HArray1OfHAsciiString.hxx>
32 #include <Interface_Macros.hxx>
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>
39 IGESAppli_ToolLevelToPWBLayerMap::IGESAppli_ToolLevelToPWBLayerMap () { }
42 void IGESAppli_ToolLevelToPWBLayerMap::ReadOwnParams
43 (const Handle(IGESAppli_LevelToPWBLayerMap)& ent,
44 const Handle(IGESData_IGESReaderData)& /* IR */, IGESData_ParamReader& PR) const
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;
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);
63 else PR.AddFail("Number of definitions: Not Positive");
65 if (!tempExchangeFileLevelNumber.IsNull() &&
66 !tempNativeLevel.IsNull() &&
67 !tempPhysicalLayerNumber.IsNull() &&
68 !tempExchangeFileLevelIdent.IsNull() )
69 for ( i = 1; i <= num; i++ )
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);
85 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
86 ent->Init(tempNbPropertyValues, tempExchangeFileLevelNumber,
87 tempNativeLevel, tempPhysicalLayerNumber, tempExchangeFileLevelIdent);
90 void IGESAppli_ToolLevelToPWBLayerMap::WriteOwnParams
91 (const Handle(IGESAppli_LevelToPWBLayerMap)& ent, IGESData_IGESWriter& IW) const
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++ )
98 IW.Send(ent->ExchangeFileLevelNumber(i));
99 IW.Send(ent->NativeLevel(i));
100 IW.Send(ent->PhysicalLayerNumber(i));
101 IW.Send(ent->ExchangeFileLevelIdent(i));
105 void IGESAppli_ToolLevelToPWBLayerMap::OwnShared
106 (const Handle(IGESAppli_LevelToPWBLayerMap)& /* ent */, Interface_EntityIterator& /* iter */) const
110 void IGESAppli_ToolLevelToPWBLayerMap::OwnCopy
111 (const Handle(IGESAppli_LevelToPWBLayerMap)& another,
112 const Handle(IGESAppli_LevelToPWBLayerMap)& ent, Interface_CopyTool& /* TC */) const
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++ )
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)));
134 ent->Init (tempNbPropertyValues, tempExchangeFileLevelNumber, tempNativeLevel,
135 tempPhysicalLayerNumber, tempExchangeFileLevelIdent);
138 IGESData_DirChecker IGESAppli_ToolLevelToPWBLayerMap::DirChecker
139 (const Handle(IGESAppli_LevelToPWBLayerMap)& /* ent */ ) const
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();
149 DC.HierarchyStatusIgnored();
153 void IGESAppli_ToolLevelToPWBLayerMap::OwnCheck
154 (const Handle(IGESAppli_LevelToPWBLayerMap)& /* ent */,
155 const Interface_ShareTool& , Handle(Interface_Check)& /* ach */) const
159 void IGESAppli_ToolLevelToPWBLayerMap::OwnDump
160 (const Handle(IGESAppli_LevelToPWBLayerMap)& ent, const IGESData_IGESDumper& /* dumper */,
161 const Handle(Message_Messenger)& S, const Standard_Integer level) const
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 : ";
171 (S,-level,1, ent->NbLevelToLayerDefs(),ent->ExchangeFileLevelIdent);
174 for ( num = ent->NbLevelToLayerDefs(), i = 1; i <= num; i++ )
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));
182 S << "Physical Layer Number : " << ent->PhysicalLayerNumber(i) << endl;
183 S << "Exchange File Level Identification : ";
184 IGESData_DumpString(S,ent->ExchangeFileLevelIdent(i));