From 35097baada6d03a680b50f52a938f0b656396da6 Mon Sep 17 00:00:00 2001 From: nds Date: Tue, 3 Oct 2017 22:11:01 +0300 Subject: [PATCH] #2205 Ability to customize the arrows and texts of dimensions --- src/SketchAPI/SketchAPI_Sketch.cpp | 16 ++++++ .../SketchPlugin_ConstraintAngle.cpp | 3 ++ .../SketchPlugin_ConstraintAngle.h | 8 +++ .../SketchPlugin_ConstraintDistance.cpp | 4 ++ .../SketchPlugin_ConstraintDistance.h | 7 +++ ...tchPlugin_ConstraintDistanceHorizontal.cpp | 4 ++ ...ketchPlugin_ConstraintDistanceHorizontal.h | 8 +++ ...ketchPlugin_ConstraintDistanceVertical.cpp | 4 ++ .../SketchPlugin_ConstraintDistanceVertical.h | 7 +++ .../SketchPlugin_ConstraintRadius.cpp | 4 ++ .../SketchPlugin_ConstraintRadius.h | 7 +++ src/SketchPlugin/SketchPlugin_Plugin.cpp | 15 ++++++ src/SketchPlugin/plugin-Sketch.xml | 52 +++++++++++++++++++ src/SketcherPrs/SketcherPrs_Angle.cpp | 15 +++++- .../SketcherPrs_LengthDimension.cpp | 34 +++++++----- src/SketcherPrs/SketcherPrs_Radius.cpp | 7 ++- 16 files changed, 179 insertions(+), 16 deletions(-) diff --git a/src/SketchAPI/SketchAPI_Sketch.cpp b/src/SketchAPI/SketchAPI_Sketch.cpp index 5f36a0872..581990dcf 100644 --- a/src/SketchAPI/SketchAPI_Sketch.cpp +++ b/src/SketchAPI/SketchAPI_Sketch.cpp @@ -564,6 +564,8 @@ std::shared_ptr SketchAPI_Sketch::setAngle( compositeFeature()->addFeature(SketchPlugin_ConstraintAngle::ID()); fillAttribute(SketcherPrs_Tools::ANGLE_DIRECT, aFeature->integer(SketchPlugin_ConstraintAngle::TYPE_ID())); + fillAttribute(SketcherPrs_Tools::LOCATION_AUTOMATIC, + aFeature->integer(SketchPlugin_ConstraintAngle::LOCATION_TYPE_ID())); // fill the value before llines to avoid calculation of angle value by the Angle feature fillAttribute(theValue, aFeature->real(SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID())); fillAttribute(theLine1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); @@ -581,6 +583,8 @@ std::shared_ptr SketchAPI_Sketch::setAngleComplementary( compositeFeature()->addFeature(SketchPlugin_ConstraintAngle::ID()); fillAttribute(SketcherPrs_Tools::ANGLE_COMPLEMENTARY, aFeature->integer(SketchPlugin_ConstraintAngle::TYPE_ID())); + fillAttribute(SketcherPrs_Tools::LOCATION_AUTOMATIC, + aFeature->integer(SketchPlugin_ConstraintAngle::LOCATION_TYPE_ID())); fillAttribute(theValue, aFeature->real(SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID())); fillAttribute(theLine1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); fillAttribute(theLine2, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B())); @@ -598,6 +602,8 @@ std::shared_ptr SketchAPI_Sketch::setAngleBackward( compositeFeature()->addFeature(SketchPlugin_ConstraintAngle::ID()); fillAttribute(SketcherPrs_Tools::ANGLE_BACKWARD, aFeature->integer(SketchPlugin_ConstraintAngle::TYPE_ID())); + fillAttribute(SketcherPrs_Tools::LOCATION_AUTOMATIC, + aFeature->integer(SketchPlugin_ConstraintAngle::LOCATION_TYPE_ID())); fillAttribute(theValue, aFeature->real(SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID())); fillAttribute(theLine1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); fillAttribute(theLine2, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B())); @@ -638,6 +644,8 @@ std::shared_ptr SketchAPI_Sketch::setDistance( { std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_ConstraintDistance::ID()); + fillAttribute(SketcherPrs_Tools::LOCATION_AUTOMATIC, + aFeature->integer(SketchPlugin_ConstraintDistance::LOCATION_TYPE_ID())); fillAttribute(thePoint, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); fillAttribute(thePointOrLine, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B())); fillAttribute(theValue, aFeature->real(SketchPlugin_Constraint::VALUE())); @@ -669,6 +677,8 @@ std::shared_ptr SketchAPI_Sketch::setHorizontalDistance( { std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_ConstraintDistanceHorizontal::ID()); + fillAttribute(SketcherPrs_Tools::LOCATION_AUTOMATIC, + aFeature->integer(SketchPlugin_ConstraintDistanceHorizontal::LOCATION_TYPE_ID())); fillAttribute(thePoint1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); fillAttribute(thePoint2, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B())); fillAttribute(theValue, aFeature->real(SketchPlugin_Constraint::VALUE())); @@ -683,6 +693,8 @@ std::shared_ptr SketchAPI_Sketch::setVerticalDistance( { std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_ConstraintDistanceVertical::ID()); + fillAttribute(SketcherPrs_Tools::LOCATION_AUTOMATIC, + aFeature->integer(SketchPlugin_ConstraintDistanceVertical::LOCATION_TYPE_ID())); fillAttribute(thePoint1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); fillAttribute(thePoint2, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B())); fillAttribute(theValue, aFeature->real(SketchPlugin_Constraint::VALUE())); @@ -756,6 +768,8 @@ std::shared_ptr SketchAPI_Sketch::setLength( { std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_ConstraintLength::ID()); + fillAttribute(SketcherPrs_Tools::LOCATION_AUTOMATIC, + aFeature->integer(SketchPlugin_ConstraintLength::LOCATION_TYPE_ID())); fillAttribute(theLine, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); fillAttribute(theValue, aFeature->real(SketchPlugin_Constraint::VALUE())); aFeature->execute(); @@ -804,6 +818,8 @@ std::shared_ptr SketchAPI_Sketch::setRadius( { std::shared_ptr aFeature = compositeFeature()->addFeature(SketchPlugin_ConstraintRadius::ID()); + fillAttribute(SketcherPrs_Tools::LOCATION_AUTOMATIC, + aFeature->integer(SketchPlugin_ConstraintRadius::LOCATION_TYPE_ID())); fillAttribute(theCircleOrArc, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A())); fillAttribute(theValue, aFeature->real(SketchPlugin_Constraint::VALUE())); aFeature->execute(); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintAngle.cpp b/src/SketchPlugin/SketchPlugin_ConstraintAngle.cpp index 14815ed66..23bba812a 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintAngle.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintAngle.cpp @@ -65,6 +65,9 @@ void SketchPlugin_ConstraintAngle::initAttributes() ModelAPI_AttributeBoolean::typeId()); data()->addAttribute(SketchPlugin_ConstraintAngle::ANGLE_REVERSED_SECOND_LINE_ID(), ModelAPI_AttributeBoolean::typeId()); + + data()->addAttribute(SketchPlugin_ConstraintAngle::LOCATION_TYPE_ID(), + ModelAPI_AttributeInteger::typeId()); } void SketchPlugin_ConstraintAngle::colorConfigInfo(std::string& theSection, std::string& theName, diff --git a/src/SketchPlugin/SketchPlugin_ConstraintAngle.h b/src/SketchPlugin/SketchPlugin_ConstraintAngle.h index ba00fbc9d..d0b21dafc 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintAngle.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintAngle.h @@ -75,6 +75,14 @@ class SketchPlugin_ConstraintAngle : public SketchPlugin_ConstraintBase return MY_ANGLE_REVERSED_ID; } + /// attribute name of dimension location type + inline static const std::string& LOCATION_TYPE_ID() + { + static const std::string MY_LOCATION_TYPE_ID("LocationType"); + return MY_LOCATION_TYPE_ID; + } + + /// \brief Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp b/src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp index 9566988fd..7532a3e0e 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp @@ -33,6 +33,7 @@ #include #include +#include #include #include @@ -55,6 +56,9 @@ void SketchPlugin_ConstraintDistance::initAttributes() data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::typeId()); data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), ModelAPI_AttributeRefAttr::typeId()); data()->addAttribute(SIGNED(), ModelAPI_AttributeBoolean::typeId()); + + data()->addAttribute(SketchPlugin_ConstraintDistance::LOCATION_TYPE_ID(), + ModelAPI_AttributeInteger::typeId()); } void SketchPlugin_ConstraintDistance::colorConfigInfo(std::string& theSection, std::string& theName, diff --git a/src/SketchPlugin/SketchPlugin_ConstraintDistance.h b/src/SketchPlugin/SketchPlugin_ConstraintDistance.h index e9e4b1501..c3f5118c4 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintDistance.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintDistance.h @@ -65,6 +65,13 @@ class SketchPlugin_ConstraintDistance : public SketchPlugin_ConstraintBase return MY_SIGNED; } + /// attribute name of dimension location type + inline static const std::string& LOCATION_TYPE_ID() + { + static const std::string MY_LOCATION_TYPE_ID("LocationType"); + return MY_LOCATION_TYPE_ID; + } + /// \brief Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintDistanceHorizontal.cpp b/src/SketchPlugin/SketchPlugin_ConstraintDistanceHorizontal.cpp index accd996af..c75e83bf5 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintDistanceHorizontal.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintDistanceHorizontal.cpp @@ -32,6 +32,7 @@ #include #include +#include const double tolerance = 1e-7; @@ -48,6 +49,9 @@ void SketchPlugin_ConstraintDistanceHorizontal::initAttributes() data()->addAttribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT(), GeomDataAPI_Point2D::typeId()); data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::typeId()); data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), ModelAPI_AttributeRefAttr::typeId()); + + data()->addAttribute(SketchPlugin_ConstraintDistanceHorizontal::LOCATION_TYPE_ID(), + ModelAPI_AttributeInteger::typeId()); } //************************************************************************************* diff --git a/src/SketchPlugin/SketchPlugin_ConstraintDistanceHorizontal.h b/src/SketchPlugin/SketchPlugin_ConstraintDistanceHorizontal.h index e8f6cb8eb..c5ddc47fe 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintDistanceHorizontal.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintDistanceHorizontal.h @@ -52,6 +52,14 @@ public: return MY_KIND; } + /// attribute name of dimension location type + inline static const std::string& LOCATION_TYPE_ID() + { + static const std::string MY_LOCATION_TYPE_ID("LocationType"); + return MY_LOCATION_TYPE_ID; + } + + /// \brief Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintDistanceVertical.cpp b/src/SketchPlugin/SketchPlugin_ConstraintDistanceVertical.cpp index e9f645a02..845b3b1cc 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintDistanceVertical.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintDistanceVertical.cpp @@ -32,6 +32,7 @@ #include #include +#include const double tolerance = 1e-7; @@ -48,6 +49,9 @@ void SketchPlugin_ConstraintDistanceVertical::initAttributes() data()->addAttribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT(), GeomDataAPI_Point2D::typeId()); data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::typeId()); data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), ModelAPI_AttributeRefAttr::typeId()); + + data()->addAttribute(SketchPlugin_ConstraintDistanceVertical::LOCATION_TYPE_ID(), + ModelAPI_AttributeInteger::typeId()); } //************************************************************************************* diff --git a/src/SketchPlugin/SketchPlugin_ConstraintDistanceVertical.h b/src/SketchPlugin/SketchPlugin_ConstraintDistanceVertical.h index 2cdb36d7d..1bfb6f144 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintDistanceVertical.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintDistanceVertical.h @@ -52,6 +52,13 @@ public: return MY_KIND; } + /// attribute name of dimension location type + inline static const std::string& LOCATION_TYPE_ID() + { + static const std::string MY_LOCATION_TYPE_ID("LocationType"); + return MY_LOCATION_TYPE_ID; + } + /// \brief Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); diff --git a/src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp b/src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp index 16c7b6032..bd5b0bd7d 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp +++ b/src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp @@ -27,6 +27,7 @@ #include #include +#include #include #include @@ -52,6 +53,9 @@ void SketchPlugin_ConstraintRadius::initAttributes() data()->addAttribute(SketchPlugin_Constraint::VALUE(), ModelAPI_AttributeDouble::typeId()); data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::typeId()); data()->addAttribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT(), GeomDataAPI_Point2D::typeId()); + + data()->addAttribute(SketchPlugin_ConstraintRadius::LOCATION_TYPE_ID(), + ModelAPI_AttributeInteger::typeId()); } void SketchPlugin_ConstraintRadius::colorConfigInfo(std::string& theSection, std::string& theName, diff --git a/src/SketchPlugin/SketchPlugin_ConstraintRadius.h b/src/SketchPlugin/SketchPlugin_ConstraintRadius.h index cdb83eccd..8b52f3593 100644 --- a/src/SketchPlugin/SketchPlugin_ConstraintRadius.h +++ b/src/SketchPlugin/SketchPlugin_ConstraintRadius.h @@ -49,6 +49,13 @@ class SketchPlugin_ConstraintRadius : public SketchPlugin_ConstraintBase return MY_KIND; } + /// attribute name of dimension location type + inline static const std::string& LOCATION_TYPE_ID() + { + static const std::string MY_LOCATION_TYPE_ID("LocationType"); + return MY_LOCATION_TYPE_ID; + } + /// \brief Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); diff --git a/src/SketchPlugin/SketchPlugin_Plugin.cpp b/src/SketchPlugin/SketchPlugin_Plugin.cpp index 0a1c02678..6d3c562e9 100644 --- a/src/SketchPlugin/SketchPlugin_Plugin.cpp +++ b/src/SketchPlugin/SketchPlugin_Plugin.cpp @@ -55,6 +55,8 @@ #include #include +#include + #include #include @@ -66,6 +68,7 @@ #include #include +#include #ifdef _DEBUG #include @@ -168,6 +171,18 @@ SketchPlugin_Plugin::SketchPlugin_Plugin() Config_PropManager::registerProp("Visualization", "xy_plane_color", "XY plane color", Config_Prop::Color, XY_PLANE_COLOR); #endif + + Config_PropManager::registerProp(SKETCH_TAB_NAME, "dimension_font", "Dimension font", Config_Prop::String, + "Arial"); + std::ostringstream aStream; + aStream << SketcherPrs_Tools::getDefaultTextHeight(); + Config_PropManager::registerProp(SKETCH_TAB_NAME, "dimension_value_size", "Dimension value size", Config_Prop::Integer, + aStream.str()); + aStream.str(""); + aStream.clear(); + aStream << SketcherPrs_Tools::getDefaultArrowSize(); + Config_PropManager::registerProp(SKETCH_TAB_NAME, "dimension_arrow_size", "Dimension arrow size", Config_Prop::Integer, + aStream.str()); } FeaturePtr SketchPlugin_Plugin::createFeature(std::string theFeatureID) diff --git a/src/SketchPlugin/plugin-Sketch.xml b/src/SketchPlugin/plugin-Sketch.xml index 30f03a352..e03938bed 100644 --- a/src/SketchPlugin/plugin-Sketch.xml +++ b/src/SketchPlugin/plugin-Sketch.xml @@ -656,6 +656,16 @@ email : webmaster.salome@opencascade.com + + @@ -689,6 +699,16 @@ email : webmaster.salome@opencascade.com + + @@ -721,6 +741,16 @@ email : webmaster.salome@opencascade.com + + @@ -770,6 +800,17 @@ email : webmaster.salome@opencascade.com + + + @@ -783,6 +824,17 @@ email : webmaster.salome@opencascade.com + + + diff --git a/src/SketcherPrs/SketcherPrs_Angle.cpp b/src/SketcherPrs/SketcherPrs_Angle.cpp index c72739545..400f07099 100644 --- a/src/SketcherPrs/SketcherPrs_Angle.cpp +++ b/src/SketcherPrs/SketcherPrs_Angle.cpp @@ -39,6 +39,13 @@ #include #include +/// Update variable aspect parameters (depending on viewer scale) +/// \param theDimAspect an aspect to be changed +/// \param theDimValue an arrow value +/// \param theTextSize an arrow value +extern void updateArrows(Handle_Prs3d_DimensionAspect theDimAspect, + double theDimValue, double theTextSize, SketcherPrs_Tools::LocationType theLocationType); + #define PI 3.1415926535897932 //#ifndef WNT @@ -230,8 +237,12 @@ void SketcherPrs_Angle::Compute(const Handle(PrsMgr_PresentationManager3d)& theP // Update text visualization: parameter value or parameter text myStyleListener->updateDimensions(this, myValue); - myAspect->SetExtensionSize(myAspect->ArrowAspect()->Length()); - myAspect->SetArrowTailSize(myAspect->ArrowAspect()->Length()); + double aTextSize = 0.0; + GetValueString(aTextSize); + AttributeIntegerPtr aLocationTypeAttr = std::dynamic_pointer_cast + (myConstraint->data()->attribute(SketchPlugin_ConstraintAngle::LOCATION_TYPE_ID())); + updateArrows(myAspect, GetValue(), aTextSize, + (SketcherPrs_Tools::LocationType)(aLocationTypeAttr->value())); AIS_AngleDimension::Compute(thePresentationManager, thePresentation, theMode); diff --git a/src/SketcherPrs/SketcherPrs_LengthDimension.cpp b/src/SketcherPrs/SketcherPrs_LengthDimension.cpp index 2b55584a0..9de74eb32 100644 --- a/src/SketcherPrs/SketcherPrs_LengthDimension.cpp +++ b/src/SketcherPrs/SketcherPrs_LengthDimension.cpp @@ -43,7 +43,7 @@ #include -//#ifdef OCCT_28850_FIXED +#define OCCT_28850_FIXED /// Creates an aspect to be shown in length/radius dimension presentations /// \return an instance of aspect @@ -87,6 +87,12 @@ void updateArrows(Handle(Prs3d_DimensionAspect) theDimAspect, theDimAspect->SetTextHorizontalPosition( theLocationType == SketcherPrs_Tools::LOCATION_LEFT ? Prs3d_DTHP_Left : Prs3d_DTHP_Right); theDimAspect->SetArrowOrientation(Prs3d_DAO_External); + + double anArrowLength = theDimAspect->ArrowAspect()->Length(); + // This is not realy correct way to get viewer scale. + double aViewerScale = (double) SketcherPrs_Tools::getDefaultArrowSize() / anArrowLength; + theDimAspect->SetExtensionSize( + (theTextSize / aViewerScale + SketcherPrs_Tools::getArrowSize()) / 2.0); } theDimAspect->SetArrowTailSize(theDimAspect->ArrowAspect()->Length()); @@ -117,9 +123,9 @@ SketcherPrs_LengthDimension::SketcherPrs_LengthDimension(ModelAPI_Feature* theCo #ifdef OCCT_28850_FIXED if (theConstraint->getKind() == SketchPlugin_ConstraintDistanceHorizontal::ID()) - SetDirection(true, mySketcherPlane->dirX()->impl()); + SetDirection(mySketcherPlane->dirX()->impl(), true); else if (theConstraint->getKind() == SketchPlugin_ConstraintDistanceVertical::ID()) - SetDirection(true, mySketcherPlane->dirY()->impl()); + SetDirection(mySketcherPlane->dirY()->impl(), true); #endif } @@ -162,17 +168,21 @@ void SketcherPrs_LengthDimension::Compute( double aTextSize = 0.0; GetValueString(aTextSize); - SketcherPrs_Tools::LocationType aLocationType = SketcherPrs_Tools::LOCATION_AUTOMATIC; std::string aLocationAttribute; - if (myConstraint->getKind() == SketchPlugin_ConstraintLength::ID()) + std::string aConstraintKind = myConstraint->getKind(); + if (aConstraintKind == SketchPlugin_ConstraintLength::ID()) aLocationAttribute = SketchPlugin_ConstraintLength::LOCATION_TYPE_ID(); - if (!aLocationAttribute.empty()) - { - std::shared_ptr aTypeAttr = std::dynamic_pointer_cast< - ModelAPI_AttributeInteger>(myConstraint->data()->attribute(aLocationAttribute)); - aLocationType = (SketcherPrs_Tools::LocationType)(aTypeAttr->value()); - } - updateArrows(DimensionAspect(), GetValue(), aTextSize, aLocationType); + else if (aConstraintKind == SketchPlugin_ConstraintDistance::ID()) + aLocationAttribute = SketchPlugin_ConstraintDistance::LOCATION_TYPE_ID(); + else if (aConstraintKind == SketchPlugin_ConstraintDistanceHorizontal::ID()) + aLocationAttribute = SketchPlugin_ConstraintDistanceHorizontal::LOCATION_TYPE_ID(); + else if (aConstraintKind == SketchPlugin_ConstraintDistanceVertical::ID()) + aLocationAttribute = SketchPlugin_ConstraintDistanceVertical::LOCATION_TYPE_ID(); + + std::shared_ptr aLocationTypeAttr = std::dynamic_pointer_cast< + ModelAPI_AttributeInteger>(myConstraint->data()->attribute(aLocationAttribute)); + updateArrows(DimensionAspect(), GetValue(), aTextSize, + (SketcherPrs_Tools::LocationType)(aLocationTypeAttr->value())); // Update text visualization: parameter value or parameter text myStyleListener->updateDimensions(this, myValue); diff --git a/src/SketcherPrs/SketcherPrs_Radius.cpp b/src/SketcherPrs/SketcherPrs_Radius.cpp index bc784cb38..8e557e32b 100644 --- a/src/SketcherPrs/SketcherPrs_Radius.cpp +++ b/src/SketcherPrs/SketcherPrs_Radius.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include @@ -163,8 +164,10 @@ void SketcherPrs_Radius::Compute( // Update variable aspect parameters (depending on viewer scale) double aTextSize = 0.0; GetValueString(aTextSize); - updateArrows(DimensionAspect(), GetValue(), aTextSize, SketcherPrs_Tools::LOCATION_AUTOMATIC); - + AttributeIntegerPtr aLocationTypeAttr = std::dynamic_pointer_cast + (myConstraint->data()->attribute(SketchPlugin_ConstraintRadius::LOCATION_TYPE_ID())); + updateArrows(DimensionAspect(), GetValue(), aTextSize, + (SketcherPrs_Tools::LocationType)(aLocationTypeAttr->value())); AIS_RadiusDimension::Compute(thePresentationManager, thePresentation, theMode); -- 2.39.2