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