summaryrefslogtreecommitdiff
path: root/src/IGESSolid/IGESSolid_ToolPlaneSurface.cxx
blob: 8872c64f33d6ba6b7cb01ceb2f22554bc95696f2 (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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
//--------------------------------------------------------------------
//
//  File Name : IGESSolid_PlaneSurface.cxx
//  Date      :
//  Author    : CKY / Contract Toubro-Larsen
//  Copyright : MATRA-DATAVISION 1993
//
//--------------------------------------------------------------------

#include <IGESSolid_ToolPlaneSurface.ixx>
#include <IGESData_ParamCursor.hxx>
#include <IGESGeom_Point.hxx>
#include <IGESGeom_Direction.hxx>
#include <Interface_Macros.hxx>


// MGE 31/07/98
#include <Message_Msg.hxx>
#include <IGESData_Status.hxx>

//=======================================================================
//function : IGESSolid_ToolPlaneSurface
//purpose  : 
//=======================================================================

IGESSolid_ToolPlaneSurface::IGESSolid_ToolPlaneSurface ()
{
}


//=======================================================================
//function : ReadOwnParams
//purpose  : 
//=======================================================================

void IGESSolid_ToolPlaneSurface::ReadOwnParams(const Handle(IGESSolid_PlaneSurface)& ent,
                                               const Handle(IGESData_IGESReaderData)& IR,
                                               IGESData_ParamReader& PR) const
{
  Handle(IGESGeom_Point) tempLocation;
  Handle(IGESGeom_Direction) tempNormal;
  Handle(IGESGeom_Direction) tempRefdir;          // default Unparametrised
  IGESData_Status aStatus;
  //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed

  if (!PR.ReadEntity(IR, PR.Current(),aStatus,STANDARD_TYPE(IGESGeom_Point), tempLocation)){ //szv#4:S4163:12Mar99 `st=` not needed
    Message_Msg Msg174("XSTEP_174");
    switch(aStatus) {
    case IGESData_ReferenceError: {  
      Message_Msg Msg216 ("IGES_216");
      Msg174.Arg(Msg216.Value());
      PR.SendFail(Msg174);
      break; }
    case IGESData_EntityError: {
      Message_Msg Msg217 ("IGES_217");
      Msg174.Arg(Msg217.Value());
      PR.SendFail(Msg174);
      break; }
    case IGESData_TypeError: {
      Message_Msg Msg218 ("IGES_218");
      Msg174.Arg(Msg218.Value());
      PR.SendFail(Msg174);
      break; }
    default:{
    }
    }
  }
/*
  st = PR.ReadEntity(IR, PR.Current(), "Point on axis",
		     STANDARD_TYPE(IGESGeom_Point), tempLocation);
*/
  if (!PR.ReadEntity(IR, PR.Current(),aStatus,STANDARD_TYPE(IGESGeom_Direction), tempNormal)){ //szv#4:S4163:12Mar99 `st=` not needed
    Message_Msg Msg175("XSTEP_175");
    switch(aStatus) {
    case IGESData_ReferenceError: {  
      Message_Msg Msg216 ("IGES_216");
      Msg175.Arg(Msg216.Value());
      PR.SendFail(Msg175);
      break; }
    case IGESData_EntityError: {
      Message_Msg Msg217 ("IGES_217");
      Msg175.Arg(Msg217.Value());
      PR.SendFail(Msg175);
      break; }
    case IGESData_TypeError: {
      Message_Msg Msg218 ("IGES_218");
      Msg175.Arg(Msg218.Value());
      PR.SendFail(Msg175);
      break; }
    default:{
    }
    }
}
/*
  st = PR.ReadEntity(IR, PR.Current(), "Normal direction",
		     STANDARD_TYPE(IGESGeom_Direction), tempNormal);
*/
  if (ent->FormNumber() == 1){
      // Parametrised surface
    if (!PR.ReadEntity(IR, PR.Current(), aStatus, STANDARD_TYPE(IGESGeom_Direction), tempRefdir)){ //szv#4:S4163:12Mar99 `st=` not needed
      Message_Msg Msg176("XSTEP_176");
      switch(aStatus) {
      case IGESData_ReferenceError: {  
	Message_Msg Msg216 ("IGES_216");
	Msg176.Arg(Msg216.Value());
	PR.SendFail(Msg176);
	break; }
      case IGESData_EntityError: {
	Message_Msg Msg217 ("IGES_217");
	Msg176.Arg(Msg217.Value());
	PR.SendFail(Msg176);
	break; }
      case IGESData_TypeError: {
	Message_Msg Msg218 ("IGES_218");
	Msg176.Arg(Msg218.Value());
	PR.SendFail(Msg176);
	break; }
      default:{
      }
      }
    }
  }
/*
    st = PR.ReadEntity(IR, PR.Current(), "Reference direction",
		       STANDARD_TYPE(IGESGeom_Direction), tempRefdir);
*/
  DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
  ent->Init (tempLocation, tempNormal, tempRefdir);
}


//=======================================================================
//function : WriteOwnParams
//purpose  : 
//=======================================================================

void IGESSolid_ToolPlaneSurface::WriteOwnParams
  (const Handle(IGESSolid_PlaneSurface)& ent, IGESData_IGESWriter& IW) const
{
  IW.Send(ent->LocationPoint());
  IW.Send(ent->Normal());
  if (ent->IsParametrised())    IW.Send(ent->ReferenceDir());
}


//=======================================================================
//function : OwnShared
//purpose  : 
//=======================================================================

void IGESSolid_ToolPlaneSurface::OwnShared(const Handle(IGESSolid_PlaneSurface)& ent,
                                           Interface_EntityIterator& iter) const
{
  iter.GetOneItem(ent->LocationPoint());
  iter.GetOneItem(ent->Normal());
  iter.GetOneItem(ent->ReferenceDir());
}


//=======================================================================
//function : OwnCopy
//purpose  : 
//=======================================================================

void IGESSolid_ToolPlaneSurface::OwnCopy
  (const Handle(IGESSolid_PlaneSurface)& another,
   const Handle(IGESSolid_PlaneSurface)& ent, Interface_CopyTool& TC) const
{
  DeclareAndCast(IGESGeom_Point, tempLocation,
		 TC.Transferred(another->LocationPoint()));
  DeclareAndCast(IGESGeom_Direction, tempNormal,
		 TC.Transferred(another->Normal()));
  if (another->IsParametrised())
    {
      DeclareAndCast(IGESGeom_Direction, tempRefdir,
		     TC.Transferred(another->ReferenceDir()));
      ent->Init (tempLocation, tempNormal, tempRefdir);
    }
  else
    {
      Handle(IGESGeom_Direction) tempRefdir;
      ent->Init (tempLocation, tempNormal, tempRefdir);
    }
}


//=======================================================================
//function : DirChecker
//purpose  : 
//=======================================================================

IGESData_DirChecker IGESSolid_ToolPlaneSurface::DirChecker
  (const Handle(IGESSolid_PlaneSurface)& /*ent*/) const
{
  IGESData_DirChecker DC(190, 0, 1);

  DC.Structure  (IGESData_DefVoid);
  DC.LineFont   (IGESData_DefAny);
  DC.Color      (IGESData_DefAny);

  DC.BlankStatusIgnored ();
  DC.HierarchyStatusIgnored ();
  return DC;
}


//=======================================================================
//function : OwnCheck
//purpose  : 
//=======================================================================

void IGESSolid_ToolPlaneSurface::OwnCheck(const Handle(IGESSolid_PlaneSurface)& ent,
                                          const Interface_ShareTool&,
                                          Handle(Interface_Check)& ach) const
{

  // MGE 31/07/98
  // Building of messages
  //========================================
  //Message_Msg Msg177("XSTEP_177");
  //========================================

  Standard_Integer fn = 0;
  if (ent->IsParametrised()) fn = 1;
  if (fn != ent->FormNumber()) {
    Message_Msg Msg177("XSTEP_177");
    ach->SendFail (Msg177);
  }
}


//=======================================================================
//function : OwnDump
//purpose  : 
//=======================================================================

void IGESSolid_ToolPlaneSurface::OwnDump(const Handle(IGESSolid_PlaneSurface)& ent,
                                         const IGESData_IGESDumper& dumper,
                                         const Handle(Message_Messenger)& S,
                                         const Standard_Integer level) const
{
  S << "IGESSolid_PlaneSurface" << endl;

  Standard_Integer sublevel = (level <= 4) ? 0 : 1;
  S << "Point on axis    : ";
  dumper.Dump(ent->LocationPoint(),S, sublevel);
  S << endl;
  S << "Normal direction : ";
  dumper.Dump(ent->Normal(),S, sublevel);
  S << endl;
  if (ent->IsParametrised())
    {
      S << "Surface is Parametrised  -  Reference direction : ";
      dumper.Dump(ent->ReferenceDir(),S, sublevel);
      S << endl;
    }
  else S << "Surface is UnParametrised" << endl;
}