-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathSketcher_SnapTangent.hxx
168 lines (136 loc) · 3.55 KB
/
Sketcher_SnapTangent.hxx
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/**
* \file Sketcher_SnapTangent.hxx
* \brief Header file for the class Sketcher_SnapTangent
* \author <a href="mailto:[email protected]?subject=Sketcher_SnapTangent.hxx">Sergei Maslov</a>
*/
#ifndef Sketcher_SnapTangent_H
#define Sketcher_SnapTangent_H
#include "Sketcher_Snap.hxx"
#include "Geom2d_Edge.hxx"
#include "Geom2d_Arc.hxx"
#include <Geom2d_Line.hxx>
#include <Geom2d_Circle.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom2dAdaptor_Curve.hxx>
#include <GccEnt_Position.hxx>
#include <Geom2dGcc_QualifiedCurve.hxx>
#include <Geom2dGcc_Lin2d2Tan.hxx>
#include <Geom2dGcc_Circ2dTanCen.hxx>
#include <Geom2dAPI_InterCurveCurve.hxx>
#include <gce_MakeDir2d.hxx>
#include <gp_Pnt2d.hxx>
#include <GeomAPI.hxx>
#include <AIS_TangentRelation.hxx>
DEFINE_STANDARD_HANDLE(Sketcher_SnapTangent,Sketcher_Snap)
//snap searching tangent to objects
class Sketcher_SnapTangent : public Sketcher_Snap
{
public:
// Type management
DEFINE_STANDARD_RTTIEXT(Sketcher_SnapTangent, Sketcher_Snap)
/**
* \fn Sketcher_SnapTangent()
* \brief Constructs a Sketcher_SnapTangent
*/
Standard_EXPORT Sketcher_SnapTangent();
/**
* \fn ~Sketcher_SnapTangent()
* \brief Destructor
*/
Standard_EXPORT ~Sketcher_SnapTangent();
/**
* \fn MouseInputEvent(const gp_Pnt2d& thePnt2d)
* \brief input event handler
* \return gp_Pnt2d
* \param thePnt2d const gp_Pnt2d&
*/
Standard_EXPORT gp_Pnt2d MouseInputEvent(const gp_Pnt2d& tempPnt2d);
/**
* \fn EraseSnap()
* \brief cancel event handler
* \return void
*/
Standard_EXPORT void EraseSnap();
/**
* \fn SelectEvent()
* \brief find new point
* \return void
*/
Standard_EXPORT void SelectEvent();
/**
* \fn GetSnapType()
* \brief get Snap type
* \return Sketcher_SnapType
*/
Standard_EXPORT Sketcher_SnapType GetSnapType();
/**
* \fn DrawRelation()
* \brief draw relation
* \return void
*/
Standard_EXPORT void DrawRelation();
/**
* \fn EraseRelation()
* \brief erase relation
* \return void
*/
Standard_EXPORT void EraseRelation();
/**
* \fn setFirstPnt(const gp_Pnt2d& p)
* \brief set point and tangent type for exceptions
* \return void
* \param p const gp_Pnt2d&
* \param ttype TangentType
*/
Standard_EXPORT void setFirstPnt(const gp_Pnt2d& p,TangentType ttype);
private:
// methods
/**
* \fn SelectLine_FirstPntEvent()
* \brief Find nearest point on curve and store it
* \return void
*/
Standard_EXPORT void SelectLine_FirstPntEvent();
/**
* \fn SelectLine_CheckFirstPntEvent()
* \brief check first point of line belonging to circle/arc
* \return void
*/
Standard_EXPORT void SelectLine_CheckFirstPntEvent();
/**
* \fn SelectLine_FixEvent()
* \brief find tangent line at first point
* \return void
*/
Standard_EXPORT void SelectLine_FixEvent();
/**
* \fn SelectLine_SecondPntEvent()
* \brief find tangent line at second point
* \return void
*/
Standard_EXPORT void SelectLine_SecondPntEvent();
/**
* \fn SelectCurveCenterEvent()
* \brief find tangent circle to curve
* \return void
*/
Standard_EXPORT void SelectCurveCenterEvent();
//members
TangentType myTangentType;
Standard_Real radiusDistance;
gp_Pnt2d myFirstPnt2d;
//for tangent line first pnt
Standard_Boolean FixFirstPnt;
Standard_Real minAngle;
Standard_Real curAngle;
gp_Lin2d mylin2d;
gp_Dir2d tempDir2d;
Handle(Geom2d_Arc) curGeom2d_Arc;
Handle(Geom2d_Circle) curGeom2d_Circle;
Handle(Geom2d_Line) tempGeom2d_Line;
Handle(Geom2d_Circle) tempGeom2d_Circle;
Handle(Geom2d_Curve) tempGeom2d_Curve;
Geom2dAPI_InterCurveCurve my2dAPI_InterCurveCurve;
Handle(AIS_TangentRelation) myTanRelation;
};
#endif