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