-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathSketcher_CommandTrim.hxx
266 lines (220 loc) · 6.13 KB
/
Sketcher_CommandTrim.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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
/**
* \file Sketcher_CommandTrim.hxx
* \brief Header file for the class Sketcher_CommandTrim
* \author <a href="mailto:[email protected]?subject=Sketcher_CommandTrim.hxx">Sergei Maslov</a>
*/
#ifndef Sketcher_CommandTrim_H
#define Sketcher_CommandTrim_H
#include "Sketcher_Command.hxx"
#include "Geom2d_Edge.hxx"
#include "Geom2d_Arc.hxx"
#include <gp_Circ2d.hxx>
#include <gp_Circ.hxx>
#include <Geom2d_Line.hxx>
#include <Geom2d_Circle.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom_Circle.hxx>
#include <AIS_Circle.hxx>
#include <Geom2dAPI_ProjectPointOnCurve.hxx>
#include <Geom2dAPI_InterCurveCurve.hxx>
#include <TColStd_SequenceOfReal.hxx>
#include <Geom2dGcc_Circ2d3Tan.hxx>
#define TRIMDISTANCETOCURVE 40
class AIS_Circle;
DEFINE_STANDARD_HANDLE(Sketcher_CommandTrim,Sketcher_Command)
//Command for trim objects
class Sketcher_CommandTrim : public Sketcher_Command
{
public:
// Type management
DEFINE_STANDARD_RTTIEXT(Sketcher_CommandTrim, Sketcher_Command)
enum TrimAction { NothingAction,TrimObject};
enum RedrawState { NothingRedraw,RedrawTrimmedObject,OneObjectRemove,TwoObjectRemove };
/**
* \fn Sketcher_CommandTrim()
* \brief Constructs a Sketcher_CommandTrim
*/
Standard_EXPORT Sketcher_CommandTrim();
/**
* \fn ~Sketcher_CommandTrim()
* \brief destructor
*/
Standard_EXPORT ~Sketcher_CommandTrim();
/**
* \fn Action()
* \brief turn command to active state
*/
Standard_EXPORT void Action();
/**
* \fn MouseInputEvent(const gp_Pnt2d& thePnt2d )
* \brief input event handler
* \return Standard_Boolean
* \param thePnt2d const gp_Pnt2d&
*/
Standard_EXPORT Standard_Boolean MouseInputEvent(const gp_Pnt2d& thePnt2d);
/**
* \fn MouseMoveEvent(const gp_Pnt2d& thePnt2d )
* \brief mouse move handler
* \return void
* \param thePnt2d const gp_Pnt2d&
*/
Standard_EXPORT void MouseMoveEvent(const gp_Pnt2d& thePnt2d);
/**
* \fn CancelEvent()
* \brief cancel event handler, stop entering object
* \return void
*/
Standard_EXPORT void CancelEvent();
/**
* \fn GetTypeOfMethod()
* \brief get command Method
* \return Sketcher_ObjectTypeOfMethod
*/
Standard_EXPORT Sketcher_ObjectTypeOfMethod GetTypeOfMethod();
private:
// methods
/**
* \fn StandardEvent()
* \brief input event and mouse move handler
* \return void
*/
Standard_EXPORT void StandardEvent();
/**
* \fn SelectCurve()
* \brief select nearest curve
* \return void
*/
Standard_EXPORT void SelectNearestCurve();
/**
* \fn FixObjectPoints()
* \brief find intersection points
* \return void
*/
Standard_EXPORT void FixObjectPoints();
/**
* \fn TrimCurve()
* \brief manager of cutting curve
* \return void
*/
Standard_EXPORT void TrimCurve();
/**
* \fn PointProjected(Standard_Integer index )
* \brief find nearest point
* \return Standard_Boolean
* \param index const Standard_Integer
*/
Standard_EXPORT Standard_Boolean PointProjected(Standard_Integer index);
/**
* \fn SetParam()
* \brief compute intersection point parameter
* \return void
*/
Standard_EXPORT void SetParam();
/**
* \fn AddParam()
* \brief add parameter to sequence
* \return void
*/
Standard_EXPORT void AddParam();
/**
* \fn FindSegment()
* \brief determine part of curve, that has been cutting
* \return void
*/
Standard_EXPORT void FindSegment();
/**
* \fn Redraw()
* \brief redraw object, if it's necessary
* \return Standard_Boolean
*/
Standard_EXPORT Standard_Boolean Redraw();
/**
* \fn RedrawOld()
* \brief draw erased object
* \return void
*/
Standard_EXPORT void RedrawOld();
/**
* \fn DelTrimmedObject()
* \brief remove object from list of objects, erase object
* \return void
*/
Standard_EXPORT void DelTrimmedObject();
/**
* \fn EditLine(Standard_Real u1,Standard_Real u2)
* \brief edit line by 2 parameters
* \return void
* \param u1 Standard_Real
* \param u2 Standard_Real
*/
Standard_EXPORT void EditLine(Standard_Real u1,Standard_Real u2);
/**
* \fn AddNewLine(Standard_Real u1,Standard_Real u2)
* \brief Constructs a new line by 2 parameters
* \return void
* \param u1 Standard_Real
* \param u2 Standard_Real
*/
Standard_EXPORT void AddNewLine(Standard_Real u1,Standard_Real u2);
/**
* \fn EditCircle()
* \brief Constructs a arc from circle by 2 parameters
* \return void
*/
Standard_EXPORT void EditCircle();
/**
* \fn EditArc(Standard_Real u1,Standard_Real u2)
* \brief edit arc by 2 parameters
* \return void
* \param u1 Standard_Real
* \param u2 Standard_Real
*/
Standard_EXPORT void EditArc(Standard_Real u1,Standard_Real u2);
/**
* \fn AddNewArc(Standard_Real u1,Standard_Real u2)
* \brief Constructs a new arc by 2 parameters
* \return void
* \param u1 Standard_Real
* \param u2 Standard_Real
*/
Standard_EXPORT void AddNewArc(Standard_Real u1,Standard_Real u2);
//members
TrimAction myTrimAction;
Handle(Sketcher_Object) mySObject;
Sketcher_ObjectGeometryType TypeofObject;
TCollection_ExtendedString TrimName;
Standard_Integer curCurveIndex;
Standard_Integer NearestCurveIndex;
Geom2dAPI_ProjectPointOnCurve myProjectOnCurve;
Geom2dAPI_InterCurveCurve my2dAPI_InterCurveCurve;
Handle(Geom2d_Edge) curGeom2d_Edge;
Handle(Geom2d_Arc) curGeom2d_Arc;
Handle(Geom2d_Circle) curGeom2d_Circle;
Handle(Geom2d_Curve) nearestGeom2d_Curve;
Handle(Geom2d_Line) temp1Geom2d_Line;
Handle(Geom2d_Line) temp2Geom2d_Line;
Standard_Real minDistance;
Standard_Real curDistance;
Standard_Real NearestPntU;
Standard_Real tempU,FirstU,SecondU;
gp_Pnt2d tempPnt2d;
gp_Pnt2d mySecondgp_Pnt2d;
gp_Circ2d nearestgp_Circ2d;
Standard_Boolean isInputMouse;
Standard_Boolean RedrawFlag;
TColStd_SequenceOfReal mySeqOfPntU;
RedrawState myRedrawState;
Handle(AIS_InteractiveObject) curTrimmedObj;
Handle(AIS_InteractiveObject) newTrimmedObj;
Handle(AIS_InteractiveObject) FirstObj;
Handle(AIS_InteractiveObject) SecondObj;
Standard_Real curFirstObjParam_Start;
Standard_Real curFirstObjParam_End;
Standard_Real newFirstObjParam_Start;
Standard_Real newFirstObjParam_End;
Standard_Real curSecondObjParam_Start;
Standard_Real curSecondObjParam_End;
Standard_Real newSecondObjParam_Start;
Standard_Real newSecondObjParam_End;
};
#endif