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_ShareTool.hxx>
33 #include <Message_Messenger.hxx>
34 #include <Standard_DomainError.hxx>
35 #include <TCollection_HAsciiString.hxx>
36 #include <TColStd_HArray1OfInteger.hxx>
38 IGESAppli_ToolLevelToPWBLayerMap::IGESAppli_ToolLevelToPWBLayerMap () { }
41 void IGESAppli_ToolLevelToPWBLayerMap::ReadOwnParams
42 (const Handle(IGESAppli_LevelToPWBLayerMap)& ent,
43 const Handle(IGESData_IGESReaderData)& /* IR */, IGESData_ParamReader& PR) const
45 //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
46 Standard_Integer num, i;
47 Standard_Integer tempNbPropertyValues;
48 Handle(TColStd_HArray1OfInteger) tempExchangeFileLevelNumber;
49 Handle(Interface_HArray1OfHAsciiString) tempNativeLevel;
50 Handle(TColStd_HArray1OfInteger) tempPhysicalLayerNumber;
51 Handle(Interface_HArray1OfHAsciiString) tempExchangeFileLevelIdent;
52 //szv#4:S4163:12Mar99 `st=` not needed
53 PR.ReadInteger(PR.Current(), "Number of property values", tempNbPropertyValues);
54 if (!PR.ReadInteger(PR.Current(), "Number of definitions", num)) num = 0;
56 tempExchangeFileLevelNumber =
57 new TColStd_HArray1OfInteger(1, num);
58 tempNativeLevel = new Interface_HArray1OfHAsciiString(1, num);
59 tempPhysicalLayerNumber = new TColStd_HArray1OfInteger(1, num);
60 tempExchangeFileLevelIdent = new Interface_HArray1OfHAsciiString(1, num);
62 else PR.AddFail("Number of definitions: Not Positive");
64 if (!tempExchangeFileLevelNumber.IsNull() &&
65 !tempNativeLevel.IsNull() &&
66 !tempPhysicalLayerNumber.IsNull() &&
67 !tempExchangeFileLevelIdent.IsNull() )
68 for ( i = 1; i <= num; i++ )
70 Standard_Integer tempEFLN;
71 //szv#4:S4163:12Mar99 moved in if
72 if (PR.ReadInteger(PR.Current(), "Exchange File Level Number", tempEFLN))
73 tempExchangeFileLevelNumber->SetValue(i, tempEFLN);
74 Handle(TCollection_HAsciiString) tempNL;
75 if (PR.ReadText(PR.Current(), "Native Level Identification", tempNL))
76 tempNativeLevel->SetValue(i, tempNL);
77 Standard_Integer tempPLN;
78 if (PR.ReadInteger(PR.Current(), "Physical Layer Number", tempPLN))
79 tempPhysicalLayerNumber->SetValue(i, tempPLN);
80 Handle(TCollection_HAsciiString) tempEFLI;
81 if (PR.ReadText(PR.Current(), "Exchange File Level Identification", tempEFLI))
82 tempExchangeFileLevelIdent->SetValue(i, tempEFLI);
84 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
85 ent->Init(tempNbPropertyValues, tempExchangeFileLevelNumber,
86 tempNativeLevel, tempPhysicalLayerNumber, tempExchangeFileLevelIdent);
89 void IGESAppli_ToolLevelToPWBLayerMap::WriteOwnParams
90 (const Handle(IGESAppli_LevelToPWBLayerMap)& ent, IGESData_IGESWriter& IW) const
92 Standard_Integer i, num;
93 IW.Send(ent->NbPropertyValues());
94 IW.Send(ent->NbLevelToLayerDefs());
95 for ( num = ent->NbLevelToLayerDefs(), i = 1; i <= num; i++ )
97 IW.Send(ent->ExchangeFileLevelNumber(i));
98 IW.Send(ent->NativeLevel(i));
99 IW.Send(ent->PhysicalLayerNumber(i));
100 IW.Send(ent->ExchangeFileLevelIdent(i));
104 void IGESAppli_ToolLevelToPWBLayerMap::OwnShared
105 (const Handle(IGESAppli_LevelToPWBLayerMap)& /* ent */, Interface_EntityIterator& /* iter */) const
109 void IGESAppli_ToolLevelToPWBLayerMap::OwnCopy
110 (const Handle(IGESAppli_LevelToPWBLayerMap)& another,
111 const Handle(IGESAppli_LevelToPWBLayerMap)& ent, Interface_CopyTool& /* TC */) const
113 Standard_Integer tempNbPropertyValues = another->NbPropertyValues();
114 Standard_Integer num = another->NbLevelToLayerDefs();
115 Handle(TColStd_HArray1OfInteger) tempExchangeFileLevelNumber =
116 new TColStd_HArray1OfInteger(1, num);
117 Handle(Interface_HArray1OfHAsciiString) tempNativeLevel =
118 new Interface_HArray1OfHAsciiString(1, num);
119 Handle(TColStd_HArray1OfInteger) tempPhysicalLayerNumber =
120 new TColStd_HArray1OfInteger(1, num);
121 Handle(Interface_HArray1OfHAsciiString) tempExchangeFileLevelIdent =
122 new Interface_HArray1OfHAsciiString(1, num);
123 for ( Standard_Integer i = 1; i <= num; i++ )
125 tempExchangeFileLevelNumber->SetValue(i,another->ExchangeFileLevelNumber(i));
126 tempNativeLevel->SetValue
127 (i, new TCollection_HAsciiString(another->NativeLevel(i)));
128 tempPhysicalLayerNumber->SetValue(i, another->PhysicalLayerNumber(i));
129 tempExchangeFileLevelIdent->SetValue
130 (i,new TCollection_HAsciiString
131 (another->ExchangeFileLevelIdent(i)));
133 ent->Init (tempNbPropertyValues, tempExchangeFileLevelNumber, tempNativeLevel,
134 tempPhysicalLayerNumber, tempExchangeFileLevelIdent);
137 IGESData_DirChecker IGESAppli_ToolLevelToPWBLayerMap::DirChecker
138 (const Handle(IGESAppli_LevelToPWBLayerMap)& /* ent */ ) const
140 IGESData_DirChecker DC(406, 24);
141 DC.Structure(IGESData_DefVoid);
142 DC.GraphicsIgnored();
143 DC.LineFont(IGESData_DefVoid);
144 DC.LineWeight(IGESData_DefVoid);
145 DC.Color(IGESData_DefVoid);
146 DC.BlankStatusIgnored();
148 DC.HierarchyStatusIgnored();
152 void IGESAppli_ToolLevelToPWBLayerMap::OwnCheck
153 (const Handle(IGESAppli_LevelToPWBLayerMap)& /* ent */,
154 const Interface_ShareTool& , Handle(Interface_Check)& /* ach */) const
158 void IGESAppli_ToolLevelToPWBLayerMap::OwnDump
159 (const Handle(IGESAppli_LevelToPWBLayerMap)& ent, const IGESData_IGESDumper& /* dumper */,
160 Standard_OStream& S, const Standard_Integer level) const
162 Standard_Integer i, num;
163 S << "IGESAppli_LevelToPWBLayerMap\n";
164 S << "Number of property values : " << ent->NbPropertyValues() << "\n";
165 S << "Exchange File Level Number :\n";
166 S << "Native Level Identification :\n";
167 S << "Physical Layer Number :\n";
168 S << "Exchange File Level Identification : ";
170 (S,-level,1, ent->NbLevelToLayerDefs(),ent->ExchangeFileLevelIdent);
173 for ( num = ent->NbLevelToLayerDefs(), i = 1; i <= num; i++ )
175 S << "[" << i << "]:\n";
176 S << "Exchange File Level Number : "
177 << ent->ExchangeFileLevelNumber(i) << "\n";
178 S << "Native Level Identification : ";
179 IGESData_DumpString(S,ent->NativeLevel(i));
181 S << "Physical Layer Number : " << ent->PhysicalLayerNumber(i) << "\n";
182 S << "Exchange File Level Identification : ";
183 IGESData_DumpString(S,ent->ExchangeFileLevelIdent(i));