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