-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathSketcher_Command.hxx
216 lines (180 loc) · 5.81 KB
/
Sketcher_Command.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
/**
* \file Sketcher_Command.hxx
* \brief Header file for the class Sketcher_Command
* \author <a href="mailto:[email protected]?subject=Sketcher_Command.hxx">Sergei Maslov</a>
*/
#ifndef SKETCHER_COMMAND_H
#define SKETCHER_COMMAND_H
#include <Standard_Macro.hxx>
#include <MMgt_TShared.hxx>
#include <Standard_DefineHandle.hxx>
#include "Sketcher_Object.hxx"
#include "Sketcher_SnapType.hxx"
#include "Sketcher_AnalyserSnap.hxx"
#include <AIS_InteractiveContext.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Ax3.hxx>
#include <Geom_CartesianPoint.hxx>
#include <AIS_Line.hxx>
#include <Prs3d_LineAspect.hxx>
#define SKETCHER_RADIUS 0
class AIS_InteractiveContext;
class gp_Pnt2d;
DEFINE_STANDARD_HANDLE(Sketcher_Command, Standard_Transient)
//base class of commands entering objects
class Sketcher_Command : public Standard_Transient
{
public:
// Type management
DEFINE_STANDARD_RTTIEXT(Sketcher_Command, Standard_Transient)
/**
* \fn Sketcher_Command(const Standard_CString name)
* \brief Constructs a Sketcher_Command
* \param name const Standard_CString
*/
Standard_EXPORT Sketcher_Command(const Standard_CString name);
/**
* \fn ~Sketcher_Command()
* \brief destructor
*/
Standard_EXPORT ~Sketcher_Command();
/**
* \fn SetContext(Handle(AIS_InteractiveContext)& theContext)
* \brief set context
* \return void
* \param theContext Handle(AIS_InteractiveContext)&
*/
Standard_EXPORT void SetContext(Handle(AIS_InteractiveContext)& theContext );
/**
* \fn SetData(Handle(TColStd_HSequenceOfTransient)& thedata)
* \brief set list of objects
* \return void
* \param thedata TColStd_HSequenceOfTransient)&
*/
Standard_EXPORT void SetData (Handle(TColStd_HSequenceOfTransient)& thedata);
/**
* \fn SetAx3(const gp_Ax3& theAx3)
* \brief set coordinate system
* \return void
* \param theAx3 const gp_Ax3&
*/
Standard_EXPORT void SetAx3(const gp_Ax3 & theAx3);
/**
* \fn SetAnalyserSnap(Handle(Sketcher_AnalyserSnap)& theAnalyserSnap)
* \brief set snap manager
* \return void
* \param theAnalyserSnap Handle(Sketcher_AnalyserSnap)&
*/
Standard_EXPORT void SetAnalyserSnap(Handle(Sketcher_AnalyserSnap)& theAnalyserSnap);
/**
* \fn SetColor(const Quantity_NameOfColor theColor)
* \brief set color
* \return void
* \param theColor const Quantity_NameOfColor
*/
Standard_EXPORT void SetColor(const Quantity_NameOfColor theColor);
/**
* \fn SetType(const Sketcher_ObjectType theType)
* \brief set type of object
* \return void
* \param theType const Sketcher_ObjectType
*/
Standard_EXPORT void SetType(const Sketcher_ObjectType theType);
/**
* \fn SetStyle(const Aspect_TypeOfLine theLineStyle)
* \brief set line style
* \return void
* \param theLineStyle const Aspect_TypeOfLine
*/
Standard_EXPORT void SetStyle(const Aspect_TypeOfLine theLineStyle);
/**
* \fn SetWidth(const Standard_Real theWidth)
* \brief set line width
* \return void
* \param theWidth const Standard_Real
*/
Standard_EXPORT void SetWidth(const Standard_Real theWidth);
/**
* \fn AddObject(const Handle(Geom2d_Geometry)& theGeom2d_Geometry,const Handle(AIS_InteractiveObject)& theAIS_InteractiveObject,const Sketcher_ObjectGeometryType theGeometryType)
* \brief add new object to object list
* \return void
* \param theGeom2d_Geometry const Handle(Geom2d_Geometry)&
* \param theAIS_InteractiveObject const Handle(AIS_InteractiveObject)&
* \param theGeometryType const Sketcher_ObjectGeometryType
*/
Standard_EXPORT void AddObject(const Handle(Geom2d_Geometry)& theGeom2d_Geometry,const Handle(AIS_InteractiveObject)& theAIS_InteractiveObject,const Sketcher_ObjectGeometryType theGeometryType);
/**
* \fn Action()
* \brief turn command to active state
*/
Standard_EXPORT virtual void Action() = 0;
/**
* \fn MouseInputEvent(const gp_Pnt2d& thePnt2d )
* \brief input event handler
* \return Standard_Boolean
* \param thePnt2d const gp_Pnt2d&
*/
Standard_EXPORT virtual Standard_Boolean MouseInputEvent(const gp_Pnt2d& thePnt2d) = 0;
/**
* \fn MouseMoveEvent(const gp_Pnt2d& thePnt2d )
* \brief mouse move handler
* \return void
* \param thePnt2d const gp_Pnt2d&
*/
Standard_EXPORT virtual void MouseMoveEvent(const gp_Pnt2d& thePnt2d) = 0;
/**
* \fn CancelEvent()
* \brief cancel event handler, stop entering object
* \return void
*/
Standard_EXPORT virtual void CancelEvent() = 0;
/**
* \fn GetTypeOfMethod()
* \brief get command Method
* \return Sketcher_ObjectTypeOfMethod
*/
Standard_EXPORT virtual Sketcher_ObjectTypeOfMethod GetTypeOfMethod() = 0;
/**
* \fn SetPolylineFirstPnt(const gp_Pnt2d& p1)
* \brief set last entering gp_Pnt2d for polyline
* \return void
* \param p1 const gp_Pnt2d&
*/
Standard_EXPORT virtual void SetPolylineFirstPnt(const gp_Pnt2d& p1);
/**
* \fn GetPolylineFirstPnt(gp_Pnt2d& p1)
* \brief get last entering gp_Pnt2d for polyline
* \return Standard_Boolean
* \param p1 gp_Pnt2d&
*/
Standard_EXPORT virtual Standard_Boolean GetPolylineFirstPnt(gp_Pnt2d& p1);
/**
* \fn SetPolylineMode(Standard_Boolean mode)
* \brief set polyline mode
* \return void
* \param mode Standard_Boolean
*/
Standard_EXPORT virtual void SetPolylineMode(Standard_Boolean mode);
protected:
Handle(AIS_InteractiveContext) myContext;
Handle(TColStd_HSequenceOfTransient) data;
Handle(Sketcher_AnalyserSnap) myAnalyserSnap;
Quantity_NameOfColor myColor;
Sketcher_ObjectType myType;
Aspect_TypeOfLine myStyle;
Standard_Real myWidth;
Handle(Prs3d_Drawer) myDrawer;
Handle(Prs3d_LineAspect) myPrs3dAspect;
Standard_Boolean myPolylineMode;
gp_Pnt2d curPnt2d;
gp_Ax3 curCoordinateSystem;
gp_Pnt2d myFirstgp_Pnt2d;
Handle(Geom_CartesianPoint) myFirstPoint;
Handle(Geom_CartesianPoint) mySecondPoint;
Handle(AIS_Line) myRubberLine;
TCollection_ExtendedString ObjectName;
Standard_Integer ObjectCounter;
bool firstPoint;
};
#endif