]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/SketchPlugin/SketchPlugin_Line.cpp
Salome HOME
Initial version of redesign of working with results
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_Line.cpp
index 3175ac13f0cb7277a3d33776028d43519f01ac3f..c15a8b62fa7331186fcf072d015913faf4582b28 100644 (file)
@@ -5,6 +5,7 @@
 #include "SketchPlugin_Line.h"
 #include "SketchPlugin_Sketch.h"
 #include <ModelAPI_Data.h>
+#include <ModelAPI_ResultConstruction.h>
 
 #include <GeomAPI_Pnt.h>
 #include <GeomAPI_Lin2d.h>
@@ -29,11 +30,7 @@ void SketchPlugin_Line::initAttributes()
   data()->addAttribute(LINE_ATTR_END, GeomDataAPI_Point2D::type());
 }
 
-void SketchPlugin_Line::execute() 
-{
-}
-
-const boost::shared_ptr<GeomAPI_Shape>& SketchPlugin_Line::preview()
+void SketchPlugin_Line::execute(boost::shared_ptr<ModelAPI_Result>& theResult) 
 {
   SketchPlugin_Sketch* aSketch = sketch();
   if (aSketch) {
@@ -48,19 +45,12 @@ const boost::shared_ptr<GeomAPI_Shape>& SketchPlugin_Line::preview()
       boost::shared_ptr<GeomAPI_Pnt> anEnd(aSketch->to3D(anEndAttr->x(), anEndAttr->y()));
       // make linear edge
       boost::shared_ptr<GeomAPI_Shape> anEdge = GeomAlgoAPI_EdgeBuilder::line(aStart, anEnd);
-      setPreview(anEdge);
+      // store the result
+      boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(theResult)->setShape(anEdge);
     }
   }
-  return getPreview();
 }
 
-boost::shared_ptr<GeomAPI_AISObject> SketchPlugin_Line::getAISObject(
-                                boost::shared_ptr<GeomAPI_AISObject> thePrevious)
-{
-  return prepareAISShape(thePrevious);
-}
-
-
 void SketchPlugin_Line::move(double theDeltaX, double theDeltaY)
 {
   boost::shared_ptr<ModelAPI_Data> aData = data();