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