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