Salome HOME
Added class for the distance constraint
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_Point.cpp
1 // File:    SketchPlugin_Point.cpp
2 // Created: 07 May 2014
3 // Author:  Artem ZHIDKOV
4
5 #include "SketchPlugin_Point.h"
6 #include "SketchPlugin_Sketch.h"
7 #include <ModelAPI_Data.h>
8 #include <GeomDataAPI_Point2D.h>
9
10 using namespace std;
11
12 SketchPlugin_Point::SketchPlugin_Point()
13 {
14 }
15
16 void SketchPlugin_Point::initAttributes()
17 {
18   data()->addAttribute(POINT_ATTR_COORD, GeomDataAPI_Point2D::type());
19 }
20
21 void SketchPlugin_Point::execute() 
22 {
23 }
24
25 const boost::shared_ptr<GeomAPI_Shape>& SketchPlugin_Point::preview()
26 {
27   SketchPlugin_Sketch* aSketch = sketch();
28   // compute a point in 3D view
29   boost::shared_ptr<GeomDataAPI_Point2D> aPoint = 
30     boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(data()->attribute(POINT_ATTR_COORD));
31   boost::shared_ptr<GeomAPI_Pnt> aPoint3D(aSketch->to3D(aPoint->x(), aPoint->y()));
32   // make a visible point
33   //boost::shared_ptr<GeomAPI_Shape> anEdge = GeomAlgoAPI_EdgeBuilder::line(aStart, anEnd);
34   //setPreview(anEdge);
35
36   return getPreview();
37 }