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