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