summaryrefslogtreecommitdiff
path: root/src/IGESAppli/IGESAppli_ToolLineWidening.cxx
blob: 5dfb732b2d98da844bcc27cac49256394521ec7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
//--------------------------------------------------------------------
//
//  File Name : IGESAppli_LineWidening.cxx
//  Date      :
//  Author    : CKY / Contract Toubro-Larsen
//  Copyright : MATRA-DATAVISION 1993
//
//--------------------------------------------------------------------

#include <IGESAppli_ToolLineWidening.ixx>
#include <IGESData_ParamCursor.hxx>
#include <IGESData_LevelListEntity.hxx>


IGESAppli_ToolLineWidening::IGESAppli_ToolLineWidening ()    {  }


void  IGESAppli_ToolLineWidening::ReadOwnParams
  (const Handle(IGESAppli_LineWidening)& ent,
   const Handle(IGESData_IGESReaderData)& /*IR*/, IGESData_ParamReader& PR) const
{
  Standard_Integer tempNbPropertyValues;
  Standard_Real tempWidth;
  Standard_Integer tempCorneringCode;
  Standard_Integer tempExtensionFlag;
  Standard_Integer tempJustificationFlag;
  Standard_Real tempExtensionValue = 0.0;
  //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed

  //szv#4:S4163:12Mar99 `st=` not needed
  PR.ReadInteger(PR.Current(),"No. of Property values",tempNbPropertyValues);
  PR.ReadReal(PR.Current(),"Width of metalization",tempWidth);
  PR.ReadInteger(PR.Current(),"Cornering code",tempCorneringCode);
  PR.ReadInteger(PR.Current(),"Extension Flag",tempExtensionFlag);
  PR.ReadInteger(PR.Current(),"Justification Flag",tempJustificationFlag);
  if (PR.IsParamDefined(PR.CurrentNumber()))
    PR.ReadReal(PR.Current(),"Extension value",tempExtensionValue);
  else if (tempExtensionFlag == 2)
    PR.AddFail("Extension Value not defined while Extension Flag = 2");

  DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
  ent->Init(tempNbPropertyValues,tempWidth,tempCorneringCode,tempExtensionFlag,
	    tempJustificationFlag,tempExtensionValue);
}

void  IGESAppli_ToolLineWidening::WriteOwnParams
  (const Handle(IGESAppli_LineWidening)& ent, IGESData_IGESWriter& IW) const
{
  IW.Send(ent->NbPropertyValues());
  IW.Send(ent->WidthOfMetalization());
  IW.Send(ent->CorneringCode());
  IW.Send(ent->ExtensionFlag());
  IW.Send(ent->JustificationFlag());
  IW.Send(ent->ExtensionValue());
}

void  IGESAppli_ToolLineWidening::OwnShared
  (const Handle(IGESAppli_LineWidening)& /*ent*/, Interface_EntityIterator& /*iter*/) const
{
}

void  IGESAppli_ToolLineWidening::OwnCopy
  (const Handle(IGESAppli_LineWidening)& another,
   const Handle(IGESAppli_LineWidening)& ent, Interface_CopyTool& /*TC*/) const
{
  ent->Init
    (5,another->WidthOfMetalization(),another->CorneringCode(),
     another->ExtensionFlag(),another->JustificationFlag(),
     another->ExtensionValue());
}

Standard_Boolean  IGESAppli_ToolLineWidening::OwnCorrect
  (const Handle(IGESAppli_LineWidening)& ent) const
{
  Standard_Boolean res = (ent->NbPropertyValues() != 5);
  if (res) ent->Init
    (5,ent->WidthOfMetalization(),ent->CorneringCode(),ent->ExtensionFlag(),
     ent->JustificationFlag(),ent->ExtensionValue());
  if (ent->SubordinateStatus() != 0) {
    Handle(IGESData_LevelListEntity) nulevel;
    ent->InitLevel(nulevel,0);
    res = Standard_True;
  }
  return res;    // nbpropertyvalues = 5 + RAZ level selon subordinate
}

IGESData_DirChecker  IGESAppli_ToolLineWidening::DirChecker
  (const Handle(IGESAppli_LineWidening)& /*ent*/ ) const
{
  IGESData_DirChecker DC(406,5);  //Form no = 5 & Type = 406
  DC.Structure(IGESData_DefVoid);
  DC.GraphicsIgnored();
  DC.BlankStatusIgnored();
  DC.UseFlagIgnored();
  DC.HierarchyStatusIgnored();
  return DC;
}

void  IGESAppli_ToolLineWidening::OwnCheck
  (const Handle(IGESAppli_LineWidening)& ent,
   const Interface_ShareTool& , Handle(Interface_Check)& ach) const
{
  if (ent->SubordinateStatus() != 0)
    if (ent->DefLevel() == IGESData_DefOne ||
	ent->DefLevel() == IGESData_DefSeveral)
      ach->AddWarning("Level type: defined while ignored");
  if (ent->NbPropertyValues() != 5)
    ach->AddFail("Number of Property Values != 5");
  if (ent->CorneringCode() != 0 && ent->CorneringCode() != 1)
    ach->AddFail("Cornering Code incorrect");
  if (ent->ExtensionFlag() < 0 || ent->ExtensionFlag() > 2)
    ach->AddFail("Extension Flag value incorrect");
  if (ent->JustificationFlag() < 0 || ent->JustificationFlag() > 2)
    ach->AddFail("Justification Flag value incorrect");
}

void  IGESAppli_ToolLineWidening::OwnDump
  (const Handle(IGESAppli_LineWidening)& ent, const IGESData_IGESDumper& /*dumper*/,
   const Handle(Message_Messenger)& S, const Standard_Integer /*level*/) const
{
  S << "IGESAppli_LineWidening" << endl;

  S << "Number of property values : " << ent->NbPropertyValues()     << endl;
  S << "Width of metalization : " << ent->WidthOfMetalization()      << endl;
  S << "Cornering Code : " ;
  if      (ent->CorneringCode() == 0) S << "0 (rounded)" << endl;
  else if (ent->CorneringCode() == 1) S << "1 (squared)" << endl;
  else                                S << "incorrect value" << endl;

  S << "Extension Flag : " ;
  if      (ent->ExtensionFlag() == 0) S << "0 (No Extension)" << endl;
  else if (ent->ExtensionFlag() == 1) S << "1 (One-half width extension)" << endl;
  else if (ent->ExtensionFlag() == 2) S << "2 (Extension set by ExtensionValue)" << endl;
  else    S << "incorrect value" << endl;

  S << "Justification Flag : " ;
  if (ent->JustificationFlag() == 0)
    S << "0 (Centre justified)" << endl;
  else if (ent->JustificationFlag() == 1)
    S << "1 (left justified)" << endl;
  else if (ent->JustificationFlag() == 2)
    S << "2 (right justified)" << endl;
  else
    S << "incorrect value" << endl;

  if (ent->ExtensionFlag() == 2)
    S << "Extension Value : " << ent->ExtensionValue()  << endl;
  else
    S << "No Extension Value (Extension Flag != 2)" << endl;
}