summaryrefslogtreecommitdiff
path: root/src/RWStepGeom/RWStepGeom_RWSurfacePatch.cxx
blob: e10f264d7f5901aa784b38c4cf7c827c470df6d4 (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

#include <RWStepGeom_RWSurfacePatch.ixx>
#include <StepGeom_BoundedSurface.hxx>
#include <StepGeom_TransitionCode.hxx>


#include <Interface_EntityIterator.hxx>


#include <StepGeom_SurfacePatch.hxx>

#include <TCollection_AsciiString.hxx>

#include <TCollection_AsciiString.hxx>


// --- Enum : TransitionCode ---
static TCollection_AsciiString tcDiscontinuous(".DISCONTINUOUS.");
static TCollection_AsciiString tcContSameGradientSameCurvature(".CONT_SAME_GRADIENT_SAME_CURVATURE.");
static TCollection_AsciiString tcContSameGradient(".CONT_SAME_GRADIENT.");
static TCollection_AsciiString tcContinuous(".CONTINUOUS.");

RWStepGeom_RWSurfacePatch::RWStepGeom_RWSurfacePatch () {}

void RWStepGeom_RWSurfacePatch::ReadStep
(const Handle(StepData_StepReaderData)& data,
 const Standard_Integer num,
 Handle(Interface_Check)& ach,
 const Handle(StepGeom_SurfacePatch)& ent) const
{
  
  
  // --- Number of Parameter Control ---
  
  if (!data->CheckNbParams(num,5,ach,"surface_patch")) return;
  
  // --- own field : parentSurface ---
  
  Handle(StepGeom_BoundedSurface) aParentSurface;
  //szv#4:S4163:12Mar99 `Standard_Boolean stat1 =` not needed
  data->ReadEntity(num, 1,"parent_surface", ach, STANDARD_TYPE(StepGeom_BoundedSurface), aParentSurface);
  
  // --- own field : uTransition ---
  
  StepGeom_TransitionCode aUTransition = StepGeom_tcDiscontinuous;
  if (data->ParamType(num,2) == Interface_ParamEnum) {
    Standard_CString text = data->ParamCValue(num,2);
    if      (tcDiscontinuous.IsEqual(text)) aUTransition = StepGeom_tcDiscontinuous;
    else if (tcContSameGradientSameCurvature.IsEqual(text)) aUTransition = StepGeom_tcContSameGradientSameCurvature;
    else if (tcContSameGradient.IsEqual(text)) aUTransition = StepGeom_tcContSameGradient;
    else if (tcContinuous.IsEqual(text)) aUTransition = StepGeom_tcContinuous;
    else ach->AddFail("Enumeration transition_code has not an allowed value");
  }
  else ach->AddFail("Parameter #2 (u_transition) is not an enumeration");
  
  // --- own field : vTransition ---
  
  StepGeom_TransitionCode aVTransition = StepGeom_tcDiscontinuous;
  if (data->ParamType(num,3) == Interface_ParamEnum) {
    Standard_CString text = data->ParamCValue(num,3);
    if      (tcDiscontinuous.IsEqual(text)) aVTransition = StepGeom_tcDiscontinuous;
    else if (tcContSameGradientSameCurvature.IsEqual(text)) aVTransition = StepGeom_tcContSameGradientSameCurvature;
    else if (tcContSameGradient.IsEqual(text)) aVTransition = StepGeom_tcContSameGradient;
    else if (tcContinuous.IsEqual(text)) aVTransition = StepGeom_tcContinuous;
    else ach->AddFail("Enumeration transition_code has not an allowed value");
  }
  else ach->AddFail("Parameter #3 (v_transition) is not an enumeration");
  
  // --- own field : uSense ---
  
  Standard_Boolean aUSense;
  //szv#4:S4163:12Mar99 `Standard_Boolean stat4 =` not needed
  data->ReadBoolean (num,4,"u_sense",ach,aUSense);
  
  // --- own field : vSense ---
  
  Standard_Boolean aVSense;
  //szv#4:S4163:12Mar99 `Standard_Boolean stat5 =` not needed
  data->ReadBoolean (num,5,"v_sense",ach,aVSense);
  
  //--- Initialisation of the read entity ---
  
  
  ent->Init(aParentSurface, aUTransition, aVTransition, aUSense, aVSense);
}


void RWStepGeom_RWSurfacePatch::WriteStep
(StepData_StepWriter& SW,
 const Handle(StepGeom_SurfacePatch)& ent) const
{
  
  // --- own field : parentSurface ---
  
  SW.Send(ent->ParentSurface());
  
  // --- own field : uTransition ---
  
  switch(ent->UTransition()) {
  case StepGeom_tcDiscontinuous : SW.SendEnum (tcDiscontinuous); break;
			   case StepGeom_tcContSameGradientSameCurvature : SW.SendEnum (tcContSameGradientSameCurvature); break;
			   case StepGeom_tcContSameGradient : SW.SendEnum (tcContSameGradient); break;
			   case StepGeom_tcContinuous : SW.SendEnum (tcContinuous); break;
			   }
  
	// --- own field : vTransition ---

	switch(ent->VTransition()) {
	  case StepGeom_tcDiscontinuous : SW.SendEnum (tcDiscontinuous); break;
	  case StepGeom_tcContSameGradientSameCurvature : SW.SendEnum (tcContSameGradientSameCurvature); break;
	  case StepGeom_tcContSameGradient : SW.SendEnum (tcContSameGradient); break;
	  case StepGeom_tcContinuous : SW.SendEnum (tcContinuous); break;
	}

	// --- own field : uSense ---

	SW.SendBoolean(ent->USense());

	// --- own field : vSense ---

	SW.SendBoolean(ent->VSense());
}


void RWStepGeom_RWSurfacePatch::Share(const Handle(StepGeom_SurfacePatch)& ent, Interface_EntityIterator& iter) const
{

	iter.GetOneItem(ent->ParentSurface());
}