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 <gp_GTrsf.hxx>
21 #include <IGESBasic_SingularSubfigure.hxx>
22 #include <IGESBasic_SubfigureDef.hxx>
23 #include <IGESBasic_ToolSingularSubfigure.hxx>
24 #include <IGESData_DirChecker.hxx>
25 #include <IGESData_Dump.hxx>
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>
35 #include <Interface_Macros.hxx>
36 #include <Interface_ShareTool.hxx>
37 #include <Message_Messenger.hxx>
38 #include <Message_Msg.hxx>
39 #include <Standard_DomainError.hxx>
42 IGESBasic_ToolSingularSubfigure::IGESBasic_ToolSingularSubfigure () { }
45 void IGESBasic_ToolSingularSubfigure::ReadOwnParams
46 (const Handle(IGESBasic_SingularSubfigure)& ent,
47 const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const
50 // Building of messages
51 //========================================
52 Message_Msg Msg213("XSTEP_213");
53 //========================================
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;
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");
65 case IGESData_ReferenceError: {
66 Message_Msg Msg216 ("IGES_216");
67 Msg212.Arg(Msg216.Value());
70 case IGESData_EntityError: {
71 Message_Msg Msg217 ("IGES_217");
72 Msg212.Arg(Msg217.Value());
75 case IGESData_TypeError: {
76 Message_Msg Msg218 ("IGES_218");
77 Msg212.Arg(Msg218.Value());
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);
88 // (PR.CurrentList(1, 3),"Translation data",tempTranslation);
89 if (PR.DefinedElseSkip())
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);
95 Message_Msg Msg214("XSTEP_214");
101 tempScaleFactor = 1.0;
102 temphasscale = Standard_False;
105 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
107 (tempSubfigureDef,tempTranslation,temphasscale,tempScaleFactor);
110 void IGESBasic_ToolSingularSubfigure::WriteOwnParams
111 (const Handle(IGESBasic_SingularSubfigure)& ent, IGESData_IGESWriter& IW) const
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());
121 void IGESBasic_ToolSingularSubfigure::OwnShared
122 (const Handle(IGESBasic_SingularSubfigure)& ent, Interface_EntityIterator& iter) const
124 iter.GetOneItem(ent->Subfigure());
127 void IGESBasic_ToolSingularSubfigure::OwnCopy
128 (const Handle(IGESBasic_SingularSubfigure)& another,
129 const Handle(IGESBasic_SingularSubfigure)& ent, Interface_CopyTool& TC) const
132 Standard_Boolean ahasScale;
133 Standard_Real aScale;
136 (IGESBasic_SubfigureDef,aSubfigureDef,TC.Transferred(another->Subfigure()));
137 aTranslation = another->Translation();
138 ahasScale = another->HasScaleFactor();
139 aScale = another->ScaleFactor();
141 ent->Init(aSubfigureDef,aTranslation,ahasScale,aScale);
144 IGESData_DirChecker IGESBasic_ToolSingularSubfigure::DirChecker
145 (const Handle(IGESBasic_SingularSubfigure)& ent ) const
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
154 void IGESBasic_ToolSingularSubfigure::OwnCheck
155 (const Handle(IGESBasic_SingularSubfigure)& /* ent */,
156 const Interface_ShareTool& , Handle(Interface_Check)& /* ach */) const
160 void IGESBasic_ToolSingularSubfigure::OwnDump
161 (const Handle(IGESBasic_SingularSubfigure)& ent, const IGESData_IGESDumper& dumper,
162 const Handle(Message_Messenger)& S, const Standard_Integer level) const
164 S << "IGESBasic_SingularSubfigure" << endl;
166 S << "Subfigure Definition Entity : " ;
167 dumper.Dump(ent->Subfigure(),S,(level <= 4) ? 0 : 1);
169 S << " Translation Data : ";
170 IGESData_DumpXYZL(S,level, ent->Translation(), ent->Location());
171 S << " Scale Factors : " << ent->ScaleFactor() << endl;