0029367: Visualization - simplify interface of V3d_View and V3d_Viewer
[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 <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 <SelectMgr_EntityOwner.hxx>
47 #include <Standard_Type.hxx>
48 #include <StdPrs_Plane.hxx>
49 #include <StdPrs_ShadedShape.hxx>
50 #include <StdPrs_ShadedSurface.hxx>
51 #include <TColgp_Array1OfPnt.hxx>
52 #include <TColgp_HArray1OfPnt.hxx>
53 #include <TCollection_AsciiString.hxx>
54 #include <UnitsAPI.hxx>
55
56 IMPLEMENT_STANDARD_RTTIEXT(AIS_Plane,AIS_InteractiveObject)
57
58 //=======================================================================
59 //function : AIS_Plane
60 //purpose  : 
61 //=======================================================================
62 AIS_Plane::AIS_Plane(const Handle(Geom_Plane)& aComponent,
63                      const Standard_Boolean aCurrentMode):
64 myComponent(aComponent),
65 myCenter(gp_Pnt(0.,0.,0.)),
66 myCurrentMode(aCurrentMode),
67 myAutomaticPosition(Standard_True),
68 myTypeOfPlane(AIS_TOPL_Unknown),
69 myIsXYZPlane(Standard_False),
70 myTypeOfSensitivity (Select3D_TOS_BOUNDARY)
71 {
72   InitDrawerAttributes();
73 }
74
75 //=======================================================================
76 //function : AIS_Plane 
77 //purpose  : avec une position
78 //=======================================================================
79 AIS_Plane::AIS_Plane(const Handle(Geom_Plane)& aComponent,
80                      const gp_Pnt& aCenter,
81                      const Standard_Boolean aCurrentMode):
82 myComponent(aComponent),
83 myCenter(aCenter),
84 myCurrentMode(aCurrentMode),
85 myAutomaticPosition(Standard_True),
86 myTypeOfPlane(AIS_TOPL_Unknown),
87 myIsXYZPlane(Standard_False),
88 myTypeOfSensitivity (Select3D_TOS_BOUNDARY)
89 {
90   InitDrawerAttributes();
91 }
92
93 //=======================================================================
94 //function : AIS_Plane
95 //purpose  : 
96 //=======================================================================
97 AIS_Plane::AIS_Plane(const Handle(Geom_Plane)& aComponent,
98                                const gp_Pnt& aCenter,
99                                const gp_Pnt& aPmin,
100                                const gp_Pnt& aPmax,
101                                const Standard_Boolean aCurrentMode):
102 myComponent(aComponent),
103 myCenter(aCenter),
104 myPmin(aPmin),
105 myPmax(aPmax),
106 myCurrentMode(aCurrentMode),
107 myAutomaticPosition(Standard_False),
108 myTypeOfPlane(AIS_TOPL_Unknown),
109 myIsXYZPlane(Standard_False),
110 myTypeOfSensitivity (Select3D_TOS_BOUNDARY)
111 {
112   InitDrawerAttributes();
113 }
114
115 //=======================================================================
116 //function : AIS_Plane
117 //purpose  : XYPlane, XZPlane, YZPlane
118 //=======================================================================
119 AIS_Plane::AIS_Plane(const Handle(Geom_Axis2Placement)& aComponent,
120                      const AIS_TypeOfPlane aPlaneType,
121                      const Standard_Boolean aCurrentMode):
122 myAx2(aComponent),
123 myCurrentMode(aCurrentMode),
124 myAutomaticPosition(Standard_True),
125 myTypeOfPlane(aPlaneType),
126 myIsXYZPlane(Standard_True),
127 myTypeOfSensitivity (Select3D_TOS_BOUNDARY)
128 {
129   InitDrawerAttributes();
130   ComputeFields();
131 }
132
133
134 //=======================================================================
135 //function : SetComponent
136 //purpose  : 
137 //=======================================================================
138
139 void AIS_Plane::SetComponent(const Handle(Geom_Plane)& aComponent)
140 {
141   myComponent = aComponent;
142   myTypeOfPlane = AIS_TOPL_Unknown;
143   myIsXYZPlane = Standard_False;
144   //myCenter = gp_Pnt(0.,0.,0.);
145   myAutomaticPosition = Standard_True;
146 }
147
148 //=======================================================================
149 //function : Type
150 //purpose  : 
151 //=======================================================================
152
153 AIS_KindOfInteractive AIS_Plane::Type() const 
154 {return AIS_KOI_Datum;}
155
156
157 //=======================================================================
158 //function : Signature
159 //purpose  : 
160 //=======================================================================
161
162 Standard_Integer AIS_Plane::Signature() const 
163 {return 7;}
164
165
166 //=======================================================================
167 //function : Axis2Placement
168 //purpose  : 
169 //=======================================================================
170
171 Handle(Geom_Axis2Placement) AIS_Plane::Axis2Placement()
172 {
173   Handle(Geom_Axis2Placement) Bid;
174   return IsXYZPlane() ? myAx2:Bid;
175 }
176 //=======================================================================
177 //function : SetAxis2Placement
178 //purpose  : 
179 //=======================================================================
180
181  void AIS_Plane::SetAxis2Placement(const Handle(Geom_Axis2Placement)& aComponent,
182                                    const AIS_TypeOfPlane aPlaneType)
183 {
184   myTypeOfPlane = aPlaneType;
185   myIsXYZPlane = Standard_True;
186   myAx2= aComponent;
187   myAutomaticPosition = Standard_True;
188   ComputeFields();
189 }
190
191 //=======================================================================
192 //function : PlaneAttributes
193 //purpose  : 
194 //=======================================================================
195 Standard_Boolean AIS_Plane::PlaneAttributes(Handle(Geom_Plane)& aComponent,
196                                             gp_Pnt& aCenter,
197                                             gp_Pnt& aPmin,
198                                             gp_Pnt& aPmax)
199 {
200   Standard_Boolean aStatus (Standard_False);
201   if (!myAutomaticPosition){
202     aComponent = myComponent;
203     aCenter = myCenter;
204     aPmin = myPmin;
205     aPmax = myPmax;
206     aStatus = Standard_True;
207   }
208   return aStatus;
209 }
210
211 //=======================================================================
212 //function : SetPlaneAttributes
213 //purpose  : 
214 //=======================================================================
215 void AIS_Plane::SetPlaneAttributes(const Handle(Geom_Plane)& aComponent,
216                               const gp_Pnt& aCenter,
217                               const gp_Pnt& aPmin,
218                               const gp_Pnt& aPmax)
219 {
220   myAutomaticPosition = Standard_False;
221   myComponent = aComponent;
222   myCenter = aCenter;
223   myPmin = aPmin;
224   myPmax = aPmax;
225   myTypeOfPlane = AIS_TOPL_Unknown;
226   myIsXYZPlane = Standard_False;
227 }
228
229 //=======================================================================
230 //function : Compute
231 //purpose  : 
232 //=======================================================================
233 void AIS_Plane::Compute(const Handle(PrsMgr_PresentationManager3d)& ,
234                         const Handle(Prs3d_Presentation)& aPresentation, 
235                         const Standard_Integer aMode)
236 {
237   ComputeFields();
238   aPresentation->SetInfiniteState(myInfiniteState);
239   myDrawer->PlaneAspect()->EdgesAspect()->SetWidth(myCurrentMode == 0? 1 : 3);
240
241   switch (aMode)
242   {
243     case 0:
244     {
245       if (!myIsXYZPlane)
246       {
247         ComputeFrame();
248         const Handle(Geom_Plane)& pl = myComponent;
249         Handle(Geom_Plane) thegoodpl (Handle(Geom_Plane)::DownCast(pl->Translated(pl->Location(),myCenter)));
250         GeomAdaptor_Surface surf(thegoodpl);
251         StdPrs_Plane::Add(aPresentation,surf,myDrawer);
252       }
253       else
254         DsgPrs_XYZPlanePresentation::Add(aPresentation,myDrawer,myCenter,myPmin,myPmax);
255       break;
256     }
257     case 1:
258     {
259       if (!myIsXYZPlane)
260       {
261         ComputeFrame();
262         Handle(Prs3d_PlaneAspect) theaspect = myDrawer->PlaneAspect();
263         Handle(Graphic3d_Group) TheGroup = Prs3d_Root::CurrentGroup(aPresentation);
264         TheGroup->SetPrimitivesAspect(myDrawer->ShadingAspect()->Aspect());
265         gp_Pnt p1;
266         const Standard_Real Xmax = 0.5*Standard_Real(theaspect->PlaneXLength());
267         const Standard_Real Ymax = 0.5*Standard_Real(theaspect->PlaneYLength());
268
269         Handle(Graphic3d_ArrayOfQuadrangles) aQuads = new Graphic3d_ArrayOfQuadrangles(4);
270
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         myComponent->D0(-Xmax,-Ymax,p1);
278         aQuads->AddVertex(p1);
279
280         TheGroup->AddPrimitiveArray(aQuads);
281       }
282       else
283         DsgPrs_ShadedPlanePresentation::Add(aPresentation,myDrawer,myCenter,myPmin,myPmax);
284       break;
285     }
286   }
287 }
288
289 void AIS_Plane::Compute(const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTransformation, const Handle(Prs3d_Presentation)& aPresentation)
290 {
291   PrsMgr_PresentableObject::Compute(aProjector, aTransformation, aPresentation);
292 }
293
294 //=======================================================================
295 //function : ComputeSelection
296 //purpose  : 
297 //=======================================================================
298 void AIS_Plane::ComputeSelection (const Handle(SelectMgr_Selection)& theSelection, const Standard_Integer /*theMode*/)
299 {
300   theSelection->Clear();
301   Handle(SelectMgr_EntityOwner) aSensitiveOwner = new SelectMgr_EntityOwner (this, 10);
302   Handle(Poly_Triangulation) aSensitivePoly;
303
304   if (!myIsXYZPlane)
305   {
306     // plane representing rectangle
307     Standard_Real aLengthX = myDrawer->PlaneAspect()->PlaneXLength() / 2.0;
308     Standard_Real aLengthY = myDrawer->PlaneAspect()->PlaneYLength() / 2.0;
309     Handle(Geom_Plane) aPlane = 
310       Handle(Geom_Plane)::DownCast (myComponent->Translated (myComponent->Location(), myCenter));
311
312     TColgp_Array1OfPnt aRectanglePoints (1, 4);
313     aPlane->D0 ( aLengthX,  aLengthY, aRectanglePoints.ChangeValue (1));
314     aPlane->D0 ( aLengthX, -aLengthY, aRectanglePoints.ChangeValue (2));
315     aPlane->D0 (-aLengthX, -aLengthY, aRectanglePoints.ChangeValue (3));
316     aPlane->D0 (-aLengthX,  aLengthY, aRectanglePoints.ChangeValue (4));
317
318     Poly_Array1OfTriangle aTriangles (1, 2);
319     aTriangles.ChangeValue (1) = Poly_Triangle (1, 2, 3);
320     aTriangles.ChangeValue (2) = Poly_Triangle (1, 3, 4);
321
322     aSensitivePoly = new Poly_Triangulation (aRectanglePoints, aTriangles);
323   }
324   else
325   {
326     // plane representing triangle
327     TColgp_Array1OfPnt aTrianglePoints (1, 3);
328     aTrianglePoints.ChangeValue (1) = myCenter;
329     aTrianglePoints.ChangeValue (2) = myPmin;
330     aTrianglePoints.ChangeValue (3) = myPmax;
331
332     Poly_Array1OfTriangle aTriangles (1, 1);
333     aTriangles.ChangeValue (1) = Poly_Triangle(1, 2, 3);
334
335     aSensitivePoly = new Poly_Triangulation (aTrianglePoints, aTriangles);
336   }
337
338   Standard_Boolean isSensitiveInterior = myTypeOfSensitivity == Select3D_TOS_INTERIOR;
339
340   Handle(Select3D_SensitiveTriangulation) aSensitive =
341     new Select3D_SensitiveTriangulation (aSensitiveOwner,
342                                          aSensitivePoly,
343                                          TopLoc_Location(),
344                                          isSensitiveInterior);
345
346   theSelection->Add(aSensitive);
347 }
348
349 //=======================================================================
350 //function : SetSize
351 //purpose  : 
352 //=======================================================================
353 void AIS_Plane::SetSize(const Standard_Real aLength)
354 {
355   SetSize(aLength,aLength);
356 }
357
358 void AIS_Plane::SetSize(const Standard_Real aXLength,
359                         const Standard_Real aYLength)
360 {
361   //if the plane already has a proper color or size, 
362   //there is already a specific PlaneAspect and DatumAspect 
363     
364   Handle(Prs3d_PlaneAspect) PA; 
365   Handle(Prs3d_DatumAspect) DA;
366
367   PA = myDrawer->PlaneAspect();
368   DA = myDrawer->DatumAspect();
369
370   Standard_Boolean yenavaitPA(Standard_True),yenavaitDA(Standard_True);
371   if(myDrawer->HasLink() && myDrawer->Link()->PlaneAspect() == PA){
372     yenavaitPA = Standard_False;
373     PA = new Prs3d_PlaneAspect();}
374   if(myDrawer->HasLink() && myDrawer->Link()->DatumAspect() == DA){
375     yenavaitDA = Standard_False;
376     DA = new Prs3d_DatumAspect();
377   }
378   
379   PA->SetPlaneLength(aXLength,aYLength);
380   DA->SetAxisLength(aXLength,aYLength,aXLength);
381   
382   if(!yenavaitPA)
383     myDrawer->SetPlaneAspect(PA);
384   if(!yenavaitDA)
385     myDrawer->SetDatumAspect(DA);
386   
387   
388   myHasOwnSize = Standard_True;
389   SetToUpdate();
390   UpdatePresentations();
391   UpdateSelection();
392 }
393
394
395 //=======================================================================
396 //function : UnsetSize
397 //purpose  : If there is a color, the size is restaured from the drawer of the context...
398 //=======================================================================
399 void AIS_Plane::UnsetSize()
400 {
401   
402   if(!myHasOwnSize) return;
403   if(!hasOwnColor)
404   {
405     myDrawer->SetPlaneAspect (Handle(Prs3d_PlaneAspect)());
406     myDrawer->SetDatumAspect (Handle(Prs3d_DatumAspect)());
407   }
408   else{
409     const Handle(Prs3d_PlaneAspect) PA = myDrawer->HasLink() ? myDrawer->Link()->PlaneAspect() :
410                                                                new Prs3d_PlaneAspect();
411     const Handle(Prs3d_DatumAspect) DA = myDrawer->HasLink() ? myDrawer->Link()->DatumAspect() :
412                                                                new Prs3d_DatumAspect();
413
414     myDrawer->PlaneAspect()->SetPlaneLength(PA->PlaneXLength(),PA->PlaneYLength());
415     myDrawer->DatumAspect()->SetAxisLength(DA->AxisLength(Prs3d_DP_XAxis),
416                                            DA->AxisLength(Prs3d_DP_YAxis),
417                                            DA->AxisLength(Prs3d_DP_ZAxis));
418   }
419   
420   myHasOwnSize = Standard_False;
421   SetToUpdate();
422   UpdatePresentations();
423   UpdateSelection();
424
425 }
426
427 //=======================================================================
428 //function : Size
429 //purpose  : 
430 //=======================================================================
431
432 Standard_Boolean AIS_Plane::Size(Standard_Real& X,Standard_Real& Y) const 
433 {
434   X = myDrawer->PlaneAspect()->PlaneXLength();
435   Y = myDrawer->PlaneAspect()->PlaneYLength();
436   return Abs(X-Y)<=Precision::Confusion();
437 }
438
439 //=======================================================================
440 //function : SetColor
441 //purpose  : 
442 //=======================================================================
443 void AIS_Plane::SetColor(const Quantity_Color &aCol)
444 {
445   // if the plane already has its proper size, there is an already created planeaspect 
446 //  Standard_Boolean yenadeja = hasOwnColor || myHasOwnSize;
447   Handle(Prs3d_PlaneAspect) PA; 
448   Handle(Prs3d_DatumAspect) DA;
449
450   PA = myDrawer->PlaneAspect();
451   DA = myDrawer->DatumAspect();
452
453   Standard_Boolean yenavaitPA(Standard_True),yenavaitDA(Standard_True);
454   if(myDrawer->HasLink() && myDrawer->Link()->PlaneAspect() == PA){
455     yenavaitPA = Standard_False;
456     PA = new Prs3d_PlaneAspect();}
457   if(myDrawer->HasLink() && myDrawer->Link()->DatumAspect() == DA){
458     yenavaitDA = Standard_False;
459     DA = new Prs3d_DatumAspect();
460   }
461   
462   PA->EdgesAspect()->SetColor(aCol);
463   DA->LineAspect(Prs3d_DP_XAxis)->SetColor(aCol);
464   DA->LineAspect(Prs3d_DP_YAxis)->SetColor(aCol);
465   DA->LineAspect(Prs3d_DP_ZAxis)->SetColor(aCol);
466
467   if(!yenavaitPA)
468     myDrawer->SetPlaneAspect(PA);
469   if(!yenavaitDA)
470     myDrawer->SetDatumAspect(DA);
471
472   myDrawer->ShadingAspect()->SetColor(aCol);
473   
474   hasOwnColor=Standard_True;
475   myDrawer->SetColor (aCol);
476 }
477 //=======================================================================
478 //function : SetColor
479 //purpose  : 
480 //=======================================================================
481 void AIS_Plane::UnsetColor()
482 {
483   if(!hasOwnColor) return;
484   if(!myHasOwnSize)
485   {
486     myDrawer->SetPlaneAspect (Handle(Prs3d_PlaneAspect)());
487     myDrawer->SetDatumAspect (Handle(Prs3d_DatumAspect)());
488   }
489   else{
490     const Handle(Prs3d_PlaneAspect) PA = myDrawer->HasLink() ? myDrawer->Link()->PlaneAspect() :
491                                                                new Prs3d_PlaneAspect();
492     Quantity_Color Col = PA->EdgesAspect()->Aspect()->Color();
493     myDrawer->PlaneAspect()->EdgesAspect()->SetColor(Col);
494     
495     myDrawer->DatumAspect()->LineAspect(Prs3d_DP_XAxis)->SetColor(Col);
496     myDrawer->DatumAspect()->LineAspect(Prs3d_DP_YAxis)->SetColor(Col);
497     myDrawer->DatumAspect()->LineAspect(Prs3d_DP_ZAxis)->SetColor(Col);
498   }
499  
500  
501   hasOwnColor=Standard_False;
502
503 }
504
505 //=======================================================================
506 //function : ComputeFrame
507 //purpose  : 
508 //=======================================================================
509 void AIS_Plane::ComputeFrame()
510 {
511
512   const Handle(Geom_Plane)& pl = myComponent;
513   Standard_Real U,V;
514
515   if (myAutomaticPosition) {
516     ElSLib::Parameters(pl->Pln(),myCenter,U,V);
517     pl->D0 (U, V, myCenter);     
518   }
519   else {
520     Handle(Geom_Plane) thegoodpl (Handle(Geom_Plane)::DownCast(pl->Translated(pl->Location(),myCenter)));
521     ElSLib::Parameters(thegoodpl->Pln(),myPmin,U,V);
522     
523     U = 2.4*Abs(U);
524     V = 2.4*Abs(V);
525     if (U < 10*Precision::Confusion()) U=0.1;
526     if (V < 10*Precision::Confusion()) V=0.1;
527     SetSize(U,V);
528     myDrawer->PlaneAspect()->SetPlaneLength(U,V);
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->AxisLength(Prs3d_DP_XAxis);
562     Standard_Real DS2 = DA->AxisLength(Prs3d_DP_YAxis);
563     Standard_Real DS3 = DA->AxisLength(Prs3d_DP_ZAxis);
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   Handle(Prs3d_ShadingAspect) shasp = new Prs3d_ShadingAspect();
607   shasp->SetMaterial(Graphic3d_NOM_PLASTIC);
608   shasp->SetColor(Quantity_NOC_GRAY40);
609   myDrawer->SetShadingAspect(shasp);
610   Handle(Graphic3d_AspectFillArea3d) asf = shasp->Aspect();
611   Graphic3d_MaterialAspect asp = asf->FrontMaterial();
612   asp.SetTransparency (0.8f);
613   asf->SetFrontMaterial(asp);
614   asf->SetBackMaterial(asp);
615 }
616
617 //=======================================================================
618 //function : AcceptDisplayMode
619 //purpose  : 
620 //=======================================================================
621
622 Standard_Boolean  AIS_Plane::
623 AcceptDisplayMode(const Standard_Integer aMode) const
624 {return aMode == 0;}
625
626
627 //=======================================================================
628 //function : SetContext
629 //purpose  : 
630 //=======================================================================
631
632 void AIS_Plane::SetContext(const Handle(AIS_InteractiveContext)& Ctx)
633 {
634   AIS_InteractiveObject::SetContext(Ctx);
635   ComputeFields();
636
637 }