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 <IGESData_DirChecker.hxx> |
20 | #include <IGESData_Dump.hxx> |
21 | #include <IGESData_IGESDumper.hxx> |
22 | #include <IGESData_IGESReaderData.hxx> |
23 | #include <IGESData_IGESWriter.hxx> |
42cf5bc1 |
24 | #include <IGESData_ParamReader.hxx> |
25 | #include <IGESDefs_MacroDef.hxx> |
26 | #include <IGESDefs_ToolMacroDef.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> |
42cf5bc1 |
33 | #include <TCollection_HAsciiString.hxx> |
7fd59977 |
34 | |
35 | IGESDefs_ToolMacroDef::IGESDefs_ToolMacroDef () { } |
36 | |
37 | |
38 | void IGESDefs_ToolMacroDef::ReadOwnParams |
39 | (const Handle(IGESDefs_MacroDef)& ent, |
40 | const Handle(IGESData_IGESReaderData)& /* IR */, IGESData_ParamReader& PR) const |
41 | { |
42 | //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed |
43 | |
44 | Handle(TCollection_HAsciiString) macro; |
45 | Standard_Integer entityTypeID; |
46 | Handle(Interface_HArray1OfHAsciiString) langStatements; |
47 | Handle(TCollection_HAsciiString) endMacro; |
48 | |
49 | PR.ReadText(PR.Current(), "MACRO", macro); //szv#4:S4163:12Mar99 `st=` not needed |
50 | |
51 | PR.ReadInteger(PR.Current(), "Entity Type ID", entityTypeID); //szv#4:S4163:12Mar99 `st=` not needed |
52 | |
53 | Standard_Integer tempCurrent = PR.CurrentNumber(); |
54 | // Counting the no. of language statements. |
55 | Standard_Integer nbval; // svv Jan 10 2000 : porting on DEC |
56 | for (nbval = 0; PR.CurrentNumber() != PR.NbParams(); |
57 | nbval++, PR.SetCurrentNumber(PR.CurrentNumber() + 1)); |
58 | |
59 | PR.SetCurrentNumber(tempCurrent); |
60 | if (nbval > 0) langStatements = |
61 | new Interface_HArray1OfHAsciiString(1, nbval); |
62 | else PR.AddFail("Number of Lang. Stats. : Not Positive"); |
63 | |
64 | if (! langStatements.IsNull()) |
65 | { |
66 | for (Standard_Integer i = 1; i <= nbval; i++) |
67 | { |
68 | Handle(TCollection_HAsciiString) langStat; |
69 | //st = PR.ReadText(PR.Current(), "Language Statement", langStat); //szv#4:S4163:12Mar99 moved in if |
70 | if (PR.ReadText(PR.Current(), "Language Statement", langStat)) |
71 | langStatements->SetValue(i, langStat); |
72 | } |
73 | } |
74 | |
75 | PR.ReadText(PR.Current(), "END MACRO", endMacro); //szv#4:S4163:12Mar99 `st=` not needed |
76 | |
77 | DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent); |
78 | ent->Init (macro, entityTypeID, langStatements, endMacro); |
79 | } |
80 | |
81 | void IGESDefs_ToolMacroDef::WriteOwnParams |
82 | (const Handle(IGESDefs_MacroDef)& ent, IGESData_IGESWriter& IW) const |
83 | { |
84 | IW.Send(ent->MACRO()); |
85 | IW.Send(ent->EntityTypeID()); |
86 | Standard_Integer upper = ent->NbStatements(); |
87 | for (Standard_Integer i = 1; i <= upper; i++) |
88 | IW.Send(ent->LanguageStatement(i)); |
89 | IW.Send(ent->ENDMACRO()); |
90 | } |
91 | |
92 | void IGESDefs_ToolMacroDef::OwnShared |
93 | (const Handle(IGESDefs_MacroDef)& /* ent */, Interface_EntityIterator& /* iter */) const |
94 | { |
95 | } |
96 | |
97 | void IGESDefs_ToolMacroDef::OwnCopy |
98 | (const Handle(IGESDefs_MacroDef)& another, |
99 | const Handle(IGESDefs_MacroDef)& ent, Interface_CopyTool& /* TC */) const |
100 | { |
101 | |
102 | Handle(TCollection_HAsciiString) macro = |
103 | new TCollection_HAsciiString(another->MACRO()); |
104 | Standard_Integer entityTypeID = another->EntityTypeID(); |
105 | Handle(TCollection_HAsciiString) endMacro = |
106 | new TCollection_HAsciiString(another->ENDMACRO()); |
107 | Handle(Interface_HArray1OfHAsciiString) langStatements; |
108 | Standard_Integer nbval = another->NbStatements(); |
109 | langStatements = new Interface_HArray1OfHAsciiString(1, nbval); |
110 | |
111 | for (Standard_Integer i = 1; i <= nbval; i++) |
112 | { |
113 | Handle(TCollection_HAsciiString) langStat = |
114 | new TCollection_HAsciiString(another->LanguageStatement(i)); |
115 | langStatements->SetValue(i, langStat); |
116 | } |
117 | ent->Init(macro, entityTypeID, langStatements, endMacro); |
118 | } |
119 | |
120 | IGESData_DirChecker IGESDefs_ToolMacroDef::DirChecker |
121 | (const Handle(IGESDefs_MacroDef)& /* ent */ ) const |
122 | { |
123 | IGESData_DirChecker DC (306, 0); |
124 | DC.Structure(IGESData_DefVoid); |
125 | DC.LineFont(IGESData_DefVoid); |
126 | DC.LineWeight(IGESData_DefVoid); |
127 | DC.Color(IGESData_DefVoid); |
128 | DC.BlankStatusIgnored(); |
129 | DC.SubordinateStatusRequired(0); |
130 | DC.UseFlagRequired(2); |
131 | DC.HierarchyStatusIgnored(); |
132 | return DC; |
133 | } |
134 | |
135 | void IGESDefs_ToolMacroDef::OwnCheck |
136 | (const Handle(IGESDefs_MacroDef)& /* ent */, |
137 | const Interface_ShareTool& , Handle(Interface_Check)& /* ach */) const |
138 | { |
139 | } |
140 | |
141 | void IGESDefs_ToolMacroDef::OwnDump |
142 | (const Handle(IGESDefs_MacroDef)& ent, const IGESData_IGESDumper& /* dumper */, |
0ebe5b0a |
143 | Standard_OStream& S, const Standard_Integer level) const |
7fd59977 |
144 | { |
0ebe5b0a |
145 | S << "IGESDefs_MacroDef\n" |
146 | << "MACRO : "; |
7fd59977 |
147 | IGESData_DumpString(S,ent->MACRO()); |
0ebe5b0a |
148 | S << "\n" |
149 | << "Entity Type ID : " << ent->EntityTypeID() << "\n" |
150 | << "Language Statement : "; |
151 | IGESData_DumpStrings(S,level,1, ent->NbStatements(),ent->LanguageStatement); |
7fd59977 |
152 | S << "END MACRO : "; |
153 | IGESData_DumpString(S,ent->ENDMACRO()); |
0ebe5b0a |
154 | S << std::endl; |
7fd59977 |
155 | } |