b311480e |
1 | // Created by: CKY / Contract Toubro-Larsen |
2 | // Copyright (c) 1993-1999 Matra Datavision |
3 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
4 | // |
5 | // The content of this file is subject to the Open CASCADE Technology Public |
6 | // License Version 6.5 (the "License"). You may not use the content of this file |
7 | // except in compliance with the License. Please obtain a copy of the License |
8 | // at http://www.opencascade.org and read it completely before using this file. |
7fd59977 |
9 | // |
b311480e |
10 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
11 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
7fd59977 |
12 | // |
b311480e |
13 | // The Original Code and all software distributed under the License is |
14 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
15 | // Initial Developer hereby disclaims all such warranties, including without |
16 | // limitation, any warranties of merchantability, fitness for a particular |
17 | // purpose or non-infringement. Please see the License for the specific terms |
18 | // and conditions governing the rights and limitations under the License. |
19 | |
20 | //-------------------------------------------------------------------- |
7fd59977 |
21 | //-------------------------------------------------------------------- |
22 | |
23 | #include <IGESAppli_ToolLineWidening.ixx> |
24 | #include <IGESData_ParamCursor.hxx> |
25 | #include <IGESData_LevelListEntity.hxx> |
26 | |
27 | |
28 | IGESAppli_ToolLineWidening::IGESAppli_ToolLineWidening () { } |
29 | |
30 | |
31 | void IGESAppli_ToolLineWidening::ReadOwnParams |
32 | (const Handle(IGESAppli_LineWidening)& ent, |
33 | const Handle(IGESData_IGESReaderData)& /*IR*/, IGESData_ParamReader& PR) const |
34 | { |
35 | Standard_Integer tempNbPropertyValues; |
36 | Standard_Real tempWidth; |
37 | Standard_Integer tempCorneringCode; |
38 | Standard_Integer tempExtensionFlag; |
39 | Standard_Integer tempJustificationFlag; |
1d47d8d0 |
40 | Standard_Real tempExtensionValue = 0.; |
7fd59977 |
41 | //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed |
42 | |
43 | //szv#4:S4163:12Mar99 `st=` not needed |
44 | PR.ReadInteger(PR.Current(),"No. of Property values",tempNbPropertyValues); |
45 | PR.ReadReal(PR.Current(),"Width of metalization",tempWidth); |
46 | PR.ReadInteger(PR.Current(),"Cornering code",tempCorneringCode); |
47 | PR.ReadInteger(PR.Current(),"Extension Flag",tempExtensionFlag); |
48 | PR.ReadInteger(PR.Current(),"Justification Flag",tempJustificationFlag); |
49 | if (PR.IsParamDefined(PR.CurrentNumber())) |
50 | PR.ReadReal(PR.Current(),"Extension value",tempExtensionValue); |
51 | else if (tempExtensionFlag == 2) |
52 | PR.AddFail("Extension Value not defined while Extension Flag = 2"); |
53 | |
54 | DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent); |
55 | ent->Init(tempNbPropertyValues,tempWidth,tempCorneringCode,tempExtensionFlag, |
56 | tempJustificationFlag,tempExtensionValue); |
57 | } |
58 | |
59 | void IGESAppli_ToolLineWidening::WriteOwnParams |
60 | (const Handle(IGESAppli_LineWidening)& ent, IGESData_IGESWriter& IW) const |
61 | { |
62 | IW.Send(ent->NbPropertyValues()); |
63 | IW.Send(ent->WidthOfMetalization()); |
64 | IW.Send(ent->CorneringCode()); |
65 | IW.Send(ent->ExtensionFlag()); |
66 | IW.Send(ent->JustificationFlag()); |
67 | IW.Send(ent->ExtensionValue()); |
68 | } |
69 | |
70 | void IGESAppli_ToolLineWidening::OwnShared |
71 | (const Handle(IGESAppli_LineWidening)& /*ent*/, Interface_EntityIterator& /*iter*/) const |
72 | { |
73 | } |
74 | |
75 | void IGESAppli_ToolLineWidening::OwnCopy |
76 | (const Handle(IGESAppli_LineWidening)& another, |
77 | const Handle(IGESAppli_LineWidening)& ent, Interface_CopyTool& /*TC*/) const |
78 | { |
79 | ent->Init |
80 | (5,another->WidthOfMetalization(),another->CorneringCode(), |
81 | another->ExtensionFlag(),another->JustificationFlag(), |
82 | another->ExtensionValue()); |
83 | } |
84 | |
85 | Standard_Boolean IGESAppli_ToolLineWidening::OwnCorrect |
86 | (const Handle(IGESAppli_LineWidening)& ent) const |
87 | { |
88 | Standard_Boolean res = (ent->NbPropertyValues() != 5); |
89 | if (res) ent->Init |
90 | (5,ent->WidthOfMetalization(),ent->CorneringCode(),ent->ExtensionFlag(), |
91 | ent->JustificationFlag(),ent->ExtensionValue()); |
92 | if (ent->SubordinateStatus() != 0) { |
93 | Handle(IGESData_LevelListEntity) nulevel; |
94 | ent->InitLevel(nulevel,0); |
95 | res = Standard_True; |
96 | } |
97 | return res; // nbpropertyvalues = 5 + RAZ level selon subordinate |
98 | } |
99 | |
100 | IGESData_DirChecker IGESAppli_ToolLineWidening::DirChecker |
101 | (const Handle(IGESAppli_LineWidening)& /*ent*/ ) const |
102 | { |
103 | IGESData_DirChecker DC(406,5); //Form no = 5 & 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 IGESAppli_ToolLineWidening::OwnCheck |
113 | (const Handle(IGESAppli_LineWidening)& ent, |
114 | const Interface_ShareTool& , Handle(Interface_Check)& ach) const |
115 | { |
116 | if (ent->SubordinateStatus() != 0) |
117 | if (ent->DefLevel() == IGESData_DefOne || |
118 | ent->DefLevel() == IGESData_DefSeveral) |
119 | ach->AddWarning("Level type: defined while ignored"); |
120 | if (ent->NbPropertyValues() != 5) |
121 | ach->AddFail("Number of Property Values != 5"); |
122 | if (ent->CorneringCode() != 0 && ent->CorneringCode() != 1) |
123 | ach->AddFail("Cornering Code incorrect"); |
124 | if (ent->ExtensionFlag() < 0 || ent->ExtensionFlag() > 2) |
125 | ach->AddFail("Extension Flag value incorrect"); |
126 | if (ent->JustificationFlag() < 0 || ent->JustificationFlag() > 2) |
127 | ach->AddFail("Justification Flag value incorrect"); |
128 | } |
129 | |
130 | void IGESAppli_ToolLineWidening::OwnDump |
131 | (const Handle(IGESAppli_LineWidening)& ent, const IGESData_IGESDumper& /*dumper*/, |
132 | const Handle(Message_Messenger)& S, const Standard_Integer /*level*/) const |
133 | { |
134 | S << "IGESAppli_LineWidening" << endl; |
135 | |
136 | S << "Number of property values : " << ent->NbPropertyValues() << endl; |
137 | S << "Width of metalization : " << ent->WidthOfMetalization() << endl; |
138 | S << "Cornering Code : " ; |
139 | if (ent->CorneringCode() == 0) S << "0 (rounded)" << endl; |
140 | else if (ent->CorneringCode() == 1) S << "1 (squared)" << endl; |
141 | else S << "incorrect value" << endl; |
142 | |
143 | S << "Extension Flag : " ; |
144 | if (ent->ExtensionFlag() == 0) S << "0 (No Extension)" << endl; |
145 | else if (ent->ExtensionFlag() == 1) S << "1 (One-half width extension)" << endl; |
146 | else if (ent->ExtensionFlag() == 2) S << "2 (Extension set by ExtensionValue)" << endl; |
147 | else S << "incorrect value" << endl; |
148 | |
149 | S << "Justification Flag : " ; |
150 | if (ent->JustificationFlag() == 0) |
151 | S << "0 (Centre justified)" << endl; |
152 | else if (ent->JustificationFlag() == 1) |
153 | S << "1 (left justified)" << endl; |
154 | else if (ent->JustificationFlag() == 2) |
155 | S << "2 (right justified)" << endl; |
156 | else |
157 | S << "incorrect value" << endl; |
158 | |
159 | if (ent->ExtensionFlag() == 2) |
160 | S << "Extension Value : " << ent->ExtensionValue() << endl; |
161 | else |
162 | S << "No Extension Value (Extension Flag != 2)" << endl; |
163 | } |
164 | |