From: vsv Date: Thu, 26 Mar 2020 09:22:58 +0000 (+0300) Subject: Issue #2999: Provide initialization of deviation coefficient for all presentations X-Git-Tag: V9_5_0a2~18 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d8d36d2338b0ed4489127c1d50acb472d63fa78d;p=modules%2Fshaper.git Issue #2999: Provide initialization of deviation coefficient for all presentations --- diff --git a/src/ModuleBase/ModuleBase_ResultPrs.cpp b/src/ModuleBase/ModuleBase_ResultPrs.cpp index f94b65780..a860f61cd 100644 --- a/src/ModuleBase/ModuleBase_ResultPrs.cpp +++ b/src/ModuleBase/ModuleBase_ResultPrs.cpp @@ -79,6 +79,7 @@ ModuleBase_ResultPrs::ModuleBase_ResultPrs(ResultPtr theResult) // Set own free boundaries aspect in order to have free // and unfree boundaries with different colors Handle(Prs3d_Drawer) aDrawer = Attributes(); + //aDrawer->SetTypeOfDeflection(Aspect_TOD_ABSOLUTE); aDrawer->SetUnFreeBoundaryAspect( new Prs3d_LineAspect(Quantity_NOC_YELLOW, Aspect_TOL_SOLID, 1)); aDrawer->SetFreeBoundaryAspect(new Prs3d_LineAspect(Quantity_NOC_GREEN, Aspect_TOL_SOLID, 1)); @@ -119,6 +120,8 @@ ModuleBase_ResultPrs::ModuleBase_ResultPrs(ResultPtr theResult) SetDynamicHilightAttributes(aDrawer); } } + //if (!aDrawer.IsNull()) + // aDrawer->SetTypeOfDeflection(Aspect_TOD_ABSOLUTE); myHiddenSubShapesDrawer = new AIS_ColoredDrawer(myDrawer); Handle(Prs3d_ShadingAspect) aShadingAspect = new Prs3d_ShadingAspect(); @@ -260,6 +263,9 @@ void ModuleBase_ResultPrs::Compute( aReadyToDisplay = false; } } + // change deviation coefficient to provide more precise circle + ModuleBase_Tools::setDefaultDeviationCoefficient(Shape(), DynamicHilightAttributes()); + ModuleBase_Tools::setDefaultDeviationCoefficient(Shape(), Attributes()); try { AIS_Shape::Compute(thePresentationManager, thePresentation, theMode); } diff --git a/src/ModuleBase/ModuleBase_Tools.cpp b/src/ModuleBase/ModuleBase_Tools.cpp index e41847bf8..a9f463969 100644 --- a/src/ModuleBase/ModuleBase_Tools.cpp +++ b/src/ModuleBase/ModuleBase_Tools.cpp @@ -456,6 +456,8 @@ void setDefaultDeviationCoefficient(const TopoDS_Shape& theShape, { if (theShape.IsNull()) return; + if (theDrawer.IsNull()) + return; std::shared_ptr aGeomShape(new GeomAPI_Shape()); aGeomShape->setImpl(new TopoDS_Shape(theShape)); diff --git a/src/PartSet/PartSet_OperationPrs.cpp b/src/PartSet/PartSet_OperationPrs.cpp index 5c2d2ae11..f782ca3c0 100644 --- a/src/PartSet/PartSet_OperationPrs.cpp +++ b/src/PartSet/PartSet_OperationPrs.cpp @@ -92,6 +92,7 @@ PartSet_OperationPrs::PartSet_OperationPrs(ModuleBase_IWorkshop* theWorkshop) aDrawer->SetUIsoAspect(aUIsoAspect); aDrawer->SetVIsoAspect(aVIsoAspect); aDrawer->SetIsoOnPlane(false); + //aDrawer->SetTypeOfDeflection(Aspect_TOD_ABSOLUTE); } bool PartSet_OperationPrs::hasShapes() @@ -135,9 +136,7 @@ void PartSet_OperationPrs::Compute( // change deviation coefficient to provide more precise circle // as there is no result, the shape is processed to correct deviation. To be unified ModuleBase_Tools::setDefaultDeviationCoefficient(aShape, aDrawer); - Handle(Prs3d_Drawer) aHighlightDrawer = DynamicHilightAttributes(); - if (!aHighlightDrawer.IsNull()) - ModuleBase_Tools::setDefaultDeviationCoefficient(aShape, aHighlightDrawer); + ModuleBase_Tools::setDefaultDeviationCoefficient(aShape, DynamicHilightAttributes()); if (myUseAISWidth) { Handle(AIS_InteractiveObject) anIO = anIter.Value(); diff --git a/src/PartSet/PartSet_ResultSketchPrs.cpp b/src/PartSet/PartSet_ResultSketchPrs.cpp index 380e4ac42..652a89b47 100644 --- a/src/PartSet/PartSet_ResultSketchPrs.cpp +++ b/src/PartSet/PartSet_ResultSketchPrs.cpp @@ -71,6 +71,7 @@ PartSet_ResultSketchPrs::PartSet_ResultSketchPrs(ResultPtr theResult) aDrawer->PointAspect()->SetTypeOfMarker(Aspect_TOM_PLUS); else aDrawer->SetPointAspect(new Prs3d_PointAspect(Aspect_TOM_PLUS, Quantity_NOC_YELLOW, 1.)); + //aDrawer->SetTypeOfDeflection(Aspect_TOD_ABSOLUTE); // Activate individual repaintng if this is a part of compsolid ResultBodyPtr anOwner = ModelAPI_Tools::bodyOwner(myResult); @@ -105,7 +106,8 @@ void PartSet_ResultSketchPrs::Compute( setAuxiliaryPresentationStyle(false); // change deviation coefficient to provide more precise circle - //ModuleBase_Tools::setDefaultDeviationCoefficient(myResult, Attributes()); + ModuleBase_Tools::setDefaultDeviationCoefficient(Shape(), DynamicHilightAttributes()); + ModuleBase_Tools::setDefaultDeviationCoefficient(Shape(), Attributes()); try { AIS_Shape::Compute(thePresentationManager, thePresentation, theMode); }