0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
[occt.git] / src / IGESDraw / IGESDraw_PerspectiveView.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
7fd59977 19#include <gp_GTrsf.hxx>
42cf5bc1 20#include <gp_Pnt.hxx>
21#include <gp_Pnt2d.hxx>
22#include <gp_Vec.hxx>
23#include <gp_XY.hxx>
24#include <gp_XYZ.hxx>
25#include <IGESData_TransfEntity.hxx>
ec357c5c 26#include <IGESData_ViewKindEntity.hxx>
42cf5bc1 27#include <IGESDraw_PerspectiveView.hxx>
28#include <Standard_OutOfRange.hxx>
29#include <Standard_Type.hxx>
7fd59977 30
92efcf78 31IMPLEMENT_STANDARD_RTTIEXT(IGESDraw_PerspectiveView,IGESData_ViewKindEntity)
32
b311480e 33IGESDraw_PerspectiveView::IGESDraw_PerspectiveView () { }
7fd59977 34
35
36// This class inherits from IGESData_ViewKindEntity
37
38 void IGESDraw_PerspectiveView::Init
39 (const Standard_Integer aViewNumber,
40 const Standard_Real aScaleFactor,
41 const gp_XYZ& aViewNormalVector,
42 const gp_XYZ& aViewReferencePoint,
43 const gp_XYZ& aCenterOfProjection,
44 const gp_XYZ& aViewUpVector,
45 const Standard_Real aViewPlaneDistance,
46 const gp_XY& aTopLeft,
47 const gp_XY& aBottomRight,
48 const Standard_Integer aDepthClip,
49 const Standard_Real aBackPlaneDistance,
50 const Standard_Real aFrontPlaneDistance)
51{
52 theViewNumber = aViewNumber;
53 theScaleFactor = aScaleFactor;
54 theViewNormalVector = aViewNormalVector;
55 theViewReferencePoint = aViewReferencePoint;
56 theCenterOfProjection = aCenterOfProjection;
57 theViewUpVector = aViewUpVector;
58 theViewPlaneDistance = aViewPlaneDistance;
59 theTopLeft = aTopLeft;
60 theBottomRight = aBottomRight;
61 theDepthClip = aDepthClip;
62 theBackPlaneDistance = aBackPlaneDistance;
63 theFrontPlaneDistance = aFrontPlaneDistance;
64 InitTypeAndForm(410,1);
65}
66
67 Standard_Boolean IGESDraw_PerspectiveView::IsSingle () const
68{
69 return Standard_True;
70}
71
72 Standard_Integer IGESDraw_PerspectiveView::NbViews () const
73{ return 1; }
74
75 Handle(IGESData_ViewKindEntity) IGESDraw_PerspectiveView::ViewItem
76 (const Standard_Integer) const
77{ return Handle(IGESData_ViewKindEntity)::DownCast (This()); }
78
79
80 Standard_Integer IGESDraw_PerspectiveView::ViewNumber () const
81{
82 return theViewNumber;
83}
84
85 Standard_Real IGESDraw_PerspectiveView::ScaleFactor () const
86{
87 return theScaleFactor;
88}
89
90 gp_Vec IGESDraw_PerspectiveView::ViewNormalVector () const
91{
92 gp_Vec tempRes(theViewNormalVector);
93 return tempRes;
94}
95
96 gp_Pnt IGESDraw_PerspectiveView::ViewReferencePoint () const
97{
98 gp_Pnt tempRes(theViewReferencePoint);
99 return tempRes;
100}
101
102 gp_Pnt IGESDraw_PerspectiveView::CenterOfProjection () const
103{
104 gp_Pnt tempRes(theCenterOfProjection);
105 return tempRes;
106}
107
108 gp_Vec IGESDraw_PerspectiveView::ViewUpVector () const
109{
110 gp_Vec tempRes(theViewUpVector);
111 return tempRes;
112}
113
114 Standard_Real IGESDraw_PerspectiveView::ViewPlaneDistance () const
115{
116 return theViewPlaneDistance;
117}
118
119 gp_Pnt2d IGESDraw_PerspectiveView::TopLeft () const
120{
121 gp_Pnt2d tempRes(theTopLeft);
122 return tempRes;
123}
124
125 gp_Pnt2d IGESDraw_PerspectiveView::BottomRight () const
126{
127 gp_Pnt2d tempRes(theBottomRight);
128 return tempRes;
129}
130
131 Standard_Integer IGESDraw_PerspectiveView::DepthClip () const
132{
133 return theDepthClip;
134}
135
136 Standard_Real IGESDraw_PerspectiveView::BackPlaneDistance () const
137{
138 return theBackPlaneDistance;
139}
140
141 Standard_Real IGESDraw_PerspectiveView::FrontPlaneDistance () const
142{
143 return theFrontPlaneDistance;
144}
145
146 Handle(IGESData_TransfEntity) IGESDraw_PerspectiveView::ViewMatrix () const
147{
148 return (Transf());
149}
150
151 gp_XYZ IGESDraw_PerspectiveView::ModelToView
152 (const gp_XYZ& coords) const
153{
154 gp_XYZ tempCoords = coords;
155 Location().Transforms(tempCoords);
156 return (tempCoords);
157}