]> SALOME platform Git repositories - modules/shaper.git/blob - src/SketchPlugin/SketchPlugin_Point.cpp
Salome HOME
fa77d2494eb1366507d2ab213a35342f81da56cb
[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 <GeomAPI_Pnt.h>
9 ////#include <GeomAlgoAPI_EdgeBuilder.h>
10 #include <GeomDataAPI_Point2D.h>
11
12 using namespace std;
13
14 ////// face of the square-face displayed for selection of general plane
15 ////const double PLANE_SIZE = 200;
16
17 SketchPlugin_Point::SketchPlugin_Point()
18 {
19 }
20
21 void SketchPlugin_Point::initAttributes()
22 {
23   data()->addAttribute(POINT_ATTR_COORD, GeomDataAPI_Point2D::type());
24 }
25
26 void SketchPlugin_Point::execute() 
27 {
28 }
29
30 const boost::shared_ptr<GeomAPI_Shape>& SketchPlugin_Point::preview()
31 {
32   SketchPlugin_Sketch* aSketch = sketch();
33   // compute a point in 3D view
34   boost::shared_ptr<GeomDataAPI_Point2D> aPoint = 
35     boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(data()->attribute(POINT_ATTR_COORD));
36   boost::shared_ptr<GeomAPI_Pnt> aPoint3D(aSketch->to3D(aPoint->x(), aPoint->y()));
37   // make a visible point
38   //boost::shared_ptr<GeomAPI_Shape> anEdge = GeomAlgoAPI_EdgeBuilder::line(aStart, anEnd);
39   //setPreview(anEdge);
40
41   return getPreview();
42 }