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 <gp_GTrsf.hxx> |
7fd59977 |
20 | #include <gp_XYZ.hxx> |
42cf5bc1 |
21 | #include <IGESBasic_SingularSubfigure.hxx> |
7fd59977 |
22 | #include <IGESBasic_SubfigureDef.hxx> |
42cf5bc1 |
23 | #include <IGESBasic_ToolSingularSubfigure.hxx> |
24 | #include <IGESData_DirChecker.hxx> |
7fd59977 |
25 | #include <IGESData_Dump.hxx> |
42cf5bc1 |
26 | #include <IGESData_IGESDumper.hxx> |
27 | #include <IGESData_IGESReaderData.hxx> |
28 | #include <IGESData_IGESWriter.hxx> |
29 | #include <IGESData_ParamCursor.hxx> |
30 | #include <IGESData_ParamReader.hxx> |
31 | #include <IGESData_Status.hxx> |
32 | #include <Interface_Check.hxx> |
33 | #include <Interface_CopyTool.hxx> |
34 | #include <Interface_EntityIterator.hxx> |
7fd59977 |
35 | #include <Interface_Macros.hxx> |
42cf5bc1 |
36 | #include <Interface_ShareTool.hxx> |
37 | #include <Message_Messenger.hxx> |
7fd59977 |
38 | #include <Message_Msg.hxx> |
42cf5bc1 |
39 | #include <Standard_DomainError.hxx> |
7fd59977 |
40 | |
42cf5bc1 |
41 | // MGE 03/08/98 |
7fd59977 |
42 | IGESBasic_ToolSingularSubfigure::IGESBasic_ToolSingularSubfigure () { } |
43 | |
44 | |
45 | void IGESBasic_ToolSingularSubfigure::ReadOwnParams |
46 | (const Handle(IGESBasic_SingularSubfigure)& ent, |
47 | const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const |
48 | { |
49 | // MGE 03/08/98 |
50 | // Building of messages |
51 | //======================================== |
52 | Message_Msg Msg213("XSTEP_213"); |
53 | //======================================== |
54 | |
55 | //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed |
56 | Standard_Boolean temphasscale; |
57 | Standard_Real tempScaleFactor; |
58 | Handle(IGESBasic_SubfigureDef) tempSubfigureDef; |
59 | gp_XYZ tempTranslation; |
60 | IGESData_Status aStatus; |
61 | |
62 | if(!PR.ReadEntity(IR,PR.Current(),aStatus,STANDARD_TYPE(IGESBasic_SubfigureDef),tempSubfigureDef)){ //szv#4:S4163:12Mar99 `st=` not needed; |
63 | Message_Msg Msg212("XSTEP_212"); |
64 | switch(aStatus) { |
65 | case IGESData_ReferenceError: { |
66 | Message_Msg Msg216 ("IGES_216"); |
67 | Msg212.Arg(Msg216.Value()); |
68 | PR.SendFail(Msg212); |
69 | break; } |
70 | case IGESData_EntityError: { |
71 | Message_Msg Msg217 ("IGES_217"); |
72 | Msg212.Arg(Msg217.Value()); |
73 | PR.SendFail(Msg212); |
74 | break; } |
75 | case IGESData_TypeError: { |
76 | Message_Msg Msg218 ("IGES_218"); |
77 | Msg212.Arg(Msg218.Value()); |
78 | PR.SendFail(Msg212); |
79 | break; } |
80 | default:{ |
81 | } |
82 | } |
83 | } |
84 | PR.ReadXYZ (PR.CurrentList(1, 3),Msg213,tempTranslation); //szv#4:S4163:12Mar99 `st=` not needed |
85 | //st = PR.ReadEntity(IR,PR.Current(),"Subfigure definition entity", |
86 | // STANDARD_TYPE(IGESBasic_SubfigureDef), tempSubfigureDef); |
87 | //st = PR.ReadXYZ |
88 | // (PR.CurrentList(1, 3),"Translation data",tempTranslation); |
89 | if (PR.DefinedElseSkip()) |
90 | { |
91 | //st = PR.ReadReal(PR.Current(),Msg214,tempScaleFactor); //szv#4:S4163:12Mar99 moved down |
92 | //st = PR.ReadReal(PR.Current(),"Scale Factor",tempScaleFactor); |
93 | temphasscale = PR.ReadReal(PR.Current(),tempScaleFactor); |
94 | if (!temphasscale){ |
95 | Message_Msg Msg214("XSTEP_214"); |
96 | PR.SendFail(Msg214); |
97 | } |
98 | } |
99 | else |
100 | { |
101 | tempScaleFactor = 1.0; |
102 | temphasscale = Standard_False; |
103 | } |
104 | |
105 | DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent); |
106 | ent->Init |
107 | (tempSubfigureDef,tempTranslation,temphasscale,tempScaleFactor); |
108 | } |
109 | |
110 | void IGESBasic_ToolSingularSubfigure::WriteOwnParams |
111 | (const Handle(IGESBasic_SingularSubfigure)& ent, IGESData_IGESWriter& IW) const |
112 | { |
113 | IW.Send(ent->Subfigure()); |
114 | IW.Send(ent->Translation().X()); |
115 | IW.Send(ent->Translation().Y()); |
116 | IW.Send(ent->Translation().Z()); |
117 | if (ent->HasScaleFactor()) IW.Send(ent->ScaleFactor()); |
118 | else IW.SendVoid(); |
119 | } |
120 | |
121 | void IGESBasic_ToolSingularSubfigure::OwnShared |
122 | (const Handle(IGESBasic_SingularSubfigure)& ent, Interface_EntityIterator& iter) const |
123 | { |
124 | iter.GetOneItem(ent->Subfigure()); |
125 | } |
126 | |
127 | void IGESBasic_ToolSingularSubfigure::OwnCopy |
128 | (const Handle(IGESBasic_SingularSubfigure)& another, |
129 | const Handle(IGESBasic_SingularSubfigure)& ent, Interface_CopyTool& TC) const |
130 | { |
131 | gp_XYZ aTranslation; |
132 | Standard_Boolean ahasScale; |
133 | Standard_Real aScale; |
134 | |
135 | DeclareAndCast |
136 | (IGESBasic_SubfigureDef,aSubfigureDef,TC.Transferred(another->Subfigure())); |
137 | aTranslation = another->Translation(); |
138 | ahasScale = another->HasScaleFactor(); |
139 | aScale = another->ScaleFactor(); |
140 | |
141 | ent->Init(aSubfigureDef,aTranslation,ahasScale,aScale); |
142 | } |
143 | |
144 | IGESData_DirChecker IGESBasic_ToolSingularSubfigure::DirChecker |
145 | (const Handle(IGESBasic_SingularSubfigure)& ent ) const |
146 | { |
147 | IGESData_DirChecker DC(408,0); //TypeNo. 408, Form no. 0 |
148 | DC.Structure(IGESData_DefVoid); |
149 | if (ent->HierarchyStatus() == 1) |
150 | DC.GraphicsIgnored(01); // GraphicsIgnored if Hierarchy = 01 |
151 | return DC; |
152 | } |
153 | |
154 | void IGESBasic_ToolSingularSubfigure::OwnCheck |
155 | (const Handle(IGESBasic_SingularSubfigure)& /* ent */, |
156 | const Interface_ShareTool& , Handle(Interface_Check)& /* ach */) const |
157 | { |
158 | } |
159 | |
160 | void IGESBasic_ToolSingularSubfigure::OwnDump |
161 | (const Handle(IGESBasic_SingularSubfigure)& ent, const IGESData_IGESDumper& dumper, |
0ebe5b0a |
162 | Standard_OStream& S, const Standard_Integer level) const |
7fd59977 |
163 | { |
0ebe5b0a |
164 | S << "IGESBasic_SingularSubfigure\n" |
165 | << "Subfigure Definition Entity : " ; |
7fd59977 |
166 | dumper.Dump(ent->Subfigure(),S,(level <= 4) ? 0 : 1); |
0ebe5b0a |
167 | S << "\n" |
168 | << " Translation Data : "; |
7fd59977 |
169 | IGESData_DumpXYZL(S,level, ent->Translation(), ent->Location()); |
0ebe5b0a |
170 | S << " Scale Factors : " << ent->ScaleFactor() << "\n" |
171 | << std::endl; |
7fd59977 |
172 | } |