7fd59977 |
1 | |
2 | #include <RWStepVisual_RWViewVolume.ixx> |
3 | #include <StepVisual_CentralOrParallel.hxx> |
4 | #include <StepGeom_CartesianPoint.hxx> |
5 | #include <StepVisual_PlanarBox.hxx> |
6 | |
7 | |
8 | #include <Interface_EntityIterator.hxx> |
9 | |
10 | |
11 | #include <StepVisual_ViewVolume.hxx> |
12 | |
13 | #include <TCollection_AsciiString.hxx> |
14 | |
15 | |
16 | // --- Enum : CentralOrParallel --- |
17 | static TCollection_AsciiString copCentral(".CENTRAL."); |
18 | static TCollection_AsciiString copParallel(".PARALLEL."); |
19 | |
20 | RWStepVisual_RWViewVolume::RWStepVisual_RWViewVolume () {} |
21 | |
22 | void RWStepVisual_RWViewVolume::ReadStep |
23 | (const Handle(StepData_StepReaderData)& data, |
24 | const Standard_Integer num, |
25 | Handle(Interface_Check)& ach, |
26 | const Handle(StepVisual_ViewVolume)& ent) const |
27 | { |
28 | |
29 | |
30 | // --- Number of Parameter Control --- |
31 | |
32 | if (!data->CheckNbParams(num,9,ach,"view_volume")) return; |
33 | |
34 | // --- own field : projectionType --- |
35 | |
36 | StepVisual_CentralOrParallel aProjectionType = StepVisual_copCentral; |
37 | if (data->ParamType(num,1) == Interface_ParamEnum) { |
38 | Standard_CString text = data->ParamCValue(num,1); |
39 | if (copCentral.IsEqual(text)) aProjectionType = StepVisual_copCentral; |
40 | else if (copParallel.IsEqual(text)) aProjectionType = StepVisual_copParallel; |
41 | else ach->AddFail("Enumeration central_or_parallel has not an allowed value"); |
42 | } |
43 | else ach->AddFail("Parameter #1 (projection_type) is not an enumeration"); |
44 | |
45 | // --- own field : projectionPoint --- |
46 | |
47 | Handle(StepGeom_CartesianPoint) aProjectionPoint; |
48 | //szv#4:S4163:12Mar99 `Standard_Boolean stat2 =` not needed |
49 | data->ReadEntity(num, 2,"projection_point", ach, STANDARD_TYPE(StepGeom_CartesianPoint), aProjectionPoint); |
50 | |
51 | // --- own field : viewPlaneDistance --- |
52 | |
53 | Standard_Real aViewPlaneDistance; |
54 | //szv#4:S4163:12Mar99 `Standard_Boolean stat3 =` not needed |
55 | data->ReadReal (num,3,"view_plane_distance",ach,aViewPlaneDistance); |
56 | |
57 | // --- own field : frontPlaneDistance --- |
58 | |
59 | Standard_Real aFrontPlaneDistance; |
60 | //szv#4:S4163:12Mar99 `Standard_Boolean stat4 =` not needed |
61 | data->ReadReal (num,4,"front_plane_distance",ach,aFrontPlaneDistance); |
62 | |
63 | // --- own field : frontPlaneClipping --- |
64 | |
65 | Standard_Boolean aFrontPlaneClipping; |
66 | //szv#4:S4163:12Mar99 `Standard_Boolean stat5 =` not needed |
67 | data->ReadBoolean (num,5,"front_plane_clipping",ach,aFrontPlaneClipping); |
68 | |
69 | // --- own field : backPlaneDistance --- |
70 | |
71 | Standard_Real aBackPlaneDistance; |
72 | //szv#4:S4163:12Mar99 `Standard_Boolean stat6 =` not needed |
73 | data->ReadReal (num,6,"back_plane_distance",ach,aBackPlaneDistance); |
74 | |
75 | // --- own field : backPlaneClipping --- |
76 | |
77 | Standard_Boolean aBackPlaneClipping; |
78 | //szv#4:S4163:12Mar99 `Standard_Boolean stat7 =` not needed |
79 | data->ReadBoolean (num,7,"back_plane_clipping",ach,aBackPlaneClipping); |
80 | |
81 | // --- own field : viewVolumeSidesClipping --- |
82 | |
83 | Standard_Boolean aViewVolumeSidesClipping; |
84 | //szv#4:S4163:12Mar99 `Standard_Boolean stat8 =` not needed |
85 | data->ReadBoolean (num,8,"view_volume_sides_clipping",ach,aViewVolumeSidesClipping); |
86 | |
87 | // --- own field : viewWindow --- |
88 | |
89 | Handle(StepVisual_PlanarBox) aViewWindow; |
90 | //szv#4:S4163:12Mar99 `Standard_Boolean stat9 =` not needed |
91 | data->ReadEntity(num, 9,"view_window", ach, STANDARD_TYPE(StepVisual_PlanarBox), aViewWindow); |
92 | |
93 | //--- Initialisation of the read entity --- |
94 | |
95 | |
96 | ent->Init(aProjectionType, aProjectionPoint, aViewPlaneDistance, aFrontPlaneDistance, aFrontPlaneClipping, aBackPlaneDistance, aBackPlaneClipping, aViewVolumeSidesClipping, aViewWindow); |
97 | } |
98 | |
99 | |
100 | void RWStepVisual_RWViewVolume::WriteStep |
101 | (StepData_StepWriter& SW, |
102 | const Handle(StepVisual_ViewVolume)& ent) const |
103 | { |
104 | |
105 | // --- own field : projectionType --- |
106 | |
107 | switch(ent->ProjectionType()) { |
108 | case StepVisual_copCentral : SW.SendEnum (copCentral); break; |
109 | case StepVisual_copParallel : SW.SendEnum (copParallel); break; |
110 | } |
111 | |
112 | // --- own field : projectionPoint --- |
113 | |
114 | SW.Send(ent->ProjectionPoint()); |
115 | |
116 | // --- own field : viewPlaneDistance --- |
117 | |
118 | SW.Send(ent->ViewPlaneDistance()); |
119 | |
120 | // --- own field : frontPlaneDistance --- |
121 | |
122 | SW.Send(ent->FrontPlaneDistance()); |
123 | |
124 | // --- own field : frontPlaneClipping --- |
125 | |
126 | SW.SendBoolean(ent->FrontPlaneClipping()); |
127 | |
128 | // --- own field : backPlaneDistance --- |
129 | |
130 | SW.Send(ent->BackPlaneDistance()); |
131 | |
132 | // --- own field : backPlaneClipping --- |
133 | |
134 | SW.SendBoolean(ent->BackPlaneClipping()); |
135 | |
136 | // --- own field : viewVolumeSidesClipping --- |
137 | |
138 | SW.SendBoolean(ent->ViewVolumeSidesClipping()); |
139 | |
140 | // --- own field : viewWindow --- |
141 | |
142 | SW.Send(ent->ViewWindow()); |
143 | } |
144 | |
145 | |
146 | void RWStepVisual_RWViewVolume::Share(const Handle(StepVisual_ViewVolume)& ent, Interface_EntityIterator& iter) const |
147 | { |
148 | |
149 | iter.GetOneItem(ent->ProjectionPoint()); |
150 | |
151 | |
152 | iter.GetOneItem(ent->ViewWindow()); |
153 | } |
154 | |