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