From: nds Date: Fri, 12 Feb 2016 12:51:25 +0000 (+0300) Subject: BUG: Set empty special symbol in lenght constraint X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0226da05efd676d980b8e90a60bab356f8d9e658;p=modules%2Fshaper.git BUG: Set empty special symbol in lenght constraint --- diff --git a/src/SketcherPrs/SketcherPrs_Angle.cpp b/src/SketcherPrs/SketcherPrs_Angle.cpp index 6304a51bd..6f5c379f3 100644 --- a/src/SketcherPrs/SketcherPrs_Angle.cpp +++ b/src/SketcherPrs/SketcherPrs_Angle.cpp @@ -25,10 +25,6 @@ IMPLEMENT_STANDARD_HANDLE(SketcherPrs_Angle, AIS_AngleDimension); IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Angle, AIS_AngleDimension); - -static const Standard_ExtCharacter MyEmptySymbol(' '); -static const Standard_ExtCharacter MySummSymbol(0x03A3); - SketcherPrs_Angle::SketcherPrs_Angle(ModelAPI_Feature* theConstraint, const std::shared_ptr& thePlane) : AIS_AngleDimension(gp_Pnt(0,0,0), gp_Pnt(1,0,0), gp_Pnt(0,1,0)), myConstraint(theConstraint), myPlane(thePlane) @@ -104,15 +100,7 @@ void SketcherPrs_Angle::Compute(const Handle(PrsMgr_PresentationManager3d)& theP myAspect->SetArrowTailSize(myAspect->ArrowAspect()->Length()); AttributeDoublePtr aValue = myConstraint->data()->real(SketchPlugin_Constraint::VALUE()); - std::set aParams = aValue->usedParameters(); - if (aParams.size() > 0) { - SetSpecialSymbol(MySummSymbol); - SetDisplaySpecialSymbol(AIS_DSS_Before); - } - else { - SetSpecialSymbol(MyEmptySymbol); - SetDisplaySpecialSymbol(AIS_DSS_Before); - } + SketcherPrs_Tools::setDisplaySpecialSymbol(this, aValue->usedParameters().size() > 0); AIS_AngleDimension::Compute(thePresentationManager, thePresentation, theMode); } diff --git a/src/SketcherPrs/SketcherPrs_LengthDimension.cpp b/src/SketcherPrs/SketcherPrs_LengthDimension.cpp index 34cae3a54..eaf5ec0cd 100644 --- a/src/SketcherPrs/SketcherPrs_LengthDimension.cpp +++ b/src/SketcherPrs/SketcherPrs_LengthDimension.cpp @@ -30,10 +30,6 @@ static const gp_Pnt MyDefStart(0,0,0); static const gp_Pnt MyDefEnd(1,0,0); static const gp_Pln MyDefPln(gp_Pnt(0,0,0), gp_Dir(0,0,1)); -// it is not possible to use 0x2211 as summ symbol because it is not supported by -// debian Linux platform -static const Standard_ExtCharacter MySummSymbol(0x03A3); - IMPLEMENT_STANDARD_HANDLE(SketcherPrs_LengthDimension, AIS_LengthDimension); IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_LengthDimension, AIS_LengthDimension); @@ -89,11 +85,7 @@ void SketcherPrs_LengthDimension::Compute(const Handle(PrsMgr_PresentationManage myAspect->TextAspect()->SetVerticalJustification(Graphic3d_VTA_CENTER); AttributeDoublePtr aValue = myConstraint->data()->real(SketchPlugin_Constraint::VALUE()); - std::set aParams = aValue->usedParameters(); - if (aParams.size() > 0) { - SetSpecialSymbol(MySummSymbol); - SetDisplaySpecialSymbol(AIS_DSS_Before); - } + SketcherPrs_Tools::setDisplaySpecialSymbol(this, aValue->usedParameters().size() > 0); AIS_LengthDimension::Compute(thePresentationManager, thePresentation, theMode); } diff --git a/src/SketcherPrs/SketcherPrs_Radius.cpp b/src/SketcherPrs/SketcherPrs_Radius.cpp index 56f9d7f0e..d6299a905 100644 --- a/src/SketcherPrs/SketcherPrs_Radius.cpp +++ b/src/SketcherPrs/SketcherPrs_Radius.cpp @@ -25,9 +25,6 @@ static const gp_Circ MyDefCirc(gp_Ax2(gp_Pnt(0,0,0), gp_Dir(0,0,1)), 1); IMPLEMENT_STANDARD_HANDLE(SketcherPrs_Radius, AIS_RadiusDimension); IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Radius, AIS_RadiusDimension); -static const Standard_ExtCharacter MyEmptySymbol(' '); -static const Standard_ExtCharacter MySummSymbol(0x03A3); - SketcherPrs_Radius::SketcherPrs_Radius(ModelAPI_Feature* theConstraint, const std::shared_ptr& thePlane) : AIS_RadiusDimension(MyDefCirc), myConstraint(theConstraint), myPlane(thePlane) @@ -124,15 +121,7 @@ void SketcherPrs_Radius::Compute(const Handle(PrsMgr_PresentationManager3d)& the myAspect->TextAspect()->SetVerticalJustification(Graphic3d_VTA_CENTER); AttributeDoublePtr aValue = myConstraint->data()->real(SketchPlugin_Constraint::VALUE()); - std::set aParams = aValue->usedParameters(); - if (aParams.size() > 0) { - SetSpecialSymbol(MySummSymbol); - SetDisplaySpecialSymbol(AIS_DSS_Before); - } - else { - SetSpecialSymbol(MyEmptySymbol); - SetDisplaySpecialSymbol(AIS_DSS_Before); - } + SketcherPrs_Tools::setDisplaySpecialSymbol(this, aValue->usedParameters().size() > 0); AIS_RadiusDimension::Compute(thePresentationManager, thePresentation, theMode); } diff --git a/src/SketcherPrs/SketcherPrs_Tools.cpp b/src/SketcherPrs/SketcherPrs_Tools.cpp index be093bc69..78b521957 100644 --- a/src/SketcherPrs/SketcherPrs_Tools.cpp +++ b/src/SketcherPrs/SketcherPrs_Tools.cpp @@ -26,6 +26,13 @@ #include #include +#include + +// it is not possible to use 0x2211 as summ symbol because it is not supported by +// debian Linux platform +static const Standard_ExtCharacter MyEmptySymbol(' '); +static const Standard_ExtCharacter MySigmaSymbol(0x03A3); + namespace SketcherPrs_Tools { ObjectPtr getResult(ModelAPI_Feature* theFeature, const std::string& theAttrName) @@ -267,4 +274,16 @@ std::shared_ptr getAnchorPoint(const ModelAPI_Feature* theConstrain return thePlane->to3D(aFlyoutPnt->x(), aFlyoutPnt->y()); } +void setDisplaySpecialSymbol(AIS_Dimension* theDimension, const bool& theToDisplay) +{ + if (theToDisplay) { + theDimension->SetSpecialSymbol(MySigmaSymbol); + theDimension->SetDisplaySpecialSymbol(AIS_DSS_Before); + } + else { + theDimension->SetSpecialSymbol(MyEmptySymbol); + theDimension->SetDisplaySpecialSymbol(AIS_DSS_No); + } +} + }; diff --git a/src/SketcherPrs/SketcherPrs_Tools.h b/src/SketcherPrs/SketcherPrs_Tools.h index 0daf04723..f490898f4 100644 --- a/src/SketcherPrs/SketcherPrs_Tools.h +++ b/src/SketcherPrs/SketcherPrs_Tools.h @@ -16,6 +16,7 @@ #include class GeomDataAPI_Point2D; +class AIS_Dimension; //#define MyTextHeight 20 @@ -103,6 +104,12 @@ namespace SketcherPrs_Tools { SKETCHERPRS_EXPORT std::shared_ptr getAnchorPoint( const ModelAPI_Feature* theConstraint, const std::shared_ptr& thePlane); + + /// Display/hide sigma symbol in the dimension presentation + /// \param theDimension a dimension constraint + /// \param theToDisplay a boolean value + SKETCHERPRS_EXPORT void setDisplaySpecialSymbol(AIS_Dimension* theDimension, + const bool& theToDisplay); }; #endif