0024830: Remove redundant keyword 'mutable' in CDL declarations
[occt.git] / src / IGESDraw / IGESDraw_ToolPerspectiveView.cxx
CommitLineData
b311480e 1// Created by: CKY / Contract Toubro-Larsen
2// Copyright (c) 1993-1999 Matra Datavision
973c2be1 3// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
7fd59977 6//
d5f74e42 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
973c2be1 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.
7fd59977 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
b311480e 15
16//--------------------------------------------------------------------
7fd59977 17//--------------------------------------------------------------------
18
19#include <IGESDraw_ToolPerspectiveView.ixx>
20#include <IGESData_ParamCursor.hxx>
21#include <IGESData_TransfEntity.hxx>
22#include <gp_XY.hxx>
23#include <gp_XYZ.hxx>
24#include <gp_Pnt.hxx>
25#include <gp_Vec.hxx>
26#include <IGESData_Dump.hxx>
27#include <Interface_Macros.hxx>
28
29
30IGESDraw_ToolPerspectiveView::IGESDraw_ToolPerspectiveView () { }
31
32
33void IGESDraw_ToolPerspectiveView::ReadOwnParams
34 (const Handle(IGESDraw_PerspectiveView)& ent,
35 const Handle(IGESData_IGESReaderData)& /*IR*/, IGESData_ParamReader& PR) const
36{
37 //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
38
39 gp_XY tempTopLeft, tempBottomRight;
40 Standard_Real tempLeft, tempRight, tempTop, tempBottom;
41 gp_XYZ tempCenterOfProjection, tempViewUpVector;
42 gp_XYZ tempViewNormalVector, tempViewReferencePoint;
43 Standard_Integer tempViewNumber, tempDepthClip;
44 Standard_Real tempScaleFactor, tempViewPlaneDistance;
45 Standard_Real tempBackPlaneDistance, tempFrontPlaneDistance;
46
47 //szv#4:S4163:12Mar99 `st=` not needed
48 PR.ReadInteger(PR.Current(), "View Number", tempViewNumber);
49 PR.ReadReal(PR.Current(), "Scale Number", tempScaleFactor);
50 PR.ReadXYZ(PR.CurrentList(1, 3), "View Plane Normal Vector", tempViewNormalVector);
51 PR.ReadXYZ(PR.CurrentList(1, 3), "View Reference Point", tempViewReferencePoint);
52 PR.ReadXYZ(PR.CurrentList(1, 3), "Center Of Projection", tempCenterOfProjection);
53 PR.ReadXYZ(PR.CurrentList(1, 3), "View Up Vector", tempViewUpVector);
54 PR.ReadReal(PR.Current(), "View Plane Distance", tempViewPlaneDistance);
55
56 //st = PR.ReadReal(PR.Current(), "Left Side Of Clipping Window", tempLeft); //szv#4:S4163:12Mar99 moved in if
57 if (PR.ReadReal(PR.Current(), "Left Side Of Clipping Window", tempLeft))
58 tempTopLeft.SetX(tempLeft);
59
60 //st = PR.ReadReal(PR.Current(), "Right Side Of Clipping Window", tempRight); //szv#4:S4163:12Mar99 moved in if
61 if (PR.ReadReal(PR.Current(), "Right Side Of Clipping Window", tempRight))
62 tempBottomRight.SetX(tempRight);
63
64 //st = PR.ReadReal(PR.Current(), "Bottom Of Clipping Window", tempBottom); //szv#4:S4163:12Mar99 moved in if
65 if (PR.ReadReal(PR.Current(), "Bottom Of Clipping Window", tempBottom))
66 tempBottomRight.SetY(tempBottom);
67
68 //st = PR.ReadReal(PR.Current(), "Top Of Clipping Window", tempTop); //szv#4:S4163:12Mar99 moved in if
69 if (PR.ReadReal(PR.Current(), "Top Of Clipping Window", tempTop))
70 tempTopLeft.SetY(tempTop);
71
72 //szv#4:S4163:12Mar99 `st=` not needed
73 PR.ReadInteger(PR.Current(), "Depth Clipping Indicator", tempDepthClip);
74 PR.ReadReal(PR.Current(), "Back Plane Distance", tempBackPlaneDistance);
75 PR.ReadReal(PR.Current(), "Front Plane Distance", tempFrontPlaneDistance);
76
77 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
78 ent->Init
79 (tempViewNumber, tempScaleFactor, tempViewNormalVector,
80 tempViewReferencePoint, tempCenterOfProjection, tempViewUpVector,
81 tempViewPlaneDistance, tempTopLeft, tempBottomRight, tempDepthClip,
82 tempBackPlaneDistance, tempFrontPlaneDistance);
83}
84
85void IGESDraw_ToolPerspectiveView::WriteOwnParams
86 (const Handle(IGESDraw_PerspectiveView)& ent, IGESData_IGESWriter& IW) const
87{
88 IW.Send(ent->ViewNumber());
89 IW.Send(ent->ScaleFactor());
90 IW.Send(ent->ViewNormalVector().X());
91 IW.Send(ent->ViewNormalVector().Y());
92 IW.Send(ent->ViewNormalVector().Z());
93 IW.Send(ent->ViewReferencePoint().X());
94 IW.Send(ent->ViewReferencePoint().Y());
95 IW.Send(ent->ViewReferencePoint().Z());
96 IW.Send(ent->CenterOfProjection().X());
97 IW.Send(ent->CenterOfProjection().Y());
98 IW.Send(ent->CenterOfProjection().Z());
99 IW.Send(ent->ViewUpVector().X());
100 IW.Send(ent->ViewUpVector().Y());
101 IW.Send(ent->ViewUpVector().Z());
102 IW.Send(ent->ViewPlaneDistance());
103 IW.Send(ent->TopLeft().X());
104 IW.Send(ent->BottomRight().X());
105 IW.Send(ent->BottomRight().Y());
106 IW.Send(ent->TopLeft().Y());
107 IW.Send(ent->DepthClip());
108 IW.Send(ent->BackPlaneDistance());
109 IW.Send(ent->FrontPlaneDistance());
110}
111
112void IGESDraw_ToolPerspectiveView::OwnShared
113 (const Handle(IGESDraw_PerspectiveView)& /*ent*/, Interface_EntityIterator& /*iter*/) const
114{
115}
116
117void IGESDraw_ToolPerspectiveView::OwnCopy
118 (const Handle(IGESDraw_PerspectiveView)& another,
119 const Handle(IGESDraw_PerspectiveView)& ent, Interface_CopyTool& /*TC*/) const
120{
121 ent->Init
122 (another->ViewNumber(), another->ScaleFactor(),
123 another->ViewNormalVector().XYZ(), another->ViewReferencePoint().XYZ(),
124 another->CenterOfProjection().XYZ(), another->ViewUpVector().XYZ(),
125 another->ViewPlaneDistance(),
126 another->TopLeft().XY(),another->BottomRight().XY(), another->DepthClip(),
127 another->BackPlaneDistance(), another->FrontPlaneDistance());
128}
129
130
131IGESData_DirChecker IGESDraw_ToolPerspectiveView::DirChecker
132 (const Handle(IGESDraw_PerspectiveView)& /*ent*/) const
133{
134 IGESData_DirChecker DC(410, 1);
135 DC.Structure(IGESData_DefVoid);
136 DC.LineFont(IGESData_DefVoid);
137 DC.LineWeight(IGESData_DefVoid);
138 DC.Color(IGESData_DefVoid);
139 DC.BlankStatusIgnored();
140 DC.UseFlagRequired(1);
141 DC.HierarchyStatusIgnored();
142
143 return DC;
144}
145
146void IGESDraw_ToolPerspectiveView::OwnCheck
147 (const Handle(IGESDraw_PerspectiveView)& ent,
148 const Interface_ShareTool& , Handle(Interface_Check)& ach) const
149{
150 if ((ent->DepthClip() < 0) || (ent->DepthClip() > 3))
151 ach->AddFail("DepthClip has invalid value");
152 if (ent->HasTransf()) {
153 if (ent->Transf()->FormNumber() != 0)
154 ach->AddFail("Associated Matrix has not Form Number 0");
155 }
156}
157
158void IGESDraw_ToolPerspectiveView::OwnDump
159 (const Handle(IGESDraw_PerspectiveView)& ent, const IGESData_IGESDumper& /*dumper*/,
160 const Handle(Message_Messenger)& S, const Standard_Integer level) const
161{
162 S << "IGESDraw_PerspectiveView" << endl;
163
164 S << "View Number : " << ent->ViewNumber() << " ";
165 S << "Scale Factor : " << ent->ScaleFactor() << endl;
166 S << "View Plane Normal Vector : ";
167 IGESData_DumpXYZL(S,level, ent->ViewNormalVector(), ent->Location());
168 S << endl << "View Reference Point : ";
169 IGESData_DumpXYZL(S,level, ent->ViewReferencePoint() , ent->Location());
170 S << endl << "Center Of Projection : ";
171 IGESData_DumpXYZL(S,level, ent->CenterOfProjection() , ent->Location());
172 S << endl << "View Up Vector : ";
173 IGESData_DumpXYZL(S,level, ent->ViewUpVector() , ent->Location());
174 S << endl << "View Plane Distance : " << ent->ViewPlaneDistance()<<endl;
175 S << "Left Side Of Clipping Window : " << ent->TopLeft().X() << endl;
176 S << "Right Side Of Clipping Window : " << ent->BottomRight().X() << endl;
177 S << "Bottom Side Of Clipping Window : " << ent->BottomRight().Y() << endl;
178 S << "Top Side Of Clipping Window : " << ent->TopLeft().Y() << endl;
179 S << "Depth Clipping : " << ent->DepthClip();
180 switch (ent->DepthClip()) {
181 case 0 : S << " (No Depth Clipping)" << endl; break;
182 case 1 : S << " (Back Clipping Plane ON)" << endl; break;
183 case 2 : S << " (Front Clipping Plane ON)" << endl; break;
184 case 3 : S << " (Front and Back Clipping Planes ON)" << endl; break;
185 default : S << " (Invalid Value)" << endl; break;
186 }
187 S << "Back Plane Distance : " << ent->BackPlaneDistance() << " ";
188 S << "Front Plane Distance : " << ent->FrontPlaneDistance() << endl;
189 S << endl;
190}