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