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 | // |
973c2be1 |
7 | // This library is free software; you can redistribute it and / or modify it |
8 | // under the terms of the GNU Lesser General Public 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. |
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 | |
19 | #include <IGESAppli_ToolLineWidening.ixx> |
20 | #include <IGESData_ParamCursor.hxx> |
21 | #include <IGESData_LevelListEntity.hxx> |
22 | |
23 | |
24 | IGESAppli_ToolLineWidening::IGESAppli_ToolLineWidening () { } |
25 | |
26 | |
27 | void IGESAppli_ToolLineWidening::ReadOwnParams |
28 | (const Handle(IGESAppli_LineWidening)& ent, |
29 | const Handle(IGESData_IGESReaderData)& /*IR*/, IGESData_ParamReader& PR) const |
30 | { |
31 | Standard_Integer tempNbPropertyValues; |
32 | Standard_Real tempWidth; |
33 | Standard_Integer tempCorneringCode; |
34 | Standard_Integer tempExtensionFlag; |
35 | Standard_Integer tempJustificationFlag; |
1d47d8d0 |
36 | Standard_Real tempExtensionValue = 0.; |
7fd59977 |
37 | //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed |
38 | |
39 | //szv#4:S4163:12Mar99 `st=` not needed |
40 | PR.ReadInteger(PR.Current(),"No. of Property values",tempNbPropertyValues); |
41 | PR.ReadReal(PR.Current(),"Width of metalization",tempWidth); |
42 | PR.ReadInteger(PR.Current(),"Cornering code",tempCorneringCode); |
43 | PR.ReadInteger(PR.Current(),"Extension Flag",tempExtensionFlag); |
44 | PR.ReadInteger(PR.Current(),"Justification Flag",tempJustificationFlag); |
45 | if (PR.IsParamDefined(PR.CurrentNumber())) |
46 | PR.ReadReal(PR.Current(),"Extension value",tempExtensionValue); |
47 | else if (tempExtensionFlag == 2) |
48 | PR.AddFail("Extension Value not defined while Extension Flag = 2"); |
49 | |
50 | DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent); |
51 | ent->Init(tempNbPropertyValues,tempWidth,tempCorneringCode,tempExtensionFlag, |
52 | tempJustificationFlag,tempExtensionValue); |
53 | } |
54 | |
55 | void IGESAppli_ToolLineWidening::WriteOwnParams |
56 | (const Handle(IGESAppli_LineWidening)& ent, IGESData_IGESWriter& IW) const |
57 | { |
58 | IW.Send(ent->NbPropertyValues()); |
59 | IW.Send(ent->WidthOfMetalization()); |
60 | IW.Send(ent->CorneringCode()); |
61 | IW.Send(ent->ExtensionFlag()); |
62 | IW.Send(ent->JustificationFlag()); |
63 | IW.Send(ent->ExtensionValue()); |
64 | } |
65 | |
66 | void IGESAppli_ToolLineWidening::OwnShared |
67 | (const Handle(IGESAppli_LineWidening)& /*ent*/, Interface_EntityIterator& /*iter*/) const |
68 | { |
69 | } |
70 | |
71 | void IGESAppli_ToolLineWidening::OwnCopy |
72 | (const Handle(IGESAppli_LineWidening)& another, |
73 | const Handle(IGESAppli_LineWidening)& ent, Interface_CopyTool& /*TC*/) const |
74 | { |
75 | ent->Init |
76 | (5,another->WidthOfMetalization(),another->CorneringCode(), |
77 | another->ExtensionFlag(),another->JustificationFlag(), |
78 | another->ExtensionValue()); |
79 | } |
80 | |
81 | Standard_Boolean IGESAppli_ToolLineWidening::OwnCorrect |
82 | (const Handle(IGESAppli_LineWidening)& ent) const |
83 | { |
84 | Standard_Boolean res = (ent->NbPropertyValues() != 5); |
85 | if (res) ent->Init |
86 | (5,ent->WidthOfMetalization(),ent->CorneringCode(),ent->ExtensionFlag(), |
87 | ent->JustificationFlag(),ent->ExtensionValue()); |
88 | if (ent->SubordinateStatus() != 0) { |
89 | Handle(IGESData_LevelListEntity) nulevel; |
90 | ent->InitLevel(nulevel,0); |
91 | res = Standard_True; |
92 | } |
93 | return res; // nbpropertyvalues = 5 + RAZ level selon subordinate |
94 | } |
95 | |
96 | IGESData_DirChecker IGESAppli_ToolLineWidening::DirChecker |
97 | (const Handle(IGESAppli_LineWidening)& /*ent*/ ) const |
98 | { |
99 | IGESData_DirChecker DC(406,5); //Form no = 5 & Type = 406 |
100 | DC.Structure(IGESData_DefVoid); |
101 | DC.GraphicsIgnored(); |
102 | DC.BlankStatusIgnored(); |
103 | DC.UseFlagIgnored(); |
104 | DC.HierarchyStatusIgnored(); |
105 | return DC; |
106 | } |
107 | |
108 | void IGESAppli_ToolLineWidening::OwnCheck |
109 | (const Handle(IGESAppli_LineWidening)& ent, |
110 | const Interface_ShareTool& , Handle(Interface_Check)& ach) const |
111 | { |
112 | if (ent->SubordinateStatus() != 0) |
113 | if (ent->DefLevel() == IGESData_DefOne || |
114 | ent->DefLevel() == IGESData_DefSeveral) |
115 | ach->AddWarning("Level type: defined while ignored"); |
116 | if (ent->NbPropertyValues() != 5) |
117 | ach->AddFail("Number of Property Values != 5"); |
118 | if (ent->CorneringCode() != 0 && ent->CorneringCode() != 1) |
119 | ach->AddFail("Cornering Code incorrect"); |
120 | if (ent->ExtensionFlag() < 0 || ent->ExtensionFlag() > 2) |
121 | ach->AddFail("Extension Flag value incorrect"); |
122 | if (ent->JustificationFlag() < 0 || ent->JustificationFlag() > 2) |
123 | ach->AddFail("Justification Flag value incorrect"); |
124 | } |
125 | |
126 | void IGESAppli_ToolLineWidening::OwnDump |
127 | (const Handle(IGESAppli_LineWidening)& ent, const IGESData_IGESDumper& /*dumper*/, |
128 | const Handle(Message_Messenger)& S, const Standard_Integer /*level*/) const |
129 | { |
130 | S << "IGESAppli_LineWidening" << endl; |
131 | |
132 | S << "Number of property values : " << ent->NbPropertyValues() << endl; |
133 | S << "Width of metalization : " << ent->WidthOfMetalization() << endl; |
134 | S << "Cornering Code : " ; |
135 | if (ent->CorneringCode() == 0) S << "0 (rounded)" << endl; |
136 | else if (ent->CorneringCode() == 1) S << "1 (squared)" << endl; |
137 | else S << "incorrect value" << endl; |
138 | |
139 | S << "Extension Flag : " ; |
140 | if (ent->ExtensionFlag() == 0) S << "0 (No Extension)" << endl; |
141 | else if (ent->ExtensionFlag() == 1) S << "1 (One-half width extension)" << endl; |
142 | else if (ent->ExtensionFlag() == 2) S << "2 (Extension set by ExtensionValue)" << endl; |
143 | else S << "incorrect value" << endl; |
144 | |
145 | S << "Justification Flag : " ; |
146 | if (ent->JustificationFlag() == 0) |
147 | S << "0 (Centre justified)" << endl; |
148 | else if (ent->JustificationFlag() == 1) |
149 | S << "1 (left justified)" << endl; |
150 | else if (ent->JustificationFlag() == 2) |
151 | S << "2 (right justified)" << endl; |
152 | else |
153 | S << "incorrect value" << endl; |
154 | |
155 | if (ent->ExtensionFlag() == 2) |
156 | S << "Extension Value : " << ent->ExtensionValue() << endl; |
157 | else |
158 | S << "No Extension Value (Extension Flag != 2)" << endl; |
159 | } |
160 | |