Salome HOME
refs #80 - Sketch base GUI: create/draw point, circle and arc
authornds <natalia.donis@opencascade.com>
Mon, 16 Jun 2014 08:20:44 +0000 (12:20 +0400)
committernds <natalia.donis@opencascade.com>
Mon, 16 Jun 2014 08:20:44 +0000 (12:20 +0400)
Arc edit correction.

src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.cpp
src/PartSet/PartSet_FeatureArcPrs.cpp
src/SketchPlugin/SketchPlugin_Arc.cpp

index d12cbdd73816d48fadbfd83cd4e41fa339a73805..6b8ebd9463d5cdba2b43bbf16e3177729148ee5f 100644 (file)
@@ -69,7 +69,11 @@ boost::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_EdgeBuilder::lineCircleArc(
     anEdgeBuilder = BRepBuilderAPI_MakeEdge(aCircle, aStart, anEnd);
 
   boost::shared_ptr<GeomAPI_Shape> aRes(new GeomAPI_Shape);
-  TopoDS_Edge anEdge = anEdgeBuilder.Edge();
-  aRes->setImpl(new TopoDS_Shape(anEdge));
+  anEdgeBuilder.Build();
+
+  if (anEdgeBuilder.IsDone())
+    aRes->setImpl(new TopoDS_Shape(anEdgeBuilder.Edge()));
+  else
+    aRes = boost::shared_ptr<GeomAPI_Shape>();
   return aRes;
 }
index dc9fd82e514ac8430a2f67875a41d564a7020cf6..0e76f6e8b899d7ea9364dd7fe93d6f4af5ebc444 100644 (file)
@@ -110,7 +110,7 @@ void PartSet_FeatureArcPrs::move(double theDeltaX, double theDeltaY)
 
   boost::shared_ptr<GeomDataAPI_Point2D> aPoint3 =
         boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(ARC_ATTR_END));
-  aPoint1->setValue(aPoint3->x() + theDeltaX, aPoint3->y() + theDeltaY);
+  aPoint3->setValue(aPoint3->x() + theDeltaX, aPoint3->y() + theDeltaY);
 }
 
 double PartSet_FeatureArcPrs::distanceToPoint(FeaturePtr theFeature,
index 1830a00585c97c9d0fe55e7b847be5b909c331dc..e390c6af2274765003ea38183cf766b28734deba 100644 (file)
@@ -61,7 +61,8 @@ const boost::shared_ptr<GeomAPI_Shape>& SketchPlugin_Arc::preview()
 
       boost::shared_ptr<GeomAPI_Shape> aCircleShape = 
                  GeomAlgoAPI_EdgeBuilder::lineCircleArc(aCenter, aStartPoint, aEndPoint, aNormal);
-      aShapes.push_back(aCircleShape);
+      if (aCircleShape)
+        aShapes.push_back(aCircleShape);
     }
     boost::shared_ptr<GeomAPI_Shape> aCompound = GeomAlgoAPI_CompoundBuilder::compound(aShapes);
     setPreview(aCompound);