0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
[occt.git] / src / IGESDraw / IGESDraw_View.cxx
1 // Created by: CKY / Contract Toubro-Larsen
2 // Copyright (c) 1993-1999 Matra Datavision
3 // Copyright (c) 1999-2014 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 //--------------------------------------------------------------------
18
19 #include <gp_GTrsf.hxx>
20 #include <gp_XYZ.hxx>
21 #include <IGESData_TransfEntity.hxx>
22 #include <IGESData_ViewKindEntity.hxx>
23 #include <IGESDraw_View.hxx>
24 #include <IGESGeom_Plane.hxx>
25 #include <Standard_OutOfRange.hxx>
26 #include <Standard_Type.hxx>
27
28 IMPLEMENT_STANDARD_RTTIEXT(IGESDraw_View,IGESData_ViewKindEntity)
29
30 IGESDraw_View::IGESDraw_View ()    {  }
31
32
33 // This class inherits from IGESData_ViewKindEntity
34
35     void IGESDraw_View::Init
36   (const Standard_Integer        aViewNum,
37    const Standard_Real           aScale,
38    const Handle(IGESGeom_Plane)& aLeftPlane,
39    const Handle(IGESGeom_Plane)& aTopPlane,
40    const Handle(IGESGeom_Plane)& aRightPlane,
41    const Handle(IGESGeom_Plane)& aBottomPlane,
42    const Handle(IGESGeom_Plane)& aBackPlane,
43    const Handle(IGESGeom_Plane)& aFrontPlane)
44 {
45   theViewNumber  = aViewNum;
46   theScaleFactor = aScale;
47   theLeftPlane   = aLeftPlane;
48   theTopPlane    = aTopPlane;
49   theRightPlane  = aRightPlane;
50   theBottomPlane = aBottomPlane;
51   theBackPlane   = aBackPlane;
52   theFrontPlane  = aFrontPlane;
53   InitTypeAndForm(410,0);
54 }
55
56     Standard_Boolean IGESDraw_View::IsSingle () const
57 {
58   return Standard_True;
59   // Redefined to return TRUE
60 }
61
62     Standard_Integer IGESDraw_View::NbViews () const
63 {  return 1;  }
64
65     Handle(IGESData_ViewKindEntity)  IGESDraw_View::ViewItem
66   (const Standard_Integer) const
67 {  return Handle(IGESData_ViewKindEntity)::DownCast (This());  }
68
69
70     Standard_Integer IGESDraw_View::ViewNumber () const
71 {
72   return theViewNumber;
73 }
74
75     Standard_Real IGESDraw_View::ScaleFactor () const
76 {
77   return theScaleFactor;
78 }
79
80     Standard_Boolean IGESDraw_View::HasLeftPlane () const
81 {
82   return  (! theLeftPlane.IsNull());
83 }
84
85     Handle(IGESGeom_Plane) IGESDraw_View::LeftPlane () const
86 {
87   return  theLeftPlane;
88 }
89
90     Standard_Boolean IGESDraw_View::HasTopPlane () const
91 {
92   return  (! theTopPlane.IsNull());
93 }
94
95     Handle(IGESGeom_Plane) IGESDraw_View::TopPlane () const
96 {
97   return  theTopPlane;
98 }
99
100     Standard_Boolean IGESDraw_View::HasRightPlane () const
101 {
102   return  (! theRightPlane.IsNull());
103 }
104
105     Handle(IGESGeom_Plane) IGESDraw_View::RightPlane () const
106 {
107   return  theRightPlane;
108 }
109
110     Standard_Boolean IGESDraw_View::HasBottomPlane () const
111 {
112   return  (! theBottomPlane.IsNull());
113 }
114
115     Handle(IGESGeom_Plane) IGESDraw_View::BottomPlane () const
116 {
117   return  theBottomPlane;
118 }
119
120     Standard_Boolean IGESDraw_View::HasBackPlane () const
121 {
122   return  (! theBackPlane.IsNull());
123 }
124
125     Handle(IGESGeom_Plane) IGESDraw_View::BackPlane () const
126 {
127   return  theBackPlane;
128 }
129
130     Standard_Boolean IGESDraw_View::HasFrontPlane () const
131 {
132   return  (! theFrontPlane.IsNull());
133 }
134
135     Handle(IGESGeom_Plane) IGESDraw_View::FrontPlane () const
136 {
137   return  theFrontPlane;
138 }
139
140     Handle(IGESData_TransfEntity) IGESDraw_View::ViewMatrix () const
141 {
142   return (Transf());
143 }
144
145     gp_XYZ IGESDraw_View::ModelToView (const gp_XYZ& coords) const
146 {
147   gp_XYZ tempCoords = coords;
148   Location().Transforms(tempCoords);
149   return (tempCoords);
150 }