0023200: Visualization - prevent multiple triangulating of a shape that already has...
[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       Bnd_Box B = BoundingBox();
398       Handle(StdSelect_BRepOwner) aOwner = new StdSelect_BRepOwner(shape,this);
399       Handle(Select3D_SensitiveBox) aSensitiveBox = new Select3D_SensitiveBox(aOwner,B);
400       aSelection->Add(aSensitiveBox);
401     }
402   }
403
404   // insert the drawer in the BrepOwners for hilight...
405   StdSelect::SetDrawerForBRepOwner(aSelection,myDrawer);
406 }
407
408 Quantity_NameOfColor AIS_Shape::Color() const {
409 Quantity_Color aColor;
410   Color(aColor);
411   return aColor.Name();
412 }
413
414 void AIS_Shape::Color( Quantity_Color& aColor ) const {
415   aColor = myDrawer->ShadingAspect()->Color(myCurrentFacingModel);
416 }
417
418 Graphic3d_NameOfMaterial AIS_Shape::Material() const {
419   return (myDrawer->ShadingAspect()->Material(myCurrentFacingModel)).Name();
420 }
421
422 Standard_Real AIS_Shape::Transparency() const {
423   return myDrawer->ShadingAspect()->Transparency(myCurrentFacingModel);
424 }
425
426 //=======================================================================
427 //function : SetColor
428 //purpose  : 
429 //=======================================================================
430
431 void AIS_Shape::SetColor(const Quantity_NameOfColor aCol)
432 {
433   SetColor(Quantity_Color(aCol));
434 }
435
436 //=======================================================================
437 //function : setColor
438 //purpose  :
439 //=======================================================================
440
441 void AIS_Shape::setColor (const Handle(Prs3d_Drawer)& theDrawer,
442                           const Quantity_Color&       theColor) const
443 {
444   if (!theDrawer->HasOwnShadingAspect())
445   {
446     theDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
447     if (theDrawer->HasLink())
448     {
449       *theDrawer->ShadingAspect()->Aspect() = *theDrawer->Link()->ShadingAspect()->Aspect();
450     }
451   }
452   if (!theDrawer->HasOwnLineAspect())
453   {
454     theDrawer->SetLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
455     if (theDrawer->HasLink())
456     {
457       *theDrawer->LineAspect()->Aspect() = *theDrawer->Link()->LineAspect()->Aspect();
458     }
459   }
460   if (!theDrawer->HasOwnWireAspect())
461   {
462     theDrawer->SetWireAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
463     if (theDrawer->HasLink())
464     {
465       *theDrawer->WireAspect()->Aspect() = *theDrawer->Link()->WireAspect()->Aspect();
466     }
467   }
468   if (!theDrawer->HasOwnPointAspect())
469   {
470     theDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_POINT, Quantity_NOC_BLACK, 1.0));
471     if (theDrawer->HasLink())
472     {
473       *theDrawer->PointAspect()->Aspect() = *theDrawer->Link()->PointAspect()->Aspect();
474     }
475   }
476   // disable dedicated line aspects
477   theDrawer->SetFreeBoundaryAspect  (theDrawer->LineAspect());
478   theDrawer->SetUnFreeBoundaryAspect(theDrawer->LineAspect());
479   theDrawer->SetSeenLineAspect      (theDrawer->LineAspect());
480
481   // override color
482   theDrawer->ShadingAspect()->SetColor (theColor, myCurrentFacingModel);
483   theDrawer->SetShadingAspectGlobal (Standard_False);
484   theDrawer->LineAspect()->SetColor (theColor);
485   theDrawer->WireAspect()->SetColor (theColor);
486   theDrawer->PointAspect()->SetColor (theColor);
487 }
488
489 //=======================================================================
490 //function : SetColor
491 //purpose  :
492 //=======================================================================
493
494 void AIS_Shape::SetColor (const Quantity_Color& theColor)
495 {
496   setColor (myDrawer, theColor);
497   myOwnColor  = theColor;
498   hasOwnColor = Standard_True;
499
500   // modify shading presentation without re-computation
501   const PrsMgr_Presentations&        aPrsList     = Presentations();
502   Handle(Graphic3d_AspectFillArea3d) anAreaAspect = myDrawer->ShadingAspect()->Aspect();
503   Handle(Graphic3d_AspectLine3d)     aLineAspect  = myDrawer->LineAspect()->Aspect();
504   Handle(Graphic3d_AspectMarker3d)   aPointAspect = myDrawer->PointAspect()->Aspect();
505   for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
506   {
507     const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
508     if (aPrsModed.Mode() != AIS_Shaded)
509     {
510       continue;
511     }
512
513     const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
514
515     // Set aspects for presentation
516     aPrs->SetPrimitivesAspect (anAreaAspect);
517     aPrs->SetPrimitivesAspect (aLineAspect);
518     aPrs->SetPrimitivesAspect (aPointAspect);
519
520     // Go through all groups to change color for all primitives
521     for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
522     {
523       const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
524
525       // Check if aspect of given type is set for the group, 
526       // because setting aspect for group with no already set aspect
527       // can lead to loss of presentation data
528       if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
529       {
530         aGroup->SetGroupPrimitivesAspect (anAreaAspect);
531       }
532       if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_LINE))
533       {
534         aGroup->SetGroupPrimitivesAspect (aLineAspect);
535       }
536       if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_MARKER))
537       {
538         aGroup->SetGroupPrimitivesAspect (aPointAspect);
539       }
540     }
541   }
542
543   LoadRecomputable (AIS_WireFrame);
544   LoadRecomputable (2);
545 }
546
547 //=======================================================================
548 //function : UnsetColor
549 //purpose  :
550 //=======================================================================
551
552 void AIS_Shape::UnsetColor()
553 {
554   if (!HasColor())
555   {
556     myToRecomputeModes.Clear();
557     return;
558   }
559   hasOwnColor = Standard_False;
560
561   if (!HasWidth())
562   {
563     Handle(Prs3d_LineAspect) anEmptyAsp;
564     myDrawer->SetLineAspect          (anEmptyAsp);
565     myDrawer->SetWireAspect          (anEmptyAsp);
566     myDrawer->SetFreeBoundaryAspect  (anEmptyAsp);
567     myDrawer->SetUnFreeBoundaryAspect(anEmptyAsp);
568     myDrawer->SetSeenLineAspect      (anEmptyAsp);
569   }
570   else
571   {
572     Quantity_Color aColor = Quantity_NOC_YELLOW;
573     if (myDrawer->HasLink())
574     {
575       AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Line,   aColor);
576     }
577     myDrawer->LineAspect()->SetColor (aColor);
578     aColor = Quantity_NOC_RED;
579     if (myDrawer->HasLink())
580     {
581       AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Wire,   aColor);
582     }
583     myDrawer->WireAspect()->SetColor (aColor);
584     aColor = Quantity_NOC_GREEN;
585     if (myDrawer->HasLink())
586     {
587       AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Free,   aColor);
588     }
589     myDrawer->FreeBoundaryAspect()->SetColor (aColor);
590     aColor = Quantity_NOC_YELLOW;
591     if (myDrawer->HasLink())
592     {
593       AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_UnFree, aColor);
594     }
595     myDrawer->UnFreeBoundaryAspect()->SetColor (aColor);
596     if (myDrawer->HasLink())
597     {
598       AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Seen,   aColor);
599     }
600     myDrawer->SeenLineAspect()->SetColor (aColor);
601   }
602
603   if (HasMaterial()
604    || IsTransparent())
605   {
606     Graphic3d_MaterialAspect aDefaultMat (Graphic3d_NOM_BRASS);
607     Graphic3d_MaterialAspect mat = aDefaultMat;
608     if (HasMaterial() || myDrawer->HasLink())
609     {
610       mat = AIS_GraphicTool::GetMaterial(HasMaterial()? myDrawer : myDrawer->Link());
611     }
612     if (HasMaterial())
613     {
614       Quantity_Color aColor = aDefaultMat.AmbientColor();
615       if (myDrawer->HasLink())
616       {
617         Quantity_Color aColor = myDrawer->Link()->ShadingAspect()->Color (myCurrentFacingModel);
618       }
619       mat.SetColor (aColor);
620     }
621     if (IsTransparent())
622     {
623       Standard_Real aTransp = myDrawer->ShadingAspect()->Transparency (myCurrentFacingModel);
624       mat.SetTransparency (aTransp);
625     }
626     myDrawer->ShadingAspect()->SetMaterial (mat ,myCurrentFacingModel);
627   }
628   else
629   {
630     myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
631   }
632   myDrawer->SetPointAspect (Handle(Prs3d_PointAspect)());
633
634   // modify shading presentation without re-computation
635   const PrsMgr_Presentations&        aPrsList  = Presentations();
636   Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->Link()->ShadingAspect()->Aspect();
637   Handle(Graphic3d_AspectLine3d)     aLineAsp  = myDrawer->Link()->LineAspect()->Aspect();
638   for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
639   {
640     const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
641     if (aPrsModed.Mode() != AIS_Shaded)
642     {
643       continue;
644     }
645
646     const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
647
648     aPrs->SetPrimitivesAspect (anAreaAsp);
649     aPrs->SetPrimitivesAspect (aLineAsp);
650
651     for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
652     {
653       const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
654
655       // Check if aspect of given type is set for the group,
656       // because setting aspect for group with no already set aspect
657       // can lead to loss of presentation data
658       if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
659       {
660         aGroup->SetGroupPrimitivesAspect (anAreaAsp);
661       }
662       if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_LINE))
663       {
664         aGroup->SetGroupPrimitivesAspect (aLineAsp);
665       }
666     }
667   }
668
669   LoadRecomputable (AIS_WireFrame);
670   LoadRecomputable (2);
671 }
672
673 //=======================================================================
674 //function : setWidth
675 //purpose  :
676 //=======================================================================
677
678 void AIS_Shape::setWidth (const Handle(Prs3d_Drawer)& theDrawer,
679                           const Standard_Real         theLineWidth) const
680 {
681   if (!theDrawer->HasOwnLineAspect())
682   {
683     theDrawer->SetLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
684     if (theDrawer->HasLink())
685     {
686       *theDrawer->LineAspect()->Aspect() = *theDrawer->Link()->LineAspect()->Aspect();
687     }
688   }
689   if (!theDrawer->HasOwnWireAspect())
690   {
691     theDrawer->SetWireAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
692     if (theDrawer->HasLink())
693     {
694       *theDrawer->WireAspect()->Aspect() = *theDrawer->Link()->WireAspect()->Aspect();
695     }
696   }
697   // disable dedicated line aspects
698   theDrawer->SetFreeBoundaryAspect  (theDrawer->LineAspect());
699   theDrawer->SetUnFreeBoundaryAspect(theDrawer->LineAspect());
700   theDrawer->SetSeenLineAspect      (theDrawer->LineAspect());
701
702   // override width
703   theDrawer->LineAspect()->SetWidth (theLineWidth);
704   theDrawer->WireAspect()->SetWidth (theLineWidth);
705 }
706
707 //=======================================================================
708 //function : SetWidth
709 //purpose  : 
710 //=======================================================================
711
712 void AIS_Shape::SetWidth (const Standard_Real theLineWidth)
713 {
714   setWidth (myDrawer, theLineWidth);
715   myOwnWidth = theLineWidth;
716   LoadRecomputable (AIS_WireFrame); // means that it is necessary to recompute only the wireframe....
717   LoadRecomputable (2);             // and the bounding box...
718 }
719
720 //=======================================================================
721 //function : UnsetWidth
722 //purpose  :
723 //=======================================================================
724
725 void AIS_Shape::UnsetWidth()
726 {
727   if (myOwnWidth == 0.0)
728   {
729     myToRecomputeModes.Clear();
730     return;
731   }
732
733   myOwnWidth = 0.0;
734
735   Handle(Prs3d_LineAspect) anEmptyAsp;
736
737   if (!HasColor())
738   {
739     myDrawer->SetLineAspect          (anEmptyAsp);
740     myDrawer->SetWireAspect          (anEmptyAsp);
741     myDrawer->SetFreeBoundaryAspect  (anEmptyAsp);
742     myDrawer->SetUnFreeBoundaryAspect(anEmptyAsp);
743     myDrawer->SetSeenLineAspect      (anEmptyAsp);
744   }
745   else
746   {
747     myDrawer->LineAspect()          ->SetWidth (myDrawer->HasLink() ?
748       AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Line) : 1.);
749     myDrawer->WireAspect()          ->SetWidth (myDrawer->HasLink() ?
750       AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Wire) : 1.);
751     myDrawer->FreeBoundaryAspect()  ->SetWidth (myDrawer->HasLink() ?
752       AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Free) : 1.);
753     myDrawer->UnFreeBoundaryAspect()->SetWidth (myDrawer->HasLink() ?
754       AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_UnFree) : 1.);
755     myDrawer->SeenLineAspect()      ->SetWidth (myDrawer->HasLink() ?
756       AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Seen) : 1.);
757   }
758   LoadRecomputable (AIS_WireFrame);
759 }
760
761 //=======================================================================
762 //function : setMaterial
763 //purpose  :
764 //=======================================================================
765
766 void AIS_Shape::setMaterial (const Handle(Prs3d_Drawer)&     theDrawer,
767                              const Graphic3d_MaterialAspect& theMaterial,
768                              const Standard_Boolean          theToKeepColor,
769                              const Standard_Boolean          theToKeepTransp) const
770 {
771   const Quantity_Color aColor  = theDrawer->ShadingAspect()->Material     (myCurrentFacingModel).Color();
772   const Standard_Real  aTransp = theDrawer->ShadingAspect()->Transparency (myCurrentFacingModel);
773   if (!theDrawer->HasOwnShadingAspect())
774   {
775     theDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
776     if (theDrawer->HasLink())
777     {
778       *theDrawer->ShadingAspect()->Aspect() = *theDrawer->Link()->ShadingAspect()->Aspect();
779     }
780   }
781   theDrawer->ShadingAspect()->SetMaterial (theMaterial, myCurrentFacingModel);
782
783   if (theToKeepColor)
784   {
785     theDrawer->ShadingAspect()->SetColor (aColor, myCurrentFacingModel);
786   }
787   if (theToKeepTransp)
788   {
789     theDrawer->ShadingAspect()->SetTransparency (aTransp, myCurrentFacingModel);
790   }
791 }
792
793 //=======================================================================
794 //function : SetMaterial
795 //purpose  : 
796 //=======================================================================
797
798 void AIS_Shape::SetMaterial(const Graphic3d_NameOfMaterial aMat)
799 {
800   SetMaterial(Graphic3d_MaterialAspect(aMat));
801 }
802
803 //=======================================================================
804 //function : SetMaterial
805 //purpose  :
806 //=======================================================================
807
808 void AIS_Shape::SetMaterial (const Graphic3d_MaterialAspect& theMat)
809 {
810   setMaterial (myDrawer, theMat, HasColor(), IsTransparent());
811   hasOwnMaterial = Standard_True;
812
813   // modify shading presentation without re-computation
814   const PrsMgr_Presentations&        aPrsList  = Presentations();
815   Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
816   for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
817   {
818     const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
819     if (aPrsModed.Mode() != AIS_Shaded)
820     {
821       continue;
822     }
823
824     const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
825     aPrs->SetPrimitivesAspect (anAreaAsp);
826     for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
827     {
828       const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
829
830       // Check if aspect of given type is set for the group, 
831       // because setting aspect for group with no already set aspect
832       // can lead to loss of presentation data
833       if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
834       {
835         aGroup->SetGroupPrimitivesAspect (anAreaAsp);
836       }
837     }
838   }
839
840   myRecomputeEveryPrs = Standard_False; // no mode to recalculate  :only viewer update
841   myToRecomputeModes.Clear();
842 }
843
844 //=======================================================================
845 //function : UnsetMaterial
846 //purpose  :
847 //=======================================================================
848
849 void AIS_Shape::UnsetMaterial()
850 {
851   if (!HasMaterial())
852   {
853     return;
854   }
855
856   if (HasColor()
857    || IsTransparent())
858   {
859     if(myDrawer->HasLink())
860     {
861       myDrawer->ShadingAspect()->SetMaterial (myDrawer->Link()->ShadingAspect()->Material (myCurrentFacingModel),
862                                               myCurrentFacingModel);
863     }
864     if (HasColor())
865     {
866       myDrawer->ShadingAspect()->SetColor        (myOwnColor,     myCurrentFacingModel);
867       myDrawer->ShadingAspect()->SetTransparency (myTransparency, myCurrentFacingModel);
868     }
869   }
870   else
871   {
872     myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
873   }
874   hasOwnMaterial = Standard_False;
875
876   // modify shading presentation without re-computation
877   const PrsMgr_Presentations&        aPrsList  = Presentations();
878   Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
879   for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
880   {
881     const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
882     if (aPrsModed.Mode() != AIS_Shaded)
883     {
884       continue;
885     }
886
887     const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
888     aPrs->SetPrimitivesAspect (anAreaAsp);
889     for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
890     {
891       const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
892       if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
893       {
894         aGroup->SetGroupPrimitivesAspect (anAreaAsp);
895       }
896     }
897   }
898
899   myRecomputeEveryPrs = Standard_False; // no mode to recalculate :only viewer update
900   myToRecomputeModes.Clear();  
901 }
902
903 //=======================================================================
904 //function : setTransparency
905 //purpose  :
906 //=======================================================================
907
908 void AIS_Shape::setTransparency (const Handle(Prs3d_Drawer)& theDrawer,
909                                  const Standard_Real         theValue) const
910 {
911   if (!theDrawer->HasOwnShadingAspect())
912   {
913     theDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
914     if (theDrawer->HasLink())
915     {
916       *theDrawer->ShadingAspect()->Aspect() = *theDrawer->Link()->ShadingAspect()->Aspect();
917     }
918   }
919
920   // override transparency
921   theDrawer->ShadingAspect()->SetTransparency (theValue, myCurrentFacingModel);
922 }
923
924 //=======================================================================
925 //function : SetTransparency
926 //purpose  :
927 //=======================================================================
928
929 void AIS_Shape::SetTransparency (const Standard_Real theValue)
930 {
931   setTransparency (myDrawer, theValue);
932   myTransparency = theValue;
933
934   // modify shading presentation without re-computation
935   const PrsMgr_Presentations&        aPrsList  = Presentations();
936   Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
937   for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
938   {
939     const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
940     if (aPrsModed.Mode() != AIS_Shaded)
941     {
942       continue;
943     }
944
945     const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
946     aPrs->SetPrimitivesAspect (anAreaAsp);
947     aPrs->SetDisplayPriority (10); // force highest priority for translucent objects
948     for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
949     {
950       const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
951       if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
952       {
953         aGroup->SetGroupPrimitivesAspect (anAreaAsp);
954       }
955     }
956   }
957
958   myRecomputeEveryPrs = Standard_False; // no mode to recalculate - only viewer update
959   myToRecomputeModes.Clear();
960 }
961
962 //=======================================================================
963 //function : UnsetTransparency
964 //purpose  :
965 //=======================================================================
966
967 void AIS_Shape::UnsetTransparency()
968 {
969   myTransparency = 0.0;
970   if (!myDrawer->HasOwnShadingAspect())
971   {
972     return;
973   }
974   else if (HasColor() || HasMaterial())
975   {
976     myDrawer->ShadingAspect()->SetTransparency (0.0, myCurrentFacingModel);
977   }
978   else
979   {
980     myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
981   }
982
983   // modify shading presentation without re-computation
984   const PrsMgr_Presentations&        aPrsList  = Presentations();
985   Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
986   for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
987   {
988     const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
989     if (aPrsModed.Mode() != AIS_Shaded)
990     {
991       continue;
992     }
993
994     const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
995     aPrs->SetPrimitivesAspect (anAreaAsp);
996     for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
997     {
998       const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
999       if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
1000       {
1001         aGroup->SetGroupPrimitivesAspect (anAreaAsp);
1002       }
1003     }
1004     aPrs->ResetDisplayPriority();
1005   }
1006
1007   myRecomputeEveryPrs = Standard_False; // no mode to recalculate :only viewer update
1008   myToRecomputeModes.Clear();
1009 }
1010
1011 //=======================================================================
1012 //function : LoadRecomputable
1013 //purpose  : 
1014 //=======================================================================
1015
1016 void AIS_Shape::LoadRecomputable(const Standard_Integer TheMode)
1017 {
1018   myRecomputeEveryPrs = Standard_False;
1019   if(!IsInList(myToRecomputeModes,TheMode))
1020     myToRecomputeModes.Append(TheMode);
1021 }
1022
1023 //=======================================================================
1024 //function : BoundingBox
1025 //purpose  : 
1026 //=======================================================================
1027
1028 const Bnd_Box& AIS_Shape::BoundingBox()  
1029 {
1030   if (myshape.ShapeType() == TopAbs_COMPOUND) {
1031     TopoDS_Iterator anExplor (myshape);
1032
1033     if (!anExplor.More()) { // empty Shape  -> empty Assembly.
1034       myBB.SetVoid();
1035       return myBB;
1036     }
1037   }
1038
1039   if(myCompBB) {
1040     BRepBndLib::AddClose(myshape, myBB);
1041     myCompBB = Standard_False;
1042   }
1043   return myBB;
1044 }
1045
1046 //*****
1047 //***** Reset
1048 //=======================================================================
1049 //function : SetOwnDeviationCoefficient
1050 //purpose  : resets myhasOwnDeviationCoefficient to Standard_False and
1051 //           returns Standard_True if it change
1052 //=======================================================================
1053
1054 Standard_Boolean AIS_Shape::SetOwnDeviationCoefficient ()
1055 {
1056   Standard_Boolean itSet = myDrawer->HasOwnDeviationCoefficient();
1057   if(itSet)  myDrawer->SetDeviationCoefficient();
1058   return itSet;
1059 }
1060
1061 //=======================================================================
1062 //function : SetHLROwnDeviationCoefficient
1063 //purpose  : resets myhasOwnHLRDeviationCoefficient to Standard_False and
1064 //           returns Standard_True if it change
1065 //=======================================================================
1066
1067 Standard_Boolean AIS_Shape::SetOwnHLRDeviationCoefficient ()
1068 {
1069   Standard_Boolean itSet = myDrawer->HasOwnHLRDeviationCoefficient();
1070   if(itSet)  myDrawer->SetHLRDeviationCoefficient();
1071   return itSet;
1072
1073 }
1074
1075 //=======================================================================
1076 //function : SetOwnDeviationAngle
1077 //purpose  : resets myhasOwnDeviationAngle to Standard_False and
1078 //           returns Standard_True if it change
1079 //=======================================================================
1080
1081 Standard_Boolean AIS_Shape::SetOwnDeviationAngle ()
1082 {
1083   Standard_Boolean itSet = myDrawer->HasOwnDeviationAngle();
1084   if(itSet)  myDrawer->SetDeviationAngle();
1085   return itSet;
1086
1087 }
1088
1089 //=======================================================================
1090 //function : SetOwnHLRDeviationAngle
1091 //purpose  : resets myhasOwnHLRDeviationAngle to Standard_False and
1092 //           returns Standard_True if it change
1093 //=======================================================================
1094
1095 Standard_Boolean AIS_Shape::SetOwnHLRDeviationAngle ()
1096 {
1097   Standard_Boolean itSet = myDrawer->HasOwnHLRDeviationAngle();
1098   if(itSet)  myDrawer->SetHLRAngle();
1099   return itSet;
1100
1101 }
1102 //***** SetOwn
1103 //=======================================================================
1104 //function : SetOwnDeviationCoefficient
1105 //purpose  : 
1106 //=======================================================================
1107
1108 void AIS_Shape::SetOwnDeviationCoefficient ( const Standard_Real  aCoefficient )
1109 {
1110   myDrawer->SetDeviationCoefficient( aCoefficient );
1111   SetToUpdate(0) ; // WireFrame
1112   SetToUpdate(1) ; // Shadding
1113 }
1114
1115 //=======================================================================
1116 //function : SetOwnHLRDeviationCoefficient
1117 //purpose  : 
1118 //=======================================================================
1119
1120 void AIS_Shape::SetOwnHLRDeviationCoefficient ( const Standard_Real  aCoefficient )
1121 {
1122   myDrawer->SetHLRDeviationCoefficient( aCoefficient );
1123   
1124 }
1125
1126 //=======================================================================
1127 //function : SetOwnDeviationAngle
1128 //purpose  : 
1129 //=======================================================================
1130
1131 void AIS_Shape::SetOwnDeviationAngle ( const Standard_Real  anAngle )
1132 {
1133
1134   myDrawer->SetDeviationAngle(anAngle );
1135   SetToUpdate(0) ;   // WireFrame
1136 }
1137 //=======================================================================
1138 //function : SetOwnDeviationAngle
1139 //purpose  : 
1140 //=======================================================================
1141
1142 void AIS_Shape::SetAngleAndDeviation ( const Standard_Real  anAngle )
1143 {
1144   Standard_Real OutAngl,OutDefl;
1145   HLRBRep::PolyHLRAngleAndDeflection(anAngle,OutAngl,OutDefl);
1146   SetOwnDeviationAngle(anAngle) ;
1147   SetOwnDeviationCoefficient(OutDefl) ;
1148   myInitAng = anAngle;
1149   SetToUpdate(0);
1150   SetToUpdate(1);
1151 }
1152
1153 //=======================================================================
1154 //function : UserAngle
1155 //purpose  : 
1156 //=======================================================================
1157
1158 Standard_Real AIS_Shape::UserAngle() const
1159 {
1160   return myInitAng ==0. ? GetContext()->DeviationAngle(): myInitAng;
1161 }
1162
1163
1164 //=======================================================================
1165 //function : SetHLRAngleAndDeviation
1166 //purpose  : 
1167 //=======================================================================
1168
1169 void AIS_Shape::SetHLRAngleAndDeviation ( const Standard_Real  anAngle )
1170 {
1171   Standard_Real OutAngl,OutDefl;
1172   HLRBRep::PolyHLRAngleAndDeflection(anAngle,OutAngl,OutDefl);
1173   SetOwnHLRDeviationAngle( OutAngl );
1174   SetOwnHLRDeviationCoefficient(OutDefl);
1175
1176 }
1177 //=======================================================================
1178 //function : SetOwnHLRDeviationAngle
1179 //purpose  : 
1180 //=======================================================================
1181
1182 void AIS_Shape::SetOwnHLRDeviationAngle ( const Standard_Real  anAngle )
1183 {
1184   myDrawer->SetHLRAngle( anAngle );
1185 }
1186
1187 //***** GetOwn
1188 //=======================================================================
1189 //function : OwnDeviationCoefficient
1190 //purpose  : 
1191 //=======================================================================
1192
1193 Standard_Boolean AIS_Shape::OwnDeviationCoefficient ( Standard_Real &  aCoefficient,
1194                                                       Standard_Real & aPreviousCoefficient ) const
1195 {
1196   aCoefficient = myDrawer->DeviationCoefficient();
1197   aPreviousCoefficient = myDrawer->PreviousDeviationCoefficient ();
1198   return myDrawer->HasOwnDeviationCoefficient() ;
1199 }
1200
1201 //=======================================================================
1202 //function : OwnHLRDeviationCoefficient
1203 //purpose  : 
1204 //=======================================================================
1205
1206 Standard_Boolean AIS_Shape::OwnHLRDeviationCoefficient ( Standard_Real & aCoefficient,
1207                                                          Standard_Real & aPreviousCoefficient ) const
1208 {
1209   aCoefficient = myDrawer->HLRDeviationCoefficient();
1210   aPreviousCoefficient = myDrawer->PreviousHLRDeviationCoefficient ();
1211   return myDrawer->HasOwnHLRDeviationCoefficient();
1212
1213 }
1214
1215 //=======================================================================
1216 //function : OwnDeviationAngle
1217 //purpose  : 
1218 //=======================================================================
1219
1220 Standard_Boolean AIS_Shape::OwnDeviationAngle ( Standard_Real &  anAngle,
1221                                                 Standard_Real & aPreviousAngle ) const
1222 {
1223   anAngle = myDrawer->DeviationAngle();
1224   aPreviousAngle = myDrawer->PreviousDeviationAngle (); 
1225   return myDrawer->HasOwnDeviationAngle();
1226 }
1227
1228 //=======================================================================
1229 //function : OwnHLRDeviationAngle
1230 //purpose  : 
1231 //=======================================================================
1232
1233 Standard_Boolean AIS_Shape::OwnHLRDeviationAngle ( Standard_Real &  anAngle,
1234                                                    Standard_Real & aPreviousAngle ) const
1235 {
1236   anAngle = myDrawer->HLRAngle();
1237   aPreviousAngle = myDrawer->PreviousHLRDeviationAngle (); 
1238   return myDrawer->HasOwnHLRDeviationAngle();
1239 }