From dcde2cf7b3e2df1135a2417d286b4b4a1e97bbc2 Mon Sep 17 00:00:00 2001 From: nds Date: Thu, 2 Jun 2016 15:01:19 +0300 Subject: [PATCH] Issue #1530 The arcs representation is not fine enough --- src/ModuleBase/ModuleBase_ResultPrs.cpp | 2 +- src/ModuleBase/ModuleBase_Tools.cpp | 11 +++++++++++ src/ModuleBase/ModuleBase_Tools.h | 9 +++++++++ src/PartSet/PartSet_OperationPrs.cpp | 1 + src/PartSet/PartSet_ResultSketchPrs.cpp | 2 +- 5 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/ModuleBase/ModuleBase_ResultPrs.cpp b/src/ModuleBase/ModuleBase_ResultPrs.cpp index 4085f399e..3923c51c6 100755 --- a/src/ModuleBase/ModuleBase_ResultPrs.cpp +++ b/src/ModuleBase/ModuleBase_ResultPrs.cpp @@ -71,7 +71,7 @@ void ModuleBase_ResultPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& t Set(myOriginalShape); } // change deviation coefficient to provide more precise circle - ModuleBase_Tools::setDefaultDeviationCoefficient(Shape(), Attributes()); + ModuleBase_Tools::setDefaultDeviationCoefficient(myResult, Attributes()); AIS_Shape::Compute(thePresentationManager, thePresentation, theMode); if (!aReadyToDisplay) { diff --git a/src/ModuleBase/ModuleBase_Tools.cpp b/src/ModuleBase/ModuleBase_Tools.cpp index 012ebb0b5..11842fe9b 100755 --- a/src/ModuleBase/ModuleBase_Tools.cpp +++ b/src/ModuleBase/ModuleBase_Tools.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -556,6 +557,16 @@ void checkObjects(const QObjectPtrList& theObjects, bool& hasResult, bool& hasFe } } +void setDefaultDeviationCoefficient(const std::shared_ptr& theResult, + const Handle(Prs3d_Drawer)& theDrawer) +{ + if (!theResult.get()) + return; + + if (theResult->groupName() == ModelAPI_ResultConstruction::group()) + theDrawer->SetDeviationCoefficient(1.e-4); +} + void setDefaultDeviationCoefficient(const TopoDS_Shape& theShape, const Handle(Prs3d_Drawer)& theDrawer) { diff --git a/src/ModuleBase/ModuleBase_Tools.h b/src/ModuleBase/ModuleBase_Tools.h index cdc4121b1..49128e4a5 100755 --- a/src/ModuleBase/ModuleBase_Tools.h +++ b/src/ModuleBase/ModuleBase_Tools.h @@ -169,6 +169,15 @@ Check types of objects which are in the given list MODULEBASE_EXPORT void checkObjects(const QObjectPtrList& theObjects, bool& hasResult, bool& hasFeature, bool& hasParameter, bool& hasCompositeOwner); +/*! Sets the default coeffient into the driver calculated accordingly the shape type. +It provides 1.e-4 for results of construction type +\param theResult a result object to define the deviation coeffient +\param theDrawer a drawer +*/ +MODULEBASE_EXPORT void setDefaultDeviationCoefficient( + const std::shared_ptr& theResult, + const Handle(Prs3d_Drawer)& theDrawer); + /*! Sets the default coeffient into the driver calculated accordingly the shape type. It provides 1.e-4 for a shape withe Edge shape type \param theShape a shape to define the deviation coeffient, diff --git a/src/PartSet/PartSet_OperationPrs.cpp b/src/PartSet/PartSet_OperationPrs.cpp index 991d4b6f2..403bbe300 100755 --- a/src/PartSet/PartSet_OperationPrs.cpp +++ b/src/PartSet/PartSet_OperationPrs.cpp @@ -111,6 +111,7 @@ void PartSet_OperationPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& t const TopoDS_Shape& aShape = anIter.Key(); aBuilder.Add(aComp, aShape); // 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); if (myUseAISWidth) { diff --git a/src/PartSet/PartSet_ResultSketchPrs.cpp b/src/PartSet/PartSet_ResultSketchPrs.cpp index a07cfd490..a8617af00 100755 --- a/src/PartSet/PartSet_ResultSketchPrs.cpp +++ b/src/PartSet/PartSet_ResultSketchPrs.cpp @@ -88,7 +88,7 @@ void PartSet_ResultSketchPrs::Compute(const Handle(PrsMgr_PresentationManager3d) setAuxiliaryPresentationStyle(false); // change deviation coefficient to provide more precise circle - ModuleBase_Tools::setDefaultDeviationCoefficient(Shape(), Attributes()); + ModuleBase_Tools::setDefaultDeviationCoefficient(myResult, Attributes()); AIS_Shape::Compute(thePresentationManager, thePresentation, theMode); if (!myAuxiliaryCompound.IsNull()) { -- 2.39.2