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 <IGESBasic_SubfigureDef.hxx>
20 #include <IGESData_DirChecker.hxx>
21 #include <IGESData_IGESDumper.hxx>
22 #include <IGESData_IGESReaderData.hxx>
23 #include <IGESData_IGESWriter.hxx>
24 #include <IGESData_ParamCursor.hxx>
25 #include <IGESData_ParamReader.hxx>
26 #include <IGESGraph_LineFontDefTemplate.hxx>
27 #include <IGESGraph_ToolLineFontDefTemplate.hxx>
28 #include <Interface_Check.hxx>
29 #include <Interface_CopyTool.hxx>
30 #include <Interface_EntityIterator.hxx>
31 #include <Interface_Macros.hxx>
32 #include <Interface_ShareTool.hxx>
33 #include <Message_Messenger.hxx>
34 #include <Standard_DomainError.hxx>
36 IGESGraph_ToolLineFontDefTemplate::IGESGraph_ToolLineFontDefTemplate () { }
39 void IGESGraph_ToolLineFontDefTemplate::ReadOwnParams
40 (const Handle(IGESGraph_LineFontDefTemplate)& ent,
41 const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const
43 //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
45 Standard_Integer tempOrientation;
46 Standard_Real tempDistance, tempScale;
47 Handle(IGESBasic_SubfigureDef) tempTemplateEntity;
49 PR.ReadInteger(PR.Current(), "Template Orientation", tempOrientation); //szv#4:S4163:12Mar99 `st=` not needed
51 PR.ReadEntity(IR, PR.Current(),
52 "Subfigure Definition Entity for Template Display",
53 STANDARD_TYPE(IGESBasic_SubfigureDef), tempTemplateEntity); //szv#4:S4163:12Mar99 `st=` not needed
55 PR.ReadReal(PR.Current(), "Distance between successive Template",
56 tempDistance); //szv#4:S4163:12Mar99 `st=` not needed
58 PR.ReadReal(PR.Current(), "Scale Factor For Subfigure", tempScale); //szv#4:S4163:12Mar99 `st=` not needed
60 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
61 ent->Init (tempOrientation, tempTemplateEntity, tempDistance, tempScale);
64 void IGESGraph_ToolLineFontDefTemplate::WriteOwnParams
65 (const Handle(IGESGraph_LineFontDefTemplate)& ent, IGESData_IGESWriter& IW) const
67 IW.Send(ent->Orientation());
68 IW.Send(ent->TemplateEntity());
69 IW.Send(ent->Distance());
70 IW.Send(ent->Scale());
73 void IGESGraph_ToolLineFontDefTemplate::OwnShared
74 (const Handle(IGESGraph_LineFontDefTemplate)& ent, Interface_EntityIterator& iter) const
76 iter.GetOneItem(ent->TemplateEntity());
79 void IGESGraph_ToolLineFontDefTemplate::OwnCopy
80 (const Handle(IGESGraph_LineFontDefTemplate)& another,
81 const Handle(IGESGraph_LineFontDefTemplate)& ent, Interface_CopyTool& TC) const
83 Standard_Integer tempOrientation = another->Orientation();
84 DeclareAndCast(IGESBasic_SubfigureDef, tempTemplateSubfigure,
85 TC.Transferred(another->TemplateEntity()));
86 Standard_Real tempDistance = another->Distance();
87 Standard_Real tempScale = another->Scale();
89 ent->Init(tempOrientation, tempTemplateSubfigure, tempDistance, tempScale);
92 IGESData_DirChecker IGESGraph_ToolLineFontDefTemplate::DirChecker
93 (const Handle(IGESGraph_LineFontDefTemplate)& /*ent*/) const
95 IGESData_DirChecker DC(304, 1);
96 DC.Structure(IGESData_DefVoid);
97 DC.LineFont(IGESData_DefValue);
98 DC.LineWeight(IGESData_DefVoid);
99 DC.Color(IGESData_DefVoid);
100 DC.BlankStatusIgnored();
101 DC.SubordinateStatusRequired(0);
102 DC.UseFlagRequired(2);
103 DC.HierarchyStatusIgnored();
108 void IGESGraph_ToolLineFontDefTemplate::OwnCheck
109 (const Handle(IGESGraph_LineFontDefTemplate)& ent,
110 const Interface_ShareTool& , Handle(Interface_Check)& ach) const
112 if (ent->RankLineFont() == 0)
113 ach->AddWarning("Line Font Rank is zero");
114 else if ((ent->RankLineFont() < 1) || (ent->RankLineFont() > 5))
115 ach->AddWarning("Invalid Value As Line Font Rank");
118 void IGESGraph_ToolLineFontDefTemplate::OwnDump
119 (const Handle(IGESGraph_LineFontDefTemplate)& ent, const IGESData_IGESDumper& dumper,
120 const Handle(Message_Messenger)& S, const Standard_Integer level) const
122 Standard_Integer tempSubLevel = (level <= 4) ? 0 : 1;
124 S << "IGESGraph_LineFontDefTemplate" << endl;
126 S << "Orientation : " << ent->Orientation() << endl;
127 S << "Subfigure Display Entity For Template Display : ";
128 dumper.Dump(ent->TemplateEntity(),S, tempSubLevel);
130 S << "Length Between Successive Template Figure : " << ent->Distance()<<endl;
131 S << "Scale Factor for Subfigure : " << ent->Scale() << endl;