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