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_Hierarchy.hxx>
20 #include <IGESBasic_ToolHierarchy.hxx>
21 #include <IGESData_DirChecker.hxx>
22 #include <IGESData_IGESDumper.hxx>
23 #include <IGESData_IGESReaderData.hxx>
24 #include <IGESData_IGESWriter.hxx>
25 #include <IGESData_ParamReader.hxx>
26 #include <Interface_Check.hxx>
27 #include <Interface_CopyTool.hxx>
28 #include <Interface_EntityIterator.hxx>
29 #include <Interface_ShareTool.hxx>
31 IGESBasic_ToolHierarchy::IGESBasic_ToolHierarchy () { }
34 void IGESBasic_ToolHierarchy::ReadOwnParams
35 (const Handle(IGESBasic_Hierarchy)& ent,
36 const Handle(IGESData_IGESReaderData)& /*IR*/, IGESData_ParamReader& PR) const
38 Standard_Integer tempNbPropertyValues;
39 Standard_Integer tempLineFont;
40 Standard_Integer tempView;
41 Standard_Integer tempEntityLevel;
42 Standard_Integer tempBlankStatus;
43 Standard_Integer tempLineWeight;
44 Standard_Integer tempColorNum;
45 //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
47 //szv#4:S4163:12Mar99 `st=` not needed
48 PR.ReadInteger(PR.Current(),"No. of Property values",tempNbPropertyValues);
49 PR.ReadInteger(PR.Current(),"LineFont",tempLineFont);
50 PR.ReadInteger(PR.Current(),"View",tempView);
51 PR.ReadInteger(PR.Current(),"Entity level",tempEntityLevel);
52 PR.ReadInteger(PR.Current(),"Blank status",tempBlankStatus);
53 PR.ReadInteger(PR.Current(),"Line weight",tempLineWeight);
54 PR.ReadInteger(PR.Current(),"Color number",tempColorNum);
56 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
57 ent->Init(tempNbPropertyValues,tempLineFont,tempView,tempEntityLevel,
58 tempBlankStatus,tempLineWeight,tempColorNum);
61 void IGESBasic_ToolHierarchy::WriteOwnParams
62 (const Handle(IGESBasic_Hierarchy)& ent, IGESData_IGESWriter& IW) const
64 IW.Send(ent->NbPropertyValues());
65 IW.Send(ent->NewLineFont());
66 IW.Send(ent->NewView());
67 IW.Send(ent->NewEntityLevel());
68 IW.Send(ent->NewBlankStatus());
69 IW.Send(ent->NewLineWeight());
70 IW.Send(ent->NewColorNum());
73 void IGESBasic_ToolHierarchy::OwnShared
74 (const Handle(IGESBasic_Hierarchy)& /*ent*/, Interface_EntityIterator& /*iter*/) const
78 void IGESBasic_ToolHierarchy::OwnCopy
79 (const Handle(IGESBasic_Hierarchy)& another,
80 const Handle(IGESBasic_Hierarchy)& ent, Interface_CopyTool& /*TC*/) const
82 ent->Init(6,another->NewLineFont(), another->NewView(),
83 another->NewEntityLevel(),another->NewBlankStatus(),
84 another->NewLineWeight(), another->NewColorNum());
87 Standard_Boolean IGESBasic_ToolHierarchy::OwnCorrect
88 (const Handle(IGESBasic_Hierarchy)& ent) const
90 Standard_Boolean res = (ent->NbPropertyValues() != 6);
92 (6,ent->NewLineFont(),ent->NewView(),ent->NewEntityLevel(),
93 ent->NewBlankStatus(),ent->NewLineWeight(),ent->NewColorNum());
94 return res; // nbpropertyvalues=6
97 IGESData_DirChecker IGESBasic_ToolHierarchy::DirChecker
98 (const Handle(IGESBasic_Hierarchy)& /*ent*/) const
100 IGESData_DirChecker DC(406,10); //Form no = 10 & Type = 406
101 DC.Structure(IGESData_DefVoid);
102 DC.GraphicsIgnored();
103 DC.BlankStatusIgnored();
105 DC.HierarchyStatusIgnored();
109 void IGESBasic_ToolHierarchy::OwnCheck
110 (const Handle(IGESBasic_Hierarchy)& ent,
111 const Interface_ShareTool& , Handle(Interface_Check)& ach) const
113 if (ent->NbPropertyValues() != 6)
114 ach->AddFail("Number of Property Values != 6");
115 if (ent->NewLineFont() != 0 && ent->NewLineFont() != 1)
116 ach->AddFail("InCorrect LineFont");
117 if (ent->NewView() != 0 && ent->NewView() != 1)
118 ach->AddFail("InCorrect View");
119 if (ent->NewEntityLevel() != 0 && ent->NewEntityLevel() != 1)
120 ach->AddFail("InCorrect EntityLevel");
121 if (ent->NewBlankStatus() != 0 && ent->NewBlankStatus() != 1)
122 if (ent->NewLineWeight() != 0 && ent->NewLineWeight() != 1)
123 ach->AddFail("InCorrect LineWeight");
124 if (ent->NewColorNum() != 0 && ent->NewColorNum() != 1)
125 ach->AddFail("InCorrect ColorNum");
128 void IGESBasic_ToolHierarchy::OwnDump
129 (const Handle(IGESBasic_Hierarchy)& ent, const IGESData_IGESDumper& /*dumper*/,
130 Standard_OStream& S, const Standard_Integer /*level*/) const
132 S << "IGESBasic_Hierarchy\n"
133 << "Number of property values : " << ent->NbPropertyValues() << "\n"
134 << "Line Font : " << ent->NewLineFont() << "\n"
135 << "View Number : " << ent->NewView() << "\n"
136 << "Entity level : " << ent->NewEntityLevel() << "\n"
137 << "Blank status : " << ent->NewBlankStatus() << "\n"
138 << "Line weight : " << ent->NewLineWeight() << "\n"
139 << "Color number : " << ent->NewColorNum() << std::endl;