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