-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathSketcher_CommandPoint.cxx
99 lines (84 loc) · 2.14 KB
/
Sketcher_CommandPoint.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/**
* \file Sketcher_CommandPoint.cxx
* \brief Implementation file for the class Sketcher_CommandPoint
* \author <a href="mailto:[email protected]?subject=Sketcher_CommandPoint.cxx">Sergei Maslov</a>
*/
#include "Sketcher_CommandPoint.hxx"
IMPLEMENT_STANDARD_RTTIEXT(Sketcher_CommandPoint, Sketcher_Command)
/**
* \fn Sketcher_CommandPoint()
* \brief Constructs a Sketcher_CommandPoint
*/
Sketcher_CommandPoint::Sketcher_CommandPoint()
: Sketcher_Command("Point.")
{
myPointAction = Nothing;
}
/**
* \fn ~Sketcher_CommandPoint()
* \brief destructor
*/
Sketcher_CommandPoint::~Sketcher_CommandPoint()
{
}
/**
* \fn Action()
* \brief turn command to active state
*/
void Sketcher_CommandPoint::Action()
{
myPointAction = Input_Point;
}
/**
* \fn MouseInputEvent(const gp_Pnt2d& thePnt2d )
* \brief input event handler
* \return Standard_Boolean
* \param thePnt2d const gp_Pnt2d&
*/
Standard_Boolean Sketcher_CommandPoint::MouseInputEvent(const gp_Pnt2d& thePnt2d)
{
curPnt2d = myAnalyserSnap->MouseInput(thePnt2d);
switch (myPointAction)
{
case Nothing: break;
case Input_Point:
{
Handle (Geom2d_CartesianPoint) myGeom2d_Point = new Geom2d_CartesianPoint(curPnt2d);
Handle (Geom_CartesianPoint) myGeom_Point = new Geom_CartesianPoint(ElCLib::To3d(curCoordinateSystem.Ax2(),curPnt2d));
Handle(AIS_Point) myAIS_Point = new AIS_Point(myGeom_Point);
myContext->Display(myAIS_Point, true);
AddObject(myGeom2d_Point,myAIS_Point,PointSketcherObject);
}
break;
default:break;
}
return Standard_False;
}
/**
* \fn MouseMoveEvent(const gp_Pnt2d& thePnt2d )
* \brief mouse move handler
* \return void
* \param thePnt2d const gp_Pnt2d&
*/
void Sketcher_CommandPoint::MouseMoveEvent(const gp_Pnt2d& thePnt2d)
{
curPnt2d = myAnalyserSnap->MouseMove(thePnt2d);
}
/**
* \fn CancelEvent()
* \brief cancel event handler, stop entering object
* \return void
*/
void Sketcher_CommandPoint::CancelEvent()
{
myPointAction = Nothing;
}
/**
* \fn GetTypeOfMethod()
* \brief get command Method
* \return Sketcher_ObjectTypeOfMethod
*/
Sketcher_ObjectTypeOfMethod Sketcher_CommandPoint::GetTypeOfMethod()
{
return Point_Method;
}