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