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