0025853: Edges disappear or reappear when displaying new edges
[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//=======================================================================
e0608a8d 714//function : setMaterial
715//purpose :
716//=======================================================================
717
718void AIS_Shape::setMaterial (const Handle(AIS_Drawer)& theDrawer,
719 const Graphic3d_MaterialAspect& theMaterial,
720 const Standard_Boolean theToKeepColor,
721 const Standard_Boolean theToKeepTransp) const
722{
723 const Quantity_Color aColor = theDrawer->ShadingAspect()->Material (myCurrentFacingModel).Color();
724 const Standard_Real aTransp = theDrawer->ShadingAspect()->Transparency (myCurrentFacingModel);
725 if (!theDrawer->HasShadingAspect())
726 {
727 theDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
728 *theDrawer->ShadingAspect()->Aspect() = *theDrawer->Link()->ShadingAspect()->Aspect();
729 }
730 theDrawer->ShadingAspect()->SetMaterial (theMaterial, myCurrentFacingModel);
731
732 if (theToKeepColor)
733 {
734 theDrawer->ShadingAspect()->SetColor (aColor, myCurrentFacingModel);
735 }
736 if (theToKeepTransp)
737 {
738 theDrawer->ShadingAspect()->SetTransparency (aTransp, myCurrentFacingModel);
739 }
740}
741
742//=======================================================================
7fd59977 743//function : SetMaterial
744//purpose :
745//=======================================================================
5cbef0fe 746
7fd59977 747void AIS_Shape::SetMaterial(const Graphic3d_NameOfMaterial aMat)
748{
a10fa819 749 SetMaterial(Graphic3d_MaterialAspect(aMat));
7fd59977 750}
5cbef0fe 751
7fd59977 752//=======================================================================
753//function : SetMaterial
ad3217cd 754//purpose :
7fd59977 755//=======================================================================
5cbef0fe 756
ad3217cd 757void AIS_Shape::SetMaterial (const Graphic3d_MaterialAspect& theMat)
7fd59977 758{
e0608a8d 759 setMaterial (myDrawer, theMat, HasColor(), IsTransparent());
7fd59977 760 hasOwnMaterial = Standard_True;
5cbef0fe 761
48cc825e 762 // modify shading presentation without re-computation
763 const PrsMgr_Presentations& aPrsList = Presentations();
764 Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
765 for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
ad3217cd 766 {
48cc825e 767 const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
768 if (aPrsModed.Mode() != AIS_Shaded)
af324faa 769 {
48cc825e 770 continue;
771 }
772
773 const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
774 aPrs->SetPrimitivesAspect (anAreaAsp);
775 for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
776 {
777 const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
778
a10fa819
A
779 // Check if aspect of given type is set for the group,
780 // because setting aspect for group with no already set aspect
781 // can lead to loss of presentation data
ad3217cd 782 if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
783 {
784 aGroup->SetGroupPrimitivesAspect (anAreaAsp);
785 }
5cbef0fe 786 }
7fd59977 787 }
48cc825e 788
789 myRecomputeEveryPrs = Standard_False; // no mode to recalculate :only viewer update
790 myToRecomputeModes.Clear();
7fd59977 791}
ad3217cd 792
7fd59977 793//=======================================================================
794//function : UnsetMaterial
ad3217cd 795//purpose :
7fd59977 796//=======================================================================
5cbef0fe 797
7fd59977 798void AIS_Shape::UnsetMaterial()
799{
ad3217cd 800 if (!HasMaterial())
801 {
802 return;
803 }
5cbef0fe 804
ad3217cd 805 if (HasColor()
806 || IsTransparent())
807 {
808 myDrawer->ShadingAspect()->SetMaterial (myDrawer->Link()->ShadingAspect()->Material (myCurrentFacingModel),
809 myCurrentFacingModel);
810 if (HasColor())
811 {
812 myDrawer->ShadingAspect()->SetColor (myOwnColor, myCurrentFacingModel);
813 myDrawer->ShadingAspect()->SetTransparency (myTransparency, myCurrentFacingModel);
7fd59977 814 }
ad3217cd 815 }
816 else
817 {
818 myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
7fd59977 819 }
820 hasOwnMaterial = Standard_False;
ad3217cd 821
48cc825e 822 // modify shading presentation without re-computation
823 const PrsMgr_Presentations& aPrsList = Presentations();
824 Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
825 for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
ad3217cd 826 {
48cc825e 827 const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
828 if (aPrsModed.Mode() != AIS_Shaded)
ad3217cd 829 {
48cc825e 830 continue;
831 }
832
833 const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
834 aPrs->SetPrimitivesAspect (anAreaAsp);
835 for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
836 {
837 const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
ad3217cd 838 if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
839 {
840 aGroup->SetGroupPrimitivesAspect (anAreaAsp);
841 }
7fd59977 842 }
843 }
48cc825e 844
ad3217cd 845 myRecomputeEveryPrs = Standard_False; // no mode to recalculate :only viewer update
7fd59977 846 myToRecomputeModes.Clear();
7fd59977 847}
5cbef0fe 848
7fd59977 849//=======================================================================
ad3217cd 850//function : setTransparency
851//purpose :
7fd59977 852//=======================================================================
853
ad3217cd 854void AIS_Shape::setTransparency (const Handle(AIS_Drawer)& theDrawer,
855 const Standard_Real theValue) const
7fd59977 856{
ad3217cd 857 if (!theDrawer->HasShadingAspect())
858 {
859 theDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
860 *theDrawer->ShadingAspect()->Aspect() = *theDrawer->Link()->ShadingAspect()->Aspect();
7fd59977 861 }
5cbef0fe 862
ad3217cd 863 // override transparency
864 theDrawer->ShadingAspect()->SetTransparency (theValue, myCurrentFacingModel);
865}
866
867//=======================================================================
868//function : SetTransparency
869//purpose :
870//=======================================================================
871
872void AIS_Shape::SetTransparency (const Standard_Real theValue)
873{
874 setTransparency (myDrawer, theValue);
875 myTransparency = theValue;
876
48cc825e 877 // modify shading presentation without re-computation
878 const PrsMgr_Presentations& aPrsList = Presentations();
879 Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
880 for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
ad3217cd 881 {
48cc825e 882 const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
883 if (aPrsModed.Mode() != AIS_Shaded)
ad3217cd 884 {
48cc825e 885 continue;
886 }
887
888 const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
889 aPrs->SetPrimitivesAspect (anAreaAsp);
890 aPrs->SetDisplayPriority (10); // force highest priority for translucent objects
891 for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
892 {
893 const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
ad3217cd 894 if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
895 {
896 aGroup->SetGroupPrimitivesAspect (anAreaAsp);
897 }
7fd59977 898 }
899 }
48cc825e 900
ad3217cd 901 myRecomputeEveryPrs = Standard_False; // no mode to recalculate - only viewer update
5cbef0fe 902 myToRecomputeModes.Clear();
7fd59977 903}
904
905//=======================================================================
906//function : UnsetTransparency
ad3217cd 907//purpose :
7fd59977 908//=======================================================================
5cbef0fe 909
7fd59977 910void AIS_Shape::UnsetTransparency()
911{
7fd59977 912 myTransparency = 0.0;
ad3217cd 913 if (!myDrawer->HasShadingAspect())
914 {
915 return;
916 }
917 else if (HasColor() || HasMaterial())
918 {
919 myDrawer->ShadingAspect()->SetTransparency (0.0, myCurrentFacingModel);
920 }
921 else
922 {
923 myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
924 }
5cbef0fe 925
48cc825e 926 // modify shading presentation without re-computation
927 const PrsMgr_Presentations& aPrsList = Presentations();
928 Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
929 for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
ad3217cd 930 {
48cc825e 931 const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
932 if (aPrsModed.Mode() != AIS_Shaded)
ad3217cd 933 {
48cc825e 934 continue;
935 }
936
937 const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
938 aPrs->SetPrimitivesAspect (anAreaAsp);
939 for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
940 {
941 const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
ad3217cd 942 if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
943 {
944 aGroup->SetGroupPrimitivesAspect (anAreaAsp);
945 }
7fd59977 946 }
48cc825e 947 aPrs->ResetDisplayPriority();
7fd59977 948 }
48cc825e 949
ad3217cd 950 myRecomputeEveryPrs = Standard_False; // no mode to recalculate :only viewer update
5cbef0fe 951 myToRecomputeModes.Clear();
7fd59977 952}
953
5cbef0fe
S
954//=======================================================================
955//function : LoadRecomputable
956//purpose :
957//=======================================================================
7fd59977 958
959void AIS_Shape::LoadRecomputable(const Standard_Integer TheMode)
960{
5cbef0fe 961 myRecomputeEveryPrs = Standard_False;
7fd59977 962 if(!IsInList(myToRecomputeModes,TheMode))
963 myToRecomputeModes.Append(TheMode);
964}
965
7fd59977 966//=======================================================================
967//function : BoundingBox
968//purpose :
969//=======================================================================
970
971const Bnd_Box& AIS_Shape::BoundingBox()
972{
973 if (myshape.ShapeType() == TopAbs_COMPOUND) {
7fd59977 974 TopoDS_Iterator anExplor (myshape);
a10fa819 975
81bba717 976 if (!anExplor.More()) { // empty Shape -> empty Assembly.
a10fa819 977 myBB.SetVoid();
7fd59977 978 return myBB;
979 }
980 }
981
982 if(myCompBB) {
983 BRepBndLib::AddClose(myshape, myBB);
a10fa819 984 myCompBB = Standard_False;
7fd59977 985 }
986 return myBB;
987}
988
989//*****
990//***** Reset
991//=======================================================================
992//function : SetOwnDeviationCoefficient
993//purpose : resets myhasOwnDeviationCoefficient to Standard_False and
994// returns Standard_True if it change
995//=======================================================================
996
997Standard_Boolean AIS_Shape::SetOwnDeviationCoefficient ()
998{
999 Standard_Boolean itSet = myDrawer->IsOwnDeviationCoefficient();
1000 if(itSet) myDrawer->SetDeviationCoefficient();
1001 return itSet;
7fd59977 1002}
1003
7fd59977 1004//=======================================================================
1005//function : SetHLROwnDeviationCoefficient
1006//purpose : resets myhasOwnHLRDeviationCoefficient to Standard_False and
1007// returns Standard_True if it change
1008//=======================================================================
1009
1010Standard_Boolean AIS_Shape::SetOwnHLRDeviationCoefficient ()
1011{
1012 Standard_Boolean itSet = myDrawer->IsOwnHLRDeviationCoefficient();
1013 if(itSet) myDrawer->SetHLRDeviationCoefficient();
1014 return itSet;
1015
1016}
1017
1018//=======================================================================
1019//function : SetOwnDeviationAngle
1020//purpose : resets myhasOwnDeviationAngle to Standard_False and
1021// returns Standard_True if it change
1022//=======================================================================
1023
1024Standard_Boolean AIS_Shape::SetOwnDeviationAngle ()
1025{
1026 Standard_Boolean itSet = myDrawer->IsOwnDeviationAngle();
1027 if(itSet) myDrawer->SetDeviationAngle();
1028 return itSet;
1029
1030}
1031
1032//=======================================================================
1033//function : SetOwnHLRDeviationAngle
1034//purpose : resets myhasOwnHLRDeviationAngle to Standard_False and
1035// returns Standard_True if it change
1036//=======================================================================
1037
1038Standard_Boolean AIS_Shape::SetOwnHLRDeviationAngle ()
1039{
1040 Standard_Boolean itSet = myDrawer->IsOwnHLRDeviationAngle();
1041 if(itSet) myDrawer->SetHLRAngle();
1042 return itSet;
1043
1044}
1045//***** SetOwn
1046//=======================================================================
1047//function : SetOwnDeviationCoefficient
1048//purpose :
1049//=======================================================================
1050
1051void AIS_Shape::SetOwnDeviationCoefficient ( const Standard_Real aCoefficient )
1052{
1053 myDrawer->SetDeviationCoefficient( aCoefficient );
1054 SetToUpdate(0) ; // WireFrame
1055 SetToUpdate(1) ; // Shadding
1056}
1057
1058//=======================================================================
1059//function : SetOwnHLRDeviationCoefficient
1060//purpose :
1061//=======================================================================
1062
1063void AIS_Shape::SetOwnHLRDeviationCoefficient ( const Standard_Real aCoefficient )
1064{
1065 myDrawer->SetHLRDeviationCoefficient( aCoefficient );
1066
1067}
1068
1069//=======================================================================
1070//function : SetOwnDeviationAngle
1071//purpose :
1072//=======================================================================
1073
1074void AIS_Shape::SetOwnDeviationAngle ( const Standard_Real anAngle )
1075{
1076
1077 myDrawer->SetDeviationAngle(anAngle );
1078 SetToUpdate(0) ; // WireFrame
1079}
1080//=======================================================================
1081//function : SetOwnDeviationAngle
1082//purpose :
1083//=======================================================================
1084
1085void AIS_Shape::SetAngleAndDeviation ( const Standard_Real anAngle )
1086{
1087 Standard_Real OutAngl,OutDefl;
1088 HLRBRep::PolyHLRAngleAndDeflection(anAngle,OutAngl,OutDefl);
1089 SetOwnDeviationAngle(anAngle) ;
7fd59977 1090 SetOwnDeviationCoefficient(OutDefl) ;
1091 myInitAng = anAngle;
1092 SetToUpdate(0);
1093 SetToUpdate(1);
1094}
1095
1096//=======================================================================
1097//function : UserAngle
1098//purpose :
1099//=======================================================================
1100
1101Standard_Real AIS_Shape::UserAngle() const
1102{
1103 return myInitAng ==0. ? GetContext()->DeviationAngle(): myInitAng;
1104}
1105
1106
1107//=======================================================================
1108//function : SetHLRAngleAndDeviation
1109//purpose :
1110//=======================================================================
1111
1112void AIS_Shape::SetHLRAngleAndDeviation ( const Standard_Real anAngle )
1113{
1114 Standard_Real OutAngl,OutDefl;
1115 HLRBRep::PolyHLRAngleAndDeflection(anAngle,OutAngl,OutDefl);
1116 SetOwnHLRDeviationAngle( OutAngl );
1117 SetOwnHLRDeviationCoefficient(OutDefl);
1118
1119}
1120//=======================================================================
1121//function : SetOwnHLRDeviationAngle
1122//purpose :
1123//=======================================================================
1124
1125void AIS_Shape::SetOwnHLRDeviationAngle ( const Standard_Real anAngle )
1126{
1127 myDrawer->SetHLRAngle( anAngle );
1128}
1129
1130//***** GetOwn
1131//=======================================================================
1132//function : OwnDeviationCoefficient
1133//purpose :
1134//=======================================================================
1135
1136Standard_Boolean AIS_Shape::OwnDeviationCoefficient ( Standard_Real & aCoefficient,
3c34883c 1137 Standard_Real & aPreviousCoefficient ) const
7fd59977 1138{
1139 aCoefficient = myDrawer->DeviationCoefficient();
1140 aPreviousCoefficient = myDrawer->PreviousDeviationCoefficient ();
1141 return myDrawer->IsOwnDeviationCoefficient() ;
1142}
1143
1144//=======================================================================
1145//function : OwnHLRDeviationCoefficient
1146//purpose :
1147//=======================================================================
1148
1149Standard_Boolean AIS_Shape::OwnHLRDeviationCoefficient ( Standard_Real & aCoefficient,
3c34883c 1150 Standard_Real & aPreviousCoefficient ) const
7fd59977 1151{
1152 aCoefficient = myDrawer->HLRDeviationCoefficient();
1153 aPreviousCoefficient = myDrawer->PreviousHLRDeviationCoefficient ();
1154 return myDrawer->IsOwnHLRDeviationCoefficient();
1155
1156}
1157
1158//=======================================================================
1159//function : OwnDeviationAngle
1160//purpose :
1161//=======================================================================
1162
1163Standard_Boolean AIS_Shape::OwnDeviationAngle ( Standard_Real & anAngle,
3c34883c 1164 Standard_Real & aPreviousAngle ) const
7fd59977 1165{
1166 anAngle = myDrawer->DeviationAngle();
1167 aPreviousAngle = myDrawer->PreviousDeviationAngle ();
1168 return myDrawer->IsOwnDeviationAngle();
1169}
1170
1171//=======================================================================
1172//function : OwnHLRDeviationAngle
1173//purpose :
1174//=======================================================================
1175
1176Standard_Boolean AIS_Shape::OwnHLRDeviationAngle ( Standard_Real & anAngle,
3c34883c 1177 Standard_Real & aPreviousAngle ) const
7fd59977 1178{
1179 anAngle = myDrawer->HLRAngle();
1180 aPreviousAngle = myDrawer->PreviousHLRDeviationAngle ();
1181 return myDrawer->IsOwnHLRDeviationAngle();
7fd59977 1182}