summaryrefslogtreecommitdiff
path: root/src/IGESAppli/IGESAppli_ToolNode.cxx
blob: 77a78d76aed8e643cac2eede4b483d828eb9ba9c (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
//--------------------------------------------------------------------
//
//  File Name : IGESAppli_Node.cxx
//  Date      :
//  Author    : CKY / Contract Toubro-Larsen
//  Copyright : MATRA-DATAVISION 1993
//
//--------------------------------------------------------------------

#include <IGESAppli_ToolNode.ixx>
#include <IGESData_ParamCursor.hxx>
#include <IGESGeom_TransformationMatrix.hxx>
#include <gp_XYZ.hxx>
#include <gp_Pnt.hxx>
#include <Interface_Macros.hxx>
#include <Message_Messenger.hxx>

IGESAppli_ToolNode::IGESAppli_ToolNode ()    {  }


void  IGESAppli_ToolNode::ReadOwnParams
  (const Handle(IGESAppli_Node)& ent,
   const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const
{
  gp_XYZ tempCoordinates;
  Handle(IGESGeom_TransformationMatrix) tempSystem;
  //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed

  //szv#4:S4163:12Mar99 `st=` not needed
  PR.ReadXYZ(PR.CurrentList(1, 3),"Coordinates of Node (XYZ)",tempCoordinates);

  if (PR.DefinedElseSkip())
    PR.ReadEntity(IR,PR.Current(),"Transformation Matrix",
		  STANDARD_TYPE(IGESGeom_TransformationMatrix), tempSystem,Standard_True);

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

void  IGESAppli_ToolNode::WriteOwnParams
  (const Handle(IGESAppli_Node)& ent, IGESData_IGESWriter& IW) const
{
  IW.Send(ent->Coord().X());
  IW.Send(ent->Coord().Y());
  IW.Send(ent->Coord().Z());
  IW.Send(ent->System());
}

void  IGESAppli_ToolNode::OwnShared
  (const Handle(IGESAppli_Node)& ent, Interface_EntityIterator& iter) const
{
  iter.GetOneItem(ent->System());
}

void  IGESAppli_ToolNode::OwnCopy
  (const Handle(IGESAppli_Node)& another,
   const Handle(IGESAppli_Node)& ent, Interface_CopyTool& TC) const
{
  gp_XYZ aCoord = (another->Coord()).XYZ();
  DeclareAndCast(IGESGeom_TransformationMatrix,aSystem,
		 TC.Transferred(another->System()));

  ent->Init(aCoord,aSystem);
}

IGESData_DirChecker  IGESAppli_ToolNode::DirChecker
  (const Handle(IGESAppli_Node)& /*ent*/ ) const
{
  IGESData_DirChecker DC(134,0);  //Form no = 0 & Type = 134
  DC.Structure(IGESData_DefVoid);
  DC.LineFont(IGESData_DefVoid);
  DC.LineWeight(IGESData_DefVoid);
  DC.Color(IGESData_DefAny);
  DC.UseFlagRequired(04);
  return DC;
}

void  IGESAppli_ToolNode::OwnCheck
  (const Handle(IGESAppli_Node)& ent,
   const Interface_ShareTool& , Handle(Interface_Check)& ach) const
{
  if (!ent->HasSubScriptNumber())
    ach->AddFail("SubScript Number expected (for Node Number) not present");
  if (!ent->HasTransf())
    ach->AddFail("Transformation Matrix expected, not present");
  if (!ent->System().IsNull())
    if (ent->System()->FormNumber() < 10)
      ach->AddFail("System : Incorrect FormNumber (not 10-11-12)");
}

void  IGESAppli_ToolNode::OwnDump
  (const Handle(IGESAppli_Node)& ent, const IGESData_IGESDumper& dumper,
   const Handle(Message_Messenger)& S, const Standard_Integer level) const
{
  S << "IGESAppli_Node" << endl;
  S << " Nodal Coords : 1st " << ent->Coord().X()
    << "  2nd : " << ent->Coord().Y() << "  3rd : " << ent->Coord().Z() <<endl;
  S << "Nodal Displacement Coordinate System : ";
  if (!ent->System().IsNull())
    dumper.Dump(ent->System(),S, level);
  else
    S << "Global Cartesian Coordinate System (default)";
  S << endl;
}