0c63f2f8 |
1 | // Created on: 2016-10-25 |
2 | // Created by: Irina KRYLOVA |
3 | // Copyright (c) 2016 OPEN CASCADE SAS |
4 | // |
5 | // This file is part of Open CASCADE Technology software library. |
6 | // |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
12 | // |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
15 | |
16 | |
17 | #include <Interface_Check.hxx> |
18 | #include <Interface_EntityIterator.hxx> |
19 | #include <RWStepVisual_RWCameraModelD3MultiClipping.hxx> |
20 | #include <StepData_StepReaderData.hxx> |
21 | #include <StepData_StepWriter.hxx> |
22 | #include <StepGeom_Axis2Placement3d.hxx> |
23 | #include <StepVisual_CameraModelD3MultiClipping.hxx> |
24 | #include <StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect.hxx> |
25 | #include <StepVisual_ViewVolume.hxx> |
26 | |
27 | //======================================================================= |
28 | //function : RWStepVisual_RWCameraModelD3MultiClipping |
29 | //purpose : |
30 | //======================================================================= |
31 | RWStepVisual_RWCameraModelD3MultiClipping::RWStepVisual_RWCameraModelD3MultiClipping() {} |
32 | |
33 | //======================================================================= |
34 | //function : ReadStep |
35 | //purpose : |
36 | //======================================================================= |
37 | void RWStepVisual_RWCameraModelD3MultiClipping::ReadStep |
38 | (const Handle(StepData_StepReaderData)& data, |
39 | const Standard_Integer num, |
40 | Handle(Interface_Check)& ach, |
41 | const Handle(StepVisual_CameraModelD3MultiClipping)& ent) const |
42 | { |
43 | // Number of Parameter Control |
44 | if (!data->CheckNbParams(num, 4, ach, "camera_model_d3_multi_clipping")) |
45 | return; |
46 | |
47 | // Inherited field : name |
48 | Handle(TCollection_HAsciiString) aName; |
49 | data->ReadString (num, 1, "name", ach, aName); |
50 | |
51 | //Inherited field : view_reference_system |
52 | Handle(StepGeom_Axis2Placement3d) aViewReferenceSystem; |
53 | data->ReadEntity(num, 2, "view_reference_system", ach, STANDARD_TYPE(StepGeom_Axis2Placement3d), aViewReferenceSystem); |
54 | |
55 | // Inherited field : perspective_of_volume |
56 | Handle(StepVisual_ViewVolume) aPerspectiveOfVolume; |
57 | data->ReadEntity(num, 3, "perspective_of_volume", ach, STANDARD_TYPE(StepVisual_ViewVolume), aPerspectiveOfVolume); |
58 | |
59 | // Own field : shape_clipping |
60 | Handle(StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect) aShapeClipping; |
61 | StepVisual_CameraModelD3MultiClippingInterectionSelect anEnt; |
62 | Standard_Integer nbSub; |
63 | if (data->ReadSubList(num, 4, "shape_clipping", ach, nbSub)) { |
64 | Standard_Integer nbElements = data->NbParams(nbSub); |
65 | aShapeClipping = new StepVisual_HArray1OfCameraModelD3MultiClippingInterectionSelect(1, nbElements); |
66 | for (Standard_Integer i = 1; i <= nbElements; i++) { |
67 | if (data->ReadEntity(nbSub, i, "shape_clipping", ach, anEnt)) |
68 | aShapeClipping->SetValue(i, anEnt); |
69 | } |
70 | } |
71 | |
72 | // Initialization of the read entity |
73 | ent->Init(aName, aViewReferenceSystem, aPerspectiveOfVolume, aShapeClipping); |
74 | } |
75 | |
76 | //======================================================================= |
77 | //function : WriteStep |
78 | //purpose : |
79 | //======================================================================= |
80 | void RWStepVisual_RWCameraModelD3MultiClipping::WriteStep |
81 | (StepData_StepWriter& SW, |
82 | const Handle(StepVisual_CameraModelD3MultiClipping)& ent) const |
83 | { |
84 | // Inherited field name |
85 | SW.Send(ent->Name()); |
86 | |
87 | // Inherited field view_reference_system |
88 | SW.Send(ent->ViewReferenceSystem()); |
89 | |
90 | // Inherited field view_reference_system |
91 | SW.Send(ent->PerspectiveOfVolume()); |
92 | |
93 | // Own field: shape_clipping |
94 | SW.OpenSub(); |
95 | for (Standard_Integer i = 1; i <= ent->ShapeClipping()->Length(); i++) { |
96 | SW.Send(ent->ShapeClipping()->Value(i).Value()); |
97 | } |
98 | SW.CloseSub(); |
99 | } |
100 | |
101 | //======================================================================= |
102 | //function : Share |
103 | //purpose : |
104 | //======================================================================= |
105 | void RWStepVisual_RWCameraModelD3MultiClipping::Share |
106 | (const Handle(StepVisual_CameraModelD3MultiClipping)& ent, |
107 | Interface_EntityIterator& iter) const |
108 | { |
109 | // Inherited field view_reference_system |
110 | iter.GetOneItem(ent->ViewReferenceSystem()); |
111 | // Inherited field : perspective_of_volume |
112 | iter.GetOneItem(ent->PerspectiveOfVolume()); |
113 | // Own field: shape_clipping |
114 | Standard_Integer i, nb = ent->ShapeClipping()->Length(); |
115 | for (i = 1; i <= nb; i++) |
116 | iter.AddItem(ent->ShapeClipping()->Value(i).Value()); |
117 | } |
118 | |