summaryrefslogtreecommitdiff
path: root/src/IGESDimen/IGESDimen_ToolSectionedArea.cxx
blob: db035fd9d4bb2c9916e07db388706c4e98e443f0 (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
152
153
154
155
156
157
//--------------------------------------------------------------------
//
//  File Name : IGESDimen_SectionedArea.cxx
//  Date      :
//  Author    : CKY / Contract Toubro-Larsen
//  Copyright : MATRA-DATAVISION 1993
//
//--------------------------------------------------------------------

#include <IGESDimen_ToolSectionedArea.ixx>
#include <IGESData_ParamCursor.hxx>
#include <gp_XYZ.hxx>
#include <gp_Pnt.hxx>
#include <IGESData_IGESEntity.hxx>
#include <IGESData_HArray1OfIGESEntity.hxx>
#include <IGESData_Dump.hxx>
#include <Interface_Macros.hxx>


IGESDimen_ToolSectionedArea::IGESDimen_ToolSectionedArea ()    {  }


void IGESDimen_ToolSectionedArea::ReadOwnParams
  (const Handle(IGESDimen_SectionedArea)& ent,
   const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const
{
  Handle(IGESData_IGESEntity) extCurve;
  Standard_Integer tempPattern, nbislands;
  gp_XYZ passPnt;
  Standard_Real tempDistance, tempAngle;
  Handle(IGESData_HArray1OfIGESEntity) tempIslands;
  Handle(IGESData_IGESEntity) anent;
  //Standard_Boolean st; //szv#4:S4163:12Mar99 moved down

  //szv#4:S4163:12Mar99 `st=` not needed
  PR.ReadEntity(IR, PR.Current(), "Exterior curve", extCurve, (ent->FormNumber() == 1));
  PR.ReadInteger(PR.Current(), "Fill pattern", tempPattern);
  PR.ReadXYZ(PR.CurrentList(1, 3), "Passing point", passPnt);
  PR.ReadReal(PR.Current(), "Distance between lines", tempDistance);

  if (PR.DefinedElseSkip())
    PR.ReadReal(PR.Current(), "Angle between line and X axis", tempAngle); //szv#4:S4163:12Mar99 `st=` not needed
  else
    tempAngle = PI / 4.0;

  Standard_Boolean st = PR.ReadInteger(PR.Current(), "Number of island curves", nbislands);
  if (st && nbislands > 0)
    PR.ReadEnts (IR,PR.CurrentList(nbislands),"Island curves",tempIslands); //szv#4:S4163:12Mar99 `st=` not needed
/*
    {
      tempIslands = new IGESData_HArray1OfIGESEntity(1, nbislands);
      for (Standard_Integer i=1; i<=nbislands; i++)
	{
          st = PR.ReadEntity(IR, PR.Current(), "Island curves", anent);
	  if (st) tempIslands->SetValue(i, anent);
	}
    }
*/

  DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
  ent->Init
    (extCurve, tempPattern, passPnt, tempDistance, tempAngle, tempIslands);
}

void IGESDimen_ToolSectionedArea::WriteOwnParams
  (const Handle(IGESDimen_SectionedArea)& ent, IGESData_IGESWriter& IW) const
{
  Standard_Integer i, length = ent->NbIslands();
  IW.Send(ent->ExteriorCurve());
  IW.Send(ent->Pattern());
  IW.Send(ent->PassingPoint().X());
  IW.Send(ent->PassingPoint().Y());
  IW.Send(ent->PassingPoint().Z());
  IW.Send(ent->Distance());
  IW.Send(ent->Angle());
  IW.Send(length);
  for (i = 1; i <= length; i ++)
    IW.Send(ent->IslandCurve(i));
}

void  IGESDimen_ToolSectionedArea::OwnShared
  (const Handle(IGESDimen_SectionedArea)& ent, Interface_EntityIterator& iter) const
{
  Standard_Integer i, length = ent->NbIslands();
  iter.GetOneItem(ent->ExteriorCurve());
  for (i = 1; i <= length; i ++)
    iter.GetOneItem(ent->IslandCurve(i));
}

void IGESDimen_ToolSectionedArea::OwnCopy
  (const Handle(IGESDimen_SectionedArea)& another,
   const Handle(IGESDimen_SectionedArea)& ent, Interface_CopyTool& TC) const
{
  DeclareAndCast(IGESData_IGESEntity, extCurve,
		 TC.Transferred(another->ExteriorCurve()));
  Standard_Integer tempPattern = another->Pattern();
  gp_XYZ passPnt = (another->PassingPoint()).XYZ();
  Standard_Real tempDistance = another->Distance();
  Standard_Real tempAngle = another->Angle();
  Handle(IGESData_HArray1OfIGESEntity) tempIslands;
  Standard_Integer nbislands = another->NbIslands();
  if (nbislands > 0)
    {
      tempIslands = new IGESData_HArray1OfIGESEntity(1, nbislands);
      for (Standard_Integer i=1; i<=nbislands; i++)
	{
          DeclareAndCast(IGESData_IGESEntity, anent,
			 TC.Transferred(another->IslandCurve(i)));
          tempIslands->SetValue(i, anent);
	}
    }
  ent->Init(extCurve, tempPattern, passPnt,
	    tempDistance, tempAngle, tempIslands);
  ent->SetInverted (another->IsInverted());
}

IGESData_DirChecker IGESDimen_ToolSectionedArea::DirChecker
  (const Handle(IGESDimen_SectionedArea)& /* ent */ ) const
{
  IGESData_DirChecker DC(230, 0,1);
  DC.Structure(IGESData_DefVoid);
  DC.LineFont(IGESData_DefAny);
  DC.LineWeight(IGESData_DefValue);
  DC.Color(IGESData_DefAny);

  DC.UseFlagRequired (1);

  return DC;
}

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

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

  S << "IGESDimen_SectionedArea" << endl;
  S << (ent->IsInverted() ? "Inverted Cross Hatches" : "Standard Cross Hatches");

  S << " - Exterior curve : ";
  dumper.Dump(ent->ExteriorCurve(),S, sublevel);
  S << endl;
  S << "Fill pattern code : " << ent->Pattern() << endl;
  S << "Passing point : ";
  IGESData_DumpXYZL(S,level, ent->PassingPoint(), ent->Location());  S << endl;
  S << "Distance between lines : " << ent->Distance() << endl;
  S << "Angle between lines and X axis : " << ent->Angle() << endl;
  S << "Island Curve : ";
  IGESData_DumpEntities(S,dumper ,level,1, ent->NbIslands(),ent->IslandCurve);
  S << endl;
}