1 // Copyright (c) 1999-2012 OPEN CASCADE SAS
3 // The content of this file is subject to the Open CASCADE Technology Public
4 // License Version 6.5 (the "License"). You may not use the content of this file
5 // except in compliance with the License. Please obtain a copy of the License
6 // at http://www.opencascade.org and read it completely before using this file.
8 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
9 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
11 // The Original Code and all software distributed under the License is
12 // distributed on an "AS IS" basis, without warranty of any kind, and the
13 // Initial Developer hereby disclaims all such warranties, including without
14 // limitation, any warranties of merchantability, fitness for a particular
15 // purpose or non-infringement. Please see the License for the specific terms
16 // and conditions governing the rights and limitations under the License.
18 /***********************************************************************/
22 File V3d_View_1.cxx : */
25 /*----------------------------------------------------------------------*/
30 #include <V3d_View.jxx>
32 /*----------------------------------------------------------------------*/
34 void V3d_View::SetAntialiasingOn() {
35 MyViewContext.SetAliasingOn() ;
36 MyView->SetContext(MyViewContext) ;
39 void V3d_View::SetAntialiasingOff() {
40 MyViewContext.SetAliasingOff() ;
41 MyView->SetContext(MyViewContext) ;
44 /*----------------------------------------------------------------------*/
46 void V3d_View::SetZClippingDepth(const Standard_Real Depth) {
47 Standard_Real Front,Back,Width ;
49 Front = MyViewContext.ZClippingFrontPlane() ;
50 Back = MyViewContext.ZClippingBackPlane() ;
51 Width = Front - Back ;
52 Front = Depth + Width/2. ;
53 Back = Depth - Width/2. ;
54 MyViewContext.SetZClippingBackPlane(Back) ;
55 MyViewContext.SetZClippingFrontPlane(Front) ;
56 MyView->SetContext(MyViewContext) ;
59 /*----------------------------------------------------------------------*/
61 void V3d_View::SetZClippingWidth(const Standard_Real Width) {
62 Standard_Real Front,Back,Depth ;
63 V3d_BadValue_Raise_if( Width <= 0.,"V3d_View::SetZClippingWidth, bad width");
65 Front = MyViewContext.ZClippingFrontPlane() ;
66 Back = MyViewContext.ZClippingBackPlane() ;
67 Depth = (Front + Back)/2. ;
68 Front = Depth + Width/2. ;
69 Back = Depth - Width/2. ;
70 MyViewContext.SetZClippingBackPlane(Back) ;
71 MyViewContext.SetZClippingFrontPlane(Front) ;
72 MyView->SetContext(MyViewContext) ;
75 /*----------------------------------------------------------------------*/
77 void V3d_View::SetZClippingType(const V3d_TypeOfZclipping Type) {
81 MyViewContext.SetZClippingOff() ;
84 MyViewContext.SetBackZClippingOn() ;
85 MyViewContext.SetFrontZClippingOff() ;
88 MyViewContext.SetFrontZClippingOn() ;
89 MyViewContext.SetBackZClippingOff() ;
92 MyViewContext.SetZClippingOn() ;
95 MyView->SetContext(MyViewContext) ;
98 /*----------------------------------------------------------------------*/
100 V3d_TypeOfZclipping V3d_View::ZClipping(Standard_Real& Depth, Standard_Real& Width) const {
101 V3d_TypeOfZclipping T = V3d_OFF ;
102 Standard_Real Front,Back ;
103 Standard_Boolean Aback,Afront ;
105 Back = MyViewContext.ZClippingBackPlane() ;
106 Front = MyViewContext.ZClippingFrontPlane() ;
107 Aback = MyViewContext.BackZClippingIsOn() ;
108 Afront = MyViewContext.FrontZClippingIsOn() ;
109 Width = Front - Back ;
110 Depth = (Front + Back)/2. ;
112 if( Afront ) T = V3d_SLICE ;
114 } else if( Afront ) T = V3d_FRONT ;
120 /*----------------------------------------------------------------------*/
122 void V3d_View::SetZCueingDepth(const Standard_Real Depth) {
123 Standard_Real Front,Back,Width ;
125 Front = MyViewContext.DepthCueingFrontPlane() ;
126 Back = MyViewContext.DepthCueingBackPlane() ;
127 Width = Front - Back ;
128 Front = Depth + Width/2. ;
129 Back = Depth - Width/2. ;
130 MyViewContext.SetDepthCueingBackPlane(Back) ;
131 MyViewContext.SetDepthCueingFrontPlane(Front) ;
132 MyView->SetContext(MyViewContext) ;
135 /*----------------------------------------------------------------------*/
137 void V3d_View::SetZCueingWidth(const Standard_Real Width) {
138 Standard_Real Front,Back,Depth ;
139 V3d_BadValue_Raise_if( Width <= 0.,"V3d_View::SetZCueingWidth, bad width");
141 Front = MyViewContext.DepthCueingFrontPlane() ;
142 Back = MyViewContext.DepthCueingBackPlane() ;
143 Depth = (Front + Back)/2. ;
144 Front = Depth + Width/2. ;
145 Back = Depth - Width/2. ;
146 MyViewContext.SetDepthCueingBackPlane(Back) ;
147 MyViewContext.SetDepthCueingFrontPlane(Front) ;
148 MyView->SetContext(MyViewContext) ;
151 /*----------------------------------------------------------------------*/
153 void V3d_View::SetZCueingOn() {
155 MyViewContext.SetDepthCueingOn() ;
156 MyView->SetContext(MyViewContext) ;
159 /*----------------------------------------------------------------------*/
161 void V3d_View::SetZCueingOff() {
163 MyViewContext.SetDepthCueingOff() ;
164 MyView->SetContext(MyViewContext) ;
167 /*----------------------------------------------------------------------*/
169 Standard_Boolean V3d_View::ZCueing(Standard_Real& Depth, Standard_Real& Width)const {
170 Standard_Boolean Z = MyViewContext.DepthCueingIsOn() ;
171 Standard_Real Front,Back ;
173 Back = MyViewContext.DepthCueingBackPlane() ;
174 Front = MyViewContext.DepthCueingFrontPlane() ;
175 Width = Front - Back ;
176 Depth = (Front + Back)/2. ;
181 /*----------------------------------------------------------------------*/