Salome HOME
Update copyrights
[modules/shaper.git] / src / SketcherPrs / SketcherPrs_Radius.cpp
index 8e557e32b9c62d10d0afb3fc1604c272dfaa9a9b..f57a08db062d3987375907d1b1b238da14429db0 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 //
 // You should have received a copy of the GNU Lesser General Public
 // License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include "SketcherPrs_Radius.h"
@@ -44,7 +43,7 @@ extern Handle(Prs3d_DimensionAspect) createDimensionAspect();
 /// \param theDimAspect an aspect to be changed
 /// \param theDimValue an arrow value
 /// \param theTextSize an arrow value
-extern void updateArrows(Handle_Prs3d_DimensionAspect theDimAspect,
+extern void updateArrows(Handle(Prs3d_DimensionAspect) theDimAspect,
   double theDimValue, double theTextSize, SketcherPrs_Tools::LocationType theLocationType);
 
 
@@ -164,10 +163,12 @@ void SketcherPrs_Radius::Compute(
   // Update variable aspect parameters (depending on viewer scale)
   double aTextSize = 0.0;
   GetValueString(aTextSize);
-  AttributeIntegerPtr aLocationTypeAttr = std::dynamic_pointer_cast<ModelAPI_AttributeInteger>
+
+  AttributeIntegerPtr aLocAttr = std::dynamic_pointer_cast<ModelAPI_AttributeInteger>
     (myConstraint->data()->attribute(SketchPlugin_ConstraintRadius::LOCATION_TYPE_ID()));
-  updateArrows(DimensionAspect(), GetValue(), aTextSize,
-    (SketcherPrs_Tools::LocationType)(aLocationTypeAttr->value()));
+  SketcherPrs_Tools::LocationType aLocationType = aLocAttr->isInitialized() ?
+    (SketcherPrs_Tools::LocationType)(aLocAttr->value()) : SketcherPrs_Tools::LOCATION_AUTOMATIC;
+  updateArrows(DimensionAspect(), GetValue(), aTextSize, aLocationType);
 
   AIS_RadiusDimension::Compute(thePresentationManager, thePresentation, theMode);
 
@@ -200,6 +201,6 @@ void SketcherPrs_Radius::ComputeSelection(const Handle(SelectMgr_Selection)& aSe
     return;
   }
   }
-  SetSelToleranceForText2d(SketcherPrs_Tools::getTextHeight());
+  SetSelToleranceForText2d(SketcherPrs_Tools::getArrowSize()/5.);
   AIS_RadiusDimension::ComputeSelection(aSelection, aMode);
 }