f0a4dd698d77eea30c19f5c92ef990c81a91dd00
[occt.git] / src / AIS / AIS_Shape.cxx
1 // Created on: 1996-12-20
2 // Created by: Robert COUBLANC
3 // Copyright (c) 1996-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_GraphicTool.hxx>
19 #include <AIS_InteractiveContext.hxx>
20 #include <AIS_Shape.hxx>
21 #include <Aspect_TypeOfLine.hxx>
22 #include <Bnd_Box.hxx>
23 #include <BRep_Builder.hxx>
24 #include <BRepBndLib.hxx>
25 #include <BRepTools.hxx>
26 #include <BRepTools_ShapeSet.hxx>
27 #include <Geom_Transformation.hxx>
28 #include <gp_Pnt.hxx>
29 #include <Graphic3d_ArrayOfPolylines.hxx>
30 #include <Graphic3d_AspectFillArea3d.hxx>
31 #include <Graphic3d_AspectLine3d.hxx>
32 #include <Graphic3d_AspectMarker3d.hxx>
33 #include <Graphic3d_AspectText3d.hxx>
34 #include <Graphic3d_Group.hxx>
35 #include <Graphic3d_MaterialAspect.hxx>
36 #include <Graphic3d_SequenceOfGroup.hxx>
37 #include <Graphic3d_Structure.hxx>
38 #include <HLRBRep.hxx>
39 #include <OSD_Timer.hxx>
40 #include <Precision.hxx>
41 #include <Prs3d.hxx>
42 #include <Prs3d_Drawer.hxx>
43 #include <Prs3d_IsoAspect.hxx>
44 #include <Prs3d_Presentation.hxx>
45 #include <Prs3d_Projector.hxx>
46 #include <Prs3d_Root.hxx>
47 #include <Prs3d_ShadingAspect.hxx>
48 #include <StdPrs_BndBox.hxx>
49 #include <StdPrs_ToolTriangulatedShape.hxx>
50 #include <PrsMgr_ModedPresentation.hxx>
51 #include <Quantity_Color.hxx>
52 #include <Select3D_SensitiveBox.hxx>
53 #include <Select3D_SensitiveEntity.hxx>
54 #include <Standard_ErrorHandler.hxx>
55 #include <Standard_Failure.hxx>
56 #include <Standard_Type.hxx>
57 #include <StdPrs_HLRPolyShape.hxx>
58 #include <StdPrs_HLRShape.hxx>
59 #include <StdPrs_ShadedShape.hxx>
60 #include <StdPrs_WFShape.hxx>
61 #include <StdSelect.hxx>
62 #include <StdSelect_BRepOwner.hxx>
63 #include <StdSelect_BRepSelectionTool.hxx>
64 #include <StdSelect_DisplayMode.hxx>
65 #include <TColStd_ListIteratorOfListOfInteger.hxx>
66 #include <TopExp.hxx>
67 #include <TopExp_Explorer.hxx>
68 #include <TopoDS_Iterator.hxx>
69 #include <TopoDS_Shape.hxx>
70
71 IMPLEMENT_STANDARD_RTTIEXT(AIS_Shape,AIS_InteractiveObject)
72
73 static Standard_Boolean IsInList(const TColStd_ListOfInteger& LL, const Standard_Integer aMode)
74 {
75   TColStd_ListIteratorOfListOfInteger It(LL);
76   for(;It.More();It.Next()){
77     if(It.Value()==aMode) 
78       return Standard_True;}
79   return Standard_False;
80 }
81
82 //==================================================
83 // Function: 
84 // Purpose :
85 //==================================================
86
87 AIS_Shape::
88 AIS_Shape(const TopoDS_Shape& shap):
89 AIS_InteractiveObject(PrsMgr_TOP_ProjectorDependant),
90 myInitAng(0.)
91 {
92   Set (shap);
93 }
94
95 //=======================================================================
96 //function : Type
97 //purpose  : 
98 //=======================================================================
99 AIS_KindOfInteractive AIS_Shape::Type() const 
100 {return AIS_KOI_Shape;}
101
102
103 //=======================================================================
104 //function : Signature
105 //purpose  : 
106 //=======================================================================
107 Standard_Integer AIS_Shape::Signature() const 
108 {return 0;}
109
110 //=======================================================================
111 //function : AcceptShapeDecomposition
112 //purpose  : 
113 //=======================================================================
114 Standard_Boolean AIS_Shape::AcceptShapeDecomposition() const 
115 {return Standard_True;}
116
117 //=======================================================================
118 //function : Compute
119 //purpose  : 
120 //=======================================================================
121 void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
122                         const Handle(Prs3d_Presentation)& aPrs,
123                         const Standard_Integer theMode)
124 {  
125   if(myshape.IsNull()) return;
126
127   // wire,edge,vertex -> pas de HLR + priorite display superieure
128   Standard_Integer TheType = (Standard_Integer) myshape.ShapeType();
129   if(TheType>4 && TheType<8) {
130     aPrs->SetVisual(Graphic3d_TOS_ALL);
131     aPrs->SetDisplayPriority(TheType+2);
132   }
133   // Shape vide -> Assemblage vide.
134   if (myshape.ShapeType() == TopAbs_COMPOUND) {
135     TopoDS_Iterator anExplor (myshape);
136
137     if (!anExplor.More()) {
138       return;
139     }
140   }
141
142   if (IsInfinite())
143   {
144     aPrs->SetInfiniteState (Standard_True); //not taken in account during FITALL
145   }
146
147   switch (theMode)
148   {
149     case AIS_WireFrame:
150     {
151       StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (myshape, myDrawer, Standard_True);
152       try
153       {
154         OCC_CATCH_SIGNALS
155         StdPrs_WFShape::Add (aPrs, myshape, myDrawer);
156       }
157       catch (Standard_Failure)
158       {
159       #ifdef OCCT_DEBUG
160         cout << "AIS_Shape::Compute() failed" << endl;
161         cout << "a Shape should be incorrect : No Compute can be maked on it " << endl;
162       #endif
163         // presentation of the bounding box is calculated
164         //      Compute(aPresentationManager,aPrs,2);
165       }
166       break;
167     }
168     case AIS_Shaded:
169     {
170       StdPrs_ToolTriangulatedShape::ClearOnOwnDeflectionChange (myshape, myDrawer, Standard_True);
171       if ((Standard_Integer) myshape.ShapeType() > 4)
172       {
173         StdPrs_WFShape::Add (aPrs, myshape, myDrawer);
174       }
175       else
176       {
177         if (IsInfinite())
178         {
179           StdPrs_WFShape::Add (aPrs, myshape, myDrawer);
180         }
181         else
182         {
183           try
184           {
185             OCC_CATCH_SIGNALS
186             StdPrs_ShadedShape::Add (aPrs, myshape, myDrawer);
187           }
188           catch (Standard_Failure)
189           {
190           #ifdef OCCT_DEBUG
191             cout << "AIS_Shape::Compute() in ShadingMode failed" << endl;
192           #endif
193             StdPrs_WFShape::Add (aPrs, myshape, myDrawer);
194           }
195         }
196       }
197       Standard_Real aTransparency = Transparency() ;
198       if (aTransparency > 0.0)
199       {
200         SetTransparency (aTransparency);
201       }
202       break;
203     }
204
205     // Bounding box.
206     case 2:
207     {
208       if (IsInfinite())
209       {
210         StdPrs_WFShape::Add (aPrs, myshape, myDrawer);
211       }
212       else
213       {
214         StdPrs_BndBox::Add (aPrs, BoundingBox(), myDrawer);
215       }
216     }
217   }
218
219   // Recompute hidden line presentation (if necessary).
220   aPrs->ReCompute();
221 }
222
223 //=======================================================================
224 //function : Compute
225 //purpose  : Hidden Line Removal
226 //=======================================================================
227 void AIS_Shape::Compute(const Handle(Prs3d_Projector)& aProjector,
228                         const Handle(Prs3d_Presentation)& aPresentation)
229 {
230   Compute(aProjector,aPresentation,myshape);
231 }
232
233 //=======================================================================
234 //function : Compute
235 //purpose  : 
236 //=======================================================================
237
238 void AIS_Shape::Compute(const Handle(Prs3d_Projector)&     aProjector,
239                         const Handle(Geom_Transformation)& TheTrsf,
240                         const Handle(Prs3d_Presentation)&  aPresentation)
241 {
242   const TopLoc_Location& loc = myshape.Location();
243   TopoDS_Shape shbis = myshape.Located(TopLoc_Location(TheTrsf->Trsf())*loc);
244   Compute(aProjector,aPresentation,shbis);
245 }
246
247 //=======================================================================
248 //function : Compute
249 //purpose  : 
250 //=======================================================================
251
252 void AIS_Shape::Compute(const Handle(Prs3d_Projector)& aProjector,
253                         const Handle(Prs3d_Presentation)& aPresentation,
254                         const TopoDS_Shape& SH)
255 {
256   if (SH.ShapeType() == TopAbs_COMPOUND) {
257     TopoDS_Iterator anExplor (SH);
258
259     if (!anExplor.More()) // Shape vide -> Assemblage vide.
260       return;
261   }
262
263   Handle (Prs3d_Drawer) defdrawer = GetContext()->DefaultDrawer();
264   if (defdrawer->DrawHiddenLine())
265     {myDrawer->EnableDrawHiddenLine();}
266   else {myDrawer->DisableDrawHiddenLine();}
267
268   Aspect_TypeOfDeflection prevdef = defdrawer->TypeOfDeflection();
269   defdrawer->SetTypeOfDeflection(Aspect_TOD_RELATIVE);
270
271   if (myDrawer->IsAutoTriangulation())
272   {
273     // coefficients for calculation
274     Standard_Real aPrevAngle, aNewAngle, aPrevCoeff, aNewCoeff;
275     Standard_Boolean isOwnHLRDeviationAngle = OwnHLRDeviationAngle (aNewAngle, aPrevAngle);
276     Standard_Boolean isOwnHLRDeviationCoefficient = OwnHLRDeviationCoefficient (aNewCoeff, aPrevCoeff);
277     if (((Abs (aNewAngle - aPrevAngle) > Precision::Angular()) && isOwnHLRDeviationAngle) ||
278         ((Abs (aNewCoeff - aPrevCoeff) > Precision::Confusion()) && isOwnHLRDeviationCoefficient))
279     {
280       BRepTools::Clean(SH);
281     }
282   }
283   
284   {
285     try {
286       OCC_CATCH_SIGNALS
287       switch (TypeOfHLR()) {
288         case Prs3d_TOH_Algo:
289           StdPrs_HLRShape::Add (aPresentation, SH, myDrawer, aProjector);
290           break;
291         case Prs3d_TOH_PolyAlgo:
292         default:
293           StdPrs_HLRPolyShape::Add (aPresentation, SH, myDrawer, aProjector);
294           break;
295       }
296     }
297     catch (Standard_Failure) {
298 #ifdef OCCT_DEBUG
299       cout <<"AIS_Shape::Compute(Proj) HLR Algorithm failed" << endl;
300 #endif
301       StdPrs_WFShape::Add(aPresentation,SH,myDrawer);
302     }
303   }
304
305   defdrawer->SetTypeOfDeflection (prevdef);
306 }
307
308 //=======================================================================
309 //function : SelectionType
310 //purpose  : gives the type according to the Index of Selection Mode
311 //=======================================================================
312
313 TopAbs_ShapeEnum AIS_Shape::SelectionType(const Standard_Integer aMode)
314 {
315   switch(aMode){
316   case 1:
317     return TopAbs_VERTEX;
318   case 2:
319     return TopAbs_EDGE;
320   case 3:
321     return TopAbs_WIRE;
322   case 4:
323     return TopAbs_FACE;
324   case 5:
325     return TopAbs_SHELL;
326   case 6:
327     return TopAbs_SOLID;
328   case 7:
329     return TopAbs_COMPSOLID;
330   case 8:
331     return TopAbs_COMPOUND;
332   case 0:
333   default:
334     return TopAbs_SHAPE;
335   }
336   
337 }
338 //=======================================================================
339 //function : SelectionType
340 //purpose  : gives the SelectionMode according to the Type od Decomposition...
341 //=======================================================================
342 Standard_Integer AIS_Shape::SelectionMode(const TopAbs_ShapeEnum aType)
343 {
344   switch(aType){
345   case TopAbs_VERTEX:
346     return 1;
347   case TopAbs_EDGE:
348     return 2;
349   case TopAbs_WIRE:
350     return 3;
351   case  TopAbs_FACE:
352     return 4;
353   case TopAbs_SHELL:
354     return 5;
355   case TopAbs_SOLID:
356     return 6;
357   case TopAbs_COMPSOLID:
358     return 7;
359   case TopAbs_COMPOUND:
360     return 8;
361   case TopAbs_SHAPE:
362   default:
363     return 0;
364   }
365 }
366
367
368 //=======================================================================
369 //function : ComputeSelection
370 //purpose  : 
371 //=======================================================================
372
373 void AIS_Shape::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
374                                               const Standard_Integer aMode)
375 {
376   if(myshape.IsNull()) return;
377   if (myshape.ShapeType() == TopAbs_COMPOUND) {
378     TopoDS_Iterator anExplor (myshape);
379
380     if (!anExplor.More()) // empty Shape -> empty Assembly.
381       return;
382   }
383
384   TopAbs_ShapeEnum TypOfSel = AIS_Shape::SelectionType(aMode);
385   TopoDS_Shape shape = myshape;
386
387 // POP protection against crash in low layers
388
389   Standard_Real aDeflection = Prs3d::GetDeflection(shape, myDrawer);
390   try {  
391     OCC_CATCH_SIGNALS
392     StdSelect_BRepSelectionTool::Load(aSelection,
393                                       this,
394                                       shape,
395                                       TypOfSel,
396                                       aDeflection,
397                                       myDrawer->HLRAngle(),
398                                       myDrawer->IsAutoTriangulation());
399   } catch ( Standard_Failure ) {
400 //    cout << "a Shape should be incorrect : A Selection on the Bnd  is activated   "<<endl;
401     if ( aMode == 0 ) {
402       aSelection->Clear();
403       Bnd_Box B = BoundingBox();
404       Handle(StdSelect_BRepOwner) aOwner = new StdSelect_BRepOwner(shape,this);
405       Handle(Select3D_SensitiveBox) aSensitiveBox = new Select3D_SensitiveBox(aOwner,B);
406       aSelection->Add(aSensitiveBox);
407     }
408   }
409
410   // insert the drawer in the BrepOwners for hilight...
411   StdSelect::SetDrawerForBRepOwner(aSelection,myDrawer);
412 }
413
414 Quantity_NameOfColor AIS_Shape::Color() const {
415 Quantity_Color aColor;
416   Color(aColor);
417   return aColor.Name();
418 }
419
420 void AIS_Shape::Color( Quantity_Color& aColor ) const {
421   aColor = myDrawer->ShadingAspect()->Color(myCurrentFacingModel);
422 }
423
424 Graphic3d_NameOfMaterial AIS_Shape::Material() const {
425   return (myDrawer->ShadingAspect()->Material(myCurrentFacingModel)).Name();
426 }
427
428 Standard_Real AIS_Shape::Transparency() const {
429   return myDrawer->ShadingAspect()->Transparency(myCurrentFacingModel);
430 }
431
432 //=======================================================================
433 //function : SetColor
434 //purpose  : 
435 //=======================================================================
436
437 void AIS_Shape::SetColor(const Quantity_NameOfColor aCol)
438 {
439   SetColor(Quantity_Color(aCol));
440 }
441
442 //=======================================================================
443 //function : setColor
444 //purpose  :
445 //=======================================================================
446
447 void AIS_Shape::setColor (const Handle(Prs3d_Drawer)& theDrawer,
448                           const Quantity_Color&       theColor) const
449 {
450   if (!theDrawer->HasOwnShadingAspect())
451   {
452     theDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
453     if (theDrawer->HasLink())
454     {
455       *theDrawer->ShadingAspect()->Aspect() = *theDrawer->Link()->ShadingAspect()->Aspect();
456     }
457   }
458   if (!theDrawer->HasOwnLineAspect())
459   {
460     theDrawer->SetLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
461     if (theDrawer->HasLink())
462     {
463       *theDrawer->LineAspect()->Aspect() = *theDrawer->Link()->LineAspect()->Aspect();
464     }
465   }
466   if (!theDrawer->HasOwnWireAspect())
467   {
468     theDrawer->SetWireAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
469     if (theDrawer->HasLink())
470     {
471       *theDrawer->WireAspect()->Aspect() = *theDrawer->Link()->WireAspect()->Aspect();
472     }
473   }
474   if (!theDrawer->HasOwnPointAspect())
475   {
476     theDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_PLUS, Quantity_NOC_BLACK, 1.0));
477     if (theDrawer->HasLink())
478     {
479       *theDrawer->PointAspect()->Aspect() = *theDrawer->Link()->PointAspect()->Aspect();
480     }
481   }
482   if (!theDrawer->HasOwnFreeBoundaryAspect())
483   {
484     theDrawer->SetFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
485     if (theDrawer->HasLink())
486     {
487       *theDrawer->FreeBoundaryAspect()->Aspect() = *theDrawer->Link()->FreeBoundaryAspect()->Aspect();
488     }
489   }
490   if (!theDrawer->HasOwnUnFreeBoundaryAspect())
491   {
492     theDrawer->SetUnFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
493     if (theDrawer->HasLink())
494     {
495       *theDrawer->UnFreeBoundaryAspect()->Aspect() = *theDrawer->Link()->UnFreeBoundaryAspect()->Aspect();
496     }
497   }
498   if (!theDrawer->HasOwnSeenLineAspect())
499   {
500     theDrawer->SetSeenLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
501     if (theDrawer->HasLink())
502     {
503       *theDrawer->SeenLineAspect()->Aspect() = *theDrawer->Link()->SeenLineAspect()->Aspect();
504     }
505   }
506
507   // override color
508   theDrawer->ShadingAspect()->SetColor (theColor, myCurrentFacingModel);
509   theDrawer->LineAspect()->SetColor (theColor);
510   theDrawer->WireAspect()->SetColor (theColor);
511   theDrawer->PointAspect()->SetColor (theColor);
512   theDrawer->FreeBoundaryAspect()->SetColor (theColor);
513   theDrawer->UnFreeBoundaryAspect()->SetColor (theColor);
514   theDrawer->SeenLineAspect()->SetColor (theColor);
515 }
516
517 //=======================================================================
518 //function : SetColor
519 //purpose  :
520 //=======================================================================
521
522 void AIS_Shape::SetColor (const Quantity_Color& theColor)
523 {
524   setColor (myDrawer, theColor);
525   myDrawer->SetColor (theColor);
526   hasOwnColor = Standard_True;
527
528   // modify shading presentation without re-computation
529   const PrsMgr_Presentations&        aPrsList     = Presentations();
530   Handle(Graphic3d_AspectFillArea3d) anAreaAspect = myDrawer->ShadingAspect()->Aspect();
531   Handle(Graphic3d_AspectLine3d)     aLineAspect  = myDrawer->LineAspect()->Aspect();
532   Handle(Graphic3d_AspectMarker3d)   aPointAspect = myDrawer->PointAspect()->Aspect();
533   for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
534   {
535     const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
536     if (aPrsModed.Mode() != AIS_Shaded)
537     {
538       continue;
539     }
540
541     const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
542     for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
543     {
544       const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
545
546       // Check if aspect of given type is set for the group, 
547       // because setting aspect for group with no already set aspect
548       // can lead to loss of presentation data
549       if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
550       {
551         aGroup->SetGroupPrimitivesAspect (anAreaAspect);
552       }
553       if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_LINE))
554       {
555         aGroup->SetGroupPrimitivesAspect (aLineAspect);
556       }
557       if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_MARKER))
558       {
559         aGroup->SetGroupPrimitivesAspect (aPointAspect);
560       }
561     }
562   }
563
564   LoadRecomputable (AIS_WireFrame);
565   LoadRecomputable (2);
566 }
567
568 //=======================================================================
569 //function : UnsetColor
570 //purpose  :
571 //=======================================================================
572
573 void AIS_Shape::UnsetColor()
574 {
575   if (!HasColor())
576   {
577     myToRecomputeModes.Clear();
578     return;
579   }
580   hasOwnColor = Standard_False;
581
582   if (!HasWidth())
583   {
584     Handle(Prs3d_LineAspect) anEmptyAsp;
585     myDrawer->SetLineAspect          (anEmptyAsp);
586     myDrawer->SetWireAspect          (anEmptyAsp);
587     myDrawer->SetFreeBoundaryAspect  (anEmptyAsp);
588     myDrawer->SetUnFreeBoundaryAspect(anEmptyAsp);
589     myDrawer->SetSeenLineAspect      (anEmptyAsp);
590   }
591   else
592   {
593     Quantity_Color aColor = Quantity_NOC_YELLOW;
594     if (myDrawer->HasLink())
595     {
596       AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Line,   aColor);
597     }
598     myDrawer->LineAspect()->SetColor (aColor);
599     aColor = Quantity_NOC_RED;
600     if (myDrawer->HasLink())
601     {
602       AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Wire,   aColor);
603     }
604     myDrawer->WireAspect()->SetColor (aColor);
605     aColor = Quantity_NOC_GREEN;
606     if (myDrawer->HasLink())
607     {
608       AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Free,   aColor);
609     }
610     myDrawer->FreeBoundaryAspect()->SetColor (aColor);
611     aColor = Quantity_NOC_YELLOW;
612     if (myDrawer->HasLink())
613     {
614       AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_UnFree, aColor);
615     }
616     myDrawer->UnFreeBoundaryAspect()->SetColor (aColor);
617     if (myDrawer->HasLink())
618     {
619       AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Seen,   aColor);
620     }
621     myDrawer->SeenLineAspect()->SetColor (aColor);
622   }
623
624   if (HasMaterial()
625    || IsTransparent())
626   {
627     Graphic3d_MaterialAspect aDefaultMat (Graphic3d_NOM_BRASS);
628     Graphic3d_MaterialAspect mat = aDefaultMat;
629     if (HasMaterial() || myDrawer->HasLink())
630     {
631       mat = AIS_GraphicTool::GetMaterial(HasMaterial()? myDrawer : myDrawer->Link());
632     }
633     if (HasMaterial())
634     {
635       Quantity_Color aColor = aDefaultMat.AmbientColor();
636       if (myDrawer->HasLink())
637       {
638         aColor = myDrawer->Link()->ShadingAspect()->Color (myCurrentFacingModel);
639       }
640       mat.SetColor (aColor);
641     }
642     if (IsTransparent())
643     {
644       Standard_Real aTransp = myDrawer->ShadingAspect()->Transparency (myCurrentFacingModel);
645       mat.SetTransparency (Standard_ShortReal(aTransp));
646     }
647     myDrawer->ShadingAspect()->SetMaterial (mat ,myCurrentFacingModel);
648   }
649   else
650   {
651     myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
652   }
653   myDrawer->SetPointAspect (Handle(Prs3d_PointAspect)());
654
655   // modify shading presentation without re-computation
656   const PrsMgr_Presentations&        aPrsList  = Presentations();
657   Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->Link()->ShadingAspect()->Aspect();
658   Handle(Graphic3d_AspectLine3d)     aLineAsp  = myDrawer->Link()->LineAspect()->Aspect();
659   for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
660   {
661     const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
662     if (aPrsModed.Mode() != AIS_Shaded)
663     {
664       continue;
665     }
666
667     const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
668     for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
669     {
670       const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
671
672       // Check if aspect of given type is set for the group,
673       // because setting aspect for group with no already set aspect
674       // can lead to loss of presentation data
675       if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
676       {
677         aGroup->SetGroupPrimitivesAspect (anAreaAsp);
678       }
679       if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_LINE))
680       {
681         aGroup->SetGroupPrimitivesAspect (aLineAsp);
682       }
683     }
684   }
685
686   LoadRecomputable (AIS_WireFrame);
687   LoadRecomputable (2);
688 }
689
690 //=======================================================================
691 //function : setWidth
692 //purpose  :
693 //=======================================================================
694
695 void AIS_Shape::setWidth (const Handle(Prs3d_Drawer)& theDrawer,
696                           const Standard_Real         theLineWidth) const
697 {
698   if (!theDrawer->HasOwnLineAspect())
699   {
700     theDrawer->SetLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
701     if (theDrawer->HasLink())
702     {
703       *theDrawer->LineAspect()->Aspect() = *theDrawer->Link()->LineAspect()->Aspect();
704     }
705   }
706   if (!theDrawer->HasOwnWireAspect())
707   {
708     theDrawer->SetWireAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
709     if (theDrawer->HasLink())
710     {
711       *theDrawer->WireAspect()->Aspect() = *theDrawer->Link()->WireAspect()->Aspect();
712     }
713   }
714   if (!theDrawer->HasOwnFreeBoundaryAspect())
715   {
716     theDrawer->SetFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
717     if (theDrawer->HasLink())
718     {
719       *theDrawer->FreeBoundaryAspect()->Aspect() = *theDrawer->Link()->FreeBoundaryAspect()->Aspect();
720     }
721   }
722   if (!theDrawer->HasOwnUnFreeBoundaryAspect())
723   {
724     theDrawer->SetUnFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
725     if (theDrawer->HasLink())
726     {
727       *theDrawer->UnFreeBoundaryAspect()->Aspect() = *theDrawer->Link()->UnFreeBoundaryAspect()->Aspect();
728     }
729   }
730   if (!theDrawer->HasOwnSeenLineAspect())
731   {
732     theDrawer->SetSeenLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
733     if (theDrawer->HasLink())
734     {
735       *theDrawer->SeenLineAspect()->Aspect() = *theDrawer->Link()->SeenLineAspect()->Aspect();
736     }
737   }
738
739   // override width
740   theDrawer->LineAspect()->SetWidth (theLineWidth);
741   theDrawer->WireAspect()->SetWidth (theLineWidth);
742   theDrawer->FreeBoundaryAspect()->SetWidth (theLineWidth);
743   theDrawer->UnFreeBoundaryAspect()->SetWidth (theLineWidth);
744   theDrawer->SeenLineAspect()->SetWidth (theLineWidth);
745 }
746
747 //=======================================================================
748 //function : SetWidth
749 //purpose  : 
750 //=======================================================================
751
752 void AIS_Shape::SetWidth (const Standard_Real theLineWidth)
753 {
754   setWidth (myDrawer, theLineWidth);
755   myOwnWidth = theLineWidth;
756   LoadRecomputable (AIS_WireFrame); // means that it is necessary to recompute only the wireframe....
757   LoadRecomputable (2);             // and the bounding box...
758 }
759
760 //=======================================================================
761 //function : UnsetWidth
762 //purpose  :
763 //=======================================================================
764
765 void AIS_Shape::UnsetWidth()
766 {
767   if (myOwnWidth == 0.0)
768   {
769     myToRecomputeModes.Clear();
770     return;
771   }
772
773   myOwnWidth = 0.0;
774
775   Handle(Prs3d_LineAspect) anEmptyAsp;
776
777   if (!HasColor())
778   {
779     myDrawer->SetLineAspect          (anEmptyAsp);
780     myDrawer->SetWireAspect          (anEmptyAsp);
781     myDrawer->SetFreeBoundaryAspect  (anEmptyAsp);
782     myDrawer->SetUnFreeBoundaryAspect(anEmptyAsp);
783     myDrawer->SetSeenLineAspect      (anEmptyAsp);
784   }
785   else
786   {
787     myDrawer->LineAspect()          ->SetWidth (myDrawer->HasLink() ?
788       AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Line) : 1.);
789     myDrawer->WireAspect()          ->SetWidth (myDrawer->HasLink() ?
790       AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Wire) : 1.);
791     myDrawer->FreeBoundaryAspect()  ->SetWidth (myDrawer->HasLink() ?
792       AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Free) : 1.);
793     myDrawer->UnFreeBoundaryAspect()->SetWidth (myDrawer->HasLink() ?
794       AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_UnFree) : 1.);
795     myDrawer->SeenLineAspect()      ->SetWidth (myDrawer->HasLink() ?
796       AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Seen) : 1.);
797   }
798   LoadRecomputable (AIS_WireFrame);
799 }
800
801 //=======================================================================
802 //function : setMaterial
803 //purpose  :
804 //=======================================================================
805
806 void AIS_Shape::setMaterial (const Handle(Prs3d_Drawer)&     theDrawer,
807                              const Graphic3d_MaterialAspect& theMaterial,
808                              const Standard_Boolean          theToKeepColor,
809                              const Standard_Boolean          theToKeepTransp) const
810 {
811   const Quantity_Color aColor  = theDrawer->ShadingAspect()->Material     (myCurrentFacingModel).Color();
812   const Standard_Real  aTransp = theDrawer->ShadingAspect()->Transparency (myCurrentFacingModel);
813   if (!theDrawer->HasOwnShadingAspect())
814   {
815     theDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
816     if (theDrawer->HasLink())
817     {
818       *theDrawer->ShadingAspect()->Aspect() = *theDrawer->Link()->ShadingAspect()->Aspect();
819     }
820   }
821   theDrawer->ShadingAspect()->SetMaterial (theMaterial, myCurrentFacingModel);
822
823   if (theToKeepColor)
824   {
825     theDrawer->ShadingAspect()->SetColor (aColor, myCurrentFacingModel);
826   }
827   if (theToKeepTransp)
828   {
829     theDrawer->ShadingAspect()->SetTransparency (aTransp, myCurrentFacingModel);
830   }
831 }
832
833 //=======================================================================
834 //function : SetMaterial
835 //purpose  : 
836 //=======================================================================
837
838 void AIS_Shape::SetMaterial(const Graphic3d_NameOfMaterial aMat)
839 {
840   SetMaterial(Graphic3d_MaterialAspect(aMat));
841 }
842
843 //=======================================================================
844 //function : SetMaterial
845 //purpose  :
846 //=======================================================================
847
848 void AIS_Shape::SetMaterial (const Graphic3d_MaterialAspect& theMat)
849 {
850   setMaterial (myDrawer, theMat, HasColor(), IsTransparent());
851   hasOwnMaterial = Standard_True;
852
853   // modify shading presentation without re-computation
854   const PrsMgr_Presentations&        aPrsList  = Presentations();
855   Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
856   for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
857   {
858     const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
859     if (aPrsModed.Mode() != AIS_Shaded)
860     {
861       continue;
862     }
863
864     const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
865     for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
866     {
867       const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
868
869       // Check if aspect of given type is set for the group, 
870       // because setting aspect for group with no already set aspect
871       // can lead to loss of presentation data
872       if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
873       {
874         aGroup->SetGroupPrimitivesAspect (anAreaAsp);
875       }
876     }
877   }
878
879   myRecomputeEveryPrs = Standard_False; // no mode to recalculate  :only viewer update
880   myToRecomputeModes.Clear();
881 }
882
883 //=======================================================================
884 //function : UnsetMaterial
885 //purpose  :
886 //=======================================================================
887
888 void AIS_Shape::UnsetMaterial()
889 {
890   if (!HasMaterial())
891   {
892     return;
893   }
894
895   if (HasColor()
896    || IsTransparent())
897   {
898     if(myDrawer->HasLink())
899     {
900       myDrawer->ShadingAspect()->SetMaterial (myDrawer->Link()->ShadingAspect()->Material (myCurrentFacingModel),
901                                               myCurrentFacingModel);
902     }
903     if (HasColor())
904     {
905       myDrawer->ShadingAspect()->SetColor        (myDrawer->Color(),        myCurrentFacingModel);
906       myDrawer->ShadingAspect()->SetTransparency (myDrawer->Transparency(), myCurrentFacingModel);
907     }
908   }
909   else
910   {
911     myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
912   }
913   hasOwnMaterial = Standard_False;
914
915   // modify shading presentation without re-computation
916   const PrsMgr_Presentations&        aPrsList  = Presentations();
917   Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
918   for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
919   {
920     const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
921     if (aPrsModed.Mode() != AIS_Shaded)
922     {
923       continue;
924     }
925
926     const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
927     for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
928     {
929       const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
930       if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
931       {
932         aGroup->SetGroupPrimitivesAspect (anAreaAsp);
933       }
934     }
935   }
936
937   myRecomputeEveryPrs = Standard_False; // no mode to recalculate :only viewer update
938   myToRecomputeModes.Clear();  
939 }
940
941 //=======================================================================
942 //function : setTransparency
943 //purpose  :
944 //=======================================================================
945
946 void AIS_Shape::setTransparency (const Handle(Prs3d_Drawer)& theDrawer,
947                                  const Standard_Real         theValue) const
948 {
949   if (!theDrawer->HasOwnShadingAspect())
950   {
951     theDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
952     if (theDrawer->HasLink())
953     {
954       *theDrawer->ShadingAspect()->Aspect() = *theDrawer->Link()->ShadingAspect()->Aspect();
955     }
956   }
957
958   // override transparency
959   theDrawer->ShadingAspect()->SetTransparency (theValue, myCurrentFacingModel);
960 }
961
962 //=======================================================================
963 //function : SetTransparency
964 //purpose  :
965 //=======================================================================
966
967 void AIS_Shape::SetTransparency (const Standard_Real theValue)
968 {
969   setTransparency (myDrawer, theValue);
970   myDrawer->SetTransparency ((Standard_ShortReal )theValue);
971
972   // modify shading presentation without re-computation
973   const PrsMgr_Presentations&        aPrsList  = Presentations();
974   Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
975   for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
976   {
977     const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
978     if (aPrsModed.Mode() != AIS_Shaded)
979     {
980       continue;
981     }
982
983     const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
984     aPrs->SetDisplayPriority (10); // force highest priority for translucent objects
985     for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
986     {
987       const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
988       if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
989       {
990         aGroup->SetGroupPrimitivesAspect (anAreaAsp);
991       }
992     }
993   }
994
995   myRecomputeEveryPrs = Standard_False; // no mode to recalculate - only viewer update
996   myToRecomputeModes.Clear();
997 }
998
999 //=======================================================================
1000 //function : UnsetTransparency
1001 //purpose  :
1002 //=======================================================================
1003
1004 void AIS_Shape::UnsetTransparency()
1005 {
1006   myDrawer->SetTransparency (0.0f);
1007   if (!myDrawer->HasOwnShadingAspect())
1008   {
1009     return;
1010   }
1011   else if (HasColor() || HasMaterial())
1012   {
1013     myDrawer->ShadingAspect()->SetTransparency (0.0, myCurrentFacingModel);
1014   }
1015   else
1016   {
1017     myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
1018   }
1019
1020   // modify shading presentation without re-computation
1021   const PrsMgr_Presentations&        aPrsList  = Presentations();
1022   Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
1023   for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
1024   {
1025     const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
1026     if (aPrsModed.Mode() != AIS_Shaded)
1027     {
1028       continue;
1029     }
1030
1031     const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
1032     for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
1033     {
1034       const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
1035       if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
1036       {
1037         aGroup->SetGroupPrimitivesAspect (anAreaAsp);
1038       }
1039     }
1040     aPrs->ResetDisplayPriority();
1041   }
1042
1043   myRecomputeEveryPrs = Standard_False; // no mode to recalculate :only viewer update
1044   myToRecomputeModes.Clear();
1045 }
1046
1047 //=======================================================================
1048 //function : LoadRecomputable
1049 //purpose  : 
1050 //=======================================================================
1051
1052 void AIS_Shape::LoadRecomputable(const Standard_Integer TheMode)
1053 {
1054   myRecomputeEveryPrs = Standard_False;
1055   if(!IsInList(myToRecomputeModes,TheMode))
1056     myToRecomputeModes.Append(TheMode);
1057 }
1058
1059 //=======================================================================
1060 //function : BoundingBox
1061 //purpose  : 
1062 //=======================================================================
1063
1064 const Bnd_Box& AIS_Shape::BoundingBox()  
1065 {
1066   if (myshape.ShapeType() == TopAbs_COMPOUND) {
1067     TopoDS_Iterator anExplor (myshape);
1068
1069     if (!anExplor.More()) { // empty Shape  -> empty Assembly.
1070       myBB.SetVoid();
1071       return myBB;
1072     }
1073   }
1074
1075   if(myCompBB) {
1076     BRepBndLib::AddClose(myshape, myBB);
1077     myCompBB = Standard_False;
1078   }
1079   return myBB;
1080 }
1081
1082 //*****
1083 //***** Reset
1084 //=======================================================================
1085 //function : SetOwnDeviationCoefficient
1086 //purpose  : resets myhasOwnDeviationCoefficient to Standard_False and
1087 //           returns Standard_True if it change
1088 //=======================================================================
1089
1090 Standard_Boolean AIS_Shape::SetOwnDeviationCoefficient ()
1091 {
1092   Standard_Boolean itSet = myDrawer->HasOwnDeviationCoefficient();
1093   if(itSet)  myDrawer->SetDeviationCoefficient();
1094   return itSet;
1095 }
1096
1097 //=======================================================================
1098 //function : SetHLROwnDeviationCoefficient
1099 //purpose  : resets myhasOwnHLRDeviationCoefficient to Standard_False and
1100 //           returns Standard_True if it change
1101 //=======================================================================
1102
1103 Standard_Boolean AIS_Shape::SetOwnHLRDeviationCoefficient ()
1104 {
1105   Standard_Boolean itSet = myDrawer->HasOwnHLRDeviationCoefficient();
1106   if(itSet)  myDrawer->SetHLRDeviationCoefficient();
1107   return itSet;
1108
1109 }
1110
1111 //=======================================================================
1112 //function : SetOwnDeviationAngle
1113 //purpose  : resets myhasOwnDeviationAngle to Standard_False and
1114 //           returns Standard_True if it change
1115 //=======================================================================
1116
1117 Standard_Boolean AIS_Shape::SetOwnDeviationAngle ()
1118 {
1119   Standard_Boolean itSet = myDrawer->HasOwnDeviationAngle();
1120   if(itSet)  myDrawer->SetDeviationAngle();
1121   return itSet;
1122
1123 }
1124
1125 //=======================================================================
1126 //function : SetOwnHLRDeviationAngle
1127 //purpose  : resets myhasOwnHLRDeviationAngle to Standard_False and
1128 //           returns Standard_True if it change
1129 //=======================================================================
1130
1131 Standard_Boolean AIS_Shape::SetOwnHLRDeviationAngle ()
1132 {
1133   Standard_Boolean itSet = myDrawer->HasOwnHLRDeviationAngle();
1134   if(itSet)  myDrawer->SetHLRAngle();
1135   return itSet;
1136
1137 }
1138 //***** SetOwn
1139 //=======================================================================
1140 //function : SetOwnDeviationCoefficient
1141 //purpose  : 
1142 //=======================================================================
1143
1144 void AIS_Shape::SetOwnDeviationCoefficient ( const Standard_Real  aCoefficient )
1145 {
1146   myDrawer->SetDeviationCoefficient( aCoefficient );
1147   SetToUpdate(0) ; // WireFrame
1148   SetToUpdate(1) ; // Shadding
1149 }
1150
1151 //=======================================================================
1152 //function : SetOwnHLRDeviationCoefficient
1153 //purpose  : 
1154 //=======================================================================
1155
1156 void AIS_Shape::SetOwnHLRDeviationCoefficient ( const Standard_Real  aCoefficient )
1157 {
1158   myDrawer->SetHLRDeviationCoefficient( aCoefficient );
1159   
1160 }
1161
1162 //=======================================================================
1163 //function : SetOwnDeviationAngle
1164 //purpose  : 
1165 //=======================================================================
1166
1167 void AIS_Shape::SetOwnDeviationAngle ( const Standard_Real  anAngle )
1168 {
1169
1170   myDrawer->SetDeviationAngle(anAngle );
1171   SetToUpdate(0) ;   // WireFrame
1172 }
1173 //=======================================================================
1174 //function : SetOwnDeviationAngle
1175 //purpose  : 
1176 //=======================================================================
1177
1178 void AIS_Shape::SetAngleAndDeviation ( const Standard_Real  anAngle )
1179 {
1180   Standard_Real OutAngl,OutDefl;
1181   HLRBRep::PolyHLRAngleAndDeflection(anAngle,OutAngl,OutDefl);
1182   SetOwnDeviationAngle(anAngle) ;
1183   SetOwnDeviationCoefficient(OutDefl) ;
1184   myInitAng = anAngle;
1185   SetToUpdate(0);
1186   SetToUpdate(1);
1187 }
1188
1189 //=======================================================================
1190 //function : UserAngle
1191 //purpose  : 
1192 //=======================================================================
1193
1194 Standard_Real AIS_Shape::UserAngle() const
1195 {
1196   return myInitAng ==0. ? GetContext()->DeviationAngle(): myInitAng;
1197 }
1198
1199
1200 //=======================================================================
1201 //function : SetHLRAngleAndDeviation
1202 //purpose  : 
1203 //=======================================================================
1204
1205 void AIS_Shape::SetHLRAngleAndDeviation ( const Standard_Real  anAngle )
1206 {
1207   Standard_Real OutAngl,OutDefl;
1208   HLRBRep::PolyHLRAngleAndDeflection(anAngle,OutAngl,OutDefl);
1209   SetOwnHLRDeviationAngle( OutAngl );
1210   SetOwnHLRDeviationCoefficient(OutDefl);
1211
1212 }
1213 //=======================================================================
1214 //function : SetOwnHLRDeviationAngle
1215 //purpose  : 
1216 //=======================================================================
1217
1218 void AIS_Shape::SetOwnHLRDeviationAngle ( const Standard_Real  anAngle )
1219 {
1220   myDrawer->SetHLRAngle( anAngle );
1221 }
1222
1223 //***** GetOwn
1224 //=======================================================================
1225 //function : OwnDeviationCoefficient
1226 //purpose  : 
1227 //=======================================================================
1228
1229 Standard_Boolean AIS_Shape::OwnDeviationCoefficient ( Standard_Real &  aCoefficient,
1230                                                       Standard_Real & aPreviousCoefficient ) const
1231 {
1232   aCoefficient = myDrawer->DeviationCoefficient();
1233   aPreviousCoefficient = myDrawer->PreviousDeviationCoefficient ();
1234   return myDrawer->HasOwnDeviationCoefficient() ;
1235 }
1236
1237 //=======================================================================
1238 //function : OwnHLRDeviationCoefficient
1239 //purpose  : 
1240 //=======================================================================
1241
1242 Standard_Boolean AIS_Shape::OwnHLRDeviationCoefficient ( Standard_Real & aCoefficient,
1243                                                          Standard_Real & aPreviousCoefficient ) const
1244 {
1245   aCoefficient = myDrawer->HLRDeviationCoefficient();
1246   aPreviousCoefficient = myDrawer->PreviousHLRDeviationCoefficient ();
1247   return myDrawer->HasOwnHLRDeviationCoefficient();
1248
1249 }
1250
1251 //=======================================================================
1252 //function : OwnDeviationAngle
1253 //purpose  : 
1254 //=======================================================================
1255
1256 Standard_Boolean AIS_Shape::OwnDeviationAngle ( Standard_Real &  anAngle,
1257                                                 Standard_Real & aPreviousAngle ) const
1258 {
1259   anAngle = myDrawer->DeviationAngle();
1260   aPreviousAngle = myDrawer->PreviousDeviationAngle (); 
1261   return myDrawer->HasOwnDeviationAngle();
1262 }
1263
1264 //=======================================================================
1265 //function : OwnHLRDeviationAngle
1266 //purpose  : 
1267 //=======================================================================
1268
1269 Standard_Boolean AIS_Shape::OwnHLRDeviationAngle ( Standard_Real &  anAngle,
1270                                                    Standard_Real & aPreviousAngle ) const
1271 {
1272   anAngle = myDrawer->HLRAngle();
1273   aPreviousAngle = myDrawer->PreviousHLRDeviationAngle (); 
1274   return myDrawer->HasOwnHLRDeviationAngle();
1275 }