]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix crash on importing salome.shaper.model
authorazv <azv@opencascade.com>
Wed, 29 Jan 2020 14:45:34 +0000 (17:45 +0300)
committerazv <azv@opencascade.com>
Wed, 29 Jan 2020 14:45:34 +0000 (17:45 +0300)
src/SketchAPI/SketchAPI_Sketch.cpp

index a93c26e05a1f586beb5f48ff95fd9ec369ea28c7..5a8d9ce21a3158b9ca52667fb5f933721915feba 100644 (file)
@@ -1212,18 +1212,15 @@ static std::shared_ptr<GeomAPI_Pnt2d> pointOnEllipse(const FeaturePtr& theFeatur
 }
 
 static std::shared_ptr<GeomAPI_Pnt2d> middlePointOnBSpline(const FeaturePtr& theFeature,
-                                                           const CompositeFeaturePtr& theSketch)
+                                                           SketchAPI_Sketch* theSketch)
 {
   GeomAPI_Edge anEdge(theFeature->lastResult()->shape());
   GeomPointPtr aMiddle = anEdge.middlePoint();
-
-  std::shared_ptr<SketchPlugin_Sketch> aSketch =
-      std::dynamic_pointer_cast<SketchPlugin_Sketch>(theSketch);
-  return aSketch->to2D(aMiddle);
+  return theSketch->to2D(aMiddle);
 }
 
 static std::shared_ptr<GeomAPI_Pnt2d> middlePoint(const ObjectPtr& theObject,
-                                                  const CompositeFeaturePtr& theSketch)
+                                                  SketchAPI_Sketch* theSketch)
 {
   std::shared_ptr<GeomAPI_Pnt2d> aMiddlePoint;
   FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
@@ -1259,7 +1256,7 @@ void SketchAPI_Sketch::move(const ModelHighAPI_RefAttr& theMovedEntity,
   if (aMessage->movedAttribute())
     anOriginalPosition = pointCoordinates(aMessage->movedAttribute());
   else
-    anOriginalPosition = middlePoint(aMessage->movedObject(), compositeFeature());
+    anOriginalPosition = middlePoint(aMessage->movedObject(), this);
 
   if (!anOriginalPosition)
     return; // something has gone wrong, do not process movement