summaryrefslogtreecommitdiff
path: root/src/IGESDimen/IGESDimen_ToolDimensionUnits.cxx
blob: bf95cf6cb28e2770561d771af66bb2b28e622b19 (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
//--------------------------------------------------------------------
//
//  File Name : IGESDimen_DimensionUnits.cxx
//  Date      :
//  Author    : CKY / Contract Toubro-Larsen
//  Copyright : MATRA-DATAVISION 1993
//
//--------------------------------------------------------------------

#include <IGESDimen_ToolDimensionUnits.ixx>
#include <IGESData_ParamCursor.hxx>
#include <TCollection_HAsciiString.hxx>
#include <Interface_Macros.hxx>
#include <IGESData_Dump.hxx>


IGESDimen_ToolDimensionUnits::IGESDimen_ToolDimensionUnits ()    {  }


void  IGESDimen_ToolDimensionUnits::ReadOwnParams
  (const Handle(IGESDimen_DimensionUnits)& ent,
   const Handle(IGESData_IGESReaderData)& /* IR */, IGESData_ParamReader& PR) const
{
  //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
  Standard_Integer tempNbProps;
  Standard_Integer tempSecondDimenPos;
  Standard_Integer tempUnitsIndic;
  Standard_Integer tempCharSet;
  Standard_Integer tempFracFlag;
  Standard_Integer tempPrecision;
  Handle(TCollection_HAsciiString) tempFormatString;

  if (PR.DefinedElseSkip())
    PR.ReadInteger(PR.Current(), "Number of Properties", tempNbProps); //szv#4:S4163:12Mar99 `st=` not needed
  else
    tempNbProps = 6;

  PR.ReadInteger(PR.Current(), "Secondary Dimension Position",
		 tempSecondDimenPos); //szv#4:S4163:12Mar99 `st=` not needed
  PR.ReadInteger(PR.Current(), "Units Indicator", tempUnitsIndic); //szv#4:S4163:12Mar99 `st=` not needed
  if (PR.DefinedElseSkip())
    PR.ReadInteger(PR.Current(), "Character Set", tempCharSet); //szv#4:S4163:12Mar99 `st=` not needed
  else
    tempCharSet = 1;

  PR.ReadText(PR.Current(), "Format String", tempFormatString); //szv#4:S4163:12Mar99 `st=` not needed
  PR.ReadInteger(PR.Current(), "Fraction Flag", tempFracFlag); //szv#4:S4163:12Mar99 `st=` not needed
  PR.ReadInteger(PR.Current(), "Precision", tempPrecision); //szv#4:S4163:12Mar99 `st=` not needed

  DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
  ent->Init
    (tempNbProps, tempSecondDimenPos, tempUnitsIndic, tempCharSet,
     tempFormatString, tempFracFlag, tempPrecision);
}

void  IGESDimen_ToolDimensionUnits::WriteOwnParams
  (const Handle(IGESDimen_DimensionUnits)& ent, IGESData_IGESWriter& IW) const
{
  IW.Send(ent->NbPropertyValues());
  IW.Send(ent->SecondaryDimenPosition());
  IW.Send(ent->UnitsIndicator());
  IW.Send(ent->CharacterSet());
  IW.Send(ent->FormatString());
  IW.Send(ent->FractionFlag());
  IW.Send(ent->PrecisionOrDenominator());
}

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

void  IGESDimen_ToolDimensionUnits::OwnCopy
  (const Handle(IGESDimen_DimensionUnits)& another,
   const Handle(IGESDimen_DimensionUnits)& ent, Interface_CopyTool& /* TC */) const
{
  Standard_Integer tempNbProps        = another->NbPropertyValues();
  Standard_Integer tempSecondDimenPos = another->SecondaryDimenPosition();
  Standard_Integer tempUnitsIndic     = another->UnitsIndicator();
  Standard_Integer tempCharSet        = another->CharacterSet();
  Handle(TCollection_HAsciiString) tempFormatString =
    new TCollection_HAsciiString(another->FormatString());
  Standard_Integer tempFracFlag       = another->FractionFlag();
  Standard_Integer tempPrecision      = another->PrecisionOrDenominator();
  ent->Init (tempNbProps, tempSecondDimenPos, tempUnitsIndic, tempCharSet,
	     tempFormatString, tempFracFlag, tempPrecision);
}

Standard_Boolean  IGESDimen_ToolDimensionUnits::OwnCorrect
  (const Handle(IGESDimen_DimensionUnits)& ent) const
{
  Standard_Boolean res = (ent->NbPropertyValues() != 6);
  if (res) ent->Init
    (6,ent->SecondaryDimenPosition(),ent->UnitsIndicator(),ent->CharacterSet(),
     ent->FormatString(),ent->FractionFlag(),ent->PrecisionOrDenominator());
  return res;    // nbpropertyvalues = 6
}

IGESData_DirChecker  IGESDimen_ToolDimensionUnits::DirChecker
  (const Handle(IGESDimen_DimensionUnits)& /* ent */) const
{
  IGESData_DirChecker DC(406, 28);
  DC.Structure(IGESData_DefVoid);
  DC.GraphicsIgnored();
  DC.LineFont(IGESData_DefVoid);
  DC.LineWeight(IGESData_DefVoid);
  DC.Color(IGESData_DefVoid);
  DC.BlankStatusIgnored();
  DC.SubordinateStatusRequired(2);
  DC.UseFlagRequired(2);
  DC.HierarchyStatusIgnored();
  return DC;
}

void  IGESDimen_ToolDimensionUnits::OwnCheck
  (const Handle(IGESDimen_DimensionUnits)& ent,
   const Interface_ShareTool& , Handle(Interface_Check)& ach) const
{
  if (ent->NbPropertyValues() != 6)
    ach->AddFail("Number of properties != 6");
  if (ent->SecondaryDimenPosition() < 0 || ent->SecondaryDimenPosition() > 4)
    ach->AddFail("Secondary Dimension Position != 0-4");
  if ( (ent->CharacterSet() != 1) &&
      ((ent->CharacterSet() < 1001) || (ent->CharacterSet() > 1003)) )
    ach->AddFail("Character Set != 1,1001-1003");
  if ((ent->FractionFlag() != 0) && (ent->FractionFlag() != 1))
    ach->AddFail("Fraction Flag != 0,1");
}

void  IGESDimen_ToolDimensionUnits::OwnDump
  (const Handle(IGESDimen_DimensionUnits)& ent, const IGESData_IGESDumper& /* dumper */,
   const Handle(Message_Messenger)& S, const Standard_Integer /* level */) const
{
  S << "IGESDimen_DimensionUnits" << endl;
  S << "Number of property values : " << ent->NbPropertyValues() << endl;
  S << "Secondary Dimension Position : " << ent->SecondaryDimenPosition() << endl;
  S << "Units Indicator : " << ent->UnitsIndicator() << endl;
  S << "Character Set   : " << ent->CharacterSet() << endl;
  S << "Format String   : ";
  IGESData_DumpString(S,ent->FormatString());
  S << endl;
  S << "Fraction Flag   : " << ent->FractionFlag();
  if (ent->FractionFlag() == 0) S << " Decimal  , Precision   : ";
  else                          S << " Fraction , Denominator : ";
  S << ent->PrecisionOrDenominator() << endl;
}