summaryrefslogtreecommitdiff
path: root/src/RWStepVisual/RWStepVisual_RWViewVolume.cxx
blob: 8ce66ac4987298127520903ebe596812de11ba03 (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

#include <RWStepVisual_RWViewVolume.ixx>
#include <StepVisual_CentralOrParallel.hxx>
#include <StepGeom_CartesianPoint.hxx>
#include <StepVisual_PlanarBox.hxx>


#include <Interface_EntityIterator.hxx>


#include <StepVisual_ViewVolume.hxx>

#include <TCollection_AsciiString.hxx>


	// --- Enum : CentralOrParallel ---
static TCollection_AsciiString copCentral(".CENTRAL.");
static TCollection_AsciiString copParallel(".PARALLEL.");

RWStepVisual_RWViewVolume::RWStepVisual_RWViewVolume () {}

void RWStepVisual_RWViewVolume::ReadStep
	(const Handle(StepData_StepReaderData)& data,
	 const Standard_Integer num,
	 Handle(Interface_Check)& ach,
	 const Handle(StepVisual_ViewVolume)& ent) const
{


	// --- Number of Parameter Control ---

	if (!data->CheckNbParams(num,9,ach,"view_volume")) return;

	// --- own field : projectionType ---

	StepVisual_CentralOrParallel aProjectionType = StepVisual_copCentral;
	if (data->ParamType(num,1) == Interface_ParamEnum) {
	  Standard_CString text = data->ParamCValue(num,1);
	  if      (copCentral.IsEqual(text)) aProjectionType = StepVisual_copCentral;
	  else if (copParallel.IsEqual(text)) aProjectionType = StepVisual_copParallel;
	  else ach->AddFail("Enumeration central_or_parallel has not an allowed value");
	}
	else ach->AddFail("Parameter #1 (projection_type) is not an enumeration");

	// --- own field : projectionPoint ---

	Handle(StepGeom_CartesianPoint) aProjectionPoint;
	//szv#4:S4163:12Mar99 `Standard_Boolean stat2 =` not needed
	data->ReadEntity(num, 2,"projection_point", ach, STANDARD_TYPE(StepGeom_CartesianPoint), aProjectionPoint);

	// --- own field : viewPlaneDistance ---

	Standard_Real aViewPlaneDistance;
	//szv#4:S4163:12Mar99 `Standard_Boolean stat3 =` not needed
	data->ReadReal (num,3,"view_plane_distance",ach,aViewPlaneDistance);

	// --- own field : frontPlaneDistance ---

	Standard_Real aFrontPlaneDistance;
	//szv#4:S4163:12Mar99 `Standard_Boolean stat4 =` not needed
	data->ReadReal (num,4,"front_plane_distance",ach,aFrontPlaneDistance);

	// --- own field : frontPlaneClipping ---

	Standard_Boolean aFrontPlaneClipping;
	//szv#4:S4163:12Mar99 `Standard_Boolean stat5 =` not needed
	data->ReadBoolean (num,5,"front_plane_clipping",ach,aFrontPlaneClipping);

	// --- own field : backPlaneDistance ---

	Standard_Real aBackPlaneDistance;
	//szv#4:S4163:12Mar99 `Standard_Boolean stat6 =` not needed
	data->ReadReal (num,6,"back_plane_distance",ach,aBackPlaneDistance);

	// --- own field : backPlaneClipping ---

	Standard_Boolean aBackPlaneClipping;
	//szv#4:S4163:12Mar99 `Standard_Boolean stat7 =` not needed
	data->ReadBoolean (num,7,"back_plane_clipping",ach,aBackPlaneClipping);

	// --- own field : viewVolumeSidesClipping ---

	Standard_Boolean aViewVolumeSidesClipping;
	//szv#4:S4163:12Mar99 `Standard_Boolean stat8 =` not needed
	data->ReadBoolean (num,8,"view_volume_sides_clipping",ach,aViewVolumeSidesClipping);

	// --- own field : viewWindow ---

	Handle(StepVisual_PlanarBox) aViewWindow;
	//szv#4:S4163:12Mar99 `Standard_Boolean stat9 =` not needed
	data->ReadEntity(num, 9,"view_window", ach, STANDARD_TYPE(StepVisual_PlanarBox), aViewWindow);

	//--- Initialisation of the read entity ---


	ent->Init(aProjectionType, aProjectionPoint, aViewPlaneDistance, aFrontPlaneDistance, aFrontPlaneClipping, aBackPlaneDistance, aBackPlaneClipping, aViewVolumeSidesClipping, aViewWindow);
}


void RWStepVisual_RWViewVolume::WriteStep
	(StepData_StepWriter& SW,
	 const Handle(StepVisual_ViewVolume)& ent) const
{

	// --- own field : projectionType ---

	switch(ent->ProjectionType()) {
	  case StepVisual_copCentral : SW.SendEnum (copCentral); break;
	  case StepVisual_copParallel : SW.SendEnum (copParallel); break;
	}

	// --- own field : projectionPoint ---

	SW.Send(ent->ProjectionPoint());

	// --- own field : viewPlaneDistance ---

	SW.Send(ent->ViewPlaneDistance());

	// --- own field : frontPlaneDistance ---

	SW.Send(ent->FrontPlaneDistance());

	// --- own field : frontPlaneClipping ---

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

	// --- own field : backPlaneDistance ---

	SW.Send(ent->BackPlaneDistance());

	// --- own field : backPlaneClipping ---

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

	// --- own field : viewVolumeSidesClipping ---

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

	// --- own field : viewWindow ---

	SW.Send(ent->ViewWindow());
}


void RWStepVisual_RWViewVolume::Share(const Handle(StepVisual_ViewVolume)& ent, Interface_EntityIterator& iter) const
{

	iter.GetOneItem(ent->ProjectionPoint());


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