0025773: Visualization - remove AIS_Drawer class and transfer its Link() logic to...
[occt.git] / src / AIS / AIS_Trihedron.cxx
1 // Created on: 1995-10-09
2 // Created by: Arnaud BOUZY/Odile Olivier
3 // Copyright (c) 1995-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #include <AIS_Trihedron.ixx>
18 #include <DsgPrs_DatumPrs.hxx>
19 #include <SelectBasics_EntityOwner.hxx>
20 #include <SelectMgr_EntityOwner.hxx>
21 #include <Select3D_SensitiveSegment.hxx>
22 #include <Select3D_SensitiveFace.hxx>
23 #include <Select3D_SensitivePoint.hxx>
24 #include <Geom_Axis2Placement.hxx>
25 #include <Geom_Line.hxx>
26 #include <Geom_Point.hxx>
27 #include <Geom_Plane.hxx>
28 #include <Geom_CartesianPoint.hxx>
29 #include <gp_Dir.hxx>
30 #include <gp_Ax1.hxx>
31 #include <gp_Ax2.hxx>
32 #include <gp_Pnt.hxx>
33 #include <gp_Vec.hxx>
34 #include <Prs3d_Drawer.hxx>
35 #include <Prs3d_LineAspect.hxx>
36 #include <Prs3d_TextAspect.hxx>
37 #include <Prs3d_ArrowAspect.hxx>
38 #include <Prs3d_DatumAspect.hxx>
39 #include <Graphic3d_AspectLine3d.hxx>
40 #include <Graphic3d_Structure.hxx>
41 #include <Graphic3d_MaterialAspect.hxx>
42 #include <Graphic3d_AspectFillArea3d.hxx>
43 #include <Aspect_TypeOfLine.hxx>
44 #include <AIS_Plane.hxx>
45 #include <AIS_Axis.hxx>
46 #include <AIS_Point.hxx>
47 #include <UnitsAPI.hxx>
48
49 #include <Select3D_SensitiveBox.hxx>
50 #include <Select3D_SensitiveTriangle.hxx>
51 #include <TColgp_Array1OfPnt.hxx>
52
53
54
55 //=======================================================================
56 //function : AIS_Trihedron
57 //purpose  : 
58 //=======================================================================
59 AIS_Trihedron::AIS_Trihedron(const Handle(Geom_Axis2Placement)& aComponent):
60 myComponent(aComponent),
61 myHasOwnSize(Standard_False),
62 myHasOwnTextColor(Standard_False),
63 myHasOwnArrowColor(Standard_False)
64
65 {  LoadSubObjects();}
66
67
68
69 //=======================================================================
70 //function : SetComponent
71 //purpose  : 
72 //=======================================================================
73
74 void AIS_Trihedron::SetComponent(const Handle(Geom_Axis2Placement)& aComponent)
75 {
76   myComponent = aComponent;
77
78   // Remove from current context and nullify objects to update
79   Handle(AIS_InteractiveContext) anAISContext = GetContext();
80   Standard_Boolean hasContext = (anAISContext.IsNull() == Standard_False);
81   Standard_Integer anIdx;
82   for (anIdx = 0; anIdx < 7; anIdx++)
83   {
84     // Deselect object
85     if (hasContext)
86     {
87       if (anAISContext->IsSelected (myShapes[anIdx]))
88         anAISContext->AddOrRemoveSelected (myShapes[anIdx], Standard_False);
89
90       anAISContext->Remove (myShapes[anIdx], Standard_False);
91     }
92     myShapes[anIdx].Nullify();
93   }
94
95   LoadSubObjects();
96 }
97
98 //=======================================================================
99 //function : SetLocation
100 //purpose  : 
101 //=======================================================================
102
103 void AIS_Trihedron::SetLocalTransformation (const gp_Trsf& theTransformation)
104 {
105   // Update location to the subshapes
106   Standard_Integer anIdx;
107   for (anIdx = 0; anIdx < 7; anIdx++)
108     myShapes[anIdx]->SetLocalTransformation (theTransformation);
109
110   AIS_InteractiveObject::SetLocalTransformation (theTransformation);
111 }
112
113 //=======================================================================
114 //function : SetSize
115 //purpose  : 
116 //=======================================================================
117 void AIS_Trihedron::SetSize(const Standard_Real aValue)
118 {
119   myHasOwnSize = Standard_True;
120   if(!myDrawer->HasOwnDatumAspect()){
121     Handle (Prs3d_DatumAspect) DA = new Prs3d_DatumAspect();
122     myDrawer->SetDatumAspect(DA);
123   }
124   
125   myDrawer->DatumAspect()->SetAxisLength(aValue,aValue,aValue);
126   
127   for(Standard_Integer i=4;i<=6;i++) 
128     (*((Handle(AIS_Plane)*)&myShapes[i]))->SetSize(aValue);
129
130   Update();
131   UpdateSelection();
132 }
133
134
135
136 //=======================================================================
137 //function : UnsetSize
138 //purpose  : if the object has 1 color, the default size of the 
139 //           drawer is reproduced, otherwise DatumAspect becomes null
140 //=======================================================================
141
142 void AIS_Trihedron::UnsetSize()
143 {
144   if(!myHasOwnSize) return;
145   
146   myHasOwnSize = Standard_False;
147   if(hasOwnColor){
148     const Handle(Prs3d_DatumAspect) DA =
149       myDrawer->HasLink() ? myDrawer->Link()->DatumAspect() : new Prs3d_DatumAspect();
150     myDrawer->DatumAspect()->SetAxisLength(DA->FirstAxisLength(),
151                                            DA->SecondAxisLength(),
152                                            DA->ThirdAxisLength());
153   }
154   else
155   {
156     myDrawer->SetDatumAspect (Handle(Prs3d_DatumAspect)());
157   }
158   Update();
159   UpdateSelection();
160
161 }
162
163 //=======================================================================
164 //function : Size
165 //purpose  : 
166 //=======================================================================
167
168 Standard_Real AIS_Trihedron::Size() const 
169 {
170   return myDrawer->DatumAspect()->FirstAxisLength();
171 }
172
173 //=======================================================================
174 //function : XAxis
175 //purpose  : 
176 //=======================================================================
177 Handle(AIS_Axis) AIS_Trihedron::XAxis() const 
178 {
179   Handle(AIS_Axis) anAxis = Handle(AIS_Axis)::DownCast(myShapes[1]);
180   if (anAxis.IsNull()) anAxis = new AIS_Axis (myComponent,AIS_TOAX_XAxis);
181   return anAxis;
182 }
183
184 //=======================================================================
185 //function : YAxis
186 //purpose  : 
187 //=======================================================================
188 Handle(AIS_Axis) AIS_Trihedron::YAxis() const 
189 {
190   Handle(AIS_Axis) anAxis = Handle(AIS_Axis)::DownCast(myShapes[2]);
191   if (anAxis.IsNull()) anAxis = new AIS_Axis (myComponent,AIS_TOAX_YAxis);
192   return anAxis;
193 }
194
195 //=======================================================================
196 //function : Axis
197 //purpose  : 
198 //=======================================================================
199 Handle(AIS_Axis) AIS_Trihedron::Axis() const 
200 {
201   Handle(AIS_Axis) anAxis = Handle(AIS_Axis)::DownCast(myShapes[3]);
202   if (anAxis.IsNull()) anAxis = new AIS_Axis (myComponent,AIS_TOAX_ZAxis);
203   return anAxis;
204 }
205
206 //=======================================================================
207 //function : Position
208 //purpose  : 
209 //=======================================================================
210 Handle(AIS_Point) AIS_Trihedron::Position() const 
211 {
212   Handle(AIS_Point) aPt = Handle(AIS_Point)::DownCast(myShapes[0]);
213   if (aPt.IsNull()) {
214     gp_Pnt aPnt = myComponent->Ax2().Location();
215     Handle(Geom_Point) aPoint = new Geom_CartesianPoint(aPnt);
216     aPt = new AIS_Point (aPoint);
217   }
218   return aPt;
219 }
220
221 //=======================================================================
222 //function : XYPlane
223 //purpose  : 
224 //=======================================================================
225 Handle(AIS_Plane) AIS_Trihedron::XYPlane() const 
226 {
227   Handle(AIS_Plane) aPl = Handle(AIS_Plane)::DownCast(myShapes[4]);
228   if (aPl.IsNull()) aPl = new AIS_Plane (myComponent,AIS_TOPL_XYPlane);
229   return aPl;
230 }
231
232 //=======================================================================
233 //function : XZPlane
234 //purpose  : 
235 //=======================================================================
236 Handle(AIS_Plane) AIS_Trihedron::XZPlane() const 
237 {
238   Handle(AIS_Plane) aPl = Handle(AIS_Plane)::DownCast(myShapes[5]);
239   if (aPl.IsNull()) aPl = new AIS_Plane (myComponent,AIS_TOPL_XZPlane);
240   return aPl;
241 }
242
243 //=======================================================================
244 //function : YZPlane
245 //purpose  : 
246 //=======================================================================
247 Handle(AIS_Plane) AIS_Trihedron::YZPlane() const 
248 {
249   Handle(AIS_Plane) aPl = Handle(AIS_Plane)::DownCast(myShapes[6]);
250   if (aPl.IsNull()) aPl = new AIS_Plane (myComponent,AIS_TOPL_YZPlane);
251   return aPl;
252 }
253
254 //=======================================================================
255 //function : Compute
256 //purpose  : 
257 //=======================================================================
258 void AIS_Trihedron::Compute(
259  const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
260  const Handle(Prs3d_Presentation)& aPresentation, 
261  const Standard_Integer aMode)
262 {
263   aPresentation->Clear();
264
265   aPresentation->SetInfiniteState (Standard_True);
266   switch(aMode){
267   case 0: 
268     DsgPrs_DatumPrs::Add(aPresentation,myComponent->Ax2(),myDrawer);
269     break;
270   case 1:
271     break;
272   case 2:
273     break;
274   }
275 }
276
277 //=======================================================================
278 //function : Compute
279 //purpose  : 
280 //=======================================================================
281
282 void AIS_Trihedron::Compute(const Handle(Prs3d_Projector)& aProjector,
283                             const Handle(Geom_Transformation)& aTransformation,
284                             const Handle(Prs3d_Presentation)& aPresentation)
285 {
286 // Standard_NotImplemented::Raise("AIS_Trihedron::Compute(const Handle(Prs3d_Projector)&, const Handle(Geom_Transformation)&, const Handle(Prs3d_Presentation)&)");
287  PrsMgr_PresentableObject::Compute( aProjector , aTransformation , aPresentation) ;
288 }
289
290 //=======================================================================
291 //function : ComputeSelection
292 //purpose  : 
293 //=======================================================================
294
295 void AIS_Trihedron::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
296                                      const Standard_Integer aMode)
297 {
298   // retrieve the tops of the trihedron.
299   Standard_Integer Prior, anIdx;
300   Handle(SelectMgr_EntityOwner) eown;
301   TColgp_Array1OfPnt PP(1,4),PO(1,4);
302   ExtremityPoints(PP);
303
304   // remove shapes from active selections
305   Handle(AIS_InteractiveContext) anAISContext = GetContext();
306   if (!anAISContext.IsNull())
307     for (anIdx = 0; anIdx < 7; anIdx++)
308     {
309       // Deselect object
310       if (anAISContext->IsSelected (myShapes[anIdx]))
311         anAISContext->AddOrRemoveSelected (myShapes[anIdx], Standard_False);
312
313       anAISContext->Remove (myShapes[anIdx], Standard_False);
314     }
315   
316   switch (aMode) {
317   case 0:
318     {   // complete triedron only 1 owner : this... priority 5 (same as faces)
319       Prior = 5;
320       eown = new SelectMgr_EntityOwner(this,Prior);
321       for (Standard_Integer i=1; i<=3;i++)
322         aSelection->Add(new Select3D_SensitiveSegment(eown,PP(1),PP(i+1)));
323       break;
324     }
325   case 1:
326     {  //origin : 
327       Prior = 8;
328       eown= new SelectMgr_EntityOwner(myShapes[0],Prior);
329       
330       aSelection->Add(new Select3D_SensitivePoint (eown,myComponent->Location()));
331       // If the trihedron's shapes display and selection modes are the same
332       // the shapes are still displayed after selection, so we need to
333       // use different presentation and hide it by nullifying
334       if (!anAISContext.IsNull())
335       {
336         anAISContext->Display (myShapes[0], 1, 0, Standard_False);
337         anAISContext->ClearPrs (myShapes[0], 1, Standard_False);
338       }
339       
340       break;
341     }
342   case 2:
343     {  //axes ... priority 7
344       Prior = 7;
345       for (Standard_Integer i=1; i<=3;i++){
346         eown= new SelectMgr_EntityOwner(myShapes[i],Prior);
347         aSelection->Add(new Select3D_SensitiveSegment(eown,PP(1),PP(i+1)));
348
349       }
350
351       // If the trihedron's shapes display and selection modes are the same
352       // the shapes are still displayed after selection, so we need to
353       // use different presentation and hide it by nullifying
354       AIS_TypeOfAxis anAxisType;
355       if (!anAISContext.IsNull())
356         for (anIdx = 1; anIdx <= 3; anIdx++)
357         {
358           // update AIS_Axis for selection
359           Handle(AIS_Axis) anAxis = Handle(AIS_Axis)::DownCast(myShapes[anIdx]);
360           Handle(Prs3d_Drawer) aDrawer = anAxis->Attributes();
361           Handle(Prs3d_DatumAspect) aDatum = myDrawer->DatumAspect();
362           aDrawer->DatumAspect()->SetAxisLength (aDatum->FirstAxisLength(),
363                                                  aDatum->SecondAxisLength(),
364                                                  aDatum->ThirdAxisLength());
365           anAxisType = anAxis->TypeOfAxis();
366           anAxis->SetAxis2Placement (myComponent, anAxisType);
367
368           // display
369           anAISContext->Display (myShapes[anIdx], 1, 0, Standard_False);
370           anAISContext->ClearPrs (myShapes[anIdx], 1, Standard_False);
371         }
372       
373       break;
374     }
375     
376   case 3:
377     {  // main planes priority 6
378 //      PO(1) = PP(1);
379 //      PO(4) = PP(1);
380       Prior =5;
381       
382       
383       eown= new SelectMgr_EntityOwner(myShapes[4],Prior);
384 //      PO(2) = PP(2);PO(3) = PP(3);
385       aSelection->Add(new Select3D_SensitiveTriangle(eown,PP(1),PP(2),PP(3)));
386
387       eown= new SelectMgr_EntityOwner(myShapes[5],Prior);
388 //      PO(2) = PP(3);PO(3) = PP(4);
389       aSelection->Add(new Select3D_SensitiveTriangle(eown,PP(1),PP(2),PP(4)));
390
391       eown= new SelectMgr_EntityOwner(myShapes[6],Prior);
392 //      PO(2) = PP(4);PO(3) = PP(2);
393       aSelection->Add(new Select3D_SensitiveTriangle(eown,PP(1),PP(3),PP(4)));
394       
395       // If the trihedron's shapes display and selection modes are the same
396       // the shapes are still displayed after selection, so we need to
397       // use different presentation and hide it by nullifying
398       if (!anAISContext.IsNull())
399         for (anIdx = 4; anIdx < 7; anIdx++)
400         {
401           anAISContext->Display (myShapes[anIdx], 1, 0, Standard_False);
402           anAISContext->ClearPrs (myShapes[anIdx], 1, Standard_False);
403         }
404     }
405   }
406   
407 }
408
409 //=======================================================================
410 //function : SetColor
411 //purpose  : 
412 //=======================================================================
413
414 void AIS_Trihedron::SetColor(const Quantity_NameOfColor aCol)
415 {
416   SetColor(Quantity_Color(aCol));
417 }
418
419 void AIS_Trihedron::SetColor(const Quantity_Color &aCol)
420 {
421   hasOwnColor=Standard_True;
422   myOwnColor = aCol;
423   
424   if(!myDrawer->HasOwnDatumAspect()){
425     Handle (Prs3d_DatumAspect) DA = new Prs3d_DatumAspect();
426     
427     DA->SetAxisLength(myDrawer->DatumAspect()->FirstAxisLength(),
428                       myDrawer->DatumAspect()->SecondAxisLength(),
429                       myDrawer->DatumAspect()->ThirdAxisLength());
430     myDrawer->SetDatumAspect(DA);
431   }
432   myDrawer->DatumAspect()->FirstAxisAspect()->SetColor(aCol);
433   myDrawer->DatumAspect()->SecondAxisAspect()->SetColor(aCol);
434   myDrawer->DatumAspect()->ThirdAxisAspect()->SetColor(aCol);
435
436 }
437
438 //=======================================================================
439 //function : SetTextColor
440 //purpose  : 
441 //=======================================================================
442
443 void AIS_Trihedron::SetTextColor(const Quantity_NameOfColor aCol)
444 {
445   myHasOwnTextColor = Standard_True;
446   myOwnTextColor = aCol;
447   
448   if(!myDrawer->HasOwnDatumAspect()){
449     Handle (Prs3d_DatumAspect) DA = new Prs3d_DatumAspect();
450     
451     DA->SetAxisLength(myDrawer->DatumAspect()->FirstAxisLength(),
452                       myDrawer->DatumAspect()->SecondAxisLength(),
453                       myDrawer->DatumAspect()->ThirdAxisLength());
454     myDrawer->SetDatumAspect(DA);
455   }
456   Handle(Prs3d_TextAspect) aspect = myDrawer->TextAspect();
457   aspect->SetColor(aCol);
458   myDrawer->SetTextAspect(aspect);
459 }
460
461 void AIS_Trihedron::SetArrowColor(const Quantity_NameOfColor aCol)
462 {
463   myHasOwnArrowColor = Standard_True;
464   myOwnArrowColor = aCol;
465   
466   if(!myDrawer->HasOwnDatumAspect()){
467     Handle (Prs3d_DatumAspect) DA = new Prs3d_DatumAspect();
468     
469     DA->SetAxisLength(myDrawer->DatumAspect()->FirstAxisLength(),
470                       myDrawer->DatumAspect()->SecondAxisLength(),
471                       myDrawer->DatumAspect()->ThirdAxisLength());
472     myDrawer->SetDatumAspect(DA);
473   }
474   Handle(Prs3d_ArrowAspect) aspect = myDrawer->ArrowAspect();
475   aspect->SetColor(aCol);
476   myDrawer->SetArrowAspect(aspect);
477 }
478
479 //=======================================================================
480 Standard_Boolean AIS_Trihedron::HasTextColor() const {
481
482   return myHasOwnTextColor;
483 }
484
485 //=======================================================================
486 Quantity_NameOfColor AIS_Trihedron::TextColor() const {
487
488   return myOwnTextColor;
489 }
490
491 //=======================================================================
492 Standard_Boolean AIS_Trihedron::HasArrowColor() const {
493
494   return myHasOwnArrowColor;
495 }
496
497 //=======================================================================
498 Quantity_NameOfColor AIS_Trihedron::ArrowColor() const {
499
500   return myOwnArrowColor;
501 }
502
503
504 //=======================================================================
505 //function : Compute
506 //purpose  : to avoid warning
507 //=======================================================================
508 void AIS_Trihedron::Compute(const Handle(Prs3d_Projector)&, 
509                                const Handle(Prs3d_Presentation)&)
510 {
511 }
512 //=======================================================================
513 //function : Type
514 //purpose  : 
515 //=======================================================================
516
517 AIS_KindOfInteractive AIS_Trihedron::Type() const 
518 {return AIS_KOI_Datum;}
519
520
521 //=======================================================================
522 //function : Signature
523 //purpose  : 
524 //=======================================================================
525
526  Standard_Integer AIS_Trihedron::Signature() const 
527 {return 3;}
528
529 //=======================================================================
530 //function : ExtremityPoints
531 //purpose  : to avoid warning
532 //=======================================================================
533 void  AIS_Trihedron::ExtremityPoints(TColgp_Array1OfPnt& PP) const 
534 {
535   gp_Ax2 theax(myComponent->Ax2());
536   PP(1) = theax.Location();
537
538   Standard_Real len = myDrawer->DatumAspect()->FirstAxisLength();
539   gp_Vec vec = theax.XDirection();
540   vec *= len;
541   PP(2) = PP(1).Translated(vec);
542   
543   len = myDrawer->DatumAspect()->SecondAxisLength();
544   vec = theax.YDirection();
545   vec *= len;
546   PP(3) = PP(1).Translated(vec);
547
548   len = myDrawer->DatumAspect()->ThirdAxisLength();
549   vec = theax.Direction();
550   vec *= len;
551   PP(4) = PP(1).Translated(vec);
552 }
553
554 //=======================================================================
555 //function : AcceptDisplayMode
556 //purpose  : 
557 //=======================================================================
558
559  Standard_Boolean  AIS_Trihedron::
560 AcceptDisplayMode(const Standard_Integer aMode) const
561 {return aMode == 0;}
562
563
564
565 //=======================================================================
566 //function : UnsetColor
567 //purpose  : 
568 //=======================================================================
569
570 void AIS_Trihedron::UnsetColor()
571 {
572   hasOwnColor=Standard_False;
573   myOwnColor = Quantity_NOC_LIGHTSTEELBLUE4;
574   myDrawer->DatumAspect()->FirstAxisAspect()->SetColor(myOwnColor);
575   myDrawer->DatumAspect()->SecondAxisAspect()->SetColor(myOwnColor);
576   myDrawer->DatumAspect()->ThirdAxisAspect()->SetColor(myOwnColor);
577   if( HasTextColor() ) {
578     SetTextColor(myOwnColor.Name());
579     myHasOwnTextColor = Standard_False;
580   }
581   if( HasArrowColor() ) {
582     SetArrowColor(myOwnColor.Name());
583     myHasOwnArrowColor = Standard_False;
584   }
585   
586 }
587
588 //=======================================================================
589 //function : UnsetWitdth
590 //purpose  : 
591 //=======================================================================
592
593 void AIS_Trihedron::UnsetWidth()
594 {
595   myOwnWidth =0.0;
596   myDrawer->DatumAspect()->FirstAxisAspect()->SetWidth(1.);
597   myDrawer->DatumAspect()->SecondAxisAspect()->SetWidth(1.);
598   myDrawer->DatumAspect()->ThirdAxisAspect()->SetWidth(1.);
599
600 }
601 void AIS_Trihedron::LoadSubObjects()
602 {
603   myShapes[0] = Position();
604   myShapes[1] = XAxis();
605   myShapes[2] = YAxis();
606   myShapes[3] = Axis();
607   myShapes[4] = XYPlane();
608   myShapes[5] = XZPlane();
609   myShapes[6] = YZPlane();
610 }
611
612 //=======================================================================
613 //function : SetContext
614 //purpose  : 
615 //=======================================================================
616
617 void AIS_Trihedron::SetContext(const Handle(AIS_InteractiveContext)& Ctx)
618 {
619 //  Standard_Boolean same_DA = myDrawer->Link() == Ctx->DefaultDrawer();
620    
621    if( Ctx.IsNull())
622    {
623       Standard_Integer anIdx;
624       for (anIdx = 0; anIdx < 7; anIdx++)
625       {
626         myShapes[anIdx]->SetContext(Ctx);
627       }
628      AIS_InteractiveObject::SetContext (Ctx);
629      return;
630    }
631   // Remove subobjects from current context
632   Handle(AIS_InteractiveContext) anAISContext = GetContext();
633   
634   Standard_Boolean hasContext = (anAISContext.IsNull() == Standard_False);
635   Standard_Integer anIdx;
636   for (anIdx = 0; anIdx < 7; anIdx++)
637     {
638       // Deselect object
639       if (hasContext)
640         {
641           if (anAISContext->IsSelected (myShapes[anIdx]))
642             anAISContext->AddOrRemoveSelected (myShapes[anIdx]);
643           
644           anAISContext->Remove (myShapes[anIdx], Standard_False);
645         }
646       myShapes[anIdx].Nullify();
647     }
648  
649   AIS_InteractiveObject::SetContext (Ctx);
650   LoadSubObjects();
651   for(Standard_Integer i= 0;i<=6;i++)
652     myShapes[i]->SetContext (Ctx);
653 }