Salome HOME
Simplified calculation of fly out distance and creation of constraints limited only...
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_ConstraintDistance.cpp
index a119433d36f7f09a5b0cd801cd8811ce1f56505b..7eeee42670cd1c92051ff22e969147ea675eb403 100644 (file)
@@ -134,6 +134,9 @@ AISObjectPtr SketchPlugin_ConstraintDistance::getAISObject(AISObjectPtr thePrevi
   if (!anAIS) {
     anAIS = SketcherPrs_Factory::lengthDimensionConstraint(this, sketch()->coordinatePlane());
   }
+  std::vector<int> aRGB = Config_PropManager::color("Visualization", "sketch_dimension_color",
+                                                    SKETCH_DIMENSION_COLOR);
+  anAIS->setColor(aRGB[0], aRGB[1], aRGB[2]);
   return anAIS;
 }
 
@@ -274,6 +277,9 @@ void SketchPlugin_ConstraintDistance::attributeChanged(const std::string& theID)
     } else
       return;
 
+    if (aEndPnt->distance(aStartPnt) < tolerance)
+      return;
+
     std::shared_ptr<GeomAPI_Dir2d> aLineDir(new GeomAPI_Dir2d(aEndPnt->decreased(aStartPnt)));
     std::shared_ptr<GeomAPI_XY> aFlyoutDir = aFlyoutPnt->xy()->decreased(aStartPnt);
 
@@ -284,15 +290,3 @@ void SketchPlugin_ConstraintDistance::attributeChanged(const std::string& theID)
   }
 }
 
-bool SketchPlugin_ConstraintDistance::customisePresentation(ResultPtr theResult,
-                                    AISObjectPtr thePrs,
-                                    std::shared_ptr<GeomAPI_ICustomPrs> theDefaultPrs)
-{
-  bool isCustomized = false;
-  std::vector<int> aRGB = Config_PropManager::color("Visualization", "sketch_dimension_color",
-                                                    SKETCH_DIMENSION_COLOR);
-  isCustomized = thePrs->setColor(aRGB[0], aRGB[1], aRGB[2]);
-
-  return isCustomized;
-}
-