From fce89382d725a60f358cd01cdaebcf55ac17f803 Mon Sep 17 00:00:00 2001 From: vsv Date: Fri, 27 Jun 2014 11:44:29 +0400 Subject: [PATCH] Bug fixing of constraints creation with preselection --- .../ModuleBase_WidgetFeatureOrAttribute.cpp | 36 +++++++++---------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/src/ModuleBase/ModuleBase_WidgetFeatureOrAttribute.cpp b/src/ModuleBase/ModuleBase_WidgetFeatureOrAttribute.cpp index 4ff9ab84b..0099c993f 100644 --- a/src/ModuleBase/ModuleBase_WidgetFeatureOrAttribute.cpp +++ b/src/ModuleBase/ModuleBase_WidgetFeatureOrAttribute.cpp @@ -48,26 +48,24 @@ bool ModuleBase_WidgetFeatureOrAttribute::setValue(ModuleBase_WidgetValue* theVa if (aFeatureValue) { boost::shared_ptr aValuePoint = aFeatureValue->point(); FeaturePtr aValueFeature = aFeatureValue->feature(); - if (aValuePoint && aValueFeature) { - if (aValueFeature) { - isDone = setFeature(aValueFeature); - } - if (!isDone) { - // find the given point in the feature attributes - std::list > anAttiributes = - aValueFeature->data()->attributes(GeomDataAPI_Point2D::type()); - std::list >::const_iterator anIt = anAttiributes.begin(), - aLast = anAttiributes.end(); - boost::shared_ptr aFPoint; - for (;anIt!=aLast && !aFPoint; anIt++) { - boost::shared_ptr aCurPoint = - boost::dynamic_pointer_cast(*anIt); - if (aCurPoint && aCurPoint->pnt()->distance(aValuePoint) < Precision::Confusion()) - aFPoint = aCurPoint; - } - if (aFPoint) - isDone = setAttribute(aFPoint); + if (aValueFeature) { + isDone = setFeature(aValueFeature); + } + if (!isDone && aValuePoint) { + // find the given point in the feature attributes + std::list > anAttiributes = + aValueFeature->data()->attributes(GeomDataAPI_Point2D::type()); + std::list >::const_iterator anIt = anAttiributes.begin(), + aLast = anAttiributes.end(); + boost::shared_ptr aFPoint; + for (;anIt!=aLast && !aFPoint; anIt++) { + boost::shared_ptr aCurPoint = + boost::dynamic_pointer_cast(*anIt); + if (aCurPoint && aCurPoint->pnt()->distance(aValuePoint) < Precision::Confusion()) + aFPoint = aCurPoint; } + if (aFPoint) + isDone = setAttribute(aFPoint); } } } -- 2.39.2