]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Correction for circle to hide AIS object when result is set. isFeatureValue should...
authornds <nds@opencascade.com>
Thu, 23 Jun 2016 06:34:22 +0000 (09:34 +0300)
committernds <nds@opencascade.com>
Thu, 23 Jun 2016 10:47:10 +0000 (13:47 +0300)
src/SketchPlugin/SketchPlugin_Circle.cpp

index 3329091847b73d26d0b6b39e9859acfaa2d75313..9c9a78c6e10ca1b916c2a1c9cc7cfbc3583a9703 100644 (file)
@@ -143,15 +143,23 @@ bool SketchPlugin_Circle::isFeatureValid()
 {
   std::shared_ptr<GeomDataAPI_Point2D> aCenter = 
       std::dynamic_pointer_cast<GeomDataAPI_Point2D>(attribute(CENTER_ID()));
-  std::shared_ptr<GeomDataAPI_Point2D> aFirstPnt =
-      std::dynamic_pointer_cast<GeomDataAPI_Point2D>(attribute(FIRST_POINT_ID()));
-  std::shared_ptr<GeomDataAPI_Point2D> aSecondPnt =
-      std::dynamic_pointer_cast<GeomDataAPI_Point2D>(attribute(SECOND_POINT_ID()));
-  std::shared_ptr<GeomDataAPI_Point2D> aThirdPnt =
-      std::dynamic_pointer_cast<GeomDataAPI_Point2D>(attribute(THIRD_POINT_ID()));
-
-  return aCenter->isInitialized() && aFirstPnt->isInitialized() &&
-         aSecondPnt->isInitialized() && aThirdPnt->isInitialized();
+  bool aValid = aCenter->isInitialized();
+
+  std::string aType = std::dynamic_pointer_cast<ModelAPI_AttributeString>(
+                                         data()->attribute(CIRCLE_TYPE()))->value();
+  if (aType == CIRCLE_TYPE_THREE_POINTS()) {
+    std::shared_ptr<GeomDataAPI_Point2D> aFirstPnt =
+        std::dynamic_pointer_cast<GeomDataAPI_Point2D>(attribute(FIRST_POINT_ID()));
+    std::shared_ptr<GeomDataAPI_Point2D> aSecondPnt =
+        std::dynamic_pointer_cast<GeomDataAPI_Point2D>(attribute(SECOND_POINT_ID()));
+    std::shared_ptr<GeomDataAPI_Point2D> aThirdPnt =
+        std::dynamic_pointer_cast<GeomDataAPI_Point2D>(attribute(THIRD_POINT_ID()));
+    aValid = aValid &&
+             aFirstPnt->isInitialized() &&
+             aSecondPnt->isInitialized() &&
+             aThirdPnt->isInitialized();
+  }
+  return aValid;
 }
 
 void SketchPlugin_Circle::move(double theDeltaX, double theDeltaY)