From: nds Date: Thu, 31 Mar 2016 12:40:23 +0000 (+0300) Subject: Issue #805 In the sketch presentation, show both the parameter and its value: provide... X-Git-Tag: V_2.3.0~353 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=05980d60d4b120a4bb9244fc923d1925ff4b4bfc;p=modules%2Fshaper.git Issue #805 In the sketch presentation, show both the parameter and its value: provided for angle/radius constraints. --- diff --git a/src/SketcherPrs/SketcherPrs_Angle.cpp b/src/SketcherPrs/SketcherPrs_Angle.cpp index d26d5999c..bd79f8b4b 100644 --- a/src/SketcherPrs/SketcherPrs_Angle.cpp +++ b/src/SketcherPrs/SketcherPrs_Angle.cpp @@ -6,6 +6,7 @@ #include "SketcherPrs_Angle.h" #include "SketcherPrs_Tools.h" +#include "SketcherPrs_DimensionStyleListener.h" #include #include @@ -42,6 +43,13 @@ SketcherPrs_Angle::SketcherPrs_Angle(ModelAPI_Feature* theConstraint, SetDimensionAspect(myAspect); SetSelToleranceForText2d(SketcherPrs_Tools::getDefaultTextHeight()); + + myStyleListener = new SketcherPrs_DimensionStyleListener(); +} + +SketcherPrs_Angle::~SketcherPrs_Angle() +{ + delete myStyleListener; } bool SketcherPrs_Angle::IsReadyToDisplay(ModelAPI_Feature* theConstraint, @@ -168,6 +176,8 @@ void SketcherPrs_Angle::Compute(const Handle(PrsMgr_PresentationManager3d)& theP AttributeDoublePtr aValue = myConstraint->data()->real(SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID()); SketcherPrs_Tools::setDisplaySpecialSymbol(this, aValue->usedParameters().size() > 0); + myStyleListener->updateDimensions(this, aValue); + AIS_AngleDimension::Compute(thePresentationManager, thePresentation, theMode); } diff --git a/src/SketcherPrs/SketcherPrs_Angle.h b/src/SketcherPrs/SketcherPrs_Angle.h index 0d87c02e3..e178a1b8c 100644 --- a/src/SketcherPrs/SketcherPrs_Angle.h +++ b/src/SketcherPrs/SketcherPrs_Angle.h @@ -14,6 +14,8 @@ #include #include +class SketcherPrs_DimensionStyleListener; + DEFINE_STANDARD_HANDLE(SketcherPrs_Angle, AIS_AngleDimension) /** @@ -29,6 +31,9 @@ public: Standard_EXPORT SketcherPrs_Angle(ModelAPI_Feature* theConstraint, const std::shared_ptr& thePlane); + /// Destructor + Standard_EXPORT ~SketcherPrs_Angle(); + DEFINE_STANDARD_RTTI(SketcherPrs_Angle) /// Returns true if the constraint feature arguments are correcly filled to build AIS presentation @@ -54,6 +59,9 @@ private: std::shared_ptr myPlane; Handle(Prs3d_DimensionAspect) myAspect; + + /// Listener to update dimension visualization style + SketcherPrs_DimensionStyleListener* myStyleListener; }; diff --git a/src/SketcherPrs/SketcherPrs_LengthDimension.cpp b/src/SketcherPrs/SketcherPrs_LengthDimension.cpp index a61a6cb40..018f47b01 100644 --- a/src/SketcherPrs/SketcherPrs_LengthDimension.cpp +++ b/src/SketcherPrs/SketcherPrs_LengthDimension.cpp @@ -6,6 +6,8 @@ #include "SketcherPrs_LengthDimension.h" #include "SketcherPrs_Tools.h" +#include "SketcherPrs_Tools.h" +#include "SketcherPrs_DimensionStyleListener.h" #include #include @@ -14,9 +16,6 @@ #include #include -#include -#include - #include #include diff --git a/src/SketcherPrs/SketcherPrs_Radius.cpp b/src/SketcherPrs/SketcherPrs_Radius.cpp index 62a50a46f..aeabe0eae 100644 --- a/src/SketcherPrs/SketcherPrs_Radius.cpp +++ b/src/SketcherPrs/SketcherPrs_Radius.cpp @@ -6,6 +6,7 @@ #include "SketcherPrs_Radius.h" #include "SketcherPrs_Tools.h" +#include "SketcherPrs_DimensionStyleListener.h" #include #include @@ -42,6 +43,13 @@ SketcherPrs_Radius::SketcherPrs_Radius(ModelAPI_Feature* theConstraint, SetDimensionAspect(myAspect); SetSelToleranceForText2d(SketcherPrs_Tools::getDefaultTextHeight()); + + myStyleListener = new SketcherPrs_DimensionStyleListener(); +} + +SketcherPrs_Radius::~SketcherPrs_Radius() +{ + delete myStyleListener; } bool SketcherPrs_Radius::IsReadyToDisplay(ModelAPI_Feature* theConstraint, @@ -180,6 +188,8 @@ void SketcherPrs_Radius::Compute(const Handle(PrsMgr_PresentationManager3d)& the AttributeDoublePtr aValue = myConstraint->data()->real(SketchPlugin_Constraint::VALUE()); SketcherPrs_Tools::setDisplaySpecialSymbol(this, aValue->usedParameters().size() > 0); + myStyleListener->updateDimensions(this, aValue); + AIS_RadiusDimension::Compute(thePresentationManager, thePresentation, theMode); } diff --git a/src/SketcherPrs/SketcherPrs_Radius.h b/src/SketcherPrs/SketcherPrs_Radius.h index ea0dc90d4..348eafdcf 100644 --- a/src/SketcherPrs/SketcherPrs_Radius.h +++ b/src/SketcherPrs/SketcherPrs_Radius.h @@ -14,6 +14,8 @@ #include #include +class SketcherPrs_DimensionStyleListener; + DEFINE_STANDARD_HANDLE(SketcherPrs_Radius, AIS_RadiusDimension) /** @@ -29,6 +31,9 @@ public: Standard_EXPORT SketcherPrs_Radius(ModelAPI_Feature* theConstraint, const std::shared_ptr& thePlane); + /// Destructor + Standard_EXPORT ~SketcherPrs_Radius(); + DEFINE_STANDARD_RTTI(SketcherPrs_Radius) /// Returns true if the constraint feature arguments are correcly filled to build AIS presentation @@ -54,6 +59,9 @@ private: std::shared_ptr myPlane; Handle(Prs3d_DimensionAspect) myAspect; + + /// Listener to update dimension visualization style + SketcherPrs_DimensionStyleListener* myStyleListener; }; #endif \ No newline at end of file