summaryrefslogtreecommitdiff
path: root/src/IGESGeom/IGESGeom_ToolDirection.cxx
blob: 1f3d4ad1f64af14ccb58d5eb49a45fa25540a4d3 (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
//--------------------------------------------------------------------
//
//  File Name : IGESGeom_Direction.cxx
//  Date      :
//  Author    : CKY / Contract Toubro-Larsen
//  Copyright : MATRA-DATAVISION 1993
//
//--------------------------------------------------------------------

#include <IGESGeom_ToolDirection.ixx>
#include <IGESData_ParamCursor.hxx>
#include <gp_XY.hxx>
#include <gp_XYZ.hxx>
#include <gp_Vec.hxx>
#include <IGESData_Dump.hxx>
#include <Interface_Macros.hxx>


IGESGeom_ToolDirection::IGESGeom_ToolDirection ()    {  }


void IGESGeom_ToolDirection::ReadOwnParams
  (const Handle(IGESGeom_Direction)& ent,
   const Handle(IGESData_IGESReaderData)& /* IR */, IGESData_ParamReader& PR) const
{
  gp_XYZ aDirection;
  gp_XY  tmpXY;
  //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
  Standard_Real tmpReal;

  //st = PR.ReadXY(PR.CurrentList(1, 2), "Direction", tmpXY); //szv#4:S4163:12Mar99 moved in if
  if (PR.ReadXY(PR.CurrentList(1, 2), "Direction", tmpXY)) {
    aDirection.SetX(tmpXY.X());
    aDirection.SetY(tmpXY.Y());
  }

  if (PR.DefinedElseSkip())
    {
      //st = PR.ReadReal(PR.Current(), "Direction", tmpReal); //szv#4:S4163:12Mar99 moved in if
      if (PR.ReadReal(PR.Current(), "Direction", tmpReal))
	aDirection.SetZ(tmpReal);
    }
  else
    {
      aDirection.SetZ(0.0);   // Default value.
    }

  DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
  ent->Init(aDirection);
}

void IGESGeom_ToolDirection::WriteOwnParams
  (const Handle(IGESGeom_Direction)& ent, IGESData_IGESWriter& IW)  const
{
  IW.Send(ent->Value().X());
  IW.Send(ent->Value().Y());
  IW.Send(ent->Value().Z());
}

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

void IGESGeom_ToolDirection::OwnCopy
  (const Handle(IGESGeom_Direction)& another,
   const Handle(IGESGeom_Direction)& ent, Interface_CopyTool& /* TC */) const
{
  ent->Init(another->Value().XYZ());
}

IGESData_DirChecker IGESGeom_ToolDirection::DirChecker
  (const Handle(IGESGeom_Direction)& /* ent */ )  const
{
  IGESData_DirChecker DC(123, 0);
  DC.Structure(IGESData_DefVoid);
  DC.LineFont(IGESData_DefAny);
//  DC.LineWeight(IGESData_DefValue);
  DC.Color(IGESData_DefAny);

  DC.BlankStatusIgnored ();
  DC.SubordinateStatusRequired (1);
  DC.UseFlagRequired (2);
  DC.HierarchyStatusIgnored ();
  return DC;
}

void IGESGeom_ToolDirection::OwnCheck
  (const Handle(IGESGeom_Direction)& ent,
   const Interface_ShareTool& , Handle(Interface_Check)& ach)  const
{
  if (ent->Value().XYZ().SquareModulus() <= 0.0)
    ach->AddFail("Direction : The values indicate no direction");
}

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

  S << "Value : ";
  IGESData_DumpXYZL(S,level, ent->Value(), ent->VectorLocation());
  S << endl;
}