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