Commit | Line | Data |
---|---|---|
7fd59977 | 1 | /*********************************************************************** |
2 | ||
3 | FONCTION : | |
4 | ---------- | |
5 | Classe V3d_View : | |
6 | ||
7 | HISTORIQUE DES MODIFICATIONS : | |
8 | -------------------------------- | |
9 | 16-08-98 : CAL ; S3892. Ajout grilles 3d. | |
10 | 16-09-98 : BGN ; Points d'entree du Triedre (S3819, Phase 1) | |
11 | 21-09-98 : CAL ; Activation de l'echo que si CSF_GraphicEcho est definie. | |
12 | 22-09-98 : BGN ; S3989 (anciennement S3819) | |
13 | TypeOfTriedron* from Aspect (pas V3d) | |
14 | 02.15.100 : JR : Clutter | |
15 | 28/05/02 : VSV: ZBUFFER mode of Trihedron | |
16 | ||
17 | ************************************************************************/ | |
18 | ||
19 | #define IMP240100 //GG | |
20 | // -> In Compute() method call MyViewer->ShowGridEcho() | |
21 | ||
22 | ||
23 | /*----------------------------------------------------------------------*/ | |
24 | /* | |
25 | * Includes | |
26 | */ | |
27 | #include <V3d_View.jxx> | |
28 | ||
29 | #include <TColStd_Array2OfReal.hxx> | |
30 | ||
31 | #include <gp_Dir2d.hxx> | |
32 | ||
33 | #include <Aspect.hxx> | |
34 | ||
35 | #include <V3d_RectangularGrid.hxx> | |
36 | #include <V3d_CircularGrid.hxx> | |
37 | ||
81bba717 | 38 | // For the echo of the chosen point |
7fd59977 | 39 | #include <Visual3d_TransientManager.hxx> |
40 | ||
41 | /*----------------------------------------------------------------------*/ | |
42 | /* | |
43 | * Constant | |
44 | */ | |
45 | ||
81bba717 | 46 | // in case NO_TRACE_ECHO and NO_TRACE_POINTS, in V3d_View_4.cxx and |
47 | // V3d_View.cxx, suspend MyGridEchoStructure and MyGridEchoGroup in cdl | |
7fd59977 | 48 | #define TRACE_ECHO |
49 | #define NO_TRACE_VALUES | |
50 | #define NO_TRACE_POINTS | |
51 | ||
81bba717 | 52 | #define MYEPSILON1 0.0001 // Comparison with 0.0 |
53 | #define MYEPSILON2 Standard_PI / 180. // Delta between 2 angles | |
7fd59977 | 54 | |
55 | #ifdef TRACE_POINTS | |
56 | #include <Graphic3d_AspectLine3d.hxx> | |
57 | #include <Graphic3d_AspectText3d.hxx> | |
58 | #endif | |
59 | ||
60 | #ifdef TRACE_VALUES | |
61 | #include <Visual3d_ViewOrientation.hxx> | |
62 | #endif | |
63 | ||
64 | #if defined TRACE_VALUES || defined TRACE_POINTS | |
65 | static char *CAR [26] = {"a", "b", "c", "d", "e", "f", "g", "h", | |
66 | "i", "j", "k", "l", "m", "n", "o", "p", | |
67 | "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}; | |
68 | #endif | |
69 | ||
70 | /*----------------------------------------------------------------------*/ | |
71 | ||
72 | void V3d_View::SetGrid (const gp_Ax3& aPlane, const Handle(Aspect_Grid)& aGrid) { | |
73 | ||
74 | MyPlane = aPlane; | |
75 | MyGrid = aGrid; | |
76 | ||
77 | #ifdef TRACE_VALUES | |
78 | if (MyGrid->IsKind (STANDARD_TYPE (Aspect_RectangularGrid))) { | |
79 | cout << "Aspect_RectangularGrid" << endl; | |
80 | Handle(Aspect_RectangularGrid) theGrid = *(Handle(Aspect_RectangularGrid) *) &MyGrid; | |
81 | cout << "\tOrigine : " << theGrid->XOrigin () << ", " | |
82 | << theGrid->YOrigin () << endl; | |
83 | cout << "\tAngle : " << theGrid->RotationAngle () << endl; | |
84 | cout << "\tSteps : " << theGrid->XStep () << ", " | |
85 | << theGrid->YStep () << endl; | |
86 | } | |
87 | else { | |
88 | cout << "Aspect_CircularGrid" << endl; | |
89 | Handle(Aspect_CircularGrid) theGrid = *(Handle(Aspect_CircularGrid) *) &MyGrid; | |
90 | cout << "\tOrigine : " << theGrid->XOrigin () << ", " | |
91 | << theGrid->YOrigin () << endl; | |
92 | cout << "\tAngle : " << theGrid->RotationAngle () << endl; | |
93 | cout << "\tRadiusStep, Division : " << theGrid->RadiusStep () | |
94 | << ", " << theGrid->DivisionNumber () << endl; | |
95 | } | |
96 | ||
97 | #endif | |
98 | ||
99 | Standard_Real xl, yl, zl; | |
100 | Standard_Real xdx, xdy, xdz; | |
101 | Standard_Real ydx, ydy, ydz; | |
102 | Standard_Real dx, dy, dz; | |
103 | aPlane.Location ().Coord (xl, yl, zl); | |
104 | aPlane.XDirection ().Coord (xdx, xdy, xdz); | |
105 | aPlane.YDirection ().Coord (ydx, ydy, ydz); | |
106 | aPlane.Direction ().Coord (dx, dy, dz); | |
107 | ||
108 | #ifdef TRACE_VALUES | |
109 | cout << "Grid Plane " << xl << ", " << yl << ", " << zl << endl; | |
110 | cout << "\tLocation " << xl << ", " << yl << ", " << zl << endl; | |
111 | cout << "\tDirection " << dx << ", " << dy << ", " << dz << endl; | |
112 | cout << "\tXDirection " << xdx << ", " << xdy << ", " << xdz << endl; | |
113 | cout << "\tYDirection " << ydx << ", " << ydy << ", " << ydz << endl; | |
114 | #endif | |
115 | ||
116 | Standard_Real CosAlpha = Cos (MyGrid->RotationAngle ()); | |
117 | Standard_Real SinAlpha = Sin (MyGrid->RotationAngle ()); | |
118 | ||
119 | TColStd_Array2OfReal Trsf1 (1, 4, 1, 4); | |
120 | Trsf1 (4, 4) = 1.0; | |
121 | Trsf1 (4, 1) = Trsf1 (4, 2) = Trsf1 (4, 3) = 0.0; | |
122 | // Translation | |
123 | Trsf1 (1, 4) = xl, | |
124 | Trsf1 (2, 4) = yl, | |
125 | Trsf1 (3, 4) = zl; | |
81bba717 | 126 | // Transformation change of marker |
7fd59977 | 127 | Trsf1 (1, 1) = xdx, |
128 | Trsf1 (2, 1) = xdy, | |
129 | Trsf1 (3, 1) = xdz, | |
130 | Trsf1 (1, 2) = ydx, | |
131 | Trsf1 (2, 2) = ydy, | |
132 | Trsf1 (3, 2) = ydz, | |
133 | Trsf1 (1, 3) = dx, | |
134 | Trsf1 (2, 3) = dy, | |
135 | Trsf1 (3, 3) = dz; | |
136 | ||
137 | TColStd_Array2OfReal Trsf2 (1, 4, 1, 4); | |
138 | Trsf2 (4, 4) = 1.0; | |
139 | Trsf2 (4, 1) = Trsf2 (4, 2) = Trsf2 (4, 3) = 0.0; | |
81bba717 | 140 | // Translation of the origin |
7fd59977 | 141 | Trsf2 (1, 4) = -MyGrid->XOrigin (), |
142 | Trsf2 (2, 4) = -MyGrid->YOrigin (), | |
143 | Trsf2 (3, 4) = 0.0; | |
81bba717 | 144 | // Rotation Alpha around axis -Z |
7fd59977 | 145 | Trsf2 (1, 1) = CosAlpha, |
146 | Trsf2 (2, 1) = -SinAlpha, | |
147 | Trsf2 (3, 1) = 0.0, | |
148 | Trsf2 (1, 2) = SinAlpha, | |
149 | Trsf2 (2, 2) = CosAlpha, | |
150 | Trsf2 (3, 2) = 0.0, | |
151 | Trsf2 (1, 3) = 0.0, | |
152 | Trsf2 (2, 3) = 0.0, | |
153 | Trsf2 (3, 3) = 1.0; | |
154 | ||
155 | Standard_Real valuetrsf; | |
156 | Standard_Real valueoldtrsf; | |
157 | Standard_Real valuenewtrsf; | |
158 | Standard_Integer i, j, k; | |
81bba717 | 159 | // Calculation of the product of matrices |
7fd59977 | 160 | for (i=1; i<=4; i++) |
161 | for (j=1; j<=4; j++) { | |
162 | MyTrsf (i, j) = 0.0; | |
163 | for (k=1; k<=4; k++) { | |
164 | valueoldtrsf = Trsf1 (i, k); | |
165 | valuetrsf = Trsf2 (k, j); | |
166 | valuenewtrsf = MyTrsf (i, j) + valueoldtrsf * valuetrsf; | |
167 | MyTrsf (i, j) = valuenewtrsf; | |
168 | } | |
169 | } | |
170 | ||
171 | } | |
172 | ||
173 | void V3d_View::SetGridActivity (const Standard_Boolean AFlag) { | |
174 | ||
175 | if (AFlag) MyGrid->Activate (); | |
176 | else MyGrid->Deactivate (); | |
177 | ||
178 | } | |
179 | ||
180 | void V3d_View::SetGridGraphicValues (const Handle(Aspect_Grid)& | |
181 | #ifdef TRACE_VALUES | |
182 | aGrid | |
183 | #endif | |
184 | ) { | |
185 | ||
186 | #ifdef TRACE_VALUES | |
187 | Standard_Real XSize, YSize, Radius, OffSet; | |
188 | if (aGrid->IsKind (STANDARD_TYPE (V3d_RectangularGrid))) { | |
189 | cout << "V3d_RectangularGrid" << endl; | |
190 | Handle(V3d_RectangularGrid) theGrid = *(Handle(V3d_RectangularGrid) *) &aGrid; | |
191 | theGrid->GraphicValues (XSize, YSize, OffSet); | |
192 | cout << "\tSizes : " << XSize << ", " << YSize << endl; | |
193 | cout << "\tOffSet : " << OffSet << endl; | |
194 | } | |
195 | else { | |
196 | cout << "V3d_CircularGrid" << endl; | |
197 | Handle(V3d_CircularGrid) theGrid = *(Handle(V3d_CircularGrid) *) &aGrid; | |
198 | theGrid->GraphicValues (Radius, OffSet); | |
199 | cout << "\tRadius : " << Radius << endl; | |
200 | cout << "\tOffSet : " << OffSet << endl; | |
201 | } | |
202 | #endif | |
203 | ||
204 | } | |
205 | ||
206 | Graphic3d_Vertex V3d_View::Compute (const Graphic3d_Vertex & AVertex) const { | |
207 | ||
208 | Graphic3d_Vertex CurPoint, NewPoint; | |
209 | Standard_Real X1, Y1, Z1, X2, Y2, Z2; | |
210 | Standard_Real XPp, YPp; | |
211 | ||
212 | MyView->ViewOrientation ().ViewReferencePlane ().Coord (X1, Y1, Z1); | |
213 | MyPlane.Direction ().Coord (X2, Y2, Z2); | |
214 | ||
215 | gp_Dir VPN (X1, Y1, Z1); | |
216 | gp_Dir GPN (X2, Y2, Z2); | |
217 | ||
218 | #ifdef TRACE_VALUES | |
219 | cout << "View Plane : " << X1 << ", " << Y1 << ", " << Z1 << endl; | |
220 | cout << "Grid Plane " << X2 << ", " << Y2 << ", " << Z2 << endl; | |
221 | cout << "Angle VPN GPN : " << VPN.Angle (GPN) << endl; | |
222 | #endif | |
223 | ||
224 | AVertex.Coord (X1, Y1, Z1); | |
225 | Project (X1, Y1, Z1, XPp, YPp); | |
226 | ||
227 | #ifdef TRACE_VALUES | |
228 | cout << "AVertex : " << X1 << ", " << Y1 << ", " << Z1 << endl; | |
229 | #endif | |
230 | ||
81bba717 | 231 | // Casw when the plane of the grid and the plane of the view |
232 | // are perpendicular to MYEPSILON2 close radians | |
7fd59977 | 233 | if (Abs (VPN.Angle (GPN) - Standard_PI / 2.) < MYEPSILON2) { |
234 | NewPoint.SetCoord (X1, Y1, Z1); | |
235 | #ifdef TRACE_POINTS | |
236 | TextAttrib->SetColor (Quantity_Color (Quantity_NOC_RED)); | |
237 | MyGridEchoGroup->SetPrimitivesAspect (TextAttrib); | |
238 | MyGridEchoGroup->Text ("Q", NewPoint, 1./81.); | |
239 | MyGridEchoGroup->Polyline (AVertex, NewPoint); | |
240 | Update (); | |
241 | #endif | |
242 | #ifdef IMP240100 | |
243 | MyViewer->ShowGridEcho(this,NewPoint); | |
244 | #else | |
245 | #ifdef TRACE_ECHO | |
246 | char *trace_echo = NULL; | |
247 | trace_echo = (char *)(getenv ("CSF_GraphicEcho")); | |
248 | if (trace_echo) { | |
249 | MyGridEchoGroup->Clear (); | |
250 | MyGridEchoGroup->Marker (NewPoint); | |
251 | Visual3d_TransientManager::BeginDraw | |
252 | (MyView, Standard_False, Standard_False); | |
253 | Visual3d_TransientManager::DrawStructure (MyGridEchoStructure); | |
254 | Visual3d_TransientManager::EndDraw (Standard_True); | |
255 | } | |
256 | #endif | |
257 | #endif //IMP240100 | |
258 | return NewPoint; | |
259 | } | |
260 | ||
261 | #ifdef TRACE_POINTS | |
262 | Handle(Graphic3d_AspectLine3d) LineAttrib = new Graphic3d_AspectLine3d (); | |
263 | Handle(Graphic3d_AspectText3d) TextAttrib = new Graphic3d_AspectText3d (); | |
264 | ||
265 | MyGridEchoGroup->Clear (); | |
266 | ||
267 | LineAttrib->SetColor (Quantity_Color (Quantity_NOC_RED)); | |
268 | MyGridEchoGroup->SetGroupPrimitivesAspect (LineAttrib); | |
269 | ||
270 | TextAttrib->SetColor (Quantity_Color (Quantity_NOC_RED)); | |
271 | MyGridEchoGroup->SetGroupPrimitivesAspect (TextAttrib); | |
272 | ||
273 | MyGridEchoGroup->Text ("P", AVertex, 1./81.); | |
274 | CurPoint.SetCoord (AVertex.X (), AVertex.Y (), AVertex.Z ()); | |
275 | ||
276 | TextAttrib->SetColor (Quantity_Color (Quantity_NOC_GREEN)); | |
277 | MyGridEchoGroup->SetPrimitivesAspect (TextAttrib); | |
278 | #endif | |
279 | ||
280 | Standard_Boolean IsRectangular = | |
281 | MyGrid->IsKind (STANDARD_TYPE (Aspect_RectangularGrid)); | |
282 | ||
283 | Graphic3d_Vertex P1; | |
284 | ||
285 | Standard_Real XO = 0.0, YO = 0.0; | |
286 | Standard_Real XOp, YOp; | |
287 | Standard_Real XAp, YAp; | |
288 | Standard_Real XBp, YBp; | |
289 | ||
290 | X1 = XO, Y1 = YO, Z1 = 0.0; | |
81bba717 | 291 | // MyTrsf * Point to return to the plane of 3D grid |
7fd59977 | 292 | P1.SetCoord (X1, Y1, Z1); |
293 | CurPoint = V3d_View::TrsPoint (P1, MyTrsf); | |
294 | CurPoint.Coord (X2, Y2, Z2); | |
295 | Project (X2, Y2, Z2, XOp, YOp); | |
296 | XPp = XPp - XOp, YPp = YPp - YOp; | |
297 | ||
298 | #ifdef TRACE_POINTS | |
299 | MyGridEchoGroup->Text ("O", CurPoint, 1./81.); | |
300 | #endif | |
301 | ||
302 | #ifdef TRACE_VALUES | |
303 | cout << "Projection de P : " << XPp << ", " << YPp << endl; | |
304 | cout << "Projection de O : " << XOp << ", " << YOp << endl; | |
305 | #endif | |
306 | ||
307 | if (IsRectangular) { | |
308 | Standard_Real XS, YS; | |
309 | Handle(Aspect_RectangularGrid) theGrid = | |
310 | *(Handle(Aspect_RectangularGrid) *) &MyGrid; | |
311 | XS = theGrid->XStep (), YS = theGrid->YStep (); | |
312 | ||
313 | X1 = XO + XS, Y1 = YO, Z1 = 0.0; | |
81bba717 | 314 | // MyTrsf * Point to return to the plane of 3D grid |
7fd59977 | 315 | P1.SetCoord (X1, Y1, Z1); |
316 | CurPoint = V3d_View::TrsPoint (P1, MyTrsf); | |
317 | CurPoint.Coord (X2, Y2, Z2); | |
318 | Project (X2, Y2, Z2, XAp, YAp); | |
319 | XAp = XAp - XOp, YAp = YAp - YOp; | |
320 | ||
321 | #ifdef TRACE_POINTS | |
322 | MyGridEchoGroup->Text ("A", CurPoint, 1./81.); | |
323 | #endif | |
324 | ||
325 | X1 = XO, Y1 = YO + YS, Z1 = 0.0; | |
81bba717 | 326 | // MyTrsf * Point to return to the plane of 3D grid |
7fd59977 | 327 | P1.SetCoord (X1, Y1, Z1); |
328 | CurPoint = V3d_View::TrsPoint (P1, MyTrsf); | |
329 | CurPoint.Coord (X2, Y2, Z2); | |
330 | Project (X2, Y2, Z2, XBp, YBp); | |
331 | XBp = XBp - XOp, YBp = YBp - YOp; | |
332 | ||
333 | #ifdef TRACE_POINTS | |
334 | MyGridEchoGroup->Text ("B", CurPoint, 1./81.); | |
335 | #endif | |
336 | ||
337 | #ifdef TRACE_VALUES | |
338 | cout << "Projection de A : " << XAp << ", " << YAp << endl; | |
339 | cout << "Projection de B : " << XBp << ", " << YBp << endl; | |
340 | #endif | |
341 | ||
342 | Standard_Real Determin = XAp*YBp - XBp*YAp; | |
343 | ||
344 | Z1 = 0.0; | |
345 | if (Abs (Determin) > MYEPSILON1) { | |
346 | X1 = (YBp*XPp - XBp*YPp) / Determin; | |
347 | Y1 = (XAp*YPp - YAp*XPp) / Determin; | |
348 | X1 = (X1 > 0. ? | |
349 | Standard_Real (Standard_Integer (Abs (X1)+0.5)) * XS : | |
350 | - Standard_Real (Standard_Integer (Abs (X1)+0.5)) * XS); | |
351 | Y1 = (Y1 > 0. ? | |
352 | Standard_Real (Standard_Integer (Abs (Y1)+0.5)) * YS : | |
353 | - Standard_Real (Standard_Integer (Abs (Y1)+0.5)) * YS); | |
354 | #ifdef TRACE_VALUES | |
81bba717 | 355 | cout << "Chosen point : " << X1 << ", " << Y1 << endl; |
7fd59977 | 356 | #endif |
81bba717 | 357 | // MyTrsf * Point to return to the plane of 3D grid |
7fd59977 | 358 | P1.SetCoord (X1, Y1, Z1); |
359 | CurPoint = V3d_View::TrsPoint (P1, MyTrsf); | |
360 | CurPoint.Coord (X2, Y2, Z2); | |
361 | } | |
362 | else { | |
363 | cout << "*****************" << endl; | |
81bba717 | 364 | cout << "Zero Determinant!" << endl; |
7fd59977 | 365 | cout << "*****************" << endl; |
366 | #ifdef TRACE_VALUES | |
81bba717 | 367 | cout << "Zero Determinant !" << endl; |
7fd59977 | 368 | #endif |
369 | AVertex.Coord (X2, Y2, Z2); | |
370 | CurPoint.SetCoord (X2, Y2, Z2); | |
371 | } | |
372 | } // IsRectangular | |
373 | else { | |
374 | Standard_Real RS; | |
375 | Standard_Integer DN; | |
376 | Standard_Real Alpha; | |
377 | Handle(Aspect_CircularGrid) theGrid = | |
378 | *(Handle(Aspect_CircularGrid) *) &MyGrid; | |
379 | RS = theGrid->RadiusStep (); | |
380 | DN = theGrid->DivisionNumber (); | |
381 | Alpha = Standard_PI / Standard_Real (DN); | |
382 | ||
383 | Standard_Real DistOP = Sqrt (XPp*XPp + YPp*YPp); | |
384 | ||
385 | Standard_Integer i, ICur=0; | |
386 | Standard_Real Angle, AngleCur; | |
387 | Standard_Real XCurp=0, YCurp=0; | |
388 | gp_Dir2d OP (XPp, YPp); | |
389 | AngleCur = 2 * Standard_PI; | |
390 | for (i=1; i<=DN*2; i++) { | |
391 | X1 = XO + Cos (Alpha * i) * RS, | |
392 | Y1 = YO + Sin (Alpha * i) * RS, | |
393 | Z1 = 0.0; | |
81bba717 | 394 | // MyTrsf * Point to return to the plane of 3D grid |
7fd59977 | 395 | P1.SetCoord (X1, Y1, Z1); |
396 | CurPoint = V3d_View::TrsPoint (P1, MyTrsf); | |
397 | CurPoint.Coord (X2, Y2, Z2); | |
398 | Project (X2, Y2, Z2, XAp, YAp); | |
399 | XAp = XAp - XOp, YAp = YAp - YOp; | |
400 | gp_Dir2d OA (XAp, YAp); | |
401 | Angle = OP.Angle (OA); | |
402 | if (Abs (AngleCur) > Abs (Angle)) { | |
403 | ICur = i; | |
404 | AngleCur = Angle; | |
405 | XCurp = XAp, YCurp = YAp; | |
406 | #ifdef TRACE_VALUES | |
81bba717 | 407 | cout << "Angle between OP and O" << CAR [i-1] |
7fd59977 | 408 | << " : " << Angle << endl; |
409 | #endif | |
410 | } | |
411 | ||
412 | #ifdef TRACE_POINTS | |
413 | MyGridEchoGroup->Text (CAR [i-1], CurPoint, 1./81.); | |
414 | #endif | |
415 | } // for (i=1; i<=DN*2; i++) | |
416 | ||
417 | Standard_Real DistOCur = Sqrt (XCurp*XCurp + YCurp*YCurp); | |
418 | ||
81bba717 | 419 | // Determination of the circle of the grid closest to P |
7fd59977 | 420 | Standard_Integer N = Standard_Integer (DistOP / DistOCur + 0.5); |
421 | Standard_Real Radius = N * RS; | |
422 | #ifdef TRACE_VALUES | |
81bba717 | 423 | cout << "Circle : " << N << " Radius : " << Radius << endl; |
7fd59977 | 424 | #endif |
425 | ||
426 | X1 = Cos (Alpha * ICur) * Radius, | |
427 | Y1 = Sin (Alpha * ICur) * Radius, | |
428 | Z1 = 0.0; | |
429 | ||
430 | #ifdef TRACE_VALUES | |
81bba717 | 431 | cout << "Chosen Point : " << X1 << ", " << Y1 << endl; |
7fd59977 | 432 | #endif |
81bba717 | 433 | // MyTrsf * Point to return to the plane of 3D grid |
7fd59977 | 434 | P1.SetCoord (X1, Y1, Z1); |
435 | CurPoint = V3d_View::TrsPoint (P1, MyTrsf); | |
436 | CurPoint.Coord (X2, Y2, Z2); | |
437 | } // IsCircular | |
438 | ||
439 | NewPoint.SetCoord (CurPoint.X (), CurPoint.Y (), CurPoint.Z ()); | |
440 | ||
441 | #ifdef TRACE_POINTS | |
442 | TextAttrib->SetColor (Quantity_Color (Quantity_NOC_RED)); | |
443 | MyGridEchoGroup->SetPrimitivesAspect (TextAttrib); | |
444 | MyGridEchoGroup->Text ("Q", NewPoint, 1./81.); | |
445 | MyGridEchoGroup->Polyline (AVertex, NewPoint); | |
446 | Update (); | |
447 | #endif | |
448 | #ifdef IMP240100 | |
449 | MyViewer->ShowGridEcho(this,NewPoint); | |
450 | #else | |
451 | #ifdef TRACE_ECHO | |
452 | char *trace_echo = NULL; | |
453 | trace_echo = (char *)(getenv ("CSF_GraphicEcho")); | |
454 | if (trace_echo) { | |
455 | MyGridEchoGroup->Clear (); | |
456 | MyGridEchoGroup->Marker (NewPoint); | |
457 | Visual3d_TransientManager::BeginDraw | |
458 | (MyView, Standard_False, Standard_False); | |
459 | Visual3d_TransientManager::DrawStructure (MyGridEchoStructure); | |
460 | Visual3d_TransientManager::EndDraw (Standard_True); | |
461 | } | |
462 | #endif | |
463 | #endif //IMP240100 | |
464 | return NewPoint; | |
465 | } | |
466 | ||
467 | // Triedron methods : the Triedron is a non-zoomable object. | |
468 | ||
469 | void V3d_View::ZBufferTriedronSetup(const Quantity_NameOfColor XColor, | |
470 | const Quantity_NameOfColor YColor, | |
471 | const Quantity_NameOfColor ZColor, | |
472 | const Standard_Real SizeRatio, | |
473 | const Standard_Real AxisDiametr, | |
474 | const Standard_Integer NbFacettes) | |
475 | { | |
476 | MyView->ZBufferTriedronSetup(XColor, YColor, ZColor, SizeRatio, AxisDiametr, NbFacettes); | |
477 | } | |
478 | ||
479 | void V3d_View::TriedronDisplay (const Aspect_TypeOfTriedronPosition APosition, | |
480 | const Quantity_NameOfColor AColor, const Standard_Real AScale, const V3d_TypeOfVisualization AMode ) { | |
481 | ||
482 | MyView->TriedronDisplay (APosition, AColor, AScale, (AMode == V3d_WIREFRAME)); | |
483 | } | |
484 | ||
485 | void V3d_View::TriedronErase ( ) { | |
486 | ||
487 | MyView->TriedronErase ( ); | |
488 | } | |
489 | ||
490 | void V3d_View::TriedronEcho (const Aspect_TypeOfTriedronEcho AType ) { | |
491 | ||
492 | MyView->TriedronEcho (AType); | |
493 | } | |
494 | ||
495 | void V3d_View::GetGraduatedTrihedron(/* Names of axes */ | |
13a22457 S |
496 | TCollection_ExtendedString &xname, |
497 | TCollection_ExtendedString &yname, | |
498 | TCollection_ExtendedString &zname, | |
7fd59977 | 499 | /* Draw names */ |
500 | Standard_Boolean& xdrawname, | |
501 | Standard_Boolean& ydrawname, | |
502 | Standard_Boolean& zdrawname, | |
503 | /* Draw values */ | |
504 | Standard_Boolean& xdrawvalues, | |
505 | Standard_Boolean& ydrawvalues, | |
506 | Standard_Boolean& zdrawvalues, | |
507 | /* Draw grid */ | |
508 | Standard_Boolean& drawgrid, | |
509 | /* Draw axes */ | |
510 | Standard_Boolean& drawaxes, | |
511 | /* Number of splits along axes */ | |
512 | Standard_Integer& nbx, | |
513 | Standard_Integer& nby, | |
514 | Standard_Integer& nbz, | |
515 | /* Offset for drawing values */ | |
516 | Standard_Integer& xoffset, | |
517 | Standard_Integer& yoffset, | |
518 | Standard_Integer& zoffset, | |
519 | /* Offset for drawing names of axes */ | |
520 | Standard_Integer& xaxisoffset, | |
521 | Standard_Integer& yaxisoffset, | |
522 | Standard_Integer& zaxisoffset, | |
523 | /* Draw tickmarks */ | |
524 | Standard_Boolean& xdrawtickmarks, | |
525 | Standard_Boolean& ydrawtickmarks, | |
526 | Standard_Boolean& zdrawtickmarks, | |
527 | /* Length of tickmarks */ | |
528 | Standard_Integer& xtickmarklength, | |
529 | Standard_Integer& ytickmarklength, | |
530 | Standard_Integer& ztickmarklength, | |
531 | /* Grid color */ | |
532 | Quantity_Color& gridcolor, | |
533 | /* X name color */ | |
534 | Quantity_Color& xnamecolor, | |
535 | /* Y name color */ | |
536 | Quantity_Color& ynamecolor, | |
537 | /* Z name color */ | |
538 | Quantity_Color& znamecolor, | |
539 | /* X color of axis and values */ | |
540 | Quantity_Color& xcolor, | |
541 | /* Y color of axis and values */ | |
542 | Quantity_Color& ycolor, | |
543 | /* Z color of axis and values */ | |
544 | Quantity_Color& zcolor, | |
545 | /* Name of font for names of axes */ | |
13a22457 | 546 | TCollection_AsciiString &fontOfNames, |
7fd59977 | 547 | /* Style of names of axes */ |
548 | OSD_FontAspect& styleOfNames, | |
549 | /* Size of names of axes */ | |
550 | Standard_Integer& sizeOfNames, | |
551 | /* Name of font for values */ | |
13a22457 | 552 | TCollection_AsciiString &fontOfValues, |
7fd59977 | 553 | /* Style of values */ |
554 | OSD_FontAspect& styleOfValues, | |
555 | /* Size of values */ | |
556 | Standard_Integer& sizeOfValues) const | |
557 | { | |
558 | MyView->GetGraduatedTrihedron(/* Names of axes */ | |
559 | xname, | |
560 | yname, | |
561 | zname, | |
562 | /* Draw names */ | |
563 | xdrawname, | |
564 | ydrawname, | |
565 | zdrawname, | |
566 | /* Draw values */ | |
567 | xdrawvalues, | |
568 | ydrawvalues, | |
569 | zdrawvalues, | |
570 | /* Draw grid */ | |
571 | drawgrid, | |
572 | /* Draw axes */ | |
573 | drawaxes, | |
574 | /* Number of splits along axes */ | |
575 | nbx, | |
576 | nby, | |
577 | nbz, | |
578 | /* Offset for drawing values */ | |
579 | xoffset, | |
580 | yoffset, | |
581 | zoffset, | |
582 | /* Offset for drawing names of axes */ | |
583 | xaxisoffset, | |
584 | yaxisoffset, | |
585 | zaxisoffset, | |
586 | /* Draw tickmarks */ | |
587 | xdrawtickmarks, | |
588 | ydrawtickmarks, | |
589 | zdrawtickmarks, | |
590 | /* Length of tickmarks */ | |
591 | xtickmarklength, | |
592 | ytickmarklength, | |
593 | ztickmarklength, | |
594 | /* Grid color */ | |
595 | gridcolor, | |
596 | /* X name color */ | |
597 | xnamecolor, | |
598 | /* Y name color */ | |
599 | ynamecolor, | |
600 | /* Z name color */ | |
601 | znamecolor, | |
602 | /* X color of axis and values */ | |
603 | xcolor, | |
604 | /* Y color of axis and values */ | |
605 | ycolor, | |
606 | /* Z color of axis and values */ | |
607 | zcolor, | |
608 | /* Name of font for names of axes */ | |
609 | fontOfNames, | |
610 | /* Style of names of axes */ | |
611 | styleOfNames, | |
612 | /* Size of names of axes */ | |
613 | sizeOfNames, | |
614 | /* Name of font for values */ | |
615 | fontOfValues, | |
616 | /* Style of values */ | |
617 | styleOfValues, | |
618 | /* Size of values */ | |
619 | sizeOfValues); | |
620 | } | |
621 | ||
622 | void V3d_View::GraduatedTrihedronDisplay(/* Names of axes */ | |
13a22457 S |
623 | const TCollection_ExtendedString &xname, |
624 | const TCollection_ExtendedString &yname, | |
625 | const TCollection_ExtendedString &zname, | |
7fd59977 | 626 | /* Draw names */ |
627 | const Standard_Boolean xdrawname, | |
628 | const Standard_Boolean ydrawname, | |
629 | const Standard_Boolean zdrawname, | |
630 | /* Draw values */ | |
631 | const Standard_Boolean xdrawvalues, | |
632 | const Standard_Boolean ydrawvalues, | |
633 | const Standard_Boolean zdrawvalues, | |
634 | /* Draw grid */ | |
635 | const Standard_Boolean drawgrid, | |
636 | /* Draw axes */ | |
637 | const Standard_Boolean drawaxes, | |
638 | /* Number of splits along axes */ | |
639 | const Standard_Integer nbx, | |
640 | const Standard_Integer nby, | |
641 | const Standard_Integer nbz, | |
642 | /* Offset for drawing values */ | |
643 | const Standard_Integer xoffset, | |
644 | const Standard_Integer yoffset, | |
645 | const Standard_Integer zoffset, | |
646 | /* Offset for drawing names of axes */ | |
647 | const Standard_Integer xaxisoffset, | |
648 | const Standard_Integer yaxisoffset, | |
649 | const Standard_Integer zaxisoffset, | |
650 | /* Draw tickmarks */ | |
651 | const Standard_Boolean xdrawtickmarks, | |
652 | const Standard_Boolean ydrawtickmarks, | |
653 | const Standard_Boolean zdrawtickmarks, | |
654 | /* Length of tickmarks */ | |
655 | const Standard_Integer xtickmarklength, | |
656 | const Standard_Integer ytickmarklength, | |
657 | const Standard_Integer ztickmarklength, | |
658 | /* Grid color */ | |
659 | const Quantity_Color& gridcolor, | |
660 | /* X name color */ | |
661 | const Quantity_Color& xnamecolor, | |
662 | /* Y name color */ | |
663 | const Quantity_Color& ynamecolor, | |
664 | /* Z name color */ | |
665 | const Quantity_Color& znamecolor, | |
666 | /* X color of axis and values */ | |
667 | const Quantity_Color& xcolor, | |
668 | /* Y color of axis and values */ | |
669 | const Quantity_Color& ycolor, | |
670 | /* Z color of axis and values */ | |
671 | const Quantity_Color& zcolor, | |
672 | /* Name of font for names of axes */ | |
13a22457 | 673 | const TCollection_AsciiString &fontOfNames, |
7fd59977 | 674 | /* Style of names of axes */ |
675 | const OSD_FontAspect styleOfNames, | |
676 | /* Size of names of axes */ | |
677 | const Standard_Integer sizeOfNames, | |
678 | /* Name of font for values */ | |
13a22457 | 679 | const TCollection_AsciiString &fontOfValues, |
7fd59977 | 680 | /* Style of values */ |
681 | const OSD_FontAspect styleOfValues, | |
682 | /* Size of values */ | |
683 | const Standard_Integer sizeOfValues) | |
684 | { | |
685 | MyView->GraduatedTrihedronDisplay(/* Names of axes */ | |
686 | xname, | |
687 | yname, | |
688 | zname, | |
689 | /* Draw names */ | |
690 | xdrawname, | |
691 | ydrawname, | |
692 | zdrawname, | |
693 | /* Draw values */ | |
694 | xdrawvalues, | |
695 | ydrawvalues, | |
696 | zdrawvalues, | |
697 | /* Draw grid */ | |
698 | drawgrid, | |
699 | /* Draw axes */ | |
700 | drawaxes, | |
701 | /* Number of splits along axes */ | |
702 | nbx, | |
703 | nby, | |
704 | nbz, | |
705 | /* Offset for drawing values */ | |
706 | xoffset, | |
707 | yoffset, | |
708 | zoffset, | |
709 | /* Offset for drawing names of axes */ | |
710 | xaxisoffset, | |
711 | yaxisoffset, | |
712 | zaxisoffset, | |
713 | /* Draw tickmarks */ | |
714 | xdrawtickmarks, | |
715 | ydrawtickmarks, | |
716 | zdrawtickmarks, | |
717 | /* Length of tickmarks */ | |
718 | xtickmarklength, | |
719 | ytickmarklength, | |
720 | ztickmarklength, | |
721 | /* Grid color */ | |
722 | gridcolor, | |
723 | /* X name color */ | |
724 | xnamecolor, | |
725 | /* Y name color */ | |
726 | ynamecolor, | |
727 | /* Z name color */ | |
728 | znamecolor, | |
729 | /* X color of axis and values */ | |
730 | xcolor, | |
731 | /* Y color of axis and values */ | |
732 | ycolor, | |
733 | /* Z color of axis and values */ | |
734 | zcolor, | |
735 | /* Name of font for names of axes */ | |
736 | fontOfNames, | |
737 | /* Style of names of axes */ | |
738 | styleOfNames, | |
739 | /* Size of names of axes */ | |
740 | sizeOfNames, | |
741 | /* Name of font for values */ | |
742 | fontOfValues, | |
743 | /* Style of values */ | |
744 | styleOfValues, | |
745 | /* Size of values */ | |
746 | sizeOfValues); | |
747 | } | |
748 | ||
749 | void V3d_View::GraduatedTrihedronErase() | |
750 | { | |
751 | MyView->GraduatedTrihedronErase(); | |
752 | } |