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