0028811: Visualization - merge texturing support into AIS_Shape class and get rid...
[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.hxx>
18
19#include <AIS_GraphicTool.hxx>
20#include <AIS_InteractiveContext.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: AIS_Shape
84// Purpose :
85//==================================================
86AIS_Shape::AIS_Shape(const TopoDS_Shape& theShape)
87: AIS_InteractiveObject (PrsMgr_TOP_ProjectorDependant),
88 myshape (theShape),
89 myUVOrigin(0.0, 0.0),
90 myUVRepeat(1.0, 1.0),
91 myUVScale (1.0, 1.0),
92 myInitAng (0.0),
93 myCompBB (Standard_True)
94{
95 //
96}
97
98//=======================================================================
99//function : Type
100//purpose :
101//=======================================================================
102AIS_KindOfInteractive AIS_Shape::Type() const
103{return AIS_KOI_Shape;}
104
105
106//=======================================================================
107//function : Signature
108//purpose :
109//=======================================================================
110Standard_Integer AIS_Shape::Signature() const
111{return 0;}
112
113//=======================================================================
114//function : AcceptShapeDecomposition
115//purpose :
116//=======================================================================
117Standard_Boolean AIS_Shape::AcceptShapeDecomposition() const
118{return Standard_True;}
119
120//=======================================================================
121//function : Compute
122//purpose :
123//=======================================================================
124void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
125 const Handle(Prs3d_Presentation)& aPrs,
126 const Standard_Integer theMode)
127{
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 if (IsInfinite())
181 {
182 StdPrs_WFShape::Add (aPrs, myshape, myDrawer);
183 }
184 else
185 {
186 try
187 {
188 OCC_CATCH_SIGNALS
189 StdPrs_ShadedShape::Add (aPrs, myshape, myDrawer,
190 myDrawer->ShadingAspect()->Aspect()->ToMapTexture()
191 && !myDrawer->ShadingAspect()->Aspect()->TextureMap().IsNull(),
192 myUVOrigin, myUVRepeat, myUVScale);
193 }
194 catch (Standard_Failure)
195 {
196 #ifdef OCCT_DEBUG
197 cout << "AIS_Shape::Compute() in ShadingMode failed" << endl;
198 #endif
199 StdPrs_WFShape::Add (aPrs, myshape, myDrawer);
200 }
201 }
202 }
203 Standard_Real aTransparency = Transparency() ;
204 if (aTransparency > 0.0)
205 {
206 SetTransparency (aTransparency);
207 }
208 break;
209 }
210
211 // Bounding box.
212 case 2:
213 {
214 if (IsInfinite())
215 {
216 StdPrs_WFShape::Add (aPrs, myshape, myDrawer);
217 }
218 else
219 {
220 StdPrs_BndBox::Add (aPrs, BoundingBox(), myDrawer);
221 }
222 }
223 }
224
225 // Recompute hidden line presentation (if necessary).
226 aPrs->ReCompute();
227}
228
229//=======================================================================
230//function : Compute
231//purpose : Hidden Line Removal
232//=======================================================================
233void AIS_Shape::Compute(const Handle(Prs3d_Projector)& aProjector,
234 const Handle(Prs3d_Presentation)& aPresentation)
235{
236 Compute(aProjector,aPresentation,myshape);
237}
238
239//=======================================================================
240//function : Compute
241//purpose :
242//=======================================================================
243
244void AIS_Shape::Compute(const Handle(Prs3d_Projector)& aProjector,
245 const Handle(Geom_Transformation)& TheTrsf,
246 const Handle(Prs3d_Presentation)& aPresentation)
247{
248 const TopLoc_Location& loc = myshape.Location();
249 TopoDS_Shape shbis = myshape.Located(TopLoc_Location(TheTrsf->Trsf())*loc);
250 Compute(aProjector,aPresentation,shbis);
251}
252
253//=======================================================================
254//function : Compute
255//purpose :
256//=======================================================================
257
258void AIS_Shape::Compute(const Handle(Prs3d_Projector)& aProjector,
259 const Handle(Prs3d_Presentation)& aPresentation,
260 const TopoDS_Shape& SH)
261{
262 if (SH.ShapeType() == TopAbs_COMPOUND) {
263 TopoDS_Iterator anExplor (SH);
264
265 if (!anExplor.More()) // Shape vide -> Assemblage vide.
266 return;
267 }
268
269 Handle (Prs3d_Drawer) defdrawer = GetContext()->DefaultDrawer();
270 if (defdrawer->DrawHiddenLine())
271 {myDrawer->EnableDrawHiddenLine();}
272 else {myDrawer->DisableDrawHiddenLine();}
273
274 Aspect_TypeOfDeflection prevdef = defdrawer->TypeOfDeflection();
275 defdrawer->SetTypeOfDeflection(Aspect_TOD_RELATIVE);
276
277 if (myDrawer->IsAutoTriangulation())
278 {
279 // coefficients for calculation
280 Standard_Real aPrevAngle, aNewAngle, aPrevCoeff, aNewCoeff;
281 Standard_Boolean isOwnHLRDeviationAngle = OwnHLRDeviationAngle (aNewAngle, aPrevAngle);
282 Standard_Boolean isOwnHLRDeviationCoefficient = OwnHLRDeviationCoefficient (aNewCoeff, aPrevCoeff);
283 if (((Abs (aNewAngle - aPrevAngle) > Precision::Angular()) && isOwnHLRDeviationAngle) ||
284 ((Abs (aNewCoeff - aPrevCoeff) > Precision::Confusion()) && isOwnHLRDeviationCoefficient))
285 {
286 BRepTools::Clean(SH);
287 }
288 }
289
290 {
291 try {
292 OCC_CATCH_SIGNALS
293 switch (TypeOfHLR()) {
294 case Prs3d_TOH_Algo:
295 StdPrs_HLRShape::Add (aPresentation, SH, myDrawer, aProjector);
296 break;
297 case Prs3d_TOH_PolyAlgo:
298 default:
299 StdPrs_HLRPolyShape::Add (aPresentation, SH, myDrawer, aProjector);
300 break;
301 }
302 }
303 catch (Standard_Failure) {
304#ifdef OCCT_DEBUG
305 cout <<"AIS_Shape::Compute(Proj) HLR Algorithm failed" << endl;
306#endif
307 StdPrs_WFShape::Add(aPresentation,SH,myDrawer);
308 }
309 }
310
311 defdrawer->SetTypeOfDeflection (prevdef);
312}
313
314//=======================================================================
315//function : SelectionType
316//purpose : gives the type according to the Index of Selection Mode
317//=======================================================================
318
319TopAbs_ShapeEnum AIS_Shape::SelectionType(const Standard_Integer aMode)
320{
321 switch(aMode){
322 case 1:
323 return TopAbs_VERTEX;
324 case 2:
325 return TopAbs_EDGE;
326 case 3:
327 return TopAbs_WIRE;
328 case 4:
329 return TopAbs_FACE;
330 case 5:
331 return TopAbs_SHELL;
332 case 6:
333 return TopAbs_SOLID;
334 case 7:
335 return TopAbs_COMPSOLID;
336 case 8:
337 return TopAbs_COMPOUND;
338 case 0:
339 default:
340 return TopAbs_SHAPE;
341 }
342
343}
344//=======================================================================
345//function : SelectionType
346//purpose : gives the SelectionMode according to the Type od Decomposition...
347//=======================================================================
348Standard_Integer AIS_Shape::SelectionMode(const TopAbs_ShapeEnum aType)
349{
350 switch(aType){
351 case TopAbs_VERTEX:
352 return 1;
353 case TopAbs_EDGE:
354 return 2;
355 case TopAbs_WIRE:
356 return 3;
357 case TopAbs_FACE:
358 return 4;
359 case TopAbs_SHELL:
360 return 5;
361 case TopAbs_SOLID:
362 return 6;
363 case TopAbs_COMPSOLID:
364 return 7;
365 case TopAbs_COMPOUND:
366 return 8;
367 case TopAbs_SHAPE:
368 default:
369 return 0;
370 }
371}
372
373
374//=======================================================================
375//function : ComputeSelection
376//purpose :
377//=======================================================================
378
379void AIS_Shape::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
380 const Standard_Integer aMode)
381{
382 if(myshape.IsNull()) return;
383 if (myshape.ShapeType() == TopAbs_COMPOUND) {
384 TopoDS_Iterator anExplor (myshape);
385
386 if (!anExplor.More()) // empty Shape -> empty Assembly.
387 return;
388 }
389
390 TopAbs_ShapeEnum TypOfSel = AIS_Shape::SelectionType(aMode);
391 TopoDS_Shape shape = myshape;
392
393// POP protection against crash in low layers
394
395 Standard_Real aDeflection = Prs3d::GetDeflection(shape, myDrawer);
396 try {
397 OCC_CATCH_SIGNALS
398 StdSelect_BRepSelectionTool::Load(aSelection,
399 this,
400 shape,
401 TypOfSel,
402 aDeflection,
403 myDrawer->HLRAngle(),
404 myDrawer->IsAutoTriangulation());
405 } catch ( Standard_Failure ) {
406// cout << "a Shape should be incorrect : A Selection on the Bnd is activated "<<endl;
407 if ( aMode == 0 ) {
408 aSelection->Clear();
409 Bnd_Box B = BoundingBox();
410 Handle(StdSelect_BRepOwner) aOwner = new StdSelect_BRepOwner(shape,this);
411 Handle(Select3D_SensitiveBox) aSensitiveBox = new Select3D_SensitiveBox(aOwner,B);
412 aSelection->Add(aSensitiveBox);
413 }
414 }
415
416 // insert the drawer in the BrepOwners for hilight...
417 StdSelect::SetDrawerForBRepOwner(aSelection,myDrawer);
418}
419
420void AIS_Shape::Color( Quantity_Color& aColor ) const {
421 aColor = myDrawer->ShadingAspect()->Color(myCurrentFacingModel);
422}
423
424Graphic3d_NameOfMaterial AIS_Shape::Material() const {
425 return (myDrawer->ShadingAspect()->Material(myCurrentFacingModel)).Name();
426}
427
428Standard_Real AIS_Shape::Transparency() const {
429 return myDrawer->ShadingAspect()->Transparency(myCurrentFacingModel);
430}
431
432//=======================================================================
433//function : setColor
434//purpose :
435//=======================================================================
436
437void AIS_Shape::setColor (const Handle(Prs3d_Drawer)& theDrawer,
438 const Quantity_Color& theColor) const
439{
440 if (!theDrawer->HasOwnShadingAspect())
441 {
442 theDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
443 if (theDrawer->HasLink())
444 {
445 *theDrawer->ShadingAspect()->Aspect() = *theDrawer->Link()->ShadingAspect()->Aspect();
446 }
447 }
448 if (!theDrawer->HasOwnLineAspect())
449 {
450 theDrawer->SetLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
451 if (theDrawer->HasLink())
452 {
453 *theDrawer->LineAspect()->Aspect() = *theDrawer->Link()->LineAspect()->Aspect();
454 }
455 }
456 if (!theDrawer->HasOwnWireAspect())
457 {
458 theDrawer->SetWireAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
459 if (theDrawer->HasLink())
460 {
461 *theDrawer->WireAspect()->Aspect() = *theDrawer->Link()->WireAspect()->Aspect();
462 }
463 }
464 if (!theDrawer->HasOwnPointAspect())
465 {
466 theDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_PLUS, Quantity_NOC_BLACK, 1.0));
467 if (theDrawer->HasLink())
468 {
469 *theDrawer->PointAspect()->Aspect() = *theDrawer->Link()->PointAspect()->Aspect();
470 }
471 }
472 if (!theDrawer->HasOwnFreeBoundaryAspect())
473 {
474 theDrawer->SetFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
475 if (theDrawer->HasLink())
476 {
477 *theDrawer->FreeBoundaryAspect()->Aspect() = *theDrawer->Link()->FreeBoundaryAspect()->Aspect();
478 }
479 }
480 if (!theDrawer->HasOwnUnFreeBoundaryAspect())
481 {
482 theDrawer->SetUnFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
483 if (theDrawer->HasLink())
484 {
485 *theDrawer->UnFreeBoundaryAspect()->Aspect() = *theDrawer->Link()->UnFreeBoundaryAspect()->Aspect();
486 }
487 }
488 if (!theDrawer->HasOwnSeenLineAspect())
489 {
490 theDrawer->SetSeenLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
491 if (theDrawer->HasLink())
492 {
493 *theDrawer->SeenLineAspect()->Aspect() = *theDrawer->Link()->SeenLineAspect()->Aspect();
494 }
495 }
496
497 // override color
498 theDrawer->ShadingAspect()->SetColor (theColor, myCurrentFacingModel);
499 theDrawer->LineAspect()->SetColor (theColor);
500 theDrawer->WireAspect()->SetColor (theColor);
501 theDrawer->PointAspect()->SetColor (theColor);
502 theDrawer->FreeBoundaryAspect()->SetColor (theColor);
503 theDrawer->UnFreeBoundaryAspect()->SetColor (theColor);
504 theDrawer->SeenLineAspect()->SetColor (theColor);
505}
506
507//=======================================================================
508//function : SetColor
509//purpose :
510//=======================================================================
511
512void AIS_Shape::SetColor (const Quantity_Color& theColor)
513{
514 setColor (myDrawer, theColor);
515 myDrawer->SetColor (theColor);
516 hasOwnColor = Standard_True;
517
518 // modify shading presentation without re-computation
519 const PrsMgr_Presentations& aPrsList = Presentations();
520 Handle(Graphic3d_AspectFillArea3d) anAreaAspect = myDrawer->ShadingAspect()->Aspect();
521 Handle(Graphic3d_AspectLine3d) aLineAspect = myDrawer->LineAspect()->Aspect();
522 Handle(Graphic3d_AspectMarker3d) aPointAspect = myDrawer->PointAspect()->Aspect();
523 for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
524 {
525 const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
526 if (aPrsModed.Mode() != AIS_Shaded)
527 {
528 continue;
529 }
530
531 const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
532 for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
533 {
534 const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
535
536 // Check if aspect of given type is set for the group,
537 // because setting aspect for group with no already set aspect
538 // can lead to loss of presentation data
539 if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
540 {
541 aGroup->SetGroupPrimitivesAspect (anAreaAspect);
542 }
543 if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_LINE))
544 {
545 aGroup->SetGroupPrimitivesAspect (aLineAspect);
546 }
547 if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_MARKER))
548 {
549 aGroup->SetGroupPrimitivesAspect (aPointAspect);
550 }
551 }
552 }
553
554 LoadRecomputable (AIS_WireFrame);
555 LoadRecomputable (2);
556}
557
558//=======================================================================
559//function : UnsetColor
560//purpose :
561//=======================================================================
562
563void AIS_Shape::UnsetColor()
564{
565 if (!HasColor())
566 {
567 myToRecomputeModes.Clear();
568 return;
569 }
570 hasOwnColor = Standard_False;
571 myDrawer->SetColor (myDrawer->HasLink() ? myDrawer->Link()->Color() : Quantity_Color (Quantity_NOC_WHITE));
572
573 if (!HasWidth())
574 {
575 Handle(Prs3d_LineAspect) anEmptyAsp;
576 myDrawer->SetLineAspect (anEmptyAsp);
577 myDrawer->SetWireAspect (anEmptyAsp);
578 myDrawer->SetFreeBoundaryAspect (anEmptyAsp);
579 myDrawer->SetUnFreeBoundaryAspect(anEmptyAsp);
580 myDrawer->SetSeenLineAspect (anEmptyAsp);
581 }
582 else
583 {
584 Quantity_Color aColor = Quantity_NOC_YELLOW;
585 if (myDrawer->HasLink())
586 {
587 AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Line, aColor);
588 }
589 myDrawer->LineAspect()->SetColor (aColor);
590 aColor = Quantity_NOC_RED;
591 if (myDrawer->HasLink())
592 {
593 AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Wire, aColor);
594 }
595 myDrawer->WireAspect()->SetColor (aColor);
596 aColor = Quantity_NOC_GREEN;
597 if (myDrawer->HasLink())
598 {
599 AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Free, aColor);
600 }
601 myDrawer->FreeBoundaryAspect()->SetColor (aColor);
602 aColor = Quantity_NOC_YELLOW;
603 if (myDrawer->HasLink())
604 {
605 AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_UnFree, aColor);
606 }
607 myDrawer->UnFreeBoundaryAspect()->SetColor (aColor);
608 if (myDrawer->HasLink())
609 {
610 AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Seen, aColor);
611 }
612 myDrawer->SeenLineAspect()->SetColor (aColor);
613 }
614
615 if (!myDrawer->HasOwnShadingAspect())
616 {
617 //
618 }
619 else if (HasMaterial()
620 || IsTransparent()
621 || myDrawer->ShadingAspect()->Aspect()->ToMapTexture())
622 {
623 const Graphic3d_MaterialAspect aDefaultMat (Graphic3d_NOM_BRASS);
624 Graphic3d_MaterialAspect mat = aDefaultMat;
625 Quantity_Color anInteriorColors[2] = {Quantity_NOC_CYAN1, Quantity_NOC_CYAN1};
626 if (myDrawer->HasLink())
627 {
628 anInteriorColors[0] = myDrawer->Link()->ShadingAspect()->Aspect()->InteriorColor();
629 anInteriorColors[1] = myDrawer->Link()->ShadingAspect()->Aspect()->BackInteriorColor();
630 }
631 if (HasMaterial() || myDrawer->HasLink())
632 {
633 const Handle(Graphic3d_AspectFillArea3d)& aSrcAspect = (HasMaterial() ? myDrawer : myDrawer->Link())->ShadingAspect()->Aspect();
634 mat = myCurrentFacingModel != Aspect_TOFM_BACK_SIDE
635 ? aSrcAspect->FrontMaterial()
636 : aSrcAspect->BackMaterial();
637 }
638 if (HasMaterial())
639 {
640 const Quantity_Color aColor = myDrawer->HasLink()
641 ? myDrawer->Link()->ShadingAspect()->Color (myCurrentFacingModel)
642 : aDefaultMat.AmbientColor();
643 mat.SetColor (aColor);
644 }
645 if (IsTransparent())
646 {
647 Standard_Real aTransp = myDrawer->ShadingAspect()->Transparency (myCurrentFacingModel);
648 mat.SetTransparency (Standard_ShortReal(aTransp));
649 }
650 myDrawer->ShadingAspect()->SetMaterial (mat, myCurrentFacingModel);
651 myDrawer->ShadingAspect()->Aspect()->SetInteriorColor (anInteriorColors[0]);
652 myDrawer->ShadingAspect()->Aspect()->SetBackInteriorColor(anInteriorColors[1]);
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->ShadingAspect()->Aspect();
663 Handle(Graphic3d_AspectLine3d) aLineAsp = myDrawer->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_MaterialAspect& theMat)
844{
845 setMaterial (myDrawer, theMat, HasColor(), IsTransparent());
846 hasOwnMaterial = Standard_True;
847
848 // modify shading presentation without re-computation
849 const PrsMgr_Presentations& aPrsList = Presentations();
850 Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
851 for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
852 {
853 const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
854 if (aPrsModed.Mode() != AIS_Shaded)
855 {
856 continue;
857 }
858
859 const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
860 for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
861 {
862 const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
863
864 // Check if aspect of given type is set for the group,
865 // because setting aspect for group with no already set aspect
866 // can lead to loss of presentation data
867 if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
868 {
869 aGroup->SetGroupPrimitivesAspect (anAreaAsp);
870 }
871 }
872 }
873
874 myRecomputeEveryPrs = Standard_False; // no mode to recalculate :only viewer update
875 myToRecomputeModes.Clear();
876}
877
878//=======================================================================
879//function : UnsetMaterial
880//purpose :
881//=======================================================================
882
883void AIS_Shape::UnsetMaterial()
884{
885 if (!HasMaterial())
886 {
887 return;
888 }
889
890 if (!myDrawer->HasOwnShadingAspect())
891 {
892 //
893 }
894 else if (HasColor()
895 || IsTransparent()
896 || myDrawer->ShadingAspect()->Aspect()->ToMapTexture())
897 {
898 if(myDrawer->HasLink())
899 {
900 myDrawer->ShadingAspect()->SetMaterial (myDrawer->Link()->ShadingAspect()->Material (myCurrentFacingModel),
901 myCurrentFacingModel);
902 }
903 if (HasColor())
904 {
905 myDrawer->ShadingAspect()->SetColor (myDrawer->Color(), myCurrentFacingModel);
906 myDrawer->ShadingAspect()->SetTransparency (myDrawer->Transparency(), myCurrentFacingModel);
907 }
908 }
909 else
910 {
911 myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
912 }
913 hasOwnMaterial = Standard_False;
914
915 // modify shading presentation without re-computation
916 const PrsMgr_Presentations& aPrsList = Presentations();
917 Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
918 for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
919 {
920 const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
921 if (aPrsModed.Mode() != AIS_Shaded)
922 {
923 continue;
924 }
925
926 const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
927 for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
928 {
929 const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
930 if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
931 {
932 aGroup->SetGroupPrimitivesAspect (anAreaAsp);
933 }
934 }
935 }
936
937 myRecomputeEveryPrs = Standard_False; // no mode to recalculate :only viewer update
938 myToRecomputeModes.Clear();
939}
940
941//=======================================================================
942//function : setTransparency
943//purpose :
944//=======================================================================
945
946void AIS_Shape::setTransparency (const Handle(Prs3d_Drawer)& theDrawer,
947 const Standard_Real theValue) const
948{
949 if (!theDrawer->HasOwnShadingAspect())
950 {
951 theDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
952 if (theDrawer->HasLink())
953 {
954 *theDrawer->ShadingAspect()->Aspect() = *theDrawer->Link()->ShadingAspect()->Aspect();
955 }
956 }
957
958 // override transparency
959 theDrawer->ShadingAspect()->SetTransparency (theValue, myCurrentFacingModel);
960}
961
962//=======================================================================
963//function : SetTransparency
964//purpose :
965//=======================================================================
966
967void AIS_Shape::SetTransparency (const Standard_Real theValue)
968{
969 setTransparency (myDrawer, theValue);
970 myDrawer->SetTransparency ((Standard_ShortReal )theValue);
971
972 // modify shading presentation without re-computation
973 const PrsMgr_Presentations& aPrsList = Presentations();
974 Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
975 for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
976 {
977 const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
978 if (aPrsModed.Mode() != AIS_Shaded)
979 {
980 continue;
981 }
982
983 const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
984 for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
985 {
986 const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
987 if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
988 {
989 aGroup->SetGroupPrimitivesAspect (anAreaAsp);
990 }
991 }
992 }
993
994 myRecomputeEveryPrs = Standard_False; // no mode to recalculate - only viewer update
995 myToRecomputeModes.Clear();
996}
997
998//=======================================================================
999//function : UnsetTransparency
1000//purpose :
1001//=======================================================================
1002
1003void AIS_Shape::UnsetTransparency()
1004{
1005 myDrawer->SetTransparency (0.0f);
1006 if (!myDrawer->HasOwnShadingAspect())
1007 {
1008 return;
1009 }
1010 else if (HasColor()
1011 || HasMaterial()
1012 || myDrawer->ShadingAspect()->Aspect()->ToMapTexture())
1013 {
1014 myDrawer->ShadingAspect()->SetTransparency (0.0, myCurrentFacingModel);
1015 }
1016 else
1017 {
1018 myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
1019 }
1020
1021 // modify shading presentation without re-computation
1022 const PrsMgr_Presentations& aPrsList = Presentations();
1023 Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
1024 for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt)
1025 {
1026 const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt);
1027 if (aPrsModed.Mode() != AIS_Shaded)
1028 {
1029 continue;
1030 }
1031
1032 const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation();
1033 for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next())
1034 {
1035 const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value();
1036 if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
1037 {
1038 aGroup->SetGroupPrimitivesAspect (anAreaAsp);
1039 }
1040 }
1041 }
1042
1043 myRecomputeEveryPrs = Standard_False; // no mode to recalculate :only viewer update
1044 myToRecomputeModes.Clear();
1045}
1046
1047//=======================================================================
1048//function : LoadRecomputable
1049//purpose :
1050//=======================================================================
1051
1052void AIS_Shape::LoadRecomputable(const Standard_Integer TheMode)
1053{
1054 myRecomputeEveryPrs = Standard_False;
1055 if(!IsInList(myToRecomputeModes,TheMode))
1056 myToRecomputeModes.Append(TheMode);
1057}
1058
1059//=======================================================================
1060//function : BoundingBox
1061//purpose :
1062//=======================================================================
1063
1064const Bnd_Box& AIS_Shape::BoundingBox()
1065{
1066 if (myshape.ShapeType() == TopAbs_COMPOUND) {
1067 TopoDS_Iterator anExplor (myshape);
1068
1069 if (!anExplor.More()) { // empty Shape -> empty Assembly.
1070 myBB.SetVoid();
1071 return myBB;
1072 }
1073 }
1074
1075 if(myCompBB) {
1076 BRepBndLib::AddClose(myshape, myBB);
1077 myCompBB = Standard_False;
1078 }
1079 return myBB;
1080}
1081
1082//*****
1083//***** Reset
1084//=======================================================================
1085//function : SetOwnDeviationCoefficient
1086//purpose : resets myhasOwnDeviationCoefficient to Standard_False and
1087// returns Standard_True if it change
1088//=======================================================================
1089
1090Standard_Boolean AIS_Shape::SetOwnDeviationCoefficient ()
1091{
1092 Standard_Boolean itSet = myDrawer->HasOwnDeviationCoefficient();
1093 if(itSet) myDrawer->SetDeviationCoefficient();
1094 return itSet;
1095}
1096
1097//=======================================================================
1098//function : SetHLROwnDeviationCoefficient
1099//purpose : resets myhasOwnHLRDeviationCoefficient to Standard_False and
1100// returns Standard_True if it change
1101//=======================================================================
1102
1103Standard_Boolean AIS_Shape::SetOwnHLRDeviationCoefficient ()
1104{
1105 Standard_Boolean itSet = myDrawer->HasOwnHLRDeviationCoefficient();
1106 if(itSet) myDrawer->SetHLRDeviationCoefficient();
1107 return itSet;
1108
1109}
1110
1111//=======================================================================
1112//function : SetOwnDeviationAngle
1113//purpose : resets myhasOwnDeviationAngle to Standard_False and
1114// returns Standard_True if it change
1115//=======================================================================
1116
1117Standard_Boolean AIS_Shape::SetOwnDeviationAngle ()
1118{
1119 Standard_Boolean itSet = myDrawer->HasOwnDeviationAngle();
1120 if(itSet) myDrawer->SetDeviationAngle();
1121 return itSet;
1122
1123}
1124
1125//=======================================================================
1126//function : SetOwnHLRDeviationAngle
1127//purpose : resets myhasOwnHLRDeviationAngle to Standard_False and
1128// returns Standard_True if it change
1129//=======================================================================
1130
1131Standard_Boolean AIS_Shape::SetOwnHLRDeviationAngle ()
1132{
1133 Standard_Boolean itSet = myDrawer->HasOwnHLRDeviationAngle();
1134 if(itSet) myDrawer->SetHLRAngle();
1135 return itSet;
1136
1137}
1138//***** SetOwn
1139//=======================================================================
1140//function : SetOwnDeviationCoefficient
1141//purpose :
1142//=======================================================================
1143
1144void AIS_Shape::SetOwnDeviationCoefficient ( const Standard_Real aCoefficient )
1145{
1146 myDrawer->SetDeviationCoefficient( aCoefficient );
1147 SetToUpdate(0) ; // WireFrame
1148 SetToUpdate(1) ; // Shadding
1149}
1150
1151//=======================================================================
1152//function : SetOwnHLRDeviationCoefficient
1153//purpose :
1154//=======================================================================
1155
1156void AIS_Shape::SetOwnHLRDeviationCoefficient ( const Standard_Real aCoefficient )
1157{
1158 myDrawer->SetHLRDeviationCoefficient( aCoefficient );
1159
1160}
1161
1162//=======================================================================
1163//function : SetOwnDeviationAngle
1164//purpose :
1165//=======================================================================
1166
1167void AIS_Shape::SetOwnDeviationAngle ( const Standard_Real anAngle )
1168{
1169
1170 myDrawer->SetDeviationAngle(anAngle );
1171 SetToUpdate(0) ; // WireFrame
1172}
1173//=======================================================================
1174//function : SetOwnDeviationAngle
1175//purpose :
1176//=======================================================================
1177
1178void AIS_Shape::SetAngleAndDeviation ( const Standard_Real anAngle )
1179{
1180 Standard_Real OutAngl,OutDefl;
1181 HLRBRep::PolyHLRAngleAndDeflection(anAngle,OutAngl,OutDefl);
1182 SetOwnDeviationAngle(anAngle) ;
1183 SetOwnDeviationCoefficient(OutDefl) ;
1184 myInitAng = anAngle;
1185 SetToUpdate(0);
1186 SetToUpdate(1);
1187}
1188
1189//=======================================================================
1190//function : UserAngle
1191//purpose :
1192//=======================================================================
1193
1194Standard_Real AIS_Shape::UserAngle() const
1195{
1196 return myInitAng ==0. ? GetContext()->DeviationAngle(): myInitAng;
1197}
1198
1199
1200//=======================================================================
1201//function : SetHLRAngleAndDeviation
1202//purpose :
1203//=======================================================================
1204
1205void AIS_Shape::SetHLRAngleAndDeviation ( const Standard_Real anAngle )
1206{
1207 Standard_Real OutAngl,OutDefl;
1208 HLRBRep::PolyHLRAngleAndDeflection(anAngle,OutAngl,OutDefl);
1209 SetOwnHLRDeviationAngle( OutAngl );
1210 SetOwnHLRDeviationCoefficient(OutDefl);
1211
1212}
1213//=======================================================================
1214//function : SetOwnHLRDeviationAngle
1215//purpose :
1216//=======================================================================
1217
1218void AIS_Shape::SetOwnHLRDeviationAngle ( const Standard_Real anAngle )
1219{
1220 myDrawer->SetHLRAngle( anAngle );
1221}
1222
1223//***** GetOwn
1224//=======================================================================
1225//function : OwnDeviationCoefficient
1226//purpose :
1227//=======================================================================
1228
1229Standard_Boolean AIS_Shape::OwnDeviationCoefficient ( Standard_Real & aCoefficient,
1230 Standard_Real & aPreviousCoefficient ) const
1231{
1232 aCoefficient = myDrawer->DeviationCoefficient();
1233 aPreviousCoefficient = myDrawer->PreviousDeviationCoefficient ();
1234 return myDrawer->HasOwnDeviationCoefficient() ;
1235}
1236
1237//=======================================================================
1238//function : OwnHLRDeviationCoefficient
1239//purpose :
1240//=======================================================================
1241
1242Standard_Boolean AIS_Shape::OwnHLRDeviationCoefficient ( Standard_Real & aCoefficient,
1243 Standard_Real & aPreviousCoefficient ) const
1244{
1245 aCoefficient = myDrawer->HLRDeviationCoefficient();
1246 aPreviousCoefficient = myDrawer->PreviousHLRDeviationCoefficient ();
1247 return myDrawer->HasOwnHLRDeviationCoefficient();
1248
1249}
1250
1251//=======================================================================
1252//function : OwnDeviationAngle
1253//purpose :
1254//=======================================================================
1255
1256Standard_Boolean AIS_Shape::OwnDeviationAngle ( Standard_Real & anAngle,
1257 Standard_Real & aPreviousAngle ) const
1258{
1259 anAngle = myDrawer->DeviationAngle();
1260 aPreviousAngle = myDrawer->PreviousDeviationAngle ();
1261 return myDrawer->HasOwnDeviationAngle();
1262}
1263
1264//=======================================================================
1265//function : OwnHLRDeviationAngle
1266//purpose :
1267//=======================================================================
1268
1269Standard_Boolean AIS_Shape::OwnHLRDeviationAngle ( Standard_Real & anAngle,
1270 Standard_Real & aPreviousAngle ) const
1271{
1272 anAngle = myDrawer->HLRAngle();
1273 aPreviousAngle = myDrawer->PreviousHLRDeviationAngle ();
1274 return myDrawer->HasOwnHLRDeviationAngle();
1275}