]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Bug fixing of constraints creation with preselection
authorvsv <vitaly.smetannikov@opencascade.com>
Fri, 27 Jun 2014 07:44:29 +0000 (11:44 +0400)
committervsv <vitaly.smetannikov@opencascade.com>
Fri, 27 Jun 2014 07:44:29 +0000 (11:44 +0400)
src/ModuleBase/ModuleBase_WidgetFeatureOrAttribute.cpp

index 4ff9ab84b52227c625efc4620d7baa002dcb4549..0099c993fc5055ab6a36451746b9e3d0a3a3c8db 100644 (file)
@@ -48,26 +48,24 @@ bool ModuleBase_WidgetFeatureOrAttribute::setValue(ModuleBase_WidgetValue* theVa
     if (aFeatureValue) {
       boost::shared_ptr<GeomAPI_Pnt2d> 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<boost::shared_ptr<ModelAPI_Attribute> > anAttiributes =
-                                        aValueFeature->data()->attributes(GeomDataAPI_Point2D::type());
-          std::list<boost::shared_ptr<ModelAPI_Attribute> >::const_iterator anIt = anAttiributes.begin(),
-                                                                            aLast = anAttiributes.end();
-          boost::shared_ptr<GeomDataAPI_Point2D> aFPoint;
-          for (;anIt!=aLast && !aFPoint; anIt++) {
-            boost::shared_ptr<GeomDataAPI_Point2D> aCurPoint =
-                                                boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(*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<boost::shared_ptr<ModelAPI_Attribute> > anAttiributes =
+                                      aValueFeature->data()->attributes(GeomDataAPI_Point2D::type());
+        std::list<boost::shared_ptr<ModelAPI_Attribute> >::const_iterator anIt = anAttiributes.begin(),
+                                                                          aLast = anAttiributes.end();
+        boost::shared_ptr<GeomDataAPI_Point2D> aFPoint;
+        for (;anIt!=aLast && !aFPoint; anIt++) {
+          boost::shared_ptr<GeomDataAPI_Point2D> aCurPoint =
+                                              boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(*anIt);
+          if (aCurPoint && aCurPoint->pnt()->distance(aValuePoint) < Precision::Confusion())
+            aFPoint = aCurPoint;
         }
+        if (aFPoint)
+          isDone = setAttribute(aFPoint);
       }
     }
   }