summaryrefslogtreecommitdiff
path: root/src/V3d/V3d_View_1.cxx
blob: 7d9da0ccaf49996fd7d0f351dea1ab4e76768b01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/***********************************************************************

     FONCTION :
     ----------
        File V3d_View_1.cxx :

************************************************************************/
/*----------------------------------------------------------------------*/
/*
 * Includes
 */ 

#include <V3d_View.jxx>

/*----------------------------------------------------------------------*/

void V3d_View::SetAntialiasingOn() {
  MyViewContext.SetAliasingOn() ;
  MyView->SetContext(MyViewContext) ;
}

void V3d_View::SetAntialiasingOff() {
  MyViewContext.SetAliasingOff() ;
  MyView->SetContext(MyViewContext) ;
}

/*----------------------------------------------------------------------*/

void V3d_View::SetZClippingDepth(const Standard_Real Depth) {
  Standard_Real Front,Back,Width ;

  Front = MyViewContext.ZClippingFrontPlane() ;
  Back = MyViewContext.ZClippingBackPlane() ;
  Width = Front - Back ;
  Front = Depth + Width/2. ;
  Back = Depth - Width/2. ;
  MyViewContext.SetZClippingBackPlane(Back) ;
  MyViewContext.SetZClippingFrontPlane(Front) ;
  MyView->SetContext(MyViewContext) ;
}

/*----------------------------------------------------------------------*/

void V3d_View::SetZClippingWidth(const Standard_Real Width) {
  Standard_Real Front,Back,Depth ;
  Viewer_BadValue_Raise_if( Width <= 0.,"V3d_View::SetZClippingWidth, bad width");

  Front = MyViewContext.ZClippingFrontPlane() ;
  Back = MyViewContext.ZClippingBackPlane() ;
  Depth = (Front + Back)/2. ;
  Front = Depth + Width/2. ;
  Back = Depth - Width/2. ;
  MyViewContext.SetZClippingBackPlane(Back) ;
  MyViewContext.SetZClippingFrontPlane(Front) ;
  MyView->SetContext(MyViewContext) ;
}

/*----------------------------------------------------------------------*/

void V3d_View::SetZClippingType(const V3d_TypeOfZclipping Type) {

  switch (Type) {
  case V3d_OFF :
    MyViewContext.SetZClippingOff() ;
    break ;
  case V3d_BACK :
    MyViewContext.SetBackZClippingOn() ;
    MyViewContext.SetFrontZClippingOff() ;
    break ;
  case V3d_FRONT :
    MyViewContext.SetFrontZClippingOn() ;
    MyViewContext.SetBackZClippingOff() ;
    break ;
  case V3d_SLICE :
    MyViewContext.SetZClippingOn() ;
    break ;
  }
  MyView->SetContext(MyViewContext) ;
}

/*----------------------------------------------------------------------*/

V3d_TypeOfZclipping V3d_View::ZClipping(Standard_Real& Depth, Standard_Real& Width) const {
  V3d_TypeOfZclipping T = V3d_OFF ;
  Standard_Real Front,Back ;
  Standard_Boolean Aback,Afront ;

  Back = MyViewContext.ZClippingBackPlane() ;
  Front = MyViewContext.ZClippingFrontPlane() ;
  Aback = MyViewContext.BackZClippingIsOn() ;
  Afront = MyViewContext.FrontZClippingIsOn() ;
  Width = Front - Back ;
  Depth = (Front + Back)/2. ;
  if( Aback ) {
    if( Afront ) T = V3d_SLICE ;
    else	 T = V3d_BACK ;
  } else if( Afront ) T = V3d_FRONT ;

  return T ;
}


/*----------------------------------------------------------------------*/

void V3d_View::SetZCueingDepth(const Standard_Real Depth) {
  Standard_Real Front,Back,Width ;

  Front = MyViewContext.DepthCueingFrontPlane() ;
  Back = MyViewContext.DepthCueingBackPlane() ;
  Width = Front - Back ;
  Front = Depth + Width/2. ;
  Back = Depth - Width/2. ;
  MyViewContext.SetDepthCueingBackPlane(Back) ;
  MyViewContext.SetDepthCueingFrontPlane(Front) ;
  MyView->SetContext(MyViewContext) ;
}

/*----------------------------------------------------------------------*/

void V3d_View::SetZCueingWidth(const Standard_Real Width) {
  Standard_Real Front,Back,Depth ;
  Viewer_BadValue_Raise_if( Width <= 0.,"V3d_View::SetZCueingWidth, bad width");

  Front = MyViewContext.DepthCueingFrontPlane() ;
  Back = MyViewContext.DepthCueingBackPlane() ;
  Depth = (Front + Back)/2. ;
  Front = Depth + Width/2. ;
  Back = Depth - Width/2. ;
  MyViewContext.SetDepthCueingBackPlane(Back) ;
  MyViewContext.SetDepthCueingFrontPlane(Front) ;
  MyView->SetContext(MyViewContext) ;
}

/*----------------------------------------------------------------------*/

void V3d_View::SetZCueingOn() {

  MyViewContext.SetDepthCueingOn() ;
  MyView->SetContext(MyViewContext) ;
}

/*----------------------------------------------------------------------*/

void V3d_View::SetZCueingOff() {

  MyViewContext.SetDepthCueingOff() ;
  MyView->SetContext(MyViewContext) ;
}

/*----------------------------------------------------------------------*/

Standard_Boolean V3d_View::ZCueing(Standard_Real& Depth, Standard_Real& Width)const  {
  Standard_Boolean Z = MyViewContext.DepthCueingIsOn() ;
  Standard_Real Front,Back ;

Back = MyViewContext.DepthCueingBackPlane() ;
  Front = MyViewContext.DepthCueingFrontPlane() ;
  Width = Front - Back ;
  Depth = (Front + Back)/2. ;

  return Z ;
}

/*----------------------------------------------------------------------*/