-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathSketcher_SnapCenter.cxx
78 lines (69 loc) · 1.82 KB
/
Sketcher_SnapCenter.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
/**
* \file Sketcher_SnapCenter.cxx
* \brief Implementation file for the class Sketcher_SnapCenter
* \author <a href="mailto:[email protected]?subject=Sketcher_SnapCenter.cxx">Sergei Maslov</a>
*/
#include "Sketcher_SnapCenter.hxx"
IMPLEMENT_STANDARD_RTTIEXT(Sketcher_SnapCenter, Sketcher_Snap)
/**
* \fn Sketcher_SnapCenter()
* \brief Constructs a Sketcher_SnapCenter
*/
Sketcher_SnapCenter::Sketcher_SnapCenter()
{
}
/**
* \fn ~Sketcher_SnapCenter()
* \brief Destructor
*/
Sketcher_SnapCenter::~Sketcher_SnapCenter()
{
}
/**
* \fn SelectEvent()
* \brief find center point of arc, circle
* \return void
*/
void Sketcher_SnapCenter::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: break;
case CircleSketcherObject:
case ArcSketcherObject: curGeom2d_Circle = Handle(Geom2d_Circle)::DownCast(mySObject->GetGeometry());
ProjectOnCurve.Init(curPnt2d,curGeom2d_Circle);
if(countProject())
{
bestPnt2d = curGeom2d_Circle->Location();
curHilightedObj = mySObject->GetAIS_Object();
}
objectPnt2d = curGeom2d_Circle->Location();
if(count())
{
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_SnapCenter::GetSnapType()
{
return SnapCenter;
}