c67e2154fb911671ed37caf5a8c02b67d56a22fe
[occt.git] / src / AIS / AIS_Plane.cxx
1 // File:        AIS_Plane.cxx
2 // Created:     Wed Aug  2 16:20:31 1995
3 // Author:      Arnaud BOUZY/Odile Olivier
4 //              <adn>
5
6 #define GER61351                //GG_171199     Enable to set an object RGB color
7 //                                                instead a restricted object NameOfColor.
8
9 #include <AIS_Plane.ixx>
10
11 #include <TColgp_Array1OfPnt.hxx>
12 #include <TColgp_HArray1OfPnt.hxx>
13
14 #include <Precision.hxx>
15 #include <gp_Pnt.hxx>
16 #include <ElSLib.hxx>
17
18 #include <Graphic3d_Array1OfVertex.hxx>
19 #include <Graphic3d_Group.hxx>
20 #include <Prs3d_Drawer.hxx>
21 #include <Prs3d_LineAspect.hxx>
22 #include <Prs3d_PlaneAspect.hxx>
23 #include <Prs3d_DatumAspect.hxx>
24 #include <Prs3d_ShadingAspect.hxx>
25 #include <StdPrs_Plane.hxx>
26 #include <StdPrs_ShadedSurface.hxx>
27
28 #include <Geom_Plane.hxx>
29 #include <GeomAdaptor_Surface.hxx>
30
31 #include <Aspect_TypeOfLine.hxx>
32 #include <Graphic3d_AspectLine3d.hxx>
33 #include <Graphic3d_Structure.hxx>
34 #include <Graphic3d_MaterialAspect.hxx>
35 #include <Graphic3d_AspectFillArea3d.hxx>
36
37 #include <DsgPrs_XYZPlanePresentation.hxx>
38 #include <DsgPrs_ShadedPlanePresentation.hxx>
39 #include <UnitsAPI.hxx>
40
41 #include <SelectBasics_EntityOwner.hxx>
42 #include <SelectMgr_EntityOwner.hxx>
43 #include <Select3D_SensitiveFace.hxx>
44 #include <StdPrs_ShadedShape.hxx>
45
46 #include <AIS_Drawer.hxx>
47
48 #include <TCollection_AsciiString.hxx>
49
50 //=======================================================================
51 //function : AIS_Plane
52 //purpose  : 
53 //=======================================================================
54 AIS_Plane::AIS_Plane(const Handle(Geom_Plane)& aComponent,
55                      const Standard_Boolean aCurrentMode):
56 myComponent(aComponent),
57 myCenter(gp_Pnt(0.,0.,0.)),
58 myCurrentMode(aCurrentMode),
59 myAutomaticPosition(Standard_True),
60 myTypeOfPlane(AIS_TOPL_Unknown),
61 myIsXYZPlane(Standard_False)
62 {
63   InitDrawerAttributes();
64 }
65
66 //=======================================================================
67 //function : AIS_Plane 
68 //purpose  : avec une position
69 //=======================================================================
70 AIS_Plane::AIS_Plane(const Handle(Geom_Plane)& aComponent,
71                      const gp_Pnt& aCenter,
72                      const Standard_Boolean aCurrentMode):
73 myComponent(aComponent),
74 myCenter(aCenter),
75 myCurrentMode(aCurrentMode),
76 myAutomaticPosition(Standard_True),
77 myTypeOfPlane(AIS_TOPL_Unknown),
78 myIsXYZPlane(Standard_False)
79 {
80   InitDrawerAttributes();
81 }
82
83 //=======================================================================
84 //function : AIS_Plane
85 //purpose  : 
86 //=======================================================================
87 AIS_Plane::AIS_Plane(const Handle(Geom_Plane)& aComponent,
88                                const gp_Pnt& aCenter,
89                                const gp_Pnt& aPmin,
90                                const gp_Pnt& aPmax,
91                                const Standard_Boolean aCurrentMode):
92 myComponent(aComponent),
93 myCenter(aCenter),
94 myPmin(aPmin),
95 myPmax(aPmax),
96 myCurrentMode(aCurrentMode),
97 myAutomaticPosition(Standard_False),
98 myTypeOfPlane(AIS_TOPL_Unknown),
99 myIsXYZPlane(Standard_False)
100 {
101   InitDrawerAttributes();
102   SetHilightMode(0);
103 }
104
105 //=======================================================================
106 //function : AIS_Plane
107 //purpose  : XYPlane, XZPlane, YZPlane
108 //=======================================================================
109 AIS_Plane::AIS_Plane(const Handle(Geom_Axis2Placement)& aComponent,
110                      const AIS_TypeOfPlane aPlaneType,
111                      const Standard_Boolean aCurrentMode):
112 myAx2(aComponent),
113 myCurrentMode(aCurrentMode),
114 myAutomaticPosition(Standard_True),
115 myTypeOfPlane(aPlaneType),
116 myIsXYZPlane(Standard_True)
117 {
118   InitDrawerAttributes();
119   ComputeFields();
120   SetHilightMode(0);
121
122 }
123
124
125 //=======================================================================
126 //function : SetComponent
127 //purpose  : 
128 //=======================================================================
129
130 void AIS_Plane::SetComponent(const Handle(Geom_Plane)& aComponent)
131 {
132   myComponent = aComponent;
133   myTypeOfPlane = AIS_TOPL_Unknown;
134   myIsXYZPlane = Standard_False;
135   //myCenter = gp_Pnt(0.,0.,0.);
136   myAutomaticPosition = Standard_True;
137 }
138
139 //=======================================================================
140 //function : Type
141 //purpose  : 
142 //=======================================================================
143
144 AIS_KindOfInteractive AIS_Plane::Type() const 
145 {return AIS_KOI_Datum;}
146
147
148 //=======================================================================
149 //function : Signature
150 //purpose  : 
151 //=======================================================================
152
153 Standard_Integer AIS_Plane::Signature() const 
154 {return 7;}
155
156
157 //=======================================================================
158 //function : Axis2Placement
159 //purpose  : 
160 //=======================================================================
161
162 Handle(Geom_Axis2Placement) AIS_Plane::Axis2Placement()
163 {
164   Handle(Geom_Axis2Placement) Bid;
165   return IsXYZPlane() ? myAx2:Bid;
166 }
167 //=======================================================================
168 //function : SetAxis2Placement
169 //purpose  : 
170 //=======================================================================
171
172  void AIS_Plane::SetAxis2Placement(const Handle(Geom_Axis2Placement)& aComponent,
173                                    const AIS_TypeOfPlane aPlaneType)
174 {
175   myTypeOfPlane = aPlaneType;
176   myIsXYZPlane = Standard_True;
177   myAx2= aComponent;
178   myAutomaticPosition = Standard_True;
179   ComputeFields();
180 }
181
182 //=======================================================================
183 //function : PlaneAttributes
184 //purpose  : 
185 //=======================================================================
186 Standard_Boolean AIS_Plane::PlaneAttributes(Handle(Geom_Plane)& aComponent,
187                                             gp_Pnt& aCenter,
188                                             gp_Pnt& aPmin,
189                                             gp_Pnt& aPmax)
190 {
191   Standard_Boolean aStatus (Standard_False);
192   if (!myAutomaticPosition){
193     aComponent = myComponent;
194     aCenter = myCenter;
195     aPmin = myPmin;
196     aPmax = myPmax;
197     aStatus = Standard_True;
198   }
199   return aStatus;
200 }
201
202 //=======================================================================
203 //function : SetPlaneAttributes
204 //purpose  : 
205 //=======================================================================
206 void AIS_Plane::SetPlaneAttributes(const Handle(Geom_Plane)& aComponent,
207                               const gp_Pnt& aCenter,
208                               const gp_Pnt& aPmin,
209                               const gp_Pnt& aPmax)
210 {
211   myAutomaticPosition = Standard_False;
212   myComponent = aComponent;
213   myCenter = aCenter;
214   myPmin = aPmin;
215   myPmax = aPmax;
216   myTypeOfPlane = AIS_TOPL_Unknown;
217   myIsXYZPlane = Standard_False;
218 }
219
220 //=======================================================================
221 //function : Compute
222 //purpose  : 
223 //=======================================================================
224 void AIS_Plane::Compute(const Handle(PrsMgr_PresentationManager3d)& ,
225                         const Handle(Prs3d_Presentation)& aPresentation, 
226                         const Standard_Integer aMode)
227 {
228   aPresentation->Clear();
229
230   ComputeFields();
231   aPresentation->SetInfiniteState(myInfiniteState);
232   if (myCurrentMode) 
233     myDrawer->PlaneAspect()->EdgesAspect()->SetWidth(3);
234   else 
235     myDrawer->PlaneAspect()->EdgesAspect()->SetWidth(1);
236   if(aMode == 0){
237     if (!myIsXYZPlane){
238       ComputeFrame();
239       const Handle(Geom_Plane)& pl = myComponent;
240       const Handle(Geom_Plane)& thegoodpl = Handle(Geom_Plane)::DownCast
241         (pl->Translated(pl->Location(),myCenter));
242       GeomAdaptor_Surface surf(thegoodpl);
243       StdPrs_Plane::Add(aPresentation,surf,myDrawer);
244     }
245     else {
246       DsgPrs_XYZPlanePresentation::Add(aPresentation,myDrawer,myCenter,myPmin,myPmax);
247     }
248   }
249   else if (aMode == 1){
250     if (!myIsXYZPlane){
251       ComputeFrame();
252       // a mettre ailleurs sans doute...
253       Handle(Prs3d_PlaneAspect) theaspect = myDrawer->PlaneAspect();
254       Handle(Graphic3d_Group) TheGroup = Prs3d_Root::CurrentGroup(aPresentation);
255       gp_Pnt p1;
256       Standard_Real Xmax,Ymax;
257       Xmax = Standard_Real(theaspect->PlaneXLength())/2.;
258       Ymax = Standard_Real(theaspect->PlaneYLength())/2.;
259       static Graphic3d_Array1OfVertex vertices(1,5);
260       TheGroup->SetPrimitivesAspect(myDrawer->ShadingAspect()->Aspect());
261       myComponent->D0(-Xmax,Ymax,p1);
262       vertices(1).SetCoord(p1.X(),p1.Y(),p1.Z());
263       vertices(5).SetCoord(p1.X(),p1.Y(),p1.Z());
264       myComponent->D0(Xmax,Ymax,p1);
265       vertices(2).SetCoord(p1.X(),p1.Y(),p1.Z());
266       myComponent->D0(Xmax,-Ymax,p1);
267       vertices(3).SetCoord(p1.X(),p1.Y(),p1.Z());
268       myComponent->D0(-Xmax,-Ymax,p1);
269       vertices(4).SetCoord(p1.X(),p1.Y(),p1.Z());
270       TheGroup->Polygon(vertices);
271         
272       }
273     else{
274       DsgPrs_ShadedPlanePresentation::Add(aPresentation,myDrawer,myCenter,myPmin,myPmax);
275       
276     }
277   }
278
279 }
280
281 void AIS_Plane::Compute(const Handle_Prs3d_Projector& aProjector, const Handle_Geom_Transformation& aTransformation, const Handle_Prs3d_Presentation& aPresentation)
282 {
283 // Standard_NotImplemented::Raise("AIS_Plane::Compute(const Handle_Prs3d_Projector&, const Handle_Geom_Transformation&, const Handle_Prs3d_Presentation&)");
284  PrsMgr_PresentableObject::Compute( aProjector , aTransformation , aPresentation) ;
285 }
286
287 //=======================================================================
288 //function : ComputeSelection
289 //purpose  : 
290 //=======================================================================
291 void AIS_Plane::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
292                                     const Standard_Integer)
293 {
294   aSelection->Clear();
295   Handle(SelectMgr_EntityOwner) eown = new SelectMgr_EntityOwner(this,10);
296   Handle(Select3D_SensitiveFace) sfac;
297
298   if (!myIsXYZPlane){
299
300     Handle(TColgp_HArray1OfPnt) harr = new TColgp_HArray1OfPnt(1,5);
301     TColgp_Array1OfPnt& arr = harr->ChangeArray1();
302     Standard_Real lx = myDrawer->PlaneAspect()->PlaneXLength()/2.;
303     Standard_Real ly = myDrawer->PlaneAspect()->PlaneYLength()/2.;
304     const Handle(Geom_Plane)& pl = myComponent;
305     const Handle(Geom_Plane)& thegoodpl = Handle(Geom_Plane)::DownCast(pl->Translated(pl->Location(),myCenter));
306     
307     thegoodpl->D0(lx,ly,arr(1));
308     thegoodpl->D0(lx,-ly,arr(2));
309     thegoodpl->D0(-lx,-ly,arr(3));
310     thegoodpl->D0(-lx,ly,arr(4));
311     arr(5) = arr(1);
312     sfac = new Select3D_SensitiveFace(eown,harr,Select3D_TOS_BOUNDARY);
313
314   }
315   else {
316     Handle(TColgp_HArray1OfPnt) harr1 = new TColgp_HArray1OfPnt(1,4);
317     TColgp_Array1OfPnt& arr1 = harr1->ChangeArray1();
318     
319     arr1(1) = myCenter;
320     arr1(2) = myPmin;
321     arr1(3) = myPmax;
322     arr1(4) = myCenter;
323     sfac = new Select3D_SensitiveFace(eown,harr1,Select3D_TOS_BOUNDARY);
324
325   }
326     aSelection->Add(sfac);
327 }
328
329
330
331
332 //=======================================================================
333 //function : SetSize
334 //purpose  : 
335 //=======================================================================
336 void AIS_Plane::SetSize(const Standard_Real aLength)
337 {
338   SetSize(aLength,aLength);
339 }
340
341 void AIS_Plane::SetSize(const Standard_Real aXLength,
342                         const Standard_Real aYLength)
343 {
344   //si le plan a deja une couleur ou une taille propre, 
345   //il y a deja un PlaneAspect et un DatumAspect specifique 
346     
347   Handle(Prs3d_PlaneAspect) PA; 
348   Handle(Prs3d_DatumAspect) DA;
349
350   PA = myDrawer->PlaneAspect();
351   DA = myDrawer->DatumAspect();
352
353   Standard_Boolean yenavaitPA(Standard_True),yenavaitDA(Standard_True);
354   if(myDrawer->Link()->PlaneAspect() == PA){
355     yenavaitPA = Standard_False;
356     PA = new Prs3d_PlaneAspect();}
357   if(myDrawer->Link()->DatumAspect() == DA){
358     yenavaitDA = Standard_False;
359     DA = new Prs3d_DatumAspect();
360   }
361   
362   PA->SetPlaneLength(aXLength,aYLength);
363   DA->SetAxisLength(aXLength,aYLength,aXLength);
364   
365   if(!yenavaitPA)
366     myDrawer->SetPlaneAspect(PA);
367   if(!yenavaitDA)
368     myDrawer->SetDatumAspect(DA);
369   
370   
371   myHasOwnSize = Standard_True;
372   Update();
373   UpdateSelection();
374 }
375
376
377 //=======================================================================
378 //function : UnsetSize
379 //purpose  : S'il ya une couleur, on recupere la taille du drawer du context...
380 //=======================================================================
381 void AIS_Plane::UnsetSize()
382 {
383   
384   if(!myHasOwnSize) return;
385   if(!hasOwnColor){
386     myDrawer->PlaneAspect().Nullify();
387     myDrawer->DatumAspect().Nullify();
388   }
389   else{
390     const Handle(Prs3d_PlaneAspect)& PA = myDrawer->Link()->PlaneAspect();
391     const Handle(Prs3d_DatumAspect)& DA = myDrawer->Link()->DatumAspect();
392
393     myDrawer->PlaneAspect()->SetPlaneLength(PA->PlaneXLength(),PA->PlaneYLength());
394     myDrawer->DatumAspect()->SetAxisLength(DA->FirstAxisLength(),
395                                            DA->SecondAxisLength(),
396                                            DA->ThirdAxisLength());
397   }
398   
399   myHasOwnSize = Standard_False;
400   Update();
401   UpdateSelection();
402
403 }
404
405 //=======================================================================
406 //function : Size
407 //purpose  : 
408 //=======================================================================
409
410 Standard_Boolean AIS_Plane::Size(Standard_Real& X,Standard_Real& Y) const 
411 {
412   X = myDrawer->PlaneAspect()->PlaneXLength();
413   Y = myDrawer->PlaneAspect()->PlaneYLength();
414   return Abs(X-Y)<=Precision::Confusion();
415 }
416
417
418 //=======================================================================
419 //function : SetColor
420 //purpose  : 
421 //=======================================================================
422
423
424 void AIS_Plane::SetColor(const Quantity_NameOfColor aCol)
425 #ifdef GER61351
426 {
427   SetColor(Quantity_Color(aCol));
428 }
429
430 void AIS_Plane::SetColor(const Quantity_Color &aCol)
431 #endif
432 {
433   // si le plan a deja sa propre taille, il y a un deja planeaspect cree
434 //  Standard_Boolean yenadeja = hasOwnColor || myHasOwnSize;
435   Handle(Prs3d_PlaneAspect) PA; 
436   Handle(Prs3d_DatumAspect) DA;
437
438   PA = myDrawer->PlaneAspect();
439   DA = myDrawer->DatumAspect();
440
441   Standard_Boolean yenavaitPA(Standard_True),yenavaitDA(Standard_True);
442   if(myDrawer->Link()->PlaneAspect() == PA){
443     yenavaitPA = Standard_False;
444     PA = new Prs3d_PlaneAspect();}
445   if(myDrawer->Link()->DatumAspect() == DA){
446     yenavaitDA = Standard_False;
447     DA = new Prs3d_DatumAspect();
448   }
449   
450   PA->EdgesAspect()->SetColor(aCol);
451   DA->FirstAxisAspect()->SetColor(aCol);
452   DA->SecondAxisAspect()->SetColor(aCol);
453   DA->ThirdAxisAspect()->SetColor(aCol);
454
455   if(!yenavaitPA)
456     myDrawer->SetPlaneAspect(PA);
457   if(!yenavaitDA)
458     myDrawer->SetDatumAspect(DA);
459
460   myDrawer->ShadingAspect()->SetColor(aCol);
461   
462   hasOwnColor=Standard_True;
463   myOwnColor = aCol;
464 }
465 //=======================================================================
466 //function : SetColor
467 //purpose  : 
468 //=======================================================================
469 void AIS_Plane::UnsetColor()
470 {
471   if(!hasOwnColor) return;
472   if(!myHasOwnSize){
473     myDrawer->PlaneAspect().Nullify();
474     myDrawer->DatumAspect().Nullify();
475   }
476   else{
477     const Handle(Prs3d_PlaneAspect)& PA = myDrawer->Link()->PlaneAspect();
478 //    const Handle(Prs3d_DatumAspect)& DA = myDrawer->Link()->DatumAspect();
479     Quantity_Color C;Aspect_TypeOfLine T;Standard_Real W;
480     PA->EdgesAspect()->Aspect()->Values(C,T,W);
481     Quantity_NameOfColor Col = C.Name();
482     myDrawer->PlaneAspect()->EdgesAspect()->SetColor(Col);
483     
484     myDrawer->DatumAspect()->FirstAxisAspect()->SetColor(Col);
485     myDrawer->DatumAspect()->SecondAxisAspect()->SetColor(Col);
486     myDrawer->DatumAspect()->ThirdAxisAspect()->SetColor(Col);
487   }
488  
489  
490   hasOwnColor=Standard_False;
491
492 }
493
494 //=======================================================================
495 //function : ComputeFrame
496 //purpose  : 
497 //=======================================================================
498 void AIS_Plane::ComputeFrame()
499 {
500
501   const Handle(Geom_Plane)& pl = myComponent;
502   Standard_Real U,V;
503
504   if (myAutomaticPosition) {
505     ElSLib::Parameters(pl->Pln(),myCenter,U,V);
506     pl->D0 (U, V, myCenter);     
507   }
508   else {
509     const Handle(Geom_Plane)& thegoodpl = 
510       Handle(Geom_Plane)::DownCast(pl->Translated(pl->Location(),myCenter));
511     ElSLib::Parameters(thegoodpl->Pln(),myPmin,U,V);
512     
513     U = 2.4*Abs(U);
514     V = 2.4*Abs(V);
515     if (U < 10*Precision::Confusion()) U=0.1;
516     if (V < 10*Precision::Confusion()) V=0.1;
517     SetSize(U,V);
518     myDrawer->PlaneAspect()->SetPlaneLength(U,V);
519   }
520 }
521
522 //=======================================================================
523 //function : Compute
524 //purpose  : to avoid warning
525 //=======================================================================
526 void AIS_Plane::Compute(const Handle(PrsMgr_PresentationManager2d)&, 
527                            const Handle(Graphic2d_GraphicObject)&,
528                            const Standard_Integer)
529 {
530 }
531
532 //=======================================================================
533 //function : Compute
534 //purpose  : to avoid warning
535 //=======================================================================
536 void AIS_Plane::Compute(const Handle(Prs3d_Projector)&, 
537                            const Handle(Prs3d_Presentation)&)
538 {
539 }
540
541 //=======================================================================
542 //function : ComputeFields
543 //purpose  : 
544 //=======================================================================
545 void AIS_Plane::ComputeFields()
546 {
547   if (myIsXYZPlane){
548     Handle (Prs3d_DatumAspect) DA = myDrawer->DatumAspect();
549
550     gp_Pnt Orig = myAx2->Ax2().Location();
551     gp_Dir oX = myAx2->Ax2().XDirection();
552     gp_Dir oY = myAx2->Ax2().YDirection();
553     gp_Dir oZ = myAx2->Ax2().Direction();
554     myCenter = Orig;
555     Standard_Real xo,yo,zo,x1,y1,z1,x2,y2,z2,x3,y3,z3,x4=0,y4=0,z4=0;
556     Standard_Real x5=0,y5=0,z5=0;
557     Orig.Coord(xo,yo,zo);
558     oX.Coord(x1,y1,z1);
559     oY.Coord(x2,y2,z2);
560     oZ.Coord(x3,y3,z3);
561     Standard_Real DS1 = DA->FirstAxisLength();
562     Standard_Real DS2 = DA->SecondAxisLength();
563     Standard_Real DS3 = DA->ThirdAxisLength();
564 //    gp_Pnt aPt2,aPt3;
565
566     switch (myTypeOfPlane) {
567     case AIS_TOPL_XYPlane:
568       {
569         gp_Pln XYP(0,0,1,0);
570         myComponent = new Geom_Plane(XYP);
571         x4=xo+x1*DS1; y4=yo+y1*DS1; z4=zo+z1*DS1;
572         x5=xo+x2*DS2; y5=yo+y2*DS2; z5=zo+z2*DS2;
573         break;
574       }
575     case AIS_TOPL_XZPlane:
576       {
577         gp_Pln XZP(0,1,0,0);
578         myComponent = new Geom_Plane(XZP);
579         x4=xo+x1*DS1; y4=yo+y1*DS1; z4=zo+z1*DS1;
580         x5=xo+x3*DS3; y5=yo+y3*DS3; z5=zo+z3*DS3;
581         break;
582       }
583     case AIS_TOPL_YZPlane:
584       {
585         gp_Pln XZP(1,0,0,0);
586         myComponent = new Geom_Plane(XZP);
587         x4=xo+x2*DS2; y4=yo+y2*DS2; z4=zo+z2*DS2;
588         x5=xo+x3*DS3; y5=yo+y3*DS3; z5=zo+z3*DS3;
589         break;
590       }
591     default:
592       break;
593     }
594     myPmin.SetCoord(x4,y4,z4);
595     myPmax.SetCoord(x5,y5,z5);
596   }
597
598 }
599 //=======================================================================
600 //function : InitDrawerAttributes
601 //purpose  : 
602 //=======================================================================
603
604 void AIS_Plane::InitDrawerAttributes()
605 {
606
607   Handle(Prs3d_ShadingAspect) shasp = new Prs3d_ShadingAspect();
608   shasp->SetMaterial(Graphic3d_NOM_PLASTIC);
609   shasp->SetColor(Quantity_NOC_GRAY40);
610   myDrawer->SetShadingAspect(shasp);
611   Handle(Graphic3d_AspectFillArea3d) asf = shasp->Aspect();
612   Graphic3d_MaterialAspect asp = asf->FrontMaterial();
613   asp.SetTransparency(0.8);
614   asf->SetFrontMaterial(asp);
615   asf->SetBackMaterial(asp);
616
617
618 }
619
620 //=======================================================================
621 //function : AcceptDisplayMode
622 //purpose  : 
623 //=======================================================================
624
625 Standard_Boolean  AIS_Plane::
626 AcceptDisplayMode(const Standard_Integer aMode) const
627 {return aMode == 0;}
628
629
630 //=======================================================================
631 //function : SetContext
632 //purpose  : 
633 //=======================================================================
634
635 void AIS_Plane::SetContext(const Handle(AIS_InteractiveContext)& Ctx)
636 {
637   AIS_InteractiveObject::SetContext(Ctx);
638   ComputeFields();
639
640 }