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

#include <IGESDimen_ToolFlagNote.ixx>
#include <IGESData_ParamCursor.hxx>
#include <gp_XYZ.hxx>
#include <IGESDimen_LeaderArrow.hxx>
#include <IGESDimen_GeneralNote.hxx>
#include <IGESDimen_HArray1OfLeaderArrow.hxx>
#include <IGESData_Dump.hxx>
#include <Interface_Macros.hxx>


IGESDimen_ToolFlagNote::IGESDimen_ToolFlagNote ()    {  }


void  IGESDimen_ToolFlagNote::ReadOwnParams
  (const Handle(IGESDimen_FlagNote)& ent,
   const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const
{ 
  //Standard_Boolean st; //szv#4:S4163:12Mar99 moved down

  gp_XYZ lowerLeft; 
  Standard_Real angle; 
  Handle(IGESDimen_GeneralNote) note;
  Standard_Integer nbval;
  Handle(IGESDimen_HArray1OfLeaderArrow) leaders;

  PR.ReadXYZ (PR.CurrentList(1, 3), "Lower Left Corner Co-ords", lowerLeft); //szv#4:S4163:12Mar99 `st=` not needed

  PR.ReadReal(PR.Current(), "Rotation Angle", angle); //szv#4:S4163:12Mar99 `st=` not needed

  PR.ReadEntity(IR, PR.Current(), "General Note Entity",
		STANDARD_TYPE(IGESDimen_GeneralNote), note); //szv#4:S4163:12Mar99 `st=` not needed

  Standard_Boolean st = PR.ReadInteger(PR.Current(), "Number of Leaders", nbval);
  if (st && nbval > 0)
    {
      leaders = new IGESDimen_HArray1OfLeaderArrow(1, nbval);

      for (Standard_Integer i = 1; i <= nbval; i++)
	{
	  Handle(IGESDimen_LeaderArrow) anentity;
	  //st = PR.ReadEntity(IR, PR.Current(), "Leaders",
			       //STANDARD_TYPE(IGESDimen_LeaderArrow), anentity); //szv#4:S4163:12Mar99 moved in if
	  if (PR.ReadEntity(IR, PR.Current(), "Leaders", STANDARD_TYPE(IGESDimen_LeaderArrow), anentity))
	    leaders->SetValue(i, anentity);
	}
    }
  else if (nbval < 0)
    PR.AddFail("Number of Leaders: Less than zero");

  DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
  ent->Init(lowerLeft, angle, note, leaders);
}

void  IGESDimen_ToolFlagNote::WriteOwnParams
  (const Handle(IGESDimen_FlagNote)& ent, IGESData_IGESWriter& IW) const 
{ 
  IW.Send(ent->LowerLeftCorner().X());
  IW.Send(ent->LowerLeftCorner().Y());
  IW.Send(ent->LowerLeftCorner().Z());
  IW.Send(ent->Angle());
  IW.Send(ent->Note());
  Standard_Integer upper = ent->NbLeaders();
  IW.Send(upper);
  for (Standard_Integer i = 1; i <= upper; i ++)
    IW.Send(ent->Leader(i));
}

void  IGESDimen_ToolFlagNote::OwnShared
  (const Handle(IGESDimen_FlagNote)& ent, Interface_EntityIterator& iter) const
{
  iter.GetOneItem(ent->Note());
  Standard_Integer upper = ent->NbLeaders();
  for (Standard_Integer i = 1; i <= upper; i ++)
    iter.GetOneItem(ent->Leader(i));
}

void  IGESDimen_ToolFlagNote::OwnCopy
  (const Handle(IGESDimen_FlagNote)& another,
   const Handle(IGESDimen_FlagNote)& ent, Interface_CopyTool& TC) const
{
  gp_XYZ lowerLeft = (another->LowerLeftCorner()).XYZ();
  Standard_Real angle = another->Angle();
  DeclareAndCast(IGESDimen_GeneralNote, note,
		 TC.Transferred(another->Note()));
  Standard_Integer nbval = another->NbLeaders();

  Handle(IGESDimen_HArray1OfLeaderArrow) leaders;

  if ( nbval > 0 )
    {
      leaders = new IGESDimen_HArray1OfLeaderArrow(1, nbval);
      for (Standard_Integer i = 1; i <= nbval; i++)
	{
          DeclareAndCast(IGESDimen_LeaderArrow, new_ent, 
			 TC.Transferred(another->Leader(i)));
          leaders->SetValue(i, new_ent);
	}
    }
  ent->Init(lowerLeft, angle, note, leaders);
}

IGESData_DirChecker  IGESDimen_ToolFlagNote::DirChecker
  (const Handle(IGESDimen_FlagNote)& /* ent */ ) const 
{ 
  IGESData_DirChecker DC (208, 0);
  DC.Structure(IGESData_DefVoid);
  DC.LineFont(IGESData_DefAny);
  DC.LineWeight(IGESData_DefValue);
  DC.Color(IGESData_DefAny);
  DC.UseFlagRequired(1);
  return DC;
}

void  IGESDimen_ToolFlagNote::OwnCheck
  (const Handle(IGESDimen_FlagNote)& /* ent */,
   const Interface_ShareTool& , Handle(Interface_Check)& /* ach */) const 
{
}

void  IGESDimen_ToolFlagNote::OwnDump
  (const Handle(IGESDimen_FlagNote)& ent, const IGESData_IGESDumper& dumper,
   const Handle(Message_Messenger)& S, const Standard_Integer level) const 
{ 
  Standard_Integer sublevel = (level > 4) ? 1 : 0;

  S << "IGESDimen_FlagNote" << endl;
  S << "LowerLeftCorner : ";
  IGESData_DumpXYZL(S,level, ent->LowerLeftCorner(), ent->Location());
  S << endl << "Rotation Angle: " << ent->Angle() << endl;
  S << "General Note Entity : ";
  dumper.Dump(ent->Note(),S, sublevel);
  S << endl;
  S << "Number of Leaders : " << ent->NbLeaders() << "   Leaders : ";
  IGESData_DumpEntities(S,dumper ,level,1, ent->NbLeaders(),ent->Leader);
  S << endl;
}