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