-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathSketcher_SnapNearest.cxx
73 lines (63 loc) · 1.6 KB
/
Sketcher_SnapNearest.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
/**
* \file Sketcher_SnapNearest.cxx
* \brief Implementation file for the class Sketcher_SnapNearest
* \author <a href="mailto:[email protected]?subject=Sketcher_SnapNearest.cxx">Sergei Maslov</a>
*/
#include "Sketcher_SnapNearest.hxx"
IMPLEMENT_STANDARD_RTTIEXT(Sketcher_SnapNearest, Sketcher_Snap)
/**
* \fn Sketcher_SnapNearest()
* \brief Constructs a Sketcher_SnapNearest
*/
Sketcher_SnapNearest::Sketcher_SnapNearest()
{
}
/**
* \fn ~Sketcher_SnapNearest()
* \brief Destructor
*/
Sketcher_SnapNearest::~Sketcher_SnapNearest()
{
}
/**
* \fn SelectEvent()
* \brief find nearest point on curve
* \return void
*/
void Sketcher_SnapNearest::SelectEvent()
{
findbestPnt2d = Standard_False;
minDistance = minimumSnapDistance;
for( Standard_Integer i=1; i<=data->Length(); i++)
{
mySObject = Handle(Sketcher_Object)::DownCast(data->Value(i));
myGeometryType = mySObject->GetGeometryType();
switch (myGeometryType)
{
case PointSketcherObject: break;
case LineSketcherObject:
case CircleSketcherObject:
case ArcSketcherObject: curGeom2d_Curve = Handle(Geom2d_Curve)::DownCast(mySObject->GetGeometry());
ProjectOnCurve.Init(curPnt2d,curGeom2d_Curve);
if(countProject())
{
bestPnt2d = objectPnt2d;
curHilightedObj = mySObject->GetAIS_Object();
}
break;
default:break;
}
}
if(minDistance == minimumSnapDistance)
bestPnt2d = curPnt2d;
else findbestPnt2d = Standard_True;
}
/**
* \fn GetSnapType()
* \brief get Snap type
* \return Sketcher_SnapType
*/
Sketcher_SnapType Sketcher_SnapNearest::GetSnapType()
{
return SnapNearest;
}