├── Geom2d_Arc.cxx
├── Geom2d_Arc.hxx
├── Geom2d_Edge.cxx
├── Geom2d_Edge.hxx
├── LICENSE.LGPL
├── Main.cxx
├── Sketcher.cxx
├── Sketcher.hxx
├── Sketcher_AnalyserSnap.cxx
├── Sketcher_AnalyserSnap.hxx
├── Sketcher_Command.cxx
├── Sketcher_Command.hxx
├── Sketcher_CommandArc3P.cxx
├── Sketcher_CommandArc3P.hxx
├── Sketcher_CommandArcCenter2P.cxx
├── Sketcher_CommandArcCenter2P.hxx
├── Sketcher_CommandBezierCurve.cxx
├── Sketcher_CommandBezierCurve.hxx
├── Sketcher_CommandCircle2PTan.cxx
├── Sketcher_CommandCircle2PTan.hxx
├── Sketcher_CommandCircle3P.cxx
├── Sketcher_CommandCircle3P.hxx
├── Sketcher_CommandCircle3Tan.cxx
├── Sketcher_CommandCircle3Tan.hxx
├── Sketcher_CommandCircleCenterRadius.cxx
├── Sketcher_CommandCircleCenterRadius.hxx
├── Sketcher_CommandCircleP2Tan.cxx
├── Sketcher_CommandCircleP2Tan.hxx
├── Sketcher_CommandLine2P.cxx
├── Sketcher_CommandLine2P.hxx
├── Sketcher_CommandPoint.cxx
├── Sketcher_CommandPoint.hxx
├── Sketcher_CommandTrim.cxx
├── Sketcher_CommandTrim.hxx
├── Sketcher_GUI.cxx
├── Sketcher_GUI.hxx
├── Sketcher_Object.cxx
├── Sketcher_Object.hxx
├── Sketcher_ObjectGeometryType.hxx
├── Sketcher_ObjectType.hxx
├── Sketcher_ObjectTypeOfMethod.hxx
├── Sketcher_Property.cxx
├── Sketcher_Property.hxx
├── Sketcher_PropertyArc.cxx
├── Sketcher_PropertyArc.hxx
├── Sketcher_PropertyCircle.cxx
├── Sketcher_PropertyCircle.hxx
├── Sketcher_PropertyLine.cxx
├── Sketcher_PropertyLine.hxx
├── Sketcher_PropertyPoint.cxx
├── Sketcher_PropertyPoint.hxx
├── Sketcher_QtGUI.cxx
├── Sketcher_QtGUI.hxx
├── Sketcher_Snap.cxx
├── Sketcher_Snap.hxx
├── Sketcher_SnapCenter.cxx
├── Sketcher_SnapCenter.hxx
├── Sketcher_SnapEnd.cxx
├── Sketcher_SnapEnd.hxx
├── Sketcher_SnapIntersection.cxx
├── Sketcher_SnapIntersection.hxx
├── Sketcher_SnapLine.cxx
├── Sketcher_SnapLine.hxx
├── Sketcher_SnapLineParallel.cxx
├── Sketcher_SnapLineParallel.hxx
├── Sketcher_SnapLinePerpendicular.cxx
├── Sketcher_SnapLinePerpendicular.hxx
├── Sketcher_SnapMiddle.cxx
├── Sketcher_SnapMiddle.hxx
├── Sketcher_SnapNearest.cxx
├── Sketcher_SnapNearest.hxx
├── Sketcher_SnapTangent.cxx
├── Sketcher_SnapTangent.hxx
├── Sketcher_SnapType.hxx
├── occQt.cpp
├── occQt.h
├── occQt.ui
├── occSketcher.pro
├── occSketcher.qrc
├── occView.cpp
├── occView.h
└── res
├── SampleImportExport.png
├── cascade.png
├── close.png
├── cursor_rotate.png
├── cursor_zoom.png
├── delete.png
├── document.png
├── erase.PNG
├── grid.PNG
├── help.png
├── icon.qm
├── inputArc.png
├── inputArc3p.PNG
├── inputArcCenter2p.PNG
├── inputBezierCurve.PNG
├── inputBsplineCurve.PNG
├── inputCircle.png
├── inputCircle2.PNG
├── inputCircle2PTan.PNG
├── inputCircle3p.PNG
├── inputCircle3tan.PNG
├── inputCircleP2Tan.png
├── inputLine.png
├── inputPoint.PNG
├── lamp.png
├── new.png
├── plane.PNG
├── property.PNG
├── redraw.png
├── snapanalyser.PNG
├── snapcenter.PNG
├── snapend.PNG
├── snapintersection.PNG
├── snapmiddle.PNG
├── snapnearest.PNG
├── snapnon.PNG
├── snapparallel.PNG
├── snapperpendicular.PNG
├── snaptangent.PNG
├── string.qm
├── tile.png
├── tool_color.png
├── tool_delete.png
├── tool_material.png
├── tool_shading.png
├── tool_transparency.png
├── tool_wireframe.png
├── trimcurve.PNG
├── view_axo.png
├── view_back.png
├── view_bottom.png
├── view_comp_off.png
├── view_comp_on.png
├── view_fitall.png
├── view_fitarea.png
├── view_front.png
├── view_glpan.png
├── view_left.png
├── view_pan.png
├── view_reset.png
├── view_right.png
├── view_rotate.png
├── view_top.png
└── view_zoom.png
/Geom2d_Arc.cxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Geom2d_Arc.cxx
3 | * \brief Implementation file for the class Geom2d_Arc
4 | * \author Sergei Maslov
5 | */
6 | #include "Geom2d_Arc.hxx"
7 |
8 | IMPLEMENT_STANDARD_RTTIEXT(Geom2d_Arc, Geom2d_Circle)
9 |
10 | /**
11 | * \fn Geom2d_Arc(const gp_Circ2d& C)
12 | * \brief Constructs a Geom2d_Arc
13 | * \param C const gp_Circ2d&
14 | */
15 | Geom2d_Arc::Geom2d_Arc(const gp_Circ2d& C)
16 | :Geom2d_Circle(C)
17 | {
18 | myFirstParam = 0.0;
19 | myLastParam = 2*M_PI;
20 | }
21 |
22 | /**
23 | * \fn Geom2d_Arc(const gp_Ax2d& Ax2d,const Standard_Real R)
24 | * \brief Constructs a Geom2d_Arc
25 | * \param Ax2d const gp_Ax2d&
26 | * \param R const Standard_Real
27 | */
28 | Geom2d_Arc::Geom2d_Arc(const gp_Ax2d& Ax2d,const Standard_Real R)
29 | :Geom2d_Circle(Ax2d,R)
30 | {
31 | myFirstParam = 0.0;
32 | myLastParam = 2*M_PI;
33 | }
34 |
35 | /**
36 | * \fn ~Geom2d_Arc()
37 | * \brief destructor
38 | */
39 | Geom2d_Arc::~Geom2d_Arc()
40 | {
41 | }
42 |
43 | /**
44 | * \fn SetParam(const gp_Pnt2d& start,const gp_Pnt2d& mid,const gp_Pnt2d& end)
45 | * \brief set parameters
46 | * \param start const gp_Pnt2d&
47 | * \param mid const gp_Pnt2d&
48 | * \param end const gp_Pnt2d&
49 | */
50 | void Geom2d_Arc::SetParam(const gp_Pnt2d& start,const gp_Pnt2d& mid,const gp_Pnt2d& end)
51 | {
52 | myFirstParam = ElCLib::Parameter(Circ2d(),start);
53 | myLastParam = ElCLib::Parameter(Circ2d(),end);
54 | Standard_Real u = ElCLib::Parameter(Circ2d(),mid);
55 | CheckParam();
56 |
57 | if( (myFirstParam < u) && (u < myLastParam) ||
58 | (myFirstParam < u + 2* M_PI) && (u + 2* M_PI < myLastParam) );
59 | else
60 | {
61 | Standard_Real u;
62 | if(myLastParam > 2*M_PI)
63 | {
64 | myLastParam -= 2*M_PI;
65 | u = myFirstParam;
66 | }
67 | else u = myFirstParam + 2*M_PI;
68 |
69 | myFirstParam = myLastParam;
70 | myLastParam = u;
71 | }
72 | }
73 |
74 | /**
75 | * \fn SetFirstParam(const Standard_Real u1)
76 | * \brief set first parameter
77 | * \return void
78 | * \param u1 const Standard_Real
79 | */
80 | void Geom2d_Arc::SetFirstParam(const Standard_Real u1)
81 | {
82 | myFirstParam = u1;
83 | CheckParam();
84 | }
85 |
86 | /**
87 | * \fn SetFirstParam(const gp_Pnt2d& p1)
88 | * \brief set first parameter
89 | * \return void
90 | * \param p1 const gp_Pnt2d&
91 | */
92 | void Geom2d_Arc::SetFirstParam(const gp_Pnt2d& p1)
93 | {
94 | myFirstParam = ElCLib::Parameter(Circ2d(),p1);
95 | CheckParam();
96 | }
97 |
98 | /**
99 | * \fn SetLastParam(const Standard_Real u2)
100 | * \brief set last parameter
101 | * \return void
102 | * \param u2 const Standard_Real
103 | */
104 | void Geom2d_Arc::SetLastParam(const Standard_Real u2)
105 | {
106 | myLastParam = u2;
107 | CheckParam();
108 | }
109 |
110 | /**
111 | * \fn SetLastParam(const gp_Pnt2d& p2)
112 | * \brief set last parameter
113 | * \return void
114 | * \param p2 const gp_Pnt2d&
115 | */
116 | void Geom2d_Arc::SetLastParam(const gp_Pnt2d& p2)
117 | {
118 | myLastParam = ElCLib::Parameter(Circ2d(),p2);
119 | CheckParam();
120 | }
121 |
122 | /**
123 | * \fn FirstParameter()
124 | * \brief get first parameter
125 | * \return Standard_Real const
126 | */
127 | Standard_Real Geom2d_Arc::FirstParameter() const
128 | {
129 | return myFirstParam;
130 | }
131 |
132 | /**
133 | * \fn LastParameter()
134 | * \brief get last parameter
135 | * \return Standard_Real const
136 | */
137 | Standard_Real Geom2d_Arc::LastParameter() const
138 | {
139 | return myLastParam;
140 | }
141 |
142 | /**
143 | * \fn FirstPnt()
144 | * \brief get first 2d point
145 | * \return gp_Pnt2d const
146 | */
147 | gp_Pnt2d Geom2d_Arc::FirstPnt() const
148 | {
149 | return ElCLib::Value(myFirstParam,Circ2d());
150 | }
151 |
152 | /**
153 | * \fn LastPnt()
154 | * \brief get last 2d point
155 | * \return gp_Pnt2d const
156 | */
157 | gp_Pnt2d Geom2d_Arc::LastPnt() const
158 | {
159 | return ElCLib::Value(myLastParam,Circ2d());
160 | }
161 |
162 | /**
163 | * \fn MiddlePnt()
164 | * \brief get middle 2d point
165 | * \return gp_Pnt2d const
166 | */
167 | gp_Pnt2d Geom2d_Arc::MiddlePnt() const
168 | {
169 | return ElCLib::Value((myLastParam + myFirstParam) / 2, Circ2d());
170 | }
171 |
172 | /**
173 | * \fn CheckParam()
174 | * \brief set correct parameters
175 | * \return void
176 | */
177 | void Geom2d_Arc::CheckParam()
178 | {
179 | while(myFirstParam > 2*M_PI)
180 | myFirstParam-= 2*M_PI;
181 | while(myLastParam > 2*M_PI || (myLastParam - myFirstParam )> 2*M_PI)
182 | myLastParam -= 2*M_PI;
183 |
184 | while(myFirstParam > myLastParam)
185 | myLastParam += 2*M_PI;
186 | }
187 |
188 |
--------------------------------------------------------------------------------
/Geom2d_Arc.hxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Geom2d_Arc.hxx
3 | * \brief Header file for the class Geom2d_Arc
4 | * \author Sergei Maslov
5 | */
6 | #ifndef _Geom2d_Arc_HeaderFile
7 | #define _Geom2d_Arc_HeaderFile
8 |
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 |
16 |
17 | DEFINE_STANDARD_HANDLE(Geom2d_Arc,Geom2d_Circle)
18 |
19 | //Class describing 2d arc geometry
20 | class Geom2d_Arc : public Geom2d_Circle
21 | {
22 |
23 | public:
24 | // Type management
25 | DEFINE_STANDARD_RTTIEXT(Geom2d_Arc, Geom2d_Circle)
26 |
27 | /**
28 | * \fn Geom2d_Arc(const gp_Circ2d& C)
29 | * \brief Constructs a Geom2d_Arc
30 | * \param C const gp_Circ2d&
31 | */
32 | Standard_EXPORT Geom2d_Arc(const gp_Circ2d& C);
33 |
34 | /**
35 | * \fn Geom2d_Arc(const gp_Ax2d& Ax2d,const Standard_Real R)
36 | * \brief Constructs a Geom2d_Arc
37 | * \param Ax2d const gp_Ax2d&
38 | * \param R const Standard_Real
39 | */
40 | Standard_EXPORT Geom2d_Arc(const gp_Ax2d& Ax2d,const Standard_Real R);
41 |
42 | /**
43 | * \fn ~Geom2d_Arc()
44 | * \brief destructor
45 | */
46 | Standard_EXPORT ~Geom2d_Arc();
47 |
48 | /**
49 | * \fn SetParam(const gp_Pnt2d& start,const gp_Pnt2d& mid,const gp_Pnt2d& end)
50 | * \brief set parameters
51 | * \param start const gp_Pnt2d&
52 | * \param mid const gp_Pnt2d&
53 | * \param end const gp_Pnt2d&
54 | */
55 | Standard_EXPORT void SetParam(const gp_Pnt2d& start,const gp_Pnt2d& mid,const gp_Pnt2d& end);
56 |
57 | /**
58 | * \fn SetFirstParam(const Standard_Real u1)
59 | * \brief set first parameter
60 | * \return void
61 | * \param u1 const Standard_Real
62 | */
63 | Standard_EXPORT void SetFirstParam(const Standard_Real u1);
64 |
65 | /**
66 | * \fn SetFirstParam(const gp_Pnt2d& p1)
67 | * \brief set first parameter
68 | * \return void
69 | * \param p1 const gp_Pnt2d&
70 | */
71 | Standard_EXPORT void SetFirstParam(const gp_Pnt2d& p1);
72 |
73 | /**
74 | * \fn SetLastParam(const Standard_Real u2)
75 | * \brief set last parameter
76 | * \return void
77 | * \param u2 const Standard_Real
78 | */
79 | Standard_EXPORT void SetLastParam(const Standard_Real u2);
80 |
81 | /**
82 | * \fn SetLastParam(const gp_Pnt2d& p2)
83 | * \brief set last parameter
84 | * \return void
85 | * \param p2 const gp_Pnt2d&
86 | */
87 | Standard_EXPORT void SetLastParam(const gp_Pnt2d& p2);
88 |
89 | /**
90 | * \fn FirstParameter()
91 | * \brief get first parameter
92 | * \return Standard_Real const
93 | */
94 | Standard_EXPORT Standard_Real FirstParameter() const;
95 |
96 | /**
97 | * \fn LastParameter()
98 | * \brief get last parameter
99 | * \return Standard_Real const
100 | */
101 | Standard_EXPORT Standard_Real LastParameter() const;
102 |
103 | /**
104 | * \fn FirstPnt()
105 | * \brief get first 2d point
106 | * \return gp_Pnt2d const
107 | */
108 | Standard_EXPORT gp_Pnt2d FirstPnt() const;
109 |
110 | /**
111 | * \fn LastPnt()
112 | * \brief get last 2d point
113 | * \return gp_Pnt2d const
114 | */
115 | Standard_EXPORT gp_Pnt2d LastPnt() const;
116 |
117 | /**
118 | * \fn MiddlePnt()
119 | * \brief get middle 2d point
120 | * \return gp_Pnt2d const
121 | */
122 | Standard_EXPORT gp_Pnt2d MiddlePnt() const;
123 |
124 | private:
125 |
126 | //methods
127 |
128 | /**
129 | * \fn CheckParam()
130 | * \brief set correct parameters
131 | * \return void
132 | */
133 | Standard_EXPORT void CheckParam();
134 |
135 | //members
136 |
137 | Standard_Real myFirstParam;
138 | Standard_Real myLastParam;
139 |
140 | };
141 |
142 | #endif
143 |
--------------------------------------------------------------------------------
/Geom2d_Edge.cxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Geom2d_Edge.cxx
3 | * \brief Implementation file for the class Geom2d_Edge
4 | * \author Sergei Maslov
5 | */
6 | #include "Geom2d_Edge.hxx"
7 |
8 | IMPLEMENT_STANDARD_RTTIEXT(Geom2d_Edge, Geom2d_Line)
9 |
10 | /**
11 | * \fn Geom2d_Edge()
12 | * \brief Constructs a Geom2d_Edge
13 | */
14 | Geom2d_Edge::Geom2d_Edge()
15 | :Geom2d_Line (gp::Origin2d(),gp::DX2d())
16 | {
17 | }
18 |
19 | /**
20 | * \fn ~Geom2d_Edge()
21 | * \brief destructor
22 | */
23 | Geom2d_Edge::~Geom2d_Edge()
24 | {
25 | }
26 |
27 | /**
28 | * \fn SetPoints(const gp_Pnt2d& p1,const gp_Pnt2d& p2)
29 | * \brief set edge by 2 points
30 | * \return Standard_Boolean
31 | * \param p1 const gp_Pnt2d&
32 | * \param p2 const gp_Pnt2d&
33 | */
34 | Standard_Boolean Geom2d_Edge::SetPoints(const gp_Pnt2d& p1,const gp_Pnt2d& p2)
35 | {
36 | if (!p1.IsEqual(p2,0))
37 | {
38 | SetDirection(gp_Dir2d(gp_Vec2d(p1,p2)));
39 | SetLocation(p1);
40 |
41 | StartPnt = p1;
42 | EndPnt = p2;
43 |
44 | return Standard_True;
45 | }
46 | else return Standard_False;
47 | }
48 |
49 |
50 | /**
51 | * \fn GetStart_Pnt()
52 | * \brief get start 2d point
53 | * \return gp_Pnt2d const
54 | */
55 | gp_Pnt2d Geom2d_Edge::GetStart_Pnt() const
56 | {
57 | return StartPnt;
58 | }
59 |
60 | /**
61 | * \fn GetEnd_Pnt()
62 | * \brief get end 2d point
63 | * \return gp_Pnt2d const
64 | */
65 | gp_Pnt2d Geom2d_Edge::GetEnd_Pnt() const
66 | {
67 | return EndPnt;
68 | }
69 |
70 | /**
71 | * \fn MiddlePnt()
72 | * \brief get middle 2d point
73 | * \return gp_Pnt2d const
74 | */
75 | gp_Pnt2d Geom2d_Edge::MiddlePnt() const
76 | {
77 | return StartPnt.Scaled(EndPnt,0.5);
78 | }
79 |
80 | /**
81 | * \fn StartParameter()
82 | * \brief get parameter of start 2d point
83 | * \return Standard_Real const
84 | */
85 | Standard_Real Geom2d_Edge::StartParameter() const
86 | {
87 | return ElCLib::Parameter(Lin2d(),StartPnt);
88 | }
89 |
90 | /**
91 | * \fn EndParameter()
92 | * \brief get parameter of end 2d point
93 | * \return Standard_Real const
94 | */
95 | Standard_Real Geom2d_Edge::EndParameter() const
96 | {
97 | return ElCLib::Parameter(Lin2d(),EndPnt);
98 | }
99 |
100 |
--------------------------------------------------------------------------------
/Geom2d_Edge.hxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Geom2d_Edge.hxx
3 | * \brief Header file for the class Geom2d_Edge
4 | * \author Sergei Maslov
5 | */
6 | #ifndef _Geom2d_Edge_HeaderFile
7 | #define _Geom2d_Edge_HeaderFile
8 |
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 |
15 | class gp_Pnt2d2d;
16 |
17 | DEFINE_STANDARD_HANDLE(Geom2d_Edge,Geom2d_Line)
18 |
19 | //Class describing 2d edge geometry
20 | class Geom2d_Edge : public Geom2d_Line
21 | {
22 |
23 | public:
24 | // Type management
25 | DEFINE_STANDARD_RTTIEXT(Geom2d_Edge, Geom2d_Line)
26 |
27 | /**
28 | * \fn Geom2d_Edge()
29 | * \brief Constructs a Geom2d_Edge
30 | */
31 | Standard_EXPORT Geom2d_Edge();
32 |
33 | /**
34 | * \fn ~Geom2d_Edge()
35 | * \brief destructor
36 | */
37 | Standard_EXPORT ~Geom2d_Edge();
38 |
39 | /**
40 | * \fn SetPoints(const gp_Pnt2d& p1,const gp_Pnt2d& p2)
41 | * \brief set edge by 2 points
42 | * \return Standard_Boolean
43 | * \param p1 const gp_Pnt2d&
44 | * \param p2 const gp_Pnt2d&
45 | */
46 | Standard_EXPORT Standard_Boolean SetPoints(const gp_Pnt2d& p1,const gp_Pnt2d& p2);
47 |
48 | /**
49 | * \fn GetStart_Pnt()
50 | * \brief get start 2d point
51 | * \return gp_Pnt2d const
52 | */
53 | Standard_EXPORT gp_Pnt2d GetStart_Pnt() const;
54 |
55 | /**
56 | * \fn GetEnd_Pnt()
57 | * \brief get end 2d point
58 | * \return gp_Pnt2d const
59 | */
60 | Standard_EXPORT gp_Pnt2d GetEnd_Pnt() const;
61 |
62 | /**
63 | * \fn MiddlePnt()
64 | * \brief get middle 2d point
65 | * \return gp_Pnt2d const
66 | */
67 | Standard_EXPORT gp_Pnt2d MiddlePnt() const;
68 |
69 | /**
70 | * \fn StartParameter()
71 | * \brief get parameter of start 2d point
72 | * \return Standard_Real const
73 | */
74 | Standard_EXPORT Standard_Real StartParameter() const;
75 |
76 | /**
77 | * \fn EndParameter()
78 | * \brief get parameter of end 2d point
79 | * \return Standard_Real const
80 | */
81 | Standard_EXPORT Standard_Real EndParameter() const;
82 |
83 | private:
84 |
85 | gp_Pnt2d StartPnt;
86 | gp_Pnt2d EndPnt;
87 |
88 | };
89 |
90 |
91 | #endif
92 |
--------------------------------------------------------------------------------
/Main.cxx:
--------------------------------------------------------------------------------
1 |
2 | #include
3 | #include
4 |
5 | #include "occQt.h"
6 |
7 | int main ( int argc, char* argv[] )
8 | {
9 | QApplication a( argc, argv );
10 |
11 | occQt w;
12 | w.show();
13 |
14 | return a.exec();
15 | }
16 |
--------------------------------------------------------------------------------
/Sketcher_AnalyserSnap.hxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_AnalyserSnap.hxx
3 | * \brief Header file for the class Sketcher_AnalyserSnap
4 | * \author Sergei Maslov
5 | */
6 | #ifndef SKETCHER_ANALYSERSNAP_H
7 | #define SKETCHER_ANALYSERSNAP_H
8 |
9 | #include
10 | #include
11 | #include
12 |
13 | #include "Sketcher_Object.hxx"
14 | #include "Sketcher_Snap.hxx"
15 |
16 | #include "Sketcher_SnapEnd.hxx"
17 | #include "Sketcher_SnapMiddle.hxx"
18 | #include "Sketcher_SnapCenter.hxx"
19 | #include "Sketcher_SnapNearest.hxx"
20 | #include "Sketcher_SnapIntersection.hxx"
21 | #include "Sketcher_SnapLineParallel.hxx"
22 | #include "Sketcher_SnapLinePerpendicular.hxx"
23 | #include "Sketcher_SnapTangent.hxx"
24 |
25 | #include
26 | #include
27 |
28 | #include
29 | #include
30 | #include
31 | #include
32 | #include
33 |
34 |
35 | DEFINE_STANDARD_HANDLE(Sketcher_AnalyserSnap, Standard_Transient)
36 |
37 | //Snap Manager class
38 | class Sketcher_AnalyserSnap : public Standard_Transient
39 | {
40 | public:
41 | // Type management
42 | DEFINE_STANDARD_RTTIEXT(Sketcher_AnalyserSnap, Standard_Transient)
43 |
44 | /**
45 | * \fn Sketcher_AnalyserSnap(Handle(AIS_InteractiveContext)& theContext,Handle(TColStd_HSequenceOfTransient)& thedata,gp_Ax3 &theAx3)
46 | * \brief Constructs a Sketcher_AnalyserSnap
47 | * \param theContext Handle(AIS_InteractiveContext)&
48 | * \param thedata Handle(TColStd_HSequenceOfTransient)&
49 | * \param theAx3 gp_Ax3&
50 | */
51 | Standard_EXPORT Sketcher_AnalyserSnap(Handle(AIS_InteractiveContext)& theContext, Handle(TColStd_HSequenceOfTransient)& thedata,gp_Ax3 & theAx3);
52 |
53 | /**
54 | * \fn ~Sketcher_AnalyserSnap()
55 | * \brief destructor
56 | */
57 | Standard_EXPORT ~Sketcher_AnalyserSnap();
58 |
59 | /**
60 | * \fn SetContext(Handle(AIS_InteractiveContext)& theContext)
61 | * \brief set context
62 | * \return void
63 | * \param theContext Handle(AIS_InteractiveContext)&
64 | */
65 | Standard_EXPORT void SetContext (Handle(AIS_InteractiveContext)& theContext);
66 |
67 | /**
68 | * \fn SetData(Handle(TColStd_HSequenceOfTransient)& thedata)
69 | * \brief set list of objects
70 | * \return void
71 | * \param thedata TColStd_HSequenceOfTransient)&
72 | */
73 | Standard_EXPORT void SetData (Handle(TColStd_HSequenceOfTransient)& thedata);
74 |
75 | /**
76 | * \fn SetAx3(const gp_Ax3& theAx3)
77 | * \brief set coordinate system
78 | * \return void
79 | * \param theAx3 const gp_Ax3&
80 | */
81 | Standard_EXPORT void SetAx3(const gp_Ax3 &theAx3);
82 |
83 | /**
84 | * \fn SetMinDistance(const Standard_Real& aPrecise)
85 | * \brief set precise for snap
86 | * \return void
87 | * \param aPrecise const Standard_Real&
88 | */
89 | Standard_EXPORT void SetMinDistance(const Standard_Real& aPrecise);
90 |
91 | /**
92 | * \fn SetSnapType(Sketcher_SnapType theSnap)
93 | * \brief set current snap type
94 | * \return void
95 | * \param theSnap Sketcher_SnapType
96 | */
97 | Standard_EXPORT void SetSnapType (Sketcher_SnapType theSnap);
98 |
99 | /**
100 | * \fn GetSnapType()
101 | * \brief get current snap type
102 | * \return Sketcher_SnapType
103 | */
104 | Standard_EXPORT Sketcher_SnapType GetSnapType();
105 |
106 | /**
107 | * \fn MouseInput(const gp_Pnt2d& thePnt2d)
108 | * \brief input event handler
109 | * \return gp_Pnt2d
110 | * \param thePnt2d const gp_Pnt2d&
111 | */
112 | Standard_EXPORT gp_Pnt2d MouseInput(const gp_Pnt2d& thePnt2d);
113 |
114 | /**
115 | * \fn MouseMove(const gp_Pnt2d& thePnt2d)
116 | * \brief mouse move handler
117 | * \return gp_Pnt2d
118 | * \param thePnt2d const gp_Pnt2d&
119 | */
120 | Standard_EXPORT gp_Pnt2d MouseMove(const gp_Pnt2d& thePnt2d);
121 |
122 | /**
123 | * \fn Cancel()
124 | * \brief cancel event handler
125 | * \return void
126 | */
127 | Standard_EXPORT void Cancel();
128 |
129 | /**
130 | * \fn MouseInputException(const gp_Pnt2d& p1, const gp_Pnt2d& thePnt2d, TangentType CType, Standard_Boolean TangentOnly)
131 | * \brief input event exception handler
132 | * \return gp_Pnt2d
133 | * \param p1 const gp_Pnt2d&
134 | * \param thePnt2d const gp_Pnt2d&
135 | * \param CType TangentType
136 | * \param TangentOnly Standard_Boolean
137 | */
138 | Standard_EXPORT gp_Pnt2d MouseInputException(const gp_Pnt2d& p1, const gp_Pnt2d& thePnt2d, TangentType CType, Standard_Boolean TangentOnly);
139 |
140 | /**
141 | * \fn MouseMoveException(const gp_Pnt2d& p1, const gp_Pnt2d& thePnt2d, TangentType CType, Standard_Boolean TangentOnly)
142 | * \brief mouse move exception handler
143 | * \return gp_Pnt2d
144 | * \param p1 const gp_Pnt2d&
145 | * \param thePnt2d const gp_Pnt2d&
146 | * \param CType TangentType
147 | * \param TangentOnly Standard_Boolean
148 | */
149 | Standard_EXPORT gp_Pnt2d MouseMoveException(const gp_Pnt2d& p1, const gp_Pnt2d& thePnt2d, TangentType CType, Standard_Boolean TangentOnly);
150 |
151 | private:
152 | //methods
153 |
154 | /**
155 | * \fn SnapAnalyserEvent()
156 | * \brief search best point among all possible snaps
157 | * \return void
158 | */
159 | Standard_EXPORT void SnapAnalyserEvent();
160 |
161 | /**
162 | * \fn AddPoints(const Standard_Real& factor)
163 | * \brief add point to sequence
164 | * \return void
165 | * \param factor const Standard_Real&
166 | */
167 | Standard_EXPORT void AddPoints(const Standard_Real& factor);
168 |
169 | /**
170 | * \fn addSnap(Handle(Sketcher_Snap) theSnap)
171 | * \brief add theSnap to snap list
172 | * \return void
173 | * \param theSnap andle(Sketcher_Snap)
174 | */
175 | Standard_EXPORT void addSnap(Handle(Sketcher_Snap) theSnap);
176 |
177 | /**
178 | * \fn SelectCurSnap()
179 | * \brief get snap from snap list
180 | * \return void
181 | */
182 | Standard_EXPORT void SelectCurSnap ();
183 |
184 | //members
185 | Handle(AIS_InteractiveContext) myContext;
186 | Handle(TColStd_HSequenceOfTransient) data;
187 | Handle(TColStd_HSequenceOfTransient) mySnaps;
188 | Handle(Sketcher_Snap) CurSnap;
189 | Sketcher_SnapType myCurrentSnap;
190 | gp_Ax3 curCoordinateSystem;
191 |
192 | gp_Pnt2d myPnt2d;
193 | gp_Pnt2d storedPnt2d;
194 | TangentType storedTangentType;
195 | Standard_Boolean isTangent;
196 | Standard_Boolean isLine;
197 |
198 | TColgp_SequenceOfPnt2d mySeqOfPnt2d;
199 | TColStd_SequenceOfReal mySeqOfDistance;
200 | TColStd_SequenceOfReal mySeqOfFactor;
201 | TColStd_SequenceOfInteger mySnapType;
202 | Sketcher_SnapType mySnapAnType;
203 | Sketcher_SnapType curSnapAnType;
204 |
205 | Standard_Real minimumSnapDistance;
206 | Standard_Real bestDist;
207 | Standard_Real curDist;
208 | };
209 |
210 | #endif
211 |
--------------------------------------------------------------------------------
/Sketcher_Command.cxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_Command.cxx
3 | * \brief Implementation file for the class Sketcher_Command
4 | * \author Sergei Maslov
5 | */
6 | #include "Sketcher_Command.hxx"
7 |
8 | IMPLEMENT_STANDARD_RTTIEXT(Sketcher_Command, Standard_Transient)
9 |
10 | /**
11 | * \fn Sketcher_Command(const Standard_CString name)
12 | * \brief Constructs a Sketcher_Command
13 | * \param name const Standard_CString
14 | */
15 | Sketcher_Command::Sketcher_Command(const Standard_CString name)
16 | : ObjectName(name),
17 | curCoordinateSystem(gp::XOY())
18 | {
19 | ObjectCounter = 0;
20 | myColor = Quantity_NOC_YELLOW;
21 | myType = MainSketcherType;
22 | myStyle = Aspect_TOL_SOLID;
23 | myWidth = 1.0;
24 | myPrs3dAspect = new Prs3d_LineAspect(myColor,myStyle,myWidth);
25 | myDrawer = new Prs3d_Drawer();
26 |
27 |
28 | myPolylineMode= Standard_False;
29 | curPnt2d = gp::Origin2d();
30 | myFirstgp_Pnt2d = gp::Origin2d();
31 |
32 | myFirstPoint = new Geom_CartesianPoint(gp::Origin());
33 | mySecondPoint = new Geom_CartesianPoint(gp::Origin());
34 | myRubberLine = new AIS_Line(myFirstPoint,mySecondPoint);
35 | myRubberLine->SetColor(Quantity_NOC_LIGHTPINK1);
36 | }
37 |
38 | /**
39 | * \fn ~Sketcher_Command()
40 | * \brief destructor
41 | */
42 |
43 | Sketcher_Command::~Sketcher_Command()
44 | {
45 | }
46 |
47 | /**
48 | * \fn SetContext(Handle(AIS_InteractiveContext)& theContext)
49 | * \brief set context
50 | * \return void
51 | * \param theContext Handle(AIS_InteractiveContext)&
52 | */
53 | void Sketcher_Command::SetContext (Handle(AIS_InteractiveContext)& theContext)
54 | {
55 | myContext = theContext;
56 | }
57 |
58 | /**
59 | * \fn SetData(Handle(TColStd_HSequenceOfTransient)& thedata)
60 | * \brief set list of objects
61 | * \return void
62 | * \param thedata TColStd_HSequenceOfTransient)&
63 | */
64 | void Sketcher_Command::SetData (Handle(TColStd_HSequenceOfTransient)& thedata)
65 | {
66 | data = thedata;
67 | }
68 |
69 | /**
70 | * \fn SetAx3(const gp_Ax3& theAx3)
71 | * \brief set coordinate system
72 | * \return void
73 | * \param theAx3 const gp_Ax3&
74 | */
75 | void Sketcher_Command::SetAx3(const gp_Ax3 &theAx3)
76 | {
77 | curCoordinateSystem = theAx3;
78 | }
79 |
80 | /**
81 | * \fn SetAnalyserSnap(Handle(Sketcher_AnalyserSnap)& theAnalyserSnap)
82 | * \brief set snap manager
83 | * \return void
84 | * \param theAnalyserSnap Handle(Sketcher_AnalyserSnap)&
85 | */
86 | void Sketcher_Command::SetAnalyserSnap(Handle(Sketcher_AnalyserSnap)& theAnalyserSnap)
87 | {
88 | myAnalyserSnap = theAnalyserSnap;
89 | }
90 |
91 | /**
92 | * \fn SetColor(const Quantity_NameOfColor theColor)
93 | * \brief set color
94 | * \return void
95 | * \param theColor const Quantity_NameOfColor
96 | */
97 | void Sketcher_Command::SetColor(const Quantity_NameOfColor theColor)
98 | {
99 | myColor = theColor;
100 | }
101 |
102 | /**
103 | * \fn SetType(const Sketcher_ObjectType theType)
104 | * \brief set type of object
105 | * \return void
106 | * \param theType const Sketcher_ObjectType
107 | */
108 | void Sketcher_Command::SetType(const Sketcher_ObjectType theType)
109 | {
110 | myType = theType;
111 | }
112 |
113 | /**
114 | * \fn SetStyle(const Aspect_TypeOfLine theLineStyle)
115 | * \brief set line style
116 | * \return void
117 | * \param theLineStyle const Aspect_TypeOfLine
118 | */
119 | void Sketcher_Command::SetStyle(const Aspect_TypeOfLine theLineStyle)
120 | {
121 | myStyle = theLineStyle;
122 | }
123 |
124 | /**
125 | * \fn SetWidth(const Standard_Real theWidth)
126 | * \brief set line width
127 | * \return void
128 | * \param theWidth const Standard_Real
129 | */
130 | void Sketcher_Command::SetWidth(const Standard_Real theWidth)
131 | {
132 | myWidth = theWidth;
133 | }
134 |
135 | /**
136 | * \fn AddObject(const Handle(Geom2d_Geometry)& theGeom2d_Geometry,const Handle(AIS_InteractiveObject)& theAIS_InteractiveObject,const Sketcher_ObjectGeometryType theGeometryType)
137 | * \brief add new object to object list
138 | * \return void
139 | * \param theGeom2d_Geometry const Handle(Geom2d_Geometry)&
140 | * \param theAIS_InteractiveObject const Handle(AIS_InteractiveObject)&
141 | * \param theGeometryType const Sketcher_ObjectGeometryType
142 | */
143 | void Sketcher_Command::AddObject(const Handle(Geom2d_Geometry)& theGeom2d_Geometry,
144 | const Handle(AIS_InteractiveObject)& theAIS_InteractiveObject,
145 | const Sketcher_ObjectGeometryType theGeometryType)
146 | {
147 | ObjectCounter++;
148 | TCollection_ExtendedString numString(ObjectCounter);
149 | TCollection_ExtendedString currentName(ObjectName);
150 | currentName += numString;
151 |
152 | if(GetTypeOfMethod() == Point_Method)
153 | theAIS_InteractiveObject->SetColor(myColor);
154 | else
155 | {
156 | myPrs3dAspect->SetColor(myColor);
157 | myPrs3dAspect->SetTypeOfLine(myStyle);
158 | myPrs3dAspect->SetWidth(myWidth);
159 |
160 | myDrawer->SetLineAspect(myPrs3dAspect);
161 | theAIS_InteractiveObject->SetAttributes(myDrawer);
162 | }
163 |
164 | Handle(Sketcher_Object) so = new Sketcher_Object(theGeom2d_Geometry,theAIS_InteractiveObject,currentName,theGeometryType,GetTypeOfMethod());
165 | so->SetColor(myColor);
166 | so->SetType(myType);
167 | so->SetStyle(myStyle);
168 | so->SetWidth(myWidth);
169 | data->Append(so);
170 | }
171 |
172 |
173 | /**
174 | * \fn SetPolylineFirstPnt(const gp_Pnt2d& p1)
175 | * \brief set last entering gp_Pnt2d for polyline
176 | * \return void
177 | * \param p1 const gp_Pnt2d&
178 | */
179 | void Sketcher_Command::SetPolylineFirstPnt(const gp_Pnt2d& p1)
180 | {
181 | }
182 |
183 | /**
184 | * \fn GetPolylineFirstPnt(gp_Pnt2d& p1)
185 | * \brief get last entering gp_Pnt2d for polyline
186 | * \return Standard_Boolean
187 | * \param p1 gp_Pnt2d&
188 | */
189 | Standard_Boolean Sketcher_Command::GetPolylineFirstPnt(gp_Pnt2d& p1)
190 | {
191 | return Standard_False;
192 | }
193 |
194 | /**
195 | * \fn SetPolylineMode(Standard_Boolean mode)
196 | * \brief set polyline mode
197 | * \return void
198 | * \param mode Standard_Boolean
199 | */
200 | void Sketcher_Command::SetPolylineMode (Standard_Boolean mode)
201 | {
202 | }
203 |
204 |
205 |
--------------------------------------------------------------------------------
/Sketcher_Command.hxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_Command.hxx
3 | * \brief Header file for the class Sketcher_Command
4 | * \author Sergei Maslov
5 | */
6 | #ifndef SKETCHER_COMMAND_H
7 | #define SKETCHER_COMMAND_H
8 |
9 | #include
10 | #include
11 | #include
12 |
13 | #include "Sketcher_Object.hxx"
14 | #include "Sketcher_SnapType.hxx"
15 | #include "Sketcher_AnalyserSnap.hxx"
16 |
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 |
24 | #include
25 |
26 | #define SKETCHER_RADIUS 0
27 |
28 |
29 | class AIS_InteractiveContext;
30 | class gp_Pnt2d;
31 |
32 | DEFINE_STANDARD_HANDLE(Sketcher_Command, Standard_Transient)
33 |
34 | //base class of commands entering objects
35 | class Sketcher_Command : public Standard_Transient
36 | {
37 | public:
38 | // Type management
39 | DEFINE_STANDARD_RTTIEXT(Sketcher_Command, Standard_Transient)
40 |
41 | /**
42 | * \fn Sketcher_Command(const Standard_CString name)
43 | * \brief Constructs a Sketcher_Command
44 | * \param name const Standard_CString
45 | */
46 | Standard_EXPORT Sketcher_Command(const Standard_CString name);
47 |
48 | /**
49 | * \fn ~Sketcher_Command()
50 | * \brief destructor
51 | */
52 | Standard_EXPORT ~Sketcher_Command();
53 |
54 | /**
55 | * \fn SetContext(Handle(AIS_InteractiveContext)& theContext)
56 | * \brief set context
57 | * \return void
58 | * \param theContext Handle(AIS_InteractiveContext)&
59 | */
60 | Standard_EXPORT void SetContext(Handle(AIS_InteractiveContext)& theContext );
61 |
62 | /**
63 | * \fn SetData(Handle(TColStd_HSequenceOfTransient)& thedata)
64 | * \brief set list of objects
65 | * \return void
66 | * \param thedata TColStd_HSequenceOfTransient)&
67 | */
68 | Standard_EXPORT void SetData (Handle(TColStd_HSequenceOfTransient)& thedata);
69 |
70 | /**
71 | * \fn SetAx3(const gp_Ax3& theAx3)
72 | * \brief set coordinate system
73 | * \return void
74 | * \param theAx3 const gp_Ax3&
75 | */
76 | Standard_EXPORT void SetAx3(const gp_Ax3 & theAx3);
77 |
78 | /**
79 | * \fn SetAnalyserSnap(Handle(Sketcher_AnalyserSnap)& theAnalyserSnap)
80 | * \brief set snap manager
81 | * \return void
82 | * \param theAnalyserSnap Handle(Sketcher_AnalyserSnap)&
83 | */
84 | Standard_EXPORT void SetAnalyserSnap(Handle(Sketcher_AnalyserSnap)& theAnalyserSnap);
85 |
86 | /**
87 | * \fn SetColor(const Quantity_NameOfColor theColor)
88 | * \brief set color
89 | * \return void
90 | * \param theColor const Quantity_NameOfColor
91 | */
92 | Standard_EXPORT void SetColor(const Quantity_NameOfColor theColor);
93 |
94 | /**
95 | * \fn SetType(const Sketcher_ObjectType theType)
96 | * \brief set type of object
97 | * \return void
98 | * \param theType const Sketcher_ObjectType
99 | */
100 | Standard_EXPORT void SetType(const Sketcher_ObjectType theType);
101 |
102 | /**
103 | * \fn SetStyle(const Aspect_TypeOfLine theLineStyle)
104 | * \brief set line style
105 | * \return void
106 | * \param theLineStyle const Aspect_TypeOfLine
107 | */
108 | Standard_EXPORT void SetStyle(const Aspect_TypeOfLine theLineStyle);
109 |
110 | /**
111 | * \fn SetWidth(const Standard_Real theWidth)
112 | * \brief set line width
113 | * \return void
114 | * \param theWidth const Standard_Real
115 | */
116 | Standard_EXPORT void SetWidth(const Standard_Real theWidth);
117 |
118 | /**
119 | * \fn AddObject(const Handle(Geom2d_Geometry)& theGeom2d_Geometry,const Handle(AIS_InteractiveObject)& theAIS_InteractiveObject,const Sketcher_ObjectGeometryType theGeometryType)
120 | * \brief add new object to object list
121 | * \return void
122 | * \param theGeom2d_Geometry const Handle(Geom2d_Geometry)&
123 | * \param theAIS_InteractiveObject const Handle(AIS_InteractiveObject)&
124 | * \param theGeometryType const Sketcher_ObjectGeometryType
125 | */
126 | Standard_EXPORT void AddObject(const Handle(Geom2d_Geometry)& theGeom2d_Geometry,const Handle(AIS_InteractiveObject)& theAIS_InteractiveObject,const Sketcher_ObjectGeometryType theGeometryType);
127 |
128 | /**
129 | * \fn Action()
130 | * \brief turn command to active state
131 | */
132 | Standard_EXPORT virtual void Action() = 0;
133 |
134 | /**
135 | * \fn MouseInputEvent(const gp_Pnt2d& thePnt2d )
136 | * \brief input event handler
137 | * \return Standard_Boolean
138 | * \param thePnt2d const gp_Pnt2d&
139 | */
140 | Standard_EXPORT virtual Standard_Boolean MouseInputEvent(const gp_Pnt2d& thePnt2d) = 0;
141 |
142 | /**
143 | * \fn MouseMoveEvent(const gp_Pnt2d& thePnt2d )
144 | * \brief mouse move handler
145 | * \return void
146 | * \param thePnt2d const gp_Pnt2d&
147 | */
148 | Standard_EXPORT virtual void MouseMoveEvent(const gp_Pnt2d& thePnt2d) = 0;
149 |
150 | /**
151 | * \fn CancelEvent()
152 | * \brief cancel event handler, stop entering object
153 | * \return void
154 | */
155 | Standard_EXPORT virtual void CancelEvent() = 0;
156 |
157 | /**
158 | * \fn GetTypeOfMethod()
159 | * \brief get command Method
160 | * \return Sketcher_ObjectTypeOfMethod
161 | */
162 | Standard_EXPORT virtual Sketcher_ObjectTypeOfMethod GetTypeOfMethod() = 0;
163 |
164 | /**
165 | * \fn SetPolylineFirstPnt(const gp_Pnt2d& p1)
166 | * \brief set last entering gp_Pnt2d for polyline
167 | * \return void
168 | * \param p1 const gp_Pnt2d&
169 | */
170 | Standard_EXPORT virtual void SetPolylineFirstPnt(const gp_Pnt2d& p1);
171 |
172 | /**
173 | * \fn GetPolylineFirstPnt(gp_Pnt2d& p1)
174 | * \brief get last entering gp_Pnt2d for polyline
175 | * \return Standard_Boolean
176 | * \param p1 gp_Pnt2d&
177 | */
178 | Standard_EXPORT virtual Standard_Boolean GetPolylineFirstPnt(gp_Pnt2d& p1);
179 |
180 | /**
181 | * \fn SetPolylineMode(Standard_Boolean mode)
182 | * \brief set polyline mode
183 | * \return void
184 | * \param mode Standard_Boolean
185 | */
186 | Standard_EXPORT virtual void SetPolylineMode(Standard_Boolean mode);
187 |
188 |
189 | protected:
190 |
191 | Handle(AIS_InteractiveContext) myContext;
192 | Handle(TColStd_HSequenceOfTransient) data;
193 | Handle(Sketcher_AnalyserSnap) myAnalyserSnap;
194 |
195 | Quantity_NameOfColor myColor;
196 | Sketcher_ObjectType myType;
197 | Aspect_TypeOfLine myStyle;
198 | Standard_Real myWidth;
199 | Handle(Prs3d_Drawer) myDrawer;
200 | Handle(Prs3d_LineAspect) myPrs3dAspect;
201 |
202 | Standard_Boolean myPolylineMode;
203 |
204 | gp_Pnt2d curPnt2d;
205 | gp_Ax3 curCoordinateSystem;
206 | gp_Pnt2d myFirstgp_Pnt2d;
207 | Handle(Geom_CartesianPoint) myFirstPoint;
208 | Handle(Geom_CartesianPoint) mySecondPoint;
209 | Handle(AIS_Line) myRubberLine;
210 | TCollection_ExtendedString ObjectName;
211 | Standard_Integer ObjectCounter;
212 | bool firstPoint;
213 |
214 | };
215 |
216 | #endif
217 |
--------------------------------------------------------------------------------
/Sketcher_CommandArc3P.hxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_CommandArc3P.hxx
3 | * \brief Header file for the class Sketcher_CommandArc3P
4 | * \author Sergei Maslov
5 | */
6 | #ifndef Sketcher_CommandARC3P_H
7 | #define Sketcher_CommandARC3P_H
8 |
9 | #include "Sketcher_Command.hxx"
10 | #include "Geom2d_Arc.hxx"
11 |
12 | #include
13 | #include
14 | #include
15 | #include
16 | #include
17 |
18 | #include
19 | #include
20 | #include
21 | #include
22 |
23 | class Geom_Circle;
24 | class AIS_Line;
25 | class AIS_Circle;
26 |
27 | DEFINE_STANDARD_HANDLE(Sketcher_CommandArc3P,Sketcher_Command)
28 |
29 | //Command entering Arc by 3 points
30 | class Sketcher_CommandArc3P : public Sketcher_Command
31 | {
32 | public:
33 | // Type management
34 | DEFINE_STANDARD_RTTIEXT(Sketcher_CommandArc3P, Sketcher_Command)
35 |
36 | enum Arc3PAction { Nothing,Input_1ArcPoint,Input_2ArcPoint,Input_3ArcPoint,Input_PolylineArc};
37 |
38 | /**
39 | * \fn Sketcher_CommandArc3P()
40 | * \brief Constructs a Sketcher_CommandArc3P
41 | */
42 | Standard_EXPORT Sketcher_CommandArc3P();
43 |
44 | /**
45 | * \fn ~Sketcher_CommandArc3P()
46 | * \brief destructor
47 | */
48 | Standard_EXPORT ~Sketcher_CommandArc3P();
49 |
50 | /**
51 | * \fn Action()
52 | * \brief turn command to active state
53 | */
54 | Standard_EXPORT void Action();
55 |
56 | /**
57 | * \fn MouseInputEvent(const gp_Pnt2d& thePnt2d )
58 | * \brief input event handler
59 | * \return Standard_Boolean
60 | * \param thePnt2d const gp_Pnt2d&
61 | */
62 | Standard_EXPORT Standard_Boolean MouseInputEvent(const gp_Pnt2d& thePnt2d);
63 |
64 | /**
65 | * \fn MouseMoveEvent(const gp_Pnt2d& thePnt2d )
66 | * \brief mouse move handler
67 | * \return void
68 | * \param thePnt2d const gp_Pnt2d&
69 | */
70 | Standard_EXPORT void MouseMoveEvent(const gp_Pnt2d& thePnt2d);
71 |
72 | /**
73 | * \fn CancelEvent()
74 | * \brief cancel event handler, stop entering object
75 | * \return void
76 | */
77 | Standard_EXPORT void CancelEvent();
78 |
79 | /**
80 | * \fn GetTypeOfMethod()
81 | * \brief get command Method
82 | * \return Sketcher_ObjectTypeOfMethod
83 | */
84 | Standard_EXPORT Sketcher_ObjectTypeOfMethod GetTypeOfMethod();
85 |
86 | /**
87 | * \fn SetPolylineFirstPnt(const gp_Pnt2d& p1)
88 | * \brief set last entering gp_Pnt2d for polyline
89 | * \return void
90 | * \param p1 const gp_Pnt2d&
91 | */
92 | Standard_EXPORT virtual void SetPolylineFirstPnt(const gp_Pnt2d& p1);
93 |
94 | /**
95 | * \fn GetPolylineFirstPnt(gp_Pnt2d& p1)
96 | * \brief get last entering gp_Pnt2d for polyline
97 | * \return Standard_Boolean
98 | * \param p1 gp_Pnt2d&
99 | */
100 | Standard_EXPORT virtual Standard_Boolean GetPolylineFirstPnt(gp_Pnt2d& p1);
101 |
102 | /**
103 | * \fn SetPolylineMode(Standard_Boolean mode)
104 | * \brief set polyline mode
105 | * \return void
106 | * \param mode Standard_Boolean
107 | */
108 | Standard_EXPORT void SetPolylineMode(Standard_Boolean mode);
109 |
110 | private:
111 | //methods
112 | /**
113 | * \fn findlastSObject()
114 | * \brief find last object at list of objects
115 | * \return void
116 | */
117 | Standard_EXPORT void findlastSObject();
118 |
119 | /**
120 | * \fn setTempLine()
121 | * \brief set default horisontal line
122 | * \return void
123 | */
124 | Standard_EXPORT void setTempLine();
125 |
126 | //members
127 | Arc3PAction myArc3PAction;
128 |
129 | Handle(Geom_Circle) tempGeom_Circle;
130 | Handle(AIS_Circle) myRubberCircle;
131 |
132 | gp_Pnt2d mySecondgp_Pnt2d;
133 | gp_Circ tempCirc;
134 | gp_Pnt third_Pnt;
135 |
136 | Geom2dAdaptor_Curve temp2dAdaptor_Curve;
137 | gp_Circ2d temp2d_Circ;
138 | Handle(Geom2d_Circle) tempGeom2d_Circle;
139 |
140 | gp_Pnt2d midpoint2d,tempu1_pnt2d,tempu2_pnt2d;
141 | Standard_Real u1,u2,temp_u1, temp_u2;
142 | Standard_Real dist1, dist2;
143 |
144 | Handle(Geom2d_Line) tempGeom2d_Line;
145 | Handle(Geom2d_CartesianPoint) FirstGeom2d_Point;
146 | Handle(Geom2d_CartesianPoint) TempGeom2d_Point;
147 |
148 | };
149 |
150 | #endif
--------------------------------------------------------------------------------
/Sketcher_CommandArcCenter2P.hxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_CommandArcCenter2P.hxx
3 | * \brief Header file for the class Sketcher_CommandArcCenter2P
4 | * \author Sergei Maslov
5 | */
6 | #ifndef Sketcher_CommandArcCenter2P_H
7 | #define Sketcher_CommandArcCenter2P_H
8 |
9 | #include "Sketcher_Command.hxx"
10 | #include "Geom2d_Arc.hxx"
11 |
12 | #include
13 | #include
14 | #include
15 | #include
16 | #include
17 | #include
18 |
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 |
26 | class Geom_Circle;
27 | class AIS_Line;
28 | class AIS_Circle;
29 |
30 | DEFINE_STANDARD_HANDLE(Sketcher_CommandArcCenter2P,Sketcher_Command)
31 |
32 | //Command entering Arc by center & 2 points
33 | class Sketcher_CommandArcCenter2P : public Sketcher_Command
34 | {
35 | public:
36 | // Type management
37 | DEFINE_STANDARD_RTTIEXT(Sketcher_CommandArcCenter2P, Sketcher_Command)
38 |
39 | enum ArcCenter2PAction { Nothing,Input_CenterArc,Input_1ArcPoint,Input_MidPoint,Input_2ArcPoint};
40 |
41 | /**
42 | * \fn Sketcher_CommandArcCenter2P()
43 | * \brief Constructs a Sketcher_CommandArcCenter2P
44 | */
45 | Standard_EXPORT Sketcher_CommandArcCenter2P();
46 |
47 | /**
48 | * \fn ~Sketcher_CommandArcCenter2P()
49 | * \brief destructor
50 | */
51 | Standard_EXPORT ~Sketcher_CommandArcCenter2P();
52 |
53 | /**
54 | * \fn Action()
55 | * \brief turn command to active state
56 | */
57 | Standard_EXPORT void Action();
58 |
59 | /**
60 | * \fn MouseInputEvent(const gp_Pnt2d& thePnt2d )
61 | * \brief input event handler
62 | * \return Standard_Boolean
63 | * \param thePnt2d const gp_Pnt2d&
64 | */
65 | Standard_EXPORT Standard_Boolean MouseInputEvent(const gp_Pnt2d& thePnt2d);
66 |
67 | /**
68 | * \fn MouseMoveEvent(const gp_Pnt2d& thePnt2d )
69 | * \brief mouse move handler
70 | * \return void
71 | * \param thePnt2d const gp_Pnt2d&
72 | */
73 | Standard_EXPORT void MouseMoveEvent(const gp_Pnt2d& thePnt2d);
74 |
75 | /**
76 | * \fn CancelEvent()
77 | * \brief cancel event handler, stop entering object
78 | * \return void
79 | */
80 | Standard_EXPORT void CancelEvent();
81 |
82 | /**
83 | * \fn GetTypeOfMethod()
84 | * \brief get command Method
85 | * \return Sketcher_ObjectTypeOfMethod
86 | */
87 | Standard_EXPORT Sketcher_ObjectTypeOfMethod GetTypeOfMethod();
88 |
89 | private:
90 |
91 | //methods
92 |
93 | /**
94 | * \fn ProjectOnCircle()
95 | * \brief project point on circle
96 | * \return Standard_Boolean
97 | */
98 | Standard_EXPORT Standard_Boolean ProjectOnCircle(const gp_Pnt2d& thePnt2d);
99 |
100 | //members
101 |
102 | ArcCenter2PAction myArcCenter2PAction;
103 |
104 | Handle(AIS_Point) myRubberCenterPoint;
105 | gp_Pnt2d mySecondgp_Pnt2d;
106 | gp_Pnt2d myMidgp_Pnt2d;
107 | Handle(Geom2d_Circle) tempGeom2d_Circle;
108 |
109 | gp_Pnt third_Pnt;
110 | Handle(Geom_Circle) tempGeom_Circle;
111 | Handle(AIS_Circle) myRubberCircle;
112 | Standard_Real radius;
113 |
114 | Geom2dAPI_ProjectPointOnCurve ProjectOnCurve;
115 |
116 |
117 | };
118 |
119 | #endif
--------------------------------------------------------------------------------
/Sketcher_CommandBezierCurve.hxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_CommandBezierCurve.hxx
3 | * \brief Header file for the class Sketcher_CommandBezierCurve
4 | * \author Sergei Maslov
5 | */
6 | #ifndef Sketcher_CommandBezierCurve_H
7 | #define Sketcher_CommandBezierCurve_H
8 |
9 | #include "Sketcher_Command.hxx"
10 |
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include
16 | #include
17 | #include
18 | #define MAXIMUMPOLES 16
19 |
20 | class AIS_Line;
21 |
22 | DEFINE_STANDARD_HANDLE(Sketcher_CommandBezierCurve,Sketcher_Command)
23 |
24 | //Command Managerial entering BezierCurve by points
25 | class Sketcher_CommandBezierCurve : public Sketcher_Command
26 | {
27 | public:
28 | // Type management
29 | DEFINE_STANDARD_RTTIEXT(Sketcher_CommandBezierCurve, Sketcher_Command)
30 |
31 | enum BezierCurveAction { Nothing,Input_1Point,Input_2Point,Input_OtherPoints };
32 |
33 |
34 | /**
35 | * \fn Sketcher_CommandBezierCurve()
36 | * \brief Constructs a Sketcher_CommandBezierCurve
37 | */
38 | Standard_EXPORT Sketcher_CommandBezierCurve();
39 |
40 | /**
41 | * \fn ~Sketcher_CommandBezierCurve()
42 | * \brief destructor
43 | */
44 | Standard_EXPORT ~Sketcher_CommandBezierCurve();
45 |
46 | /**
47 | * \fn Action()
48 | * \brief turn command to active state
49 | */
50 | Standard_EXPORT void Action();
51 |
52 | /**
53 | * \fn MouseInputEvent(const gp_Pnt2d& thePnt2d )
54 | * \brief input event handler
55 | * \return Standard_Boolean
56 | * \param thePnt2d const gp_Pnt2d&
57 | */
58 | Standard_EXPORT Standard_Boolean MouseInputEvent(const gp_Pnt2d& thePnt2d);
59 |
60 | /**
61 | * \fn MouseMoveEvent(const gp_Pnt2d& thePnt2d )
62 | * \brief mouse move handler
63 | * \return void
64 | * \param thePnt2d const gp_Pnt2d&
65 | */
66 | Standard_EXPORT void MouseMoveEvent(const gp_Pnt2d& thePnt2d);
67 |
68 | /**
69 | * \fn CancelEvent()
70 | * \brief cancel event handler, stop entering object
71 | * \return void
72 | */
73 | Standard_EXPORT void CancelEvent();
74 |
75 | /**
76 | * \fn GetTypeOfMethod()
77 | * \brief get command Method
78 | * \return Sketcher_ObjectTypeOfMethod
79 | */
80 | Standard_EXPORT Sketcher_ObjectTypeOfMethod GetTypeOfMethod();
81 |
82 | private:
83 |
84 | //methods
85 |
86 | /**
87 | * \fn closeBezierCurve()
88 | * \brief display Bezier Curve, add to list of objects
89 | * \return void
90 | */
91 | Standard_EXPORT void closeBezierCurve();
92 |
93 | /**
94 | * \fn storePoles()
95 | * \brief display Pole point, add to list of objects
96 | * \return void
97 | */
98 | Standard_EXPORT void storePoles();
99 |
100 | //members
101 |
102 | BezierCurveAction myBezierCurveAction;
103 | Handle(Geom2d_BezierCurve) myGeom2d_BezierCurve;
104 | Handle(Geom_BezierCurve) myGeom_BezierCurve;
105 |
106 | TopoDS_Edge curEdge;
107 | Handle(AIS_Shape) myRubberAIS_Shape;
108 | gp_Pnt2d tempPnt2d;
109 | gp_Pnt myFirstgp_Pnt;
110 | gp_Pnt tempPnt;
111 |
112 | Standard_Integer IndexCounter;
113 | };
114 |
115 | #endif
--------------------------------------------------------------------------------
/Sketcher_CommandCircle2PTan.hxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_CommandCircle2PTan.hxx
3 | * \brief Header file for the class Sketcher_CommandCircle2PTan
4 | * \author Sergei Maslov
5 | */
6 | #ifndef Sketcher_CommandCircle2PTan_H
7 | #define Sketcher_CommandCircle2PTan_H
8 |
9 | #include "Sketcher_Command.hxx"
10 | #include "Geom2d_Edge.hxx"
11 | #include "Geom2d_Arc.hxx"
12 |
13 | #include
14 | #include
15 | #include
16 | #include
17 | #include
18 | #include
19 | #include
20 |
21 | #include
22 | #include
23 | #include
24 |
25 | #define MINIMUMDISTANCETOCURVE 100
26 |
27 | class AIS_Circle;
28 |
29 | DEFINE_STANDARD_HANDLE(Sketcher_CommandCircle2PTan,Sketcher_Command)
30 |
31 | //Command entering Circle by 2 Point & 1 tangential to curve
32 | class Sketcher_CommandCircle2PTan : public Sketcher_Command
33 | {
34 | public:
35 | // Type management
36 | DEFINE_STANDARD_RTTIEXT(Sketcher_CommandCircle2PTan, Sketcher_Command)
37 |
38 | enum Circle2PTanAction { Nothing,Input_1CirclePoint,Input_2CirclePoint,Input_3CircleTan };
39 |
40 | /**
41 | * \fn Sketcher_CommandCircle2PTan()
42 | * \brief Constructs a Sketcher_CommandCircle2PTan
43 | */
44 | Standard_EXPORT Sketcher_CommandCircle2PTan();
45 |
46 | /**
47 | * \fn ~Sketcher_CommandCircle2PTan()
48 | * \brief destructor
49 | */
50 | Standard_EXPORT ~Sketcher_CommandCircle2PTan();
51 |
52 | /**
53 | * \fn Action()
54 | * \brief turn command to active state
55 | */
56 | Standard_EXPORT void Action();
57 |
58 | /**
59 | * \fn MouseInputEvent(const gp_Pnt2d& thePnt2d )
60 | * \brief input event handler
61 | * \return Standard_Boolean
62 | * \param thePnt2d const gp_Pnt2d&
63 | */
64 | Standard_EXPORT Standard_Boolean MouseInputEvent(const gp_Pnt2d& thePnt2d);
65 |
66 | /**
67 | * \fn MouseMoveEvent(const gp_Pnt2d& thePnt2d )
68 | * \brief mouse move handler
69 | * \return void
70 | * \param thePnt2d const gp_Pnt2d&
71 | */
72 | Standard_EXPORT void MouseMoveEvent(const gp_Pnt2d& thePnt2d);
73 |
74 | /**
75 | * \fn CancelEvent()
76 | * \brief cancel event handler, stop entering object
77 | * \return void
78 | */
79 | Standard_EXPORT void CancelEvent();
80 |
81 | /**
82 | * \fn GetTypeOfMethod()
83 | * \brief get command Method
84 | * \return Sketcher_ObjectTypeOfMethod
85 | */
86 | Standard_EXPORT Sketcher_ObjectTypeOfMethod GetTypeOfMethod();
87 |
88 | private:
89 |
90 | //methods
91 |
92 | /**
93 | * \fn SelectCurve()
94 | * \brief selecy nearest curve
95 | * \return void
96 | */
97 | Standard_EXPORT void SelectCurve();
98 |
99 | /**
100 | * \fn SumDistanceToCircle()
101 | * \brief select circle orientation
102 | * \return Standard_Boolean
103 | */
104 | Standard_EXPORT Standard_Boolean SumDistanceToCircle();
105 |
106 | //members
107 |
108 | Circle2PTanAction myCircle2PTanAction;
109 | Handle(Sketcher_Object) mySObject;
110 |
111 | Standard_Real minDistance;
112 | Standard_Real curDistance;
113 | Standard_Real u_temp;
114 |
115 | gp_Pnt2d tempPnt2d;
116 | Handle(Geom2d_CartesianPoint) First2dPoint;
117 | Handle(Geom2d_CartesianPoint) Second2dPoint;
118 |
119 |
120 | gp_Circ2d temp_Circ2d;
121 | gp_Circ best_Circ;
122 |
123 | Handle(AIS_Circle) myRubberCircle;
124 |
125 | Handle(Geom2d_Line) tempGeom2d_Line;
126 | Handle(Geom2d_Circle) tempGeom2d_Circle;
127 | Handle(Geom2d_Curve) tempGeom2d_Curve;
128 |
129 | Handle(Geom_Circle) tempGeom_Circle;
130 |
131 | Geom2dAPI_ProjectPointOnCurve myProjectOnCurve;
132 |
133 | };
134 |
135 | #endif
--------------------------------------------------------------------------------
/Sketcher_CommandCircle3P.cxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_CommandCircle3P.cxx
3 | * \brief Implementation file for the class Sketcher_CommandCircle3P
4 | * \author Sergei Maslov
5 | */
6 | #include "Sketcher_CommandCircle3P.hxx"
7 |
8 | IMPLEMENT_STANDARD_RTTIEXT(Sketcher_CommandCircle3P, Sketcher_Command)
9 |
10 | /**
11 | * \fn Sketcher_CommandCircle3P()
12 | * \brief Constructs a Sketcher_CommandCircle3P
13 | */
14 | Sketcher_CommandCircle3P::Sketcher_CommandCircle3P()
15 | : Sketcher_Command("Circle3P."),
16 | tempCirc(curCoordinateSystem.Ax2(),SKETCHER_RADIUS)
17 | {
18 | myCircle3PAction = Nothing;
19 |
20 | tempGeom_Circle = new Geom_Circle(curCoordinateSystem.Ax2(),SKETCHER_RADIUS);
21 | myRubberCircle = new AIS_Circle(tempGeom_Circle);
22 | myRubberCircle->SetColor(Quantity_NOC_LIGHTPINK1);
23 |
24 | mySecondgp_Pnt2d = gp::Origin2d();
25 | third_Pnt = gp::Origin();
26 | }
27 |
28 |
29 | /**
30 | * \fn ~Sketcher_CommandCircle3P()
31 | * \brief destructor
32 | */
33 | Sketcher_CommandCircle3P::~Sketcher_CommandCircle3P()
34 | {
35 | }
36 |
37 | /**
38 | * \fn Action()
39 | * \brief turn command to active state
40 | */
41 | void Sketcher_CommandCircle3P::Action()
42 | {
43 | myCircle3PAction = Input_1CirclePoint;
44 | tempCirc.SetPosition (curCoordinateSystem.Ax2());
45 | }
46 |
47 |
48 | /**
49 | * \fn MouseInputEvent(const gp_Pnt2d& thePnt2d )
50 | * \brief input event handler
51 | * \return Standard_Boolean
52 | * \param thePnt2d const gp_Pnt2d&
53 | */
54 | Standard_Boolean Sketcher_CommandCircle3P::MouseInputEvent(const gp_Pnt2d& thePnt2d)
55 | {
56 | curPnt2d = myAnalyserSnap->MouseInput(thePnt2d);
57 | switch (myCircle3PAction)
58 | {
59 | case Nothing: break;
60 |
61 | case Input_1CirclePoint:
62 | myFirstgp_Pnt2d = curPnt2d;
63 | myFirstPoint->SetPnt(ElCLib::To3d(curCoordinateSystem.Ax2(),curPnt2d));
64 |
65 | // myRubberLine->SetPoints(myFirstPoint,myFirstPoint);
66 | // myContext->Display(myRubberLine,0,-1);
67 | firstPoint=true;
68 |
69 | myCircle3PAction = Input_2CirclePoint;
70 | break;
71 |
72 | case Input_2CirclePoint:
73 | {
74 | mySecondgp_Pnt2d = curPnt2d;
75 | mySecondPoint->SetPnt(ElCLib::To3d(curCoordinateSystem.Ax2(),curPnt2d));
76 | tempCirc.SetLocation(myFirstPoint->Pnt().Scaled(mySecondPoint->Pnt(),0.5));
77 | tempCirc.SetRadius(myFirstgp_Pnt2d.Distance(curPnt2d) / 2);
78 |
79 | tempGeom_Circle->SetCirc(tempCirc);
80 | myRubberCircle->SetCircle(tempGeom_Circle);
81 |
82 | myContext->Remove(myRubberLine, false);
83 | myContext->Display(myRubberCircle,0,-1, false);
84 | myContext->Redisplay(myRubberCircle, true);
85 |
86 | myCircle3PAction = Input_3CirclePoint;
87 | }
88 | break;
89 | case Input_3CirclePoint:
90 | {
91 | gce_MakeCirc2d tempMakeCirc2d(myFirstgp_Pnt2d,mySecondgp_Pnt2d,curPnt2d);
92 | if (tempMakeCirc2d.Status() == gce_Done)
93 | {
94 | Handle(Geom2d_Circle) myGeom2d_Circle = new Geom2d_Circle(tempMakeCirc2d.Value());
95 |
96 | Handle(Geom_Circle) Geom_Circle1 = new Geom_Circle(ElCLib::To3d(curCoordinateSystem.Ax2(),myGeom2d_Circle->Circ2d()));
97 | Handle(AIS_Circle) myAIS_Circle = new AIS_Circle(Geom_Circle1);
98 | AddObject(myGeom2d_Circle,myAIS_Circle,CircleSketcherObject);
99 |
100 | myContext->Remove(myRubberCircle, false);
101 | myContext->Display(myAIS_Circle, true);
102 | myCircle3PAction = Input_1CirclePoint;
103 | }
104 | }
105 | break;
106 | default:break;
107 | }
108 | return Standard_False;
109 | }
110 |
111 |
112 |
113 | /**
114 | * \fn MouseMoveEvent(const gp_Pnt2d& thePnt2d )
115 | * \brief mouse move handler
116 | * \return void
117 | * \param thePnt2d const gp_Pnt2d&
118 | */
119 | void Sketcher_CommandCircle3P::MouseMoveEvent(const gp_Pnt2d& thePnt2d)
120 | {
121 | curPnt2d = myAnalyserSnap->MouseMove(thePnt2d);
122 | switch (myCircle3PAction)
123 | {
124 | case Nothing:break;
125 |
126 | case Input_1CirclePoint: break;
127 |
128 | case Input_2CirclePoint:
129 | mySecondPoint->SetPnt(ElCLib::To3d(curCoordinateSystem.Ax2(),curPnt2d));
130 | myRubberLine->SetPoints(myFirstPoint,mySecondPoint);
131 | if(firstPoint)
132 | {
133 | myContext->Display(myRubberLine,0,-1, true);
134 | firstPoint = false;
135 | }else
136 | {
137 | myContext->Redisplay(myRubberLine, true);
138 | }
139 | break;
140 | case Input_3CirclePoint:
141 | {
142 | third_Pnt = ElCLib::To3d(curCoordinateSystem.Ax2(),curPnt2d);
143 | gce_MakeCirc tempMakeCirc = gce_MakeCirc(myFirstPoint->Pnt(),mySecondPoint->Pnt(),third_Pnt);
144 | if (tempMakeCirc.Status() == gce_Done)
145 | {
146 | tempGeom_Circle->SetCirc(tempMakeCirc.Value());
147 | // myRubberCircle->SetCircle(tempGeom_Circle);
148 | myContext->Redisplay(myRubberCircle, true);
149 | }
150 | }
151 | break;
152 | default:break;
153 | }
154 | }
155 |
156 |
157 | /**
158 | * \fn CancelEvent()
159 | * \brief cancel event handler, stop entering object
160 | * \return void
161 | */
162 | void Sketcher_CommandCircle3P::CancelEvent()
163 | {
164 | switch (myCircle3PAction)
165 | {
166 | case Nothing: break;
167 |
168 | case Input_1CirclePoint: break;
169 |
170 | case Input_2CirclePoint: myContext->Remove(myRubberLine, true);
171 | break;
172 | case Input_3CirclePoint: myContext->Remove(myRubberCircle, true);
173 | break;
174 | default: break;
175 | }
176 | myCircle3PAction = Nothing;
177 | }
178 |
179 | /**
180 | * \fn GetTypeOfMethod()
181 | * \brief get command Method
182 | * \return Sketcher_ObjectTypeOfMethod
183 | */
184 | Sketcher_ObjectTypeOfMethod Sketcher_CommandCircle3P::GetTypeOfMethod()
185 | {
186 | return Circle3P_Method;
187 | }
188 |
189 |
--------------------------------------------------------------------------------
/Sketcher_CommandCircle3P.hxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_CommandCircle3P.hxx
3 | * \brief Header file for the class Sketcher_CommandCircle3P
4 | * \author Sergei Maslov
5 | */
6 | #ifndef Sketcher_CommandCIRCLE3P_H
7 | #define Sketcher_CommandCIRCLE3P_H
8 |
9 | #include "Sketcher_Command.hxx"
10 |
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include
16 | #include
17 |
18 | class Geom_Circle;
19 | class AIS_Line;
20 | class AIS_Circle;
21 |
22 | DEFINE_STANDARD_HANDLE(Sketcher_CommandCircle3P,Sketcher_Command)
23 |
24 | //Command entering Circle by 3 points
25 | class Sketcher_CommandCircle3P : public Sketcher_Command
26 | {
27 | public:
28 | // Type management
29 | DEFINE_STANDARD_RTTIEXT(Sketcher_CommandCircle3P, Sketcher_Command)
30 |
31 | enum Circle3PAction { Nothing,Input_1CirclePoint,Input_2CirclePoint,Input_3CirclePoint };
32 |
33 | /**
34 | * \fn Sketcher_CommandCircle3P()
35 | * \brief Constructs a Sketcher_CommandCircle3P
36 | */
37 | Standard_EXPORT Sketcher_CommandCircle3P();
38 |
39 | /**
40 | * \fn ~Sketcher_CommandCircle3P()
41 | * \brief destructor
42 | */
43 | Standard_EXPORT ~Sketcher_CommandCircle3P();
44 |
45 | /**
46 | * \fn Action()
47 | * \brief turn command to active state
48 | */
49 | Standard_EXPORT void Action();
50 |
51 | /**
52 | * \fn MouseInputEvent(const gp_Pnt2d& thePnt2d )
53 | * \brief input event handler
54 | * \return Standard_Boolean
55 | * \param thePnt2d const gp_Pnt2d&
56 | */
57 | Standard_EXPORT Standard_Boolean MouseInputEvent(const gp_Pnt2d& thePnt2d);
58 |
59 | /**
60 | * \fn MouseMoveEvent(const gp_Pnt2d& thePnt2d )
61 | * \brief mouse move handler
62 | * \return void
63 | * \param thePnt2d const gp_Pnt2d&
64 | */
65 | Standard_EXPORT void MouseMoveEvent(const gp_Pnt2d& thePnt2d);
66 |
67 | /**
68 | * \fn CancelEvent()
69 | * \brief cancel event handler, stop entering object
70 | * \return void
71 | */
72 | Standard_EXPORT void CancelEvent();
73 |
74 | /**
75 | * \fn GetTypeOfMethod()
76 | * \brief get command Method
77 | * \return Sketcher_ObjectTypeOfMethod
78 | */
79 | Standard_EXPORT Sketcher_ObjectTypeOfMethod GetTypeOfMethod();
80 |
81 | private:
82 |
83 | //members
84 | Circle3PAction myCircle3PAction;
85 |
86 | Handle(Geom_Circle) tempGeom_Circle;
87 | Handle(AIS_Circle) myRubberCircle;
88 |
89 | gp_Pnt2d mySecondgp_Pnt2d;
90 | gp_Circ tempCirc;
91 | gp_Pnt third_Pnt;
92 |
93 | };
94 |
95 | #endif
--------------------------------------------------------------------------------
/Sketcher_CommandCircle3Tan.hxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_CommandCircle3Tan.hxx
3 | * \brief Header file for the class Sketcher_CommandCircle3Tan
4 | * \author Sergei Maslov
5 | */
6 | #ifndef Sketcher_CommandCircle3Tan_H
7 | #define Sketcher_CommandCircle3Tan_H
8 |
9 | #include "Sketcher_Command.hxx"
10 | #include "Geom2d_Edge.hxx"
11 | #include "Geom2d_Arc.hxx"
12 |
13 | #include
14 | #include
15 | #include
16 | #include
17 | #include
18 | #include
19 |
20 | #include
21 | #include
22 | #include
23 |
24 | #define MINIMUMDISTANCETOCURVE 100
25 |
26 | class AIS_Circle;
27 |
28 | DEFINE_STANDARD_HANDLE(Sketcher_CommandCircle3Tan,Sketcher_Command)
29 |
30 | //Command entering Circle by 3 tangential to curve
31 | class Sketcher_CommandCircle3Tan : public Sketcher_Command
32 | {
33 | public:
34 | // Type management
35 | DEFINE_STANDARD_RTTIEXT(Sketcher_CommandCircle3Tan, Sketcher_Command)
36 |
37 | enum Circle3TanAction { Nothing,Input_1CircleTan,Input_2CircleTan,Input_3CircleTan };
38 |
39 | /**
40 | * \fn Sketcher_CommandCircle3Tan()
41 | * \brief Constructs a Sketcher_CommandCircle3Tan
42 | */
43 | Standard_EXPORT Sketcher_CommandCircle3Tan();
44 |
45 | /**
46 | * \fn ~Sketcher_CommandCircle3Tan()
47 | * \brief destructor
48 | */
49 | Standard_EXPORT ~Sketcher_CommandCircle3Tan();
50 |
51 | /**
52 | * \fn Action()
53 | * \brief turn command to active state
54 | */
55 | Standard_EXPORT void Action();
56 |
57 | /**
58 | * \fn MouseInputEvent(const gp_Pnt2d& thePnt2d )
59 | * \brief input event handler
60 | * \return Standard_Boolean
61 | * \param thePnt2d const gp_Pnt2d&
62 | */
63 | Standard_EXPORT Standard_Boolean MouseInputEvent(const gp_Pnt2d& thePnt2d);
64 |
65 | /**
66 | * \fn MouseMoveEvent(const gp_Pnt2d& thePnt2d )
67 | * \brief mouse move handler
68 | * \return void
69 | * \param thePnt2d const gp_Pnt2d&
70 | */
71 | Standard_EXPORT void MouseMoveEvent(const gp_Pnt2d& thePnt2d);
72 |
73 | /**
74 | * \fn CancelEvent()
75 | * \brief cancel event handler, stop entering object
76 | * \return void
77 | */
78 | Standard_EXPORT void CancelEvent();
79 |
80 | /**
81 | * \fn GetTypeOfMethod()
82 | * \brief get command Method
83 | * \return Sketcher_ObjectTypeOfMethod
84 | */
85 | Standard_EXPORT Sketcher_ObjectTypeOfMethod GetTypeOfMethod();
86 |
87 | private:
88 |
89 | //methods
90 |
91 | /**
92 | * \fn SelectCurve()
93 | * \brief selecy nearest curve
94 | * \return void
95 | */
96 | Standard_EXPORT void SelectCurve();
97 |
98 | /**
99 | * \fn SumDistanceToCircle()
100 | * \brief select circle orientation
101 | * \return Standard_Boolean
102 | */
103 | Standard_EXPORT Standard_Boolean SumDistanceToCircle ();
104 |
105 | /**
106 | * \fn CheckgpObject()
107 | * \brief check object, is it possible to create tangent circle
108 | * \return Standard_Boolean
109 | */
110 | Standard_EXPORT Standard_Boolean CheckgpObject();
111 |
112 | /**
113 | * \fn StoregpObject()
114 | * \brief store objects for building tangent circle
115 | * \return Standard_Boolean
116 | */
117 | Standard_EXPORT Standard_Boolean StoregpObject();
118 |
119 | //members
120 | Circle3TanAction myCircle3TanAction;
121 | Handle(Sketcher_Object) mySObject;
122 |
123 | Standard_Real minDistance;
124 | Standard_Real curDistance;
125 | Standard_Real u1,u2,u_temp;
126 | gp_Pnt2d tempPnt2d;
127 | gp_Pnt2d mySecondgp_Pnt2d;
128 |
129 | gp_Circ2d temp_Circ2d;
130 | gp_Circ best_Circ;
131 | Handle(AIS_Circle) myRubberCircle;
132 |
133 | Handle(Geom2d_Circle) tempGeom2d_Circle;
134 | Handle(Geom2d_Curve) tempGeom2d_Curve;
135 |
136 | Handle(Geom2d_Curve) myFirst2d_Curve;
137 | Handle(Geom2d_Curve) mySecond2d_Curve;
138 | Handle(Geom_Circle) tempGeom_Circle;
139 |
140 |
141 | Standard_Boolean gp_lin1Exist,gp_lin2Exist;
142 | Standard_Boolean gp_circ1Exist,gp_circ2Exist;
143 | gp_Lin2d gp_lin1,gp_lin2;
144 | gp_Circ2d gp_circ1,gp_circ2;
145 |
146 | Geom2dAPI_ProjectPointOnCurve myProjectOnCurve;
147 |
148 | };
149 |
150 | #endif
--------------------------------------------------------------------------------
/Sketcher_CommandCircleCenterRadius.cxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_CommandCircleCenterRadius.cxx
3 | * \brief Implementation file for the class Sketcher_CommandCircleCenterRadius
4 | * \author Sergei Maslov
5 | */
6 | #include "Sketcher_CommandCircleCenterRadius.hxx"
7 |
8 | IMPLEMENT_STANDARD_RTTIEXT(Sketcher_CommandCircleCenterRadius, Sketcher_Command)
9 |
10 | /**
11 | * \fn Sketcher_CommandCircleCenterRadius()
12 | * \brief Constructs a Sketcher_CommandCircleCenterRadius
13 | */
14 | Sketcher_CommandCircleCenterRadius::Sketcher_CommandCircleCenterRadius()
15 | : Sketcher_Command("CircleCR."),
16 | myCircleAx2d(gp::Origin2d(),gp::DX2d())
17 | {
18 | myCircleCenterRadiusAction = Nothing;
19 | radius = 0;
20 |
21 | tempGeom_Circle = new Geom_Circle(curCoordinateSystem.Ax2(),SKETCHER_RADIUS);
22 | myRubberCircle = new AIS_Circle(tempGeom_Circle);
23 | myRubberCircle->SetColor(Quantity_NOC_LIGHTPINK1);
24 | }
25 |
26 |
27 | /**
28 | * \fn ~Sketcher_CommandCircleCenterRadius()
29 | * \brief destructor
30 | */
31 | Sketcher_CommandCircleCenterRadius::~Sketcher_CommandCircleCenterRadius()
32 | {
33 | }
34 |
35 | /**
36 | * \fn Action()
37 | * \brief turn command to active state
38 | */
39 | void Sketcher_CommandCircleCenterRadius::Action()
40 | {
41 | myCircleCenterRadiusAction = Input_CenterPoint;
42 | tempGeom_Circle->SetAxis(curCoordinateSystem.Axis());
43 | myCircleAx2d.SetDirection(gp_Dir2d (curCoordinateSystem.XDirection().X(),curCoordinateSystem.XDirection().Y()));
44 | }
45 |
46 |
47 | /**
48 | * \fn MouseInputEvent(const gp_Pnt2d& thePnt2d )
49 | * \brief input event handler
50 | * \return Standard_Boolean
51 | * \param thePnt2d const gp_Pnt2d&
52 | */
53 | Standard_Boolean Sketcher_CommandCircleCenterRadius::MouseInputEvent(const gp_Pnt2d& thePnt2d)
54 | {
55 | switch (myCircleCenterRadiusAction)
56 | {
57 | case Nothing: break;
58 |
59 | case Input_CenterPoint:
60 | curPnt2d = myAnalyserSnap->MouseInput(thePnt2d);
61 | myFirstgp_Pnt2d = curPnt2d;
62 | myFirstPoint->SetPnt(ElCLib::To3d(curCoordinateSystem.Ax2(),curPnt2d));///////
63 |
64 | myCircleAx2d.SetLocation(myFirstgp_Pnt2d);
65 | tempGeom_Circle->SetLocation(myFirstPoint->Pnt());
66 | tempGeom_Circle->SetRadius(SKETCHER_RADIUS);
67 | myRubberCircle->SetCircle(tempGeom_Circle);
68 | myContext->Display(myRubberCircle,0,-1, true);
69 |
70 | // myRubberLine->SetPoints(myFirstPoint,myFirstPoint);
71 | // myContext->Display(myRubberLine,0,-1);
72 | firstPoint=true;
73 |
74 | myCircleCenterRadiusAction = Input_RadiusPoint;
75 | break;
76 |
77 | case Input_RadiusPoint:
78 | {
79 | curPnt2d = myAnalyserSnap->MouseInputException(myFirstgp_Pnt2d,thePnt2d,Circle_CenterPnt,Standard_True);
80 | radius = myFirstgp_Pnt2d.Distance(curPnt2d);
81 | Handle(Geom2d_Circle) myGeom2d_Circle = new Geom2d_Circle(myCircleAx2d,radius);
82 |
83 | Handle(Geom_Circle) Geom_Circle1 = new Geom_Circle(ElCLib::To3d(curCoordinateSystem.Ax2(),myGeom2d_Circle->Circ2d()));
84 | Handle(AIS_Circle) myAIS_Circle = new AIS_Circle(Geom_Circle1);
85 | AddObject(myGeom2d_Circle,myAIS_Circle,CircleSketcherObject);
86 |
87 | myContext->Remove(myRubberCircle, false);
88 | myContext->Remove(myRubberLine, false);
89 | myContext->Display(myAIS_Circle, true);
90 |
91 | myCircleCenterRadiusAction = Input_CenterPoint;
92 | }
93 | break;
94 | default:break;
95 | }
96 | return Standard_False;
97 | }
98 |
99 |
100 | /**
101 | * \fn MouseMoveEvent(const gp_Pnt2d& thePnt2d )
102 | * \brief mouse move handler
103 | * \return void
104 | * \param thePnt2d const gp_Pnt2d&
105 | */
106 | void Sketcher_CommandCircleCenterRadius::MouseMoveEvent(const gp_Pnt2d& thePnt2d)
107 | {
108 | switch (myCircleCenterRadiusAction)
109 | {
110 | case Nothing:break;
111 |
112 | case Input_CenterPoint:
113 | curPnt2d = myAnalyserSnap->MouseMove(thePnt2d);
114 | break;
115 |
116 | case Input_RadiusPoint:
117 | curPnt2d = myAnalyserSnap->MouseMoveException(myFirstgp_Pnt2d,thePnt2d,Circle_CenterPnt,Standard_True);
118 | radius = myFirstgp_Pnt2d.Distance(curPnt2d);
119 | tempGeom_Circle->SetRadius(radius);
120 | // myRubberCircle->SetCircle (tempGeom_Circle);
121 | myContext->Redisplay(myRubberCircle, false);
122 |
123 | mySecondPoint->SetPnt(ElCLib::To3d(curCoordinateSystem.Ax2(),curPnt2d));
124 | myRubberLine->SetPoints(myFirstPoint,mySecondPoint);
125 | if(firstPoint)
126 | {
127 | myContext->Display(myRubberLine,0,-1, true);
128 | firstPoint = false;
129 | }else
130 | {
131 | myContext->Redisplay(myRubberLine, true);
132 | }
133 |
134 | break;
135 | default:break;
136 | }
137 | }
138 |
139 |
140 | /**
141 | * \fn CancelEvent()
142 | * \brief cancel event handler, stop entering object
143 | * \return void
144 | */
145 | void Sketcher_CommandCircleCenterRadius::CancelEvent()
146 | {
147 | switch (myCircleCenterRadiusAction)
148 | {
149 | case Nothing: break;
150 |
151 | case Input_CenterPoint: break;
152 |
153 | case Input_RadiusPoint: myContext->Remove(myRubberCircle, false);
154 | myContext->Remove(myRubberLine, true);////////////////////////
155 | break;
156 | default: break;
157 | }
158 | myCircleCenterRadiusAction = Nothing;
159 | }
160 |
161 |
162 | /**
163 | * \fn GetTypeOfMethod()
164 | * \brief get command Method
165 | * \return Sketcher_ObjectTypeOfMethod
166 | */
167 | Sketcher_ObjectTypeOfMethod Sketcher_CommandCircleCenterRadius::GetTypeOfMethod()
168 | {
169 | return CircleCenterRadius_Method;
170 | }
171 |
172 |
--------------------------------------------------------------------------------
/Sketcher_CommandCircleCenterRadius.hxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_CommandCircleCenterRadius.hxx
3 | * \brief Header file for the class Sketcher_CommandCircleCenterRadius
4 | * \author Sergei Maslov
5 | */
6 | #ifndef Sketcher_CommandCIRCLECENTERRADIUS_H
7 | #define Sketcher_CommandCIRCLECENTERRADIUS_H
8 |
9 | #include "Sketcher_Command.hxx"
10 |
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include
16 | #include
17 |
18 | class Geom_Circle;
19 | class AIS_Circle;
20 | class AIS_Line;
21 |
22 | DEFINE_STANDARD_HANDLE(Sketcher_CommandCircleCenterRadius,Sketcher_Command)
23 |
24 | //Command entering Circle by Center point and other point
25 | class Sketcher_CommandCircleCenterRadius : public Sketcher_Command
26 | {
27 | public:
28 | // Type management
29 | DEFINE_STANDARD_RTTIEXT(Sketcher_CommandCircleCenterRadius, Sketcher_Command)
30 |
31 | enum CircleCenterRadiusAction { Nothing,Input_CenterPoint,Input_RadiusPoint };
32 |
33 | /**
34 | * \fn Sketcher_CommandCircleCenterRadius()
35 | * \brief Constructs a Sketcher_CommandCircleCenterRadius
36 | */
37 | Standard_EXPORT Sketcher_CommandCircleCenterRadius();
38 |
39 | /**
40 | * \fn ~Sketcher_CommandCircleCenterRadius()
41 | * \brief destructor
42 | */
43 | Standard_EXPORT ~Sketcher_CommandCircleCenterRadius();
44 |
45 | /**
46 | * \fn Action()
47 | * \brief turn command to active state
48 | */
49 | Standard_EXPORT void Action();
50 |
51 | /**
52 | * \fn MouseInputEvent(const gp_Pnt2d& thePnt2d )
53 | * \brief input event handler
54 | * \return Standard_Boolean
55 | * \param thePnt2d const gp_Pnt2d&
56 | */
57 | Standard_EXPORT Standard_Boolean MouseInputEvent(const gp_Pnt2d& thePnt2d);
58 |
59 | /**
60 | * \fn MouseMoveEvent(const gp_Pnt2d& thePnt2d )
61 | * \brief mouse move handler
62 | * \return void
63 | * \param thePnt2d const gp_Pnt2d&
64 | */
65 | Standard_EXPORT void MouseMoveEvent(const gp_Pnt2d& thePnt2d);
66 |
67 | /**
68 | * \fn CancelEvent()
69 | * \brief cancel event handler, stop entering object
70 | * \return void
71 | */
72 | Standard_EXPORT void CancelEvent();
73 |
74 | /**
75 | * \fn GetTypeOfMethod()
76 | * \brief get command Method
77 | * \return Sketcher_ObjectTypeOfMethod
78 | */
79 | Standard_EXPORT Sketcher_ObjectTypeOfMethod GetTypeOfMethod();
80 |
81 | private:
82 |
83 | //members
84 | CircleCenterRadiusAction myCircleCenterRadiusAction;
85 | Standard_Real radius;
86 |
87 | Handle(Geom_Circle) tempGeom_Circle;
88 | Handle(AIS_Circle) myRubberCircle;
89 | gp_Ax2d myCircleAx2d;
90 | };
91 |
92 | #endif
--------------------------------------------------------------------------------
/Sketcher_CommandCircleP2Tan.hxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_CommandCircleP2Tan.hxx
3 | * \brief Header file for the class Sketcher_CommandCircleP2Tan
4 | * \author Sergei Maslov
5 | */
6 | #ifndef Sketcher_CommandCircleP2Tan_H
7 | #define Sketcher_CommandCircleP2Tan_H
8 |
9 | #include "Sketcher_Command.hxx"
10 | #include "Geom2d_Edge.hxx"
11 | #include "Geom2d_Arc.hxx"
12 |
13 | #include
14 | #include
15 | #include
16 | #include
17 | #include
18 | #include
19 |
20 | #include
21 | #include
22 | #include
23 |
24 | #define MINIMUMDISTANCETOCURVE 100
25 |
26 | class AIS_Circle;
27 |
28 | DEFINE_STANDARD_HANDLE(Sketcher_CommandCircleP2Tan,Sketcher_Command)
29 |
30 | //Command entering Circle by 3 tangential to curve
31 | class Sketcher_CommandCircleP2Tan : public Sketcher_Command
32 | {
33 | public:
34 | // Type management
35 | DEFINE_STANDARD_RTTIEXT(Sketcher_CommandCircleP2Tan, Sketcher_Command)
36 |
37 | enum CircleP2TanAction { Nothing,Input_1CirclePoint,Input_2CircleTan,Input_3CircleTan };
38 |
39 | /**
40 | * \fn Sketcher_CommandCircleP2Tan()
41 | * \brief Constructs a Sketcher_CommandCircleP2Tan
42 | */
43 | Standard_EXPORT Sketcher_CommandCircleP2Tan();
44 |
45 | /**
46 | * \fn ~Sketcher_CommandCircleP2Tan()
47 | * \brief destructor
48 | */
49 | Standard_EXPORT ~Sketcher_CommandCircleP2Tan();
50 |
51 | /**
52 | * \fn Action()
53 | * \brief turn command to active state
54 | */
55 | Standard_EXPORT void Action();
56 |
57 | /**
58 | * \fn MouseInputEvent(const gp_Pnt2d& thePnt2d )
59 | * \brief input event handler
60 | * \return Standard_Boolean
61 | * \param thePnt2d const gp_Pnt2d&
62 | */
63 | Standard_EXPORT Standard_Boolean MouseInputEvent(const gp_Pnt2d& thePnt2d);
64 |
65 | /**
66 | * \fn MouseMoveEvent(const gp_Pnt2d& thePnt2d )
67 | * \brief mouse move handler
68 | * \return void
69 | * \param thePnt2d const gp_Pnt2d&
70 | */
71 | Standard_EXPORT void MouseMoveEvent(const gp_Pnt2d& thePnt2d);
72 |
73 | /**
74 | * \fn CancelEvent()
75 | * \brief cancel event handler, stop entering object
76 | * \return void
77 | */
78 | Standard_EXPORT void CancelEvent();
79 |
80 | /**
81 | * \fn GetTypeOfMethod()
82 | * \brief get command Method
83 | * \return Sketcher_ObjectTypeOfMethod
84 | */
85 | Standard_EXPORT Sketcher_ObjectTypeOfMethod GetTypeOfMethod();
86 |
87 | private:
88 | //methods
89 |
90 | /**
91 | * \fn SelectCurve()
92 | * \brief selecy nearest curve
93 | * \return void
94 | */
95 | Standard_EXPORT void SelectCurve();
96 |
97 | /**
98 | * \fn SumDistanceToCircle()
99 | * \brief select circle orientation
100 | * \return Standard_Boolean
101 | */
102 | Standard_EXPORT Standard_Boolean SumDistanceToCircle ();
103 |
104 | /**
105 | * \fn CheckgpObject()
106 | * \brief check object, is it possible to create tangent circle
107 | * \return Standard_Boolean
108 | */
109 | Standard_EXPORT Standard_Boolean CheckgpObject();
110 |
111 | /**
112 | * \fn StoregpObject()
113 | * \brief store objects for building tangent circle
114 | * \return Standard_Boolean
115 | */
116 | Standard_EXPORT Standard_Boolean StoregpObject();
117 |
118 | //members
119 | CircleP2TanAction myCircleP2TanAction;
120 | Handle(Sketcher_Object) mySObject;
121 |
122 | Standard_Real minDistance;
123 | Standard_Real curDistance;
124 | Standard_Real u2,u_temp;
125 |
126 | gp_Pnt2d tempPnt2d;
127 | gp_Pnt2d mySecondgp_Pnt2d;
128 | Handle(Geom2d_CartesianPoint) First2dPoint;
129 |
130 | gp_Circ2d temp_Circ2d;
131 | gp_Circ best_Circ;
132 | Handle(AIS_Circle) myRubberCircle;
133 |
134 | Handle(Geom2d_Circle) tempGeom2d_Circle;
135 | Handle(Geom2d_Curve) tempGeom2d_Curve;
136 |
137 | Handle(Geom2d_Curve) mySecond2d_Curve;
138 | Handle(Geom_Circle) tempGeom_Circle;
139 |
140 |
141 | Standard_Boolean gp_linExist;
142 | Standard_Boolean gp_circExist;
143 | gp_Lin2d gp_lin;
144 | gp_Circ2d gp_circ;
145 |
146 | Geom2dAPI_ProjectPointOnCurve myProjectOnCurve;
147 |
148 | };
149 |
150 | #endif
--------------------------------------------------------------------------------
/Sketcher_CommandLine2P.cxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_CommandLine2P.cxx
3 | * \brief Implementation file for the class Sketcher_CommandLine2P
4 | * \author Sergei Maslov
5 | */
6 | #include "Sketcher_CommandLine2P.hxx"
7 |
8 | IMPLEMENT_STANDARD_RTTIEXT(Sketcher_CommandLine2P, Sketcher_Command)
9 |
10 | /**
11 | * \fn Sketcher_CommandLine2P()
12 | * \brief Constructs a Sketcher_CommandLine2P
13 | */
14 | Sketcher_CommandLine2P::Sketcher_CommandLine2P()
15 | : Sketcher_Command("Line2P.")
16 | {
17 | myLine2PAction = Nothing;
18 | }
19 |
20 |
21 | /**
22 | * \fn ~Sketcher_CommandLine2P()
23 | * \brief destructor
24 | */
25 | Sketcher_CommandLine2P::~Sketcher_CommandLine2P()
26 | {
27 | }
28 |
29 | /**
30 | * \fn Action()
31 | * \brief turn command to active state
32 | */
33 | void Sketcher_CommandLine2P::Action()
34 | {
35 | myLine2PAction = Input_FirstPointLine;
36 | }
37 |
38 | /**
39 | * \fn MouseInputEvent(const gp_Pnt2d& thePnt2d )
40 | * \brief input event handler
41 | * \return Standard_Boolean
42 | * \param thePnt2d const gp_Pnt2d&
43 | */
44 | Standard_Boolean Sketcher_CommandLine2P::MouseInputEvent(const gp_Pnt2d& thePnt2d)
45 | {
46 | switch (myLine2PAction)
47 | {
48 | case Nothing: break;
49 |
50 | case Input_FirstPointLine:
51 | curPnt2d = myAnalyserSnap->MouseInputException(thePnt2d,thePnt2d,Line_FirstPnt,Standard_True);
52 | myFirstgp_Pnt2d = curPnt2d;
53 | myFirstPoint->SetPnt(ElCLib::To3d(curCoordinateSystem.Ax2(),curPnt2d));
54 |
55 | // myRubberLine->SetPoints(myFirstPoint,myFirstPoint);
56 |
57 | // myContext->Display(myRubberLine,0,-1);
58 | myLine2PAction = Input_SecondPointLine;
59 | firstPoint = true;
60 | break;
61 |
62 | case Input_SecondPointLine:
63 | {
64 | curPnt2d = myAnalyserSnap->MouseInputException(myFirstgp_Pnt2d,thePnt2d,Line_SecondPnt,Standard_False);
65 |
66 | Handle(Geom2d_Edge) newGeom2d_Edge = new Geom2d_Edge();
67 | if(newGeom2d_Edge->SetPoints(myFirstgp_Pnt2d,curPnt2d))
68 | {
69 | Handle (Geom_CartesianPoint) Geom_Point1 = new Geom_CartesianPoint(ElCLib::To3d(curCoordinateSystem.Ax2(),myFirstgp_Pnt2d));
70 | Handle (Geom_CartesianPoint) Geom_Point2 = new Geom_CartesianPoint(ElCLib::To3d(curCoordinateSystem.Ax2(),curPnt2d));
71 | Handle(AIS_Line) myAIS_Line = new AIS_Line(Geom_Point1,Geom_Point2);
72 | AddObject(newGeom2d_Edge,myAIS_Line,LineSketcherObject);
73 |
74 | myContext->Display(myAIS_Line, true);
75 | if (myPolylineMode)
76 | {
77 | myFirstgp_Pnt2d = curPnt2d;
78 | myFirstPoint->SetPnt(mySecondPoint->Pnt());
79 | myRubberLine->SetPoints(myFirstPoint,myFirstPoint);
80 | myContext->Redisplay(myRubberLine, true);
81 | }
82 | else
83 | {
84 | myContext->Remove(myRubberLine, true);
85 | myLine2PAction = Input_FirstPointLine;
86 | }
87 | }
88 | }
89 | break;
90 | default:break;
91 | }
92 | return Standard_False;
93 | }
94 |
95 |
96 | /**
97 | * \fn MouseMoveEvent(const gp_Pnt2d& thePnt2d )
98 | * \brief mouse move handler
99 | * \return void
100 | * \param thePnt2d const gp_Pnt2d&
101 | */
102 | void Sketcher_CommandLine2P::MouseMoveEvent(const gp_Pnt2d& thePnt2d)
103 | {
104 |
105 | switch (myLine2PAction)
106 | {
107 | case Nothing:break;
108 |
109 | case Input_FirstPointLine:
110 | curPnt2d = myAnalyserSnap->MouseMoveException(thePnt2d,thePnt2d,Line_FirstPnt,Standard_True);
111 | break;
112 | case Input_SecondPointLine:
113 | curPnt2d = myAnalyserSnap->MouseMoveException(myFirstgp_Pnt2d,thePnt2d,Line_SecondPnt,Standard_False);
114 | mySecondPoint->SetPnt(ElCLib::To3d(curCoordinateSystem.Ax2(),curPnt2d));
115 | myRubberLine->SetPoints(myFirstPoint,mySecondPoint);
116 | if(firstPoint)
117 | {
118 | myContext->Display(myRubberLine,0,-1, true);
119 | firstPoint = false;
120 | }else
121 | {
122 | myContext->Redisplay(myRubberLine, true);
123 | }
124 | break;
125 | default:break;
126 | }
127 | }
128 |
129 |
130 | /**
131 | * \fn CancelEvent()
132 | * \brief cancel event handler, stop entering object
133 | * \return void
134 | */
135 | void Sketcher_CommandLine2P::CancelEvent()
136 | {
137 | switch (myLine2PAction)
138 | {
139 | case Nothing: break;
140 |
141 | case Input_FirstPointLine: break;
142 |
143 | case Input_SecondPointLine: myContext->Remove(myRubberLine, true);
144 | break;
145 | default: break;
146 | }
147 | myLine2PAction = Nothing;
148 | }
149 |
150 | /**
151 | * \fn GetTypeOfMethod()
152 | * \brief get command Method
153 | * \return Sketcher_ObjectTypeOfMethod
154 | */
155 | Sketcher_ObjectTypeOfMethod Sketcher_CommandLine2P::GetTypeOfMethod()
156 | {
157 | return Line2P_Method;
158 | }
159 |
160 |
161 | /**
162 | * \fn SetPolylineFirstPnt(const gp_Pnt2d& p1)
163 | * \brief set last entering gp_Pnt2d for polyline
164 | * \return void
165 | * \param p1 const gp_Pnt2d&
166 | */
167 | void Sketcher_CommandLine2P::SetPolylineFirstPnt(const gp_Pnt2d& p1)
168 | {
169 | myFirstgp_Pnt2d = p1;
170 | myFirstPoint->SetPnt(ElCLib::To3d(curCoordinateSystem.Ax2(),p1));
171 | myRubberLine->SetPoints(myFirstPoint,myFirstPoint);
172 | myContext->Display(myRubberLine,0,-1, true);
173 | myLine2PAction = Input_SecondPointLine;
174 | }
175 |
176 |
177 | /**
178 | * \fn GetPolylineFirstPnt(gp_Pnt2d& p1)
179 | * \brief get last entering gp_Pnt2d for polyline
180 | * \return Standard_Boolean
181 | * \param p1 gp_Pnt2d&
182 | */
183 | Standard_Boolean Sketcher_CommandLine2P::GetPolylineFirstPnt(gp_Pnt2d& p1)
184 | {
185 | if (myLine2PAction == Input_SecondPointLine && myPolylineMode == Standard_True)
186 | {
187 | p1 = myFirstgp_Pnt2d;
188 | return Standard_True;
189 | }
190 | else
191 | return Standard_False;
192 | }
193 |
194 |
195 | /**
196 | * \fn SetPolylineMode(Standard_Boolean mode)
197 | * \brief set polyline mode
198 | * \return void
199 | * \param mode Standard_Boolean
200 | */
201 | void Sketcher_CommandLine2P::SetPolylineMode (Standard_Boolean mode)
202 | {
203 | myPolylineMode = mode;
204 | }
205 |
206 |
207 |
--------------------------------------------------------------------------------
/Sketcher_CommandLine2P.hxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_CommandLine2P.hxx
3 | * \brief Header file for the class Sketcher_CommandLine2P
4 | * \author Sergei Maslov
5 | */
6 | #ifndef Sketcher_CommandLine2P_H
7 | #define Sketcher_CommandLine2P_H
8 |
9 | #include "Sketcher_Command.hxx"
10 | #include "Geom2d_Edge.hxx"
11 |
12 | class Geom2d_CartesianPoint;
13 | class AIS_Line;
14 |
15 | DEFINE_STANDARD_HANDLE(Sketcher_CommandLine2P,Sketcher_Command)
16 |
17 | //Command entering Line by 2 Points
18 | class Sketcher_CommandLine2P : public Sketcher_Command
19 | {
20 | public:
21 | // Type management
22 | DEFINE_STANDARD_RTTIEXT(Sketcher_CommandLine2P, Sketcher_Command)
23 |
24 | enum Line2PAction { Nothing,Input_FirstPointLine,Input_SecondPointLine };
25 |
26 |
27 | /**
28 | * \fn Sketcher_CommandLine2P()
29 | * \brief Constructs a Sketcher_CommandLine2P
30 | */
31 | Standard_EXPORT Sketcher_CommandLine2P();
32 |
33 | /**
34 | * \fn ~Sketcher_CommandLine2P()
35 | * \brief destructor
36 | */
37 | Standard_EXPORT ~Sketcher_CommandLine2P();
38 |
39 | /**
40 | * \fn Action()
41 | * \brief turn command to active state
42 | */
43 | Standard_EXPORT void Action();
44 |
45 | /**
46 | * \fn MouseInputEvent(const gp_Pnt2d& thePnt2d )
47 | * \brief input event handler
48 | * \return Standard_Boolean
49 | * \param thePnt2d const gp_Pnt2d&
50 | */
51 | Standard_EXPORT Standard_Boolean MouseInputEvent(const gp_Pnt2d& thePnt2d);
52 |
53 | /**
54 | * \fn MouseMoveEvent(const gp_Pnt2d& thePnt2d )
55 | * \brief mouse move handler
56 | * \return void
57 | * \param thePnt2d const gp_Pnt2d&
58 | */
59 | Standard_EXPORT void MouseMoveEvent(const gp_Pnt2d& thePnt2d);
60 |
61 | /**
62 | * \fn CancelEvent()
63 | * \brief cancel event handler, stop entering object
64 | * \return void
65 | */
66 | Standard_EXPORT void CancelEvent();
67 |
68 | /**
69 | * \fn GetTypeOfMethod()
70 | * \brief get command Method
71 | * \return Sketcher_ObjectTypeOfMethod
72 | */
73 | Standard_EXPORT Sketcher_ObjectTypeOfMethod GetTypeOfMethod();
74 |
75 | /**
76 | * \fn SetPolylineFirstPnt(const gp_Pnt2d& p1)
77 | * \brief set last entering gp_Pnt2d for polyline
78 | * \return void
79 | * \param p1 const gp_Pnt2d&
80 | */
81 | Standard_EXPORT virtual void SetPolylineFirstPnt(const gp_Pnt2d& p1);
82 |
83 | /**
84 | * \fn GetPolylineFirstPnt(gp_Pnt2d& p1)
85 | * \brief get last entering gp_Pnt2d for polyline
86 | * \return Standard_Boolean
87 | * \param p1 gp_Pnt2d&
88 | */
89 | Standard_EXPORT virtual Standard_Boolean GetPolylineFirstPnt(gp_Pnt2d& p1);
90 |
91 | /**
92 | * \fn SetPolylineMode(Standard_Boolean mode)
93 | * \brief set polyline mode
94 | * \return void
95 | * \param mode Standard_Boolean
96 | */
97 | Standard_EXPORT void SetPolylineMode(Standard_Boolean mode);
98 |
99 | private:
100 | //members
101 |
102 | Line2PAction myLine2PAction;
103 |
104 | };
105 |
106 | #endif
--------------------------------------------------------------------------------
/Sketcher_CommandPoint.cxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_CommandPoint.cxx
3 | * \brief Implementation file for the class Sketcher_CommandPoint
4 | * \author Sergei Maslov
5 | */
6 | #include "Sketcher_CommandPoint.hxx"
7 |
8 | IMPLEMENT_STANDARD_RTTIEXT(Sketcher_CommandPoint, Sketcher_Command)
9 |
10 | /**
11 | * \fn Sketcher_CommandPoint()
12 | * \brief Constructs a Sketcher_CommandPoint
13 | */
14 | Sketcher_CommandPoint::Sketcher_CommandPoint()
15 | : Sketcher_Command("Point.")
16 | {
17 | myPointAction = Nothing;
18 | }
19 |
20 |
21 | /**
22 | * \fn ~Sketcher_CommandPoint()
23 | * \brief destructor
24 | */
25 | Sketcher_CommandPoint::~Sketcher_CommandPoint()
26 | {
27 | }
28 |
29 | /**
30 | * \fn Action()
31 | * \brief turn command to active state
32 | */
33 | void Sketcher_CommandPoint::Action()
34 | {
35 | myPointAction = Input_Point;
36 | }
37 |
38 | /**
39 | * \fn MouseInputEvent(const gp_Pnt2d& thePnt2d )
40 | * \brief input event handler
41 | * \return Standard_Boolean
42 | * \param thePnt2d const gp_Pnt2d&
43 | */
44 | Standard_Boolean Sketcher_CommandPoint::MouseInputEvent(const gp_Pnt2d& thePnt2d)
45 | {
46 | curPnt2d = myAnalyserSnap->MouseInput(thePnt2d);
47 | switch (myPointAction)
48 | {
49 | case Nothing: break;
50 |
51 | case Input_Point:
52 | {
53 | Handle (Geom2d_CartesianPoint) myGeom2d_Point = new Geom2d_CartesianPoint(curPnt2d);
54 |
55 | Handle (Geom_CartesianPoint) myGeom_Point = new Geom_CartesianPoint(ElCLib::To3d(curCoordinateSystem.Ax2(),curPnt2d));
56 | Handle(AIS_Point) myAIS_Point = new AIS_Point(myGeom_Point);
57 | myContext->Display(myAIS_Point, true);
58 |
59 | AddObject(myGeom2d_Point,myAIS_Point,PointSketcherObject);
60 | }
61 | break;
62 | default:break;
63 | }
64 | return Standard_False;
65 | }
66 |
67 |
68 | /**
69 | * \fn MouseMoveEvent(const gp_Pnt2d& thePnt2d )
70 | * \brief mouse move handler
71 | * \return void
72 | * \param thePnt2d const gp_Pnt2d&
73 | */
74 | void Sketcher_CommandPoint::MouseMoveEvent(const gp_Pnt2d& thePnt2d)
75 | {
76 | curPnt2d = myAnalyserSnap->MouseMove(thePnt2d);
77 | }
78 |
79 |
80 | /**
81 | * \fn CancelEvent()
82 | * \brief cancel event handler, stop entering object
83 | * \return void
84 | */
85 | void Sketcher_CommandPoint::CancelEvent()
86 | {
87 | myPointAction = Nothing;
88 | }
89 |
90 |
91 | /**
92 | * \fn GetTypeOfMethod()
93 | * \brief get command Method
94 | * \return Sketcher_ObjectTypeOfMethod
95 | */
96 | Sketcher_ObjectTypeOfMethod Sketcher_CommandPoint::GetTypeOfMethod()
97 | {
98 | return Point_Method;
99 | }
100 |
--------------------------------------------------------------------------------
/Sketcher_CommandPoint.hxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_CommandPoint.hxx
3 | * \brief Header file for the class Sketcher_CommandPoint
4 | * \author Sergei Maslov
5 | */
6 | #ifndef Sketcher_CommandPOINT_H
7 | #define Sketcher_CommandPOINT_H
8 |
9 | #include "Sketcher_Command.hxx"
10 | #include
11 |
12 | DEFINE_STANDARD_HANDLE(Sketcher_CommandPoint,Sketcher_Command)
13 |
14 | //Command entering Point
15 | class Sketcher_CommandPoint : public Sketcher_Command
16 | {
17 | public:
18 | // Type management
19 | DEFINE_STANDARD_RTTIEXT(Sketcher_CommandPoint, Sketcher_Command)
20 |
21 | enum PointAction { Nothing,Input_Point};
22 |
23 | /**
24 | * \fn Sketcher_CommandPoint()
25 | * \brief Constructs a Sketcher_CommandPoint
26 | */
27 | Standard_EXPORT Sketcher_CommandPoint();
28 |
29 | /**
30 | * \fn ~Sketcher_CommandPoint()
31 | * \brief destructor
32 | */
33 | Standard_EXPORT ~Sketcher_CommandPoint();
34 |
35 | /**
36 | * \fn Action()
37 | * \brief turn command to active state
38 | */
39 | Standard_EXPORT void Action();
40 |
41 | /**
42 | * \fn MouseInputEvent(const gp_Pnt2d& thePnt2d )
43 | * \brief input event handler
44 | * \return Standard_Boolean
45 | * \param thePnt2d const gp_Pnt2d&
46 | */
47 | Standard_EXPORT Standard_Boolean MouseInputEvent(const gp_Pnt2d& thePnt2d);
48 |
49 | /**
50 | * \fn MouseMoveEvent(const gp_Pnt2d& thePnt2d )
51 | * \brief mouse move handler
52 | * \return void
53 | * \param thePnt2d const gp_Pnt2d&
54 | */
55 | Standard_EXPORT void MouseMoveEvent(const gp_Pnt2d& thePnt2d);
56 |
57 | /**
58 | * \fn CancelEvent()
59 | * \brief cancel event handler, stop entering object
60 | * \return void
61 | */
62 | Standard_EXPORT void CancelEvent();
63 |
64 | /**
65 | * \fn GetTypeOfMethod()
66 | * \brief get command Method
67 | * \return Sketcher_ObjectTypeOfMethod
68 | */
69 | Standard_EXPORT Sketcher_ObjectTypeOfMethod GetTypeOfMethod();
70 |
71 | private:
72 |
73 | //members
74 | PointAction myPointAction;
75 |
76 | };
77 |
78 | #endif
--------------------------------------------------------------------------------
/Sketcher_GUI.cxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_GUI.cxx
3 | * \brief Implementation file for the class Sketcher_GUI
4 | * \author Sergei Maslov
5 | */
6 | #include "Sketcher_GUI.hxx"
7 |
8 |
9 | /**
10 | * \fn Sketcher_GUI()
11 | * \brief Constructs a Sketcher_GUI
12 | */
13 | Sketcher_GUI::Sketcher_GUI()
14 | {
15 | }
16 |
17 | /**
18 | * \fn ~Sketcher_GUI()
19 | * \brief destructor
20 | */
21 | Sketcher_GUI::~Sketcher_GUI()
22 | {
23 | // no need to delete child widgets, Qt does it all for us
24 | }
25 |
--------------------------------------------------------------------------------
/Sketcher_GUI.hxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_GUI.hxx
3 | * \brief Header file for the class Sketcher_GUI
4 | * \author Sergei Maslov
5 | */
6 | #ifndef SKETCHER_GUI_H
7 | #define SKETCHER_GUI_H
8 |
9 | #include "Sketcher_Object.hxx"
10 | #include
11 |
12 |
13 | class Sketcher_GUI
14 | {
15 | public:
16 |
17 | /**
18 | * \fn Sketcher_GUI()
19 | * \brief Constructs a Sketcher_GUI
20 | */
21 | Sketcher_GUI();
22 | /**
23 | * \fn ~Sketcher_GUI()
24 | * \brief destructor
25 | */
26 | ~Sketcher_GUI();
27 |
28 | /**
29 | * \fn SetContext(Handle(AIS_InteractiveContext)& theContext)
30 | * \brief pass context to property classes
31 | * \return void
32 | * \param theContext Handle(AIS_InteractiveContext)&
33 | */
34 | virtual void SetContext (Handle(AIS_InteractiveContext)& theContext) = 0;
35 |
36 | /**
37 | * \fn SetAx3(const gp_Ax3& theAx3)
38 | * \brief pass coordinate system to property classes
39 | * \return void
40 | * \param theAx3 const gp_Ax3&
41 | */
42 | virtual void SetAx3 (const gp_Ax3& theAx3) = 0;
43 |
44 | /**
45 | * \fn SetSketcher_Object(Handle(Sketcher_Object)& CurObject)
46 | * \brief determine property to show, pass object to this property class
47 | * \return void
48 | * \param CurObject Handle(Sketcher_Object)&
49 | */
50 | virtual void SetSketcher_Object(Handle(Sketcher_Object)& CurObject) = 0;
51 |
52 | };
53 |
54 | #endif
--------------------------------------------------------------------------------
/Sketcher_Object.cxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_Object.cxx
3 | * \brief Implementation file for the class Sketcher_Object
4 | * \author Sergei Maslov
5 | */
6 | #include "Sketcher_Object.hxx"
7 |
8 | IMPLEMENT_STANDARD_RTTIEXT(Sketcher_Object, Standard_Transient)
9 |
10 | /**
11 | * \fn Sketcher_Object(const Handle(Geom2d_Geometry)& theGeom2d_Geometry,const Handle(AIS_InteractiveObject)& theAIS_InteractiveObject, const TCollection_ExtendedString& theName, const Sketcher_ObjectGeometryType theGeometryType, const Sketcher_ObjectTypeOfMethod theTypeOfMethod)
12 | * \brief Constructs a Sketcher_Object
13 | * \param theGeom2d_Geometry const Handle(Geom2d_Geometry)&
14 | * \param theAIS_InteractiveObject const TCollection_ExtendedString&
15 | * \param theName const TCollection_ExtendedString&
16 | * \param theGeometryType const Sketcher_ObjectGeometryType
17 | * \param theTypeOfMethod const Sketcher_ObjectTypeOfMethod
18 | */
19 | Sketcher_Object::Sketcher_Object(const Handle(Geom2d_Geometry)& theGeom2d_Geometry,
20 | const Handle(AIS_InteractiveObject)& theAIS_InteractiveObject,
21 | const TCollection_ExtendedString& theName,
22 | const Sketcher_ObjectGeometryType theGeometryType,
23 | const Sketcher_ObjectTypeOfMethod theTypeOfMethod)
24 | {
25 | myGeometry = theGeom2d_Geometry;
26 | myAIS_InteractiveObject = theAIS_InteractiveObject;
27 | myName = theName;
28 | myGeometryType = theGeometryType;
29 | myTypeOfMethod = theTypeOfMethod;
30 |
31 | myNameOfColor = Quantity_NOC_YELLOW;
32 | myObjectType = MainSketcherType;
33 | myLineStyle = Aspect_TOL_SOLID;
34 | myWidth = 1.0;
35 | }
36 |
37 |
38 | /**
39 | * \fn ~Sketcher_Object()
40 | * \brief destructor
41 | */
42 | Sketcher_Object::~Sketcher_Object()
43 | {
44 | }
45 |
46 | /**
47 | * \fn SetGeometry(const Handle(Geom2d_Geometry)& theGeom2d_Geometry)
48 | * \brief set Geom2d_Geometry
49 | * \return void
50 | * \param theGeom2d_Geometry const Handle(Geom2d_Geometry)&
51 | */
52 | void Sketcher_Object::SetGeometry(const Handle(Geom2d_Geometry)& theGeom2d_Geometry)
53 | {
54 | myGeometry = theGeom2d_Geometry;
55 | }
56 |
57 | /**
58 | * \fn GetGeometry()
59 | * \brief get Geom2d_Geometry
60 | * \return Handle(Geom2d_Geometry)
61 | */
62 | Handle(Geom2d_Geometry) Sketcher_Object::GetGeometry()
63 | {
64 | return myGeometry;
65 | }
66 |
67 | /**
68 | * \fn SetAIS_Object(const Handle(AIS_InteractiveObject)& theAIS_InteractiveObject)
69 | * \brief set object representation
70 | * \return void
71 | * \param theAIS_InteractiveObject const Handle(AIS_InteractiveObject)&
72 | */
73 | void Sketcher_Object::SetAIS_Object(const Handle(AIS_InteractiveObject)& theAIS_InteractiveObject)
74 | {
75 | myAIS_InteractiveObject = theAIS_InteractiveObject;
76 | }
77 |
78 | /**
79 | * \fn GetAIS_Object()
80 | * \brief get object represent
81 | * \return Handle(AIS_InteractiveObject)
82 | */
83 | Handle(AIS_InteractiveObject) Sketcher_Object::GetAIS_Object()
84 | {
85 | return myAIS_InteractiveObject;
86 | }
87 |
88 |
89 | /**
90 | * \fn SetObjectName(const Handle(TCollection_ExtendedString)& theName)
91 | * \brief set object name
92 | * \return void
93 | * \param theName const Handle(TCollection_ExtendedString)&
94 | */
95 | void Sketcher_Object::SetObjectName(const TCollection_ExtendedString& theName)
96 | {
97 | myName = theName;
98 | }
99 |
100 | /**
101 | * \fn GetObjectName()
102 | * \brief get object name
103 | * \return TCollection_ExtendedString
104 | */
105 | TCollection_ExtendedString Sketcher_Object::GetObjectName()
106 | {
107 | return myName;
108 | }
109 |
110 | /**
111 | * \fn SetGeometryType(const Sketcher_ObjectGeometryTypeHandle(TCollection_ExtendedString)& theGeometryType)
112 | * \brief set type of geometry
113 | * \return void
114 | * \param theGeometryType const Sketcher_ObjectGeometryType
115 | */
116 | void Sketcher_Object::SetGeometryType(const Sketcher_ObjectGeometryType theGeometryType)
117 | {
118 | myGeometryType = theGeometryType;
119 | }
120 |
121 | /**
122 | * \fn GetGeometryType()
123 | * \brief get type of geometry
124 | * \return Sketcher_ObjectGeometryType
125 | */
126 | Sketcher_ObjectGeometryType Sketcher_Object::GetGeometryType()
127 | {
128 | return myGeometryType;
129 | }
130 |
131 | /**
132 | * \fn SetTypeOfMethod(const Sketcher_ObjectTypeOfMethod theTypeOfMethod)
133 | * \brief set object entering method
134 | * \return void
135 | * \param theGeometryType const Sketcher_ObjectTypeOfMethod
136 | */
137 | void Sketcher_Object::SetTypeOfMethod(const Sketcher_ObjectTypeOfMethod theTypeOfMethod)
138 | {
139 | myTypeOfMethod = theTypeOfMethod;
140 | }
141 |
142 | /**
143 | * \fn GetTypeOfMethod()
144 | * \brief get object entering method
145 | * \return Sketcher_ObjectTypeOfMethod
146 | */
147 | Sketcher_ObjectTypeOfMethod Sketcher_Object::GetTypeOfMethod()
148 | {
149 | return myTypeOfMethod;
150 | }
151 |
152 | /**
153 | * \fn SetColor(const Quantity_NameOfColor theColor)
154 | * \brief set color
155 | * \return void
156 | * \param theColor const Quantity_NameOfColor
157 | */
158 | void Sketcher_Object::SetColor(const Quantity_NameOfColor theColor)
159 | {
160 | myNameOfColor = theColor;
161 | }
162 |
163 | /**
164 | * \fn GetColor()
165 | * \brief get color
166 | * \return Quantity_NameOfColor
167 | */
168 | Quantity_NameOfColor Sketcher_Object::GetColor()
169 | {
170 | return myNameOfColor;
171 | }
172 |
173 | /**
174 | * \fn SetType(const Sketcher_ObjectType theType)
175 | * \brief set type of object
176 | * \return void
177 | * \param theType const Sketcher_ObjectType
178 | */
179 | void Sketcher_Object::SetType(const Sketcher_ObjectType theType)
180 | {
181 | myObjectType = theType;
182 | }
183 |
184 | /**
185 | * \fn GetType()
186 | * \brief get object type
187 | * \return Sketcher_ObjectType
188 | */
189 | Sketcher_ObjectType Sketcher_Object::GetType()
190 | {
191 | return myObjectType;
192 | }
193 |
194 | /**
195 | * \fn SetStyle(const Aspect_TypeOfLine theLineStyle)
196 | * \brief set line style
197 | * \return void
198 | * \param theLineStyle const Aspect_TypeOfLine
199 | */
200 | void Sketcher_Object::SetStyle(const Aspect_TypeOfLine theLineStyle)
201 | {
202 | myLineStyle = theLineStyle;
203 | }
204 |
205 | /**
206 | * \fn GetStyle()
207 | * \brief get line style
208 | * \return Aspect_TypeOfLine
209 | */
210 | Aspect_TypeOfLine Sketcher_Object::GetStyle()
211 | {
212 | return myLineStyle;
213 | }
214 |
215 | /**
216 | * \fn SetWidth(const Standard_Real theWidth)
217 | * \brief set line width
218 | * \return void
219 | * \param theWidth const Standard_Real
220 | */
221 | void Sketcher_Object::SetWidth(const Standard_Real theWidth)
222 | {
223 | myWidth = theWidth;
224 | }
225 |
226 | /**
227 | * \fn GetWidth()
228 | * \brief get width
229 | * \return Standard_Real
230 | */
231 | Standard_Real Sketcher_Object::GetWidth()
232 | {
233 | return myWidth;
234 | }
235 |
236 |
--------------------------------------------------------------------------------
/Sketcher_Object.hxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_Object.hxx
3 | * \brief Header file for the class Sketcher_Object
4 | * \author Sergei Maslov
5 | */
6 | #ifndef Sketcher_Object_H
7 | #define Sketcher_Object_H
8 |
9 | #ifndef _Standard_Macro_HeaderFile
10 | #include
11 | #endif
12 |
13 | #include
14 | #include
15 |
16 | #include
17 | #include
18 | #include
19 |
20 | #include "Sketcher_ObjectGeometryType.hxx"
21 | #include "Sketcher_ObjectTypeOfMethod.hxx"
22 | #include
23 | #include "Sketcher_ObjectType.hxx"
24 | #include
25 |
26 | class AIS_InteractiveObject;
27 | class Geom2d_Geometry;
28 |
29 | DEFINE_STANDARD_HANDLE(Sketcher_Object, Standard_Transient)
30 |
31 | //store object and all it's attributes
32 | class Sketcher_Object : public Standard_Transient
33 | {
34 | public:
35 | // Type management
36 | DEFINE_STANDARD_RTTIEXT(Sketcher_Object, Standard_Transient)
37 |
38 | /**
39 | * \fn Sketcher_Object(const Handle(Geom2d_Geometry)& theGeom2d_Geometry,const Handle(AIS_InteractiveObject)& theAIS_InteractiveObject, const TCollection_ExtendedString& theName, const Sketcher_ObjectGeometryType theGeometryType, const Sketcher_ObjectTypeOfMethod theTypeOfMethod)
40 | * \brief Constructs a Sketcher_Object
41 | * \param theGeom2d_Geometry const Handle(Geom2d_Geometry)&
42 | * \param theAIS_InteractiveObject const TCollection_ExtendedString&
43 | * \param theName const TCollection_ExtendedString&
44 | * \param theGeometryType const Sketcher_ObjectGeometryType
45 | * \param theTypeOfMethod const Sketcher_ObjectTypeOfMethod
46 | */
47 | Standard_EXPORT Sketcher_Object(const Handle(Geom2d_Geometry)& theGeom2d_Geometry,const Handle(AIS_InteractiveObject)& theAIS_InteractiveObject,const TCollection_ExtendedString& theName,const Sketcher_ObjectGeometryType theGeometryType,const Sketcher_ObjectTypeOfMethod theTypeOfMethod);
48 |
49 | /**
50 | * \fn ~Sketcher_Object()
51 | * \brief destructor
52 | */
53 | Standard_EXPORT ~Sketcher_Object();
54 |
55 | /**
56 | * \fn SetGeometry(const Handle(Geom2d_Geometry)& theGeom2d_Geometry)
57 | * \brief set Geom2d_Geometry
58 | * \return void
59 | * \param theGeom2d_Geometry const Handle(Geom2d_Geometry)&
60 | */
61 | Standard_EXPORT void SetGeometry(const Handle(Geom2d_Geometry)& theGeom2d_Geometry);
62 | /**
63 | * \fn GetGeometry()
64 | * \brief get Geom2d_Geometry
65 | * \return Handle(Geom2d_Geometry)
66 | */
67 | Standard_EXPORT Handle(Geom2d_Geometry) GetGeometry();
68 |
69 | /**
70 | * \fn SetAIS_Object(const Handle(AIS_InteractiveObject)& theAIS_InteractiveObject)
71 | * \brief set object representation
72 | * \return void
73 | * \param theAIS_InteractiveObject const Handle(AIS_InteractiveObject)&
74 | */
75 |
76 | Standard_EXPORT void SetAIS_Object(const Handle(AIS_InteractiveObject)& theAIS_InteractiveObject);
77 | /**
78 | * \fn GetAIS_Object()
79 | * \brief get object represent
80 | * \return Handle(AIS_InteractiveObject)
81 | */
82 | Standard_EXPORT Handle(AIS_InteractiveObject) GetAIS_Object();
83 |
84 | /**
85 | * \fn SetObjectName(const Handle(TCollection_ExtendedString)& theName)
86 | * \brief set object name
87 | * \return void
88 | * \param theName const Handle(TCollection_ExtendedString)&
89 | */
90 | Standard_EXPORT void SetObjectName(const TCollection_ExtendedString& theName);
91 |
92 | /**
93 | * \fn GetObjectName()
94 | * \brief get object name
95 | * \return TCollection_ExtendedString
96 | */
97 | Standard_EXPORT TCollection_ExtendedString GetObjectName();
98 |
99 | /**
100 | * \fn SetGeometryType(const Sketcher_ObjectGeometryTypeHandle(TCollection_ExtendedString)& theGeometryType)
101 | * \brief set type of geometry
102 | * \return void
103 | * \param theGeometryType const Sketcher_ObjectGeometryType
104 | */
105 | Standard_EXPORT void SetGeometryType(const Sketcher_ObjectGeometryType theGeometryType);
106 |
107 | /**
108 | * \fn GetGeometryType()
109 | * \brief get type of geometry
110 | * \return Sketcher_ObjectGeometryType
111 | */
112 | Standard_EXPORT Sketcher_ObjectGeometryType GetGeometryType();
113 |
114 | /**
115 | * \fn SetTypeOfMethod(const Sketcher_ObjectTypeOfMethod theTypeOfMethod)
116 | * \brief set object entering method
117 | * \return void
118 | * \param theGeometryType const Sketcher_ObjectTypeOfMethod
119 | */
120 | Standard_EXPORT void SetTypeOfMethod(const Sketcher_ObjectTypeOfMethod theTypeOfMethod);
121 |
122 | /**
123 | * \fn GetTypeOfMethod()
124 | * \brief get object entering method
125 | * \return Sketcher_ObjectTypeOfMethod
126 | */
127 | Standard_EXPORT Sketcher_ObjectTypeOfMethod GetTypeOfMethod();
128 |
129 | /**
130 | * \fn SetColor(const Quantity_NameOfColor theColor)
131 | * \brief set color
132 | * \return void
133 | * \param theColor const Quantity_NameOfColor
134 | */
135 | Standard_EXPORT void SetColor(const Quantity_NameOfColor theColor);
136 |
137 | /**
138 | * \fn GetColor()
139 | * \brief get color
140 | * \return Quantity_NameOfColor
141 | */
142 | Standard_EXPORT Quantity_NameOfColor GetColor();
143 |
144 | /**
145 | * \fn SetType(const Sketcher_ObjectType theType)
146 | * \brief set type of object
147 | * \return void
148 | * \param theType const Sketcher_ObjectType
149 | */
150 | Standard_EXPORT void SetType(const Sketcher_ObjectType theType);
151 |
152 | /**
153 | * \fn GetType()
154 | * \brief get object type
155 | * \return Sketcher_ObjectType
156 | */
157 | Standard_EXPORT Sketcher_ObjectType GetType();
158 |
159 | /**
160 | * \fn SetStyle(const Aspect_TypeOfLine theLineStyle)
161 | * \brief set line style
162 | * \return void
163 | * \param theLineStyle const Aspect_TypeOfLine
164 | */
165 | Standard_EXPORT void SetStyle(const Aspect_TypeOfLine theLineStyle);
166 |
167 | /**
168 | * \fn GetStyle()
169 | * \brief get line style
170 | * \return Aspect_TypeOfLine
171 | */
172 | Standard_EXPORT Aspect_TypeOfLine GetStyle();
173 |
174 | /**
175 | * \fn SetWidth(const Standard_Real theWidth)
176 | * \brief set line width
177 | * \return void
178 | * \param theWidth const Standard_Real
179 | */
180 | Standard_EXPORT void SetWidth(const Standard_Real theWidth);
181 |
182 | /**
183 | * \fn GetWidth()
184 | * \brief get width
185 | * \return Standard_Real
186 | */
187 | Standard_EXPORT Standard_Real GetWidth();
188 |
189 | private:
190 |
191 | //members
192 |
193 | Handle(Geom2d_Geometry) myGeometry;
194 | Handle(AIS_InteractiveObject) myAIS_InteractiveObject;
195 |
196 | TCollection_ExtendedString myName;
197 | Sketcher_ObjectGeometryType myGeometryType;
198 | Sketcher_ObjectTypeOfMethod myTypeOfMethod;
199 |
200 | Quantity_NameOfColor myNameOfColor;
201 | Sketcher_ObjectType myObjectType;
202 | Aspect_TypeOfLine myLineStyle;
203 | Standard_Real myWidth;
204 |
205 | };
206 |
207 | #endif
208 |
209 |
--------------------------------------------------------------------------------
/Sketcher_ObjectGeometryType.hxx:
--------------------------------------------------------------------------------
1 | #ifndef Sketcher_ObjectGeometryType_HeaderFile
2 | #define Sketcher_ObjectGeometryType_HeaderFile
3 |
4 | enum Sketcher_ObjectGeometryType
5 | {
6 | PointSketcherObject,
7 | LineSketcherObject,
8 | CircleSketcherObject,
9 | ArcSketcherObject,
10 | CurveSketcherObject
11 | };
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/Sketcher_ObjectType.hxx:
--------------------------------------------------------------------------------
1 | #ifndef Sketcher_ObjectType_HeaderFile
2 | #define Sketcher_ObjectType_HeaderFile
3 |
4 | enum Sketcher_ObjectType
5 | {
6 | MainSketcherType,
7 | AuxiliarySketcherType
8 | };
9 |
10 | #endif
11 |
--------------------------------------------------------------------------------
/Sketcher_ObjectTypeOfMethod.hxx:
--------------------------------------------------------------------------------
1 | #ifndef Sketcher_ObjectTypeOfMethod_HeaderFile
2 | #define Sketcher_ObjectTypeOfMethod_HeaderFile
3 |
4 | enum Sketcher_ObjectTypeOfMethod
5 | {
6 | Nothing_Method,
7 | Point_Method,
8 | Line2P_Method,
9 | CircleCenterRadius_Method,
10 | Circle3P_Method,
11 | Circle2PTan_Method,
12 | CircleP2Tan_Method,
13 | Circle3Tan_Method,
14 | Arc3P_Method,
15 | ArcCenter2P_Method,
16 | BezierCurve_Method,
17 | Trim_Method
18 | };
19 |
20 | enum TangentType
21 | {
22 | NothingTangent,
23 | Line_FirstPnt,
24 | Line_SecondPnt,
25 | Circle_CenterPnt
26 | };
27 |
28 | #endif
29 |
--------------------------------------------------------------------------------
/Sketcher_Property.hxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_Property.hxx
3 | * \brief Header file for the class Sketcher_Property
4 | * \author Sergei Maslov
5 | */
6 | #ifndef Sketcher_Property_H
7 | #define Sketcher_Property_H
8 |
9 | #include
10 | #include
11 |
12 | #include
13 | #include
14 | #include
15 | #include
16 | #include
17 | #include
18 | #include
19 | #include
20 |
21 | #include
22 | #include
23 | #include
24 | #include
25 |
26 | #include
27 | #include
28 | #include
29 | #include
30 |
31 | #include "Sketcher_Object.hxx"
32 |
33 |
34 | class QVBoxLayout;
35 | class QHBoxLayout;
36 | class QGridLayout;
37 | class QComboBox;
38 | class QGroupBox;
39 | class QLabel;
40 | class QLineEdit;
41 | class QPushButton;
42 |
43 | //base class for editing object classes
44 | class Sketcher_Property : public QWidget
45 | {
46 | Q_OBJECT
47 |
48 | public:
49 |
50 | //methods
51 |
52 | /**
53 | * \fn Sketcher_Property( QWidget* parent, const char* name, WFlags fl )
54 | * \brief Constructs a Sketcher_Property which is a child of 'parent', with the name 'name' and widget flags set to 'f'
55 | * \param parent QWidget*
56 | * \param name const char*
57 | * \param fl WFlags
58 | */
59 | Sketcher_Property( QWidget* parent = 0, const char* name = 0);
60 |
61 | /**
62 | * \fn ~Sketcher_Property()
63 | * \brief destructor
64 | */
65 | ~Sketcher_Property();
66 |
67 |
68 | /**
69 | * \fn SetContext(Handle(AIS_InteractiveContext)& theContext)
70 | * \brief set context
71 | * \return void
72 | * \param theContext Handle(AIS_InteractiveContext)&
73 | */
74 | void SetContext (Handle(AIS_InteractiveContext)& theContext);
75 |
76 | /**
77 | * \fn SetAx3(const gp_Ax3& theAx3)
78 | * \brief set coordinate system
79 | * \return void
80 | * \param theAx3 const gp_Ax3&
81 | */
82 | void SetAx3 (const gp_Ax3& theAx3);
83 |
84 | /**
85 | * \fn SetObject(Handle(Sketcher_Object)& CurObject)
86 | * \brief set Sketcher_Object, show dialog window
87 | * \return void
88 | * \param CurObject Handle(Sketcher_Object)&
89 | */
90 | void SetObject(Handle(Sketcher_Object)& CurObject);
91 |
92 | //members
93 |
94 | QLabel* TextLabelID;
95 | QLineEdit* LineEditID;
96 |
97 | QGroupBox* GroupBoxGP;
98 | QLabel* TextLabelPoint1;
99 | QLineEdit* LineEditPoint1;
100 |
101 | QGroupBox* GroupBoxAttributes;
102 | QLabel* TextLabelColor;
103 | QComboBox* ComboBoxColor;
104 | QLabel* TextLabelType;
105 | QComboBox* ComboBoxType;
106 |
107 | QLabel* TextLabelStyle;
108 | QComboBox* ComboBoxStyle;
109 | QLabel* TextLabelWidth;
110 | QComboBox* ComboBoxWidth;
111 |
112 | QPushButton* PushButtonOK;
113 | QPushButton* PushButtonCancel;
114 | QPushButton* PushButtonApply;
115 |
116 | private slots:
117 | /**
118 | * \fn onOK()
119 | * \brief clicking on "OK" button handler
120 | * \return void
121 | */
122 | void onOK();
123 |
124 | /**
125 | * \fn onApply()
126 | * \brief clicking on "Apply" button handler
127 | * \return void
128 | */
129 | void onApply();
130 |
131 | protected:
132 |
133 | //methods
134 |
135 | /**
136 | * \fn Init()
137 | * \brief Constructs a supplementary elements
138 | * \return void
139 | */
140 | void Init();
141 |
142 | /**
143 | * \fn SetGeometry()
144 | * \brief show object geometry in dialog window
145 | * \return void
146 | */
147 | virtual void SetGeometry() = 0;
148 |
149 | /**
150 | * \fn CheckGeometry()
151 | * \brief check geometry for change
152 | * \return bool
153 | */
154 | virtual bool CheckGeometry() = 0;
155 |
156 | /**
157 | * \fn GetGeometry()
158 | * \brief create new object
159 | * \return bool
160 | */
161 | virtual bool GetGeometry() = 0;
162 |
163 | /**
164 | * \fn SetID()
165 | * \brief set object name to LineEditID
166 | * \return void
167 | */
168 | void SetID ();
169 |
170 | /**
171 | * \fn GetID()
172 | * \brief get text from LineEditID
173 | * \return TCollection_ExtendedString
174 | */
175 | TCollection_ExtendedString GetID ();
176 |
177 | /**
178 | * \fn SetCoord(QLineEdit* le,const gp_Pnt2d& p)
179 | * \brief set point coordinate to le
180 | * \return void
181 | * \param le QLineEdit*
182 | * \param p const gp_Pnt2d&
183 | */
184 | void SetCoord(QLineEdit* le,const gp_Pnt2d& p);
185 |
186 | /**
187 | * \fn CheckCoord(QLineEdit* le,const gp_Pnt2d& p)
188 | * \brief get point coordinate from le
189 | * \return bool
190 | * \param le QLineEdit*
191 | * \param p const gp_Pnt2d&
192 | */
193 | bool CheckCoord(QLineEdit* le, gp_Pnt2d& p);
194 |
195 | /**
196 | * \fn CheckAttributies()
197 | * \brief check attributes for change
198 | * \return void
199 | */
200 | void CheckAttributies();
201 |
202 | /**
203 | * \fn GetAttributies()
204 | * \brief set attributes to object
205 | * \return void
206 | */
207 | void GetAttributies();
208 |
209 | /**
210 | * \fn GetName()
211 | * \brief check name and type of object for change
212 | * \return void
213 | */
214 | void GetName();
215 |
216 | /**
217 | * \fn SetColor()
218 | * \brief show object color in dialog window
219 | * \return void
220 | */
221 | void SetColor();
222 |
223 | /**
224 | * \fn GetColor()
225 | * \brief get object color from dialog window
226 | * \return Quantity_NameOfColor
227 | */
228 | Quantity_NameOfColor GetColor();
229 |
230 | /**
231 | * \fn SetObjectType()
232 | * \brief show object type in dialog window
233 | * \return void
234 | */
235 | void SetObjectType();
236 |
237 | /**
238 | * \fn GetObjectType()
239 | * \brief get object type from dialog window
240 | * \return Sketcher_ObjectType
241 | */
242 | Sketcher_ObjectType GetObjectType();
243 |
244 | /**
245 | * \fn SetObjectStyle()
246 | * \brief show object line style in dialog window
247 | * \return void
248 | */
249 | void SetObjectStyle();
250 |
251 | /**
252 | * \fn GetObjectStyle()
253 | * \brief get object line style from dialog window
254 | * \return Aspect_TypeOfLine
255 | */
256 | Aspect_TypeOfLine GetObjectStyle();
257 |
258 | /**
259 | * \fn SetWidth()
260 | * \brief show object line width in dialog window
261 | * \return void
262 | */
263 | void SetWidth();
264 |
265 | /**
266 | * \fn GetWidth()
267 | * \brief get object line width from dialog window
268 | * \return Standard_Real
269 | */
270 | Standard_Real GetWidth();
271 |
272 |
273 | //members
274 |
275 | QGridLayout* PropertyLayout;
276 | QGridLayout* GroupBoxGPLayout;
277 | QGridLayout* GroupBoxAttributesLayout;
278 |
279 | bool isPointWindow;
280 |
281 | const QString StartCoord,MidCoord,EndCoord;
282 | const QRegExp NumberExpr;
283 | QString NumName;
284 |
285 | Handle(AIS_InteractiveContext) myContext;
286 | gp_Ax3 myCoordinateSystem;
287 |
288 | Handle(Sketcher_Object) mySObject;
289 | Handle(AIS_InteractiveObject) myAIS_Object;
290 | TCollection_ExtendedString myID,tempID;
291 | Quantity_NameOfColor myNameOfColor;
292 | Sketcher_ObjectType myObjectType;
293 | Aspect_TypeOfLine myObjectStyle;
294 | Standard_Real myWidth;
295 |
296 | Handle(Prs3d_Drawer) myDrawer;
297 | Handle(Prs3d_LineAspect) myPrs3dAspect;
298 | gp_Pnt2d firstPnt2d,tempPnt2d;
299 |
300 | };
301 |
302 | #endif // Sketcher_Property_H
303 |
--------------------------------------------------------------------------------
/Sketcher_PropertyArc.cxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_PropertyArc.cxx
3 | * \brief Implementation file for the class Sketcher_PropertyArc
4 | * \author Sergei Maslov
5 | */
6 | #include "Sketcher_PropertyArc.hxx"
7 |
8 | /**
9 | * \fn Sketcher_PropertyArc( QWidget* parent, const char* name, WFlags fl )
10 | * \brief Constructs a Sketcher_PropertyArc which is a child of 'parent', with the name 'name' and widget flags set to 'f'
11 | * \param parent QWidget*
12 | * \param name const char*
13 | * \param fl WFlags
14 | */
15 | Sketcher_PropertyArc::Sketcher_PropertyArc( QWidget* parent, const char* name)
16 | : Sketcher_Property( parent, name)
17 | {
18 | if ( !name )
19 | setWindowTitle( tr( "ArcProperties" ) );
20 |
21 | ////////////////////////////////////////////////////////////////////////////////
22 |
23 | TextLabelPoint1->setText( tr( "Center" ) );
24 | TextLabelRadius = new QLabel("TextLabelRadius", GroupBoxGP );
25 | TextLabelRadius->setText( tr( "Radius" ) );
26 | LineEditRadius = new QLineEdit( "LineEditRadius", GroupBoxGP);
27 |
28 | TextLabelStartArc = new QLabel( "TextLabelStartArc", GroupBoxGP);
29 | TextLabelStartArc->setText( tr( "Start" ) );
30 | LineEditStartArc = new QLineEdit( "LineEditStartArc", GroupBoxGP);
31 | TextLabelEndArc = new QLabel("TextLabelEndArc", GroupBoxGP);
32 | TextLabelEndArc->setText( tr( "End" ) );
33 | LineEditEndArc = new QLineEdit( "LineEditEndArc", GroupBoxGP);
34 |
35 |
36 | GroupBoxGPLayout->addWidget( TextLabelRadius, 1, 0 );
37 | GroupBoxGPLayout->addWidget( LineEditRadius, 1, 1 );
38 | GroupBoxGPLayout->addWidget( TextLabelStartArc, 2, 0 );
39 | GroupBoxGPLayout->addWidget( LineEditStartArc, 2, 1 );
40 | GroupBoxGPLayout->addWidget( TextLabelEndArc, 3, 0 );
41 | GroupBoxGPLayout->addWidget( LineEditEndArc, 3, 1 );
42 |
43 | ///////////////////////////////////////////////////////////////////////////////
44 |
45 | Init();
46 |
47 | ////////////////////////////////////////////////////////////////////////////////////
48 |
49 | }
50 |
51 | /**
52 | * \fn ~Sketcher_PropertyArc()
53 | * \brief destructor
54 | */
55 | Sketcher_PropertyArc::~Sketcher_PropertyArc()
56 | {
57 | // no need to delete child widgets, Qt does it all for us
58 | }
59 |
60 |
61 | /**
62 | * \fn SetGeometry()
63 | * \brief show object geometry in dialog window
64 | * \return void
65 | */
66 | void Sketcher_PropertyArc::SetGeometry()
67 | {
68 | curGeom2d_Arc = Handle(Geom2d_Arc)::DownCast(mySObject->GetGeometry());
69 |
70 | firstPnt2d = curGeom2d_Arc->Location();
71 | myRadius = curGeom2d_Arc->Radius();
72 | myFirstParameter = curGeom2d_Arc->FirstParameter() / (2*M_PI);
73 | myLastParameter = curGeom2d_Arc->LastParameter() / (2*M_PI);
74 |
75 | SetCoord(LineEditPoint1,firstPnt2d);
76 | LineEditRadius->setText(QString::number(myRadius));
77 | LineEditStartArc->setText(QString::number(myFirstParameter ));
78 | LineEditEndArc->setText(QString::number(myLastParameter));
79 | }
80 |
81 |
82 | /**
83 | * \fn CheckGeometry()
84 | * \brief check geometry for change
85 | * \return bool
86 | */
87 | bool Sketcher_PropertyArc::CheckGeometry()
88 | {
89 | if (CheckCoord(LineEditPoint1,tempPnt2d ))
90 | {
91 | NumName = LineEditRadius->text();
92 | tempRadius = NumName.toDouble();
93 | if(NumName.contains(NumberExpr) == 0 && !NumName.isNull() && tempRadius > 0)
94 | {
95 | NumName = LineEditStartArc->text();
96 | tempFirstParameter = NumName.toDouble();
97 | if(NumName.contains(NumberExpr) == 0 && !NumName.isNull())
98 | {
99 | NumName = LineEditEndArc->text();
100 | tempLastParameter = NumName.toDouble();
101 | if(NumName.contains(NumberExpr) == 0 && !NumName.isNull())
102 | return true;
103 | else LineEditEndArc->selectAll();
104 | }
105 | else LineEditStartArc->selectAll();
106 | }
107 | else LineEditRadius->selectAll();
108 | }
109 | return false;
110 | }
111 |
112 | /**
113 | * \fn GetGeometry()
114 | * \brief create new object
115 | * \return bool
116 | */
117 | bool Sketcher_PropertyArc::GetGeometry()
118 | {
119 | if(!firstPnt2d.IsEqual(tempPnt2d,1.0e-6) || myRadius != tempRadius || myFirstParameter != tempFirstParameter || myLastParameter != tempLastParameter )
120 | {
121 | gce_MakeCirc2d tempMakeCirc2d(tempPnt2d,tempRadius);
122 | if (tempMakeCirc2d.Status() == gce_Done)
123 | {
124 | firstPnt2d = tempPnt2d;
125 | myRadius = tempRadius;
126 |
127 | curGeom2d_Arc->SetCirc2d(tempMakeCirc2d.Value());
128 | curGeom2d_Arc->SetFirstParam(tempFirstParameter * 2*M_PI);
129 | curGeom2d_Arc->SetLastParam(tempLastParameter * 2*M_PI);
130 | myFirstParameter = curGeom2d_Arc->FirstParameter();
131 | myLastParameter = curGeom2d_Arc->LastParameter();
132 |
133 | Handle(Geom_Circle) newGeom_Circle = new Geom_Circle(ElCLib::To3d(myCoordinateSystem.Ax2(),curGeom2d_Arc->Circ2d()));
134 | Handle(AIS_Circle) newAIS_Circle = new AIS_Circle(newGeom_Circle);
135 | newAIS_Circle->SetFirstParam(myFirstParameter);
136 | newAIS_Circle->SetLastParam (myLastParameter);
137 | myFirstParameter /= (2*M_PI);
138 | myLastParameter /= (2*M_PI);
139 |
140 | myContext->Remove(myAIS_Object, true);
141 | myAIS_Object = newAIS_Circle;
142 |
143 | LineEditStartArc->setText(QString::number(myFirstParameter));
144 | LineEditEndArc->setText(QString::number(myLastParameter));
145 | return true;
146 | }
147 | }
148 | return false;
149 | }
150 |
151 |
--------------------------------------------------------------------------------
/Sketcher_PropertyArc.hxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_PropertyArc.hxx
3 | * \brief Header file for the class Sketcher_PropertyArc
4 | * \author Sergei Maslov
5 | */
6 | #ifndef Sketcher_PropertyArc_H
7 | #define Sketcher_PropertyArc_H
8 |
9 | #include "Sketcher_Property.hxx"
10 | #include "Geom2d_Arc.hxx"
11 |
12 | #include
13 | #include
14 | #include
15 |
16 | //class editing arc
17 | class Sketcher_PropertyArc : public Sketcher_Property
18 | {
19 | Q_OBJECT
20 |
21 | public:
22 |
23 | //methods
24 |
25 | /**
26 | * \fn Sketcher_PropertyArc( QWidget* parent, const char* name, WFlags fl )
27 | * \brief Constructs a Sketcher_PropertyArc which is a child of 'parent', with the name 'name' and widget flags set to 'f'
28 | * \param parent QWidget*
29 | * \param name const char*
30 | * \param fl WFlags
31 | */
32 | Sketcher_PropertyArc( QWidget* parent = 0, const char* name = 0);
33 |
34 | /**
35 | * \fn ~Sketcher_PropertyArc()
36 | * \brief destructor
37 | */
38 | ~Sketcher_PropertyArc();
39 |
40 |
41 | //members
42 |
43 | QLabel* TextLabelRadius;
44 | QLineEdit* LineEditRadius;
45 | QLabel* TextLabelStartArc;
46 | QLineEdit* LineEditStartArc;
47 | QLabel* TextLabelEndArc;
48 | QLineEdit* LineEditEndArc;
49 |
50 | private:
51 |
52 | //methods
53 |
54 | /**
55 | * \fn SetGeometry()
56 | * \brief show object geometry in dialog window
57 | * \return void
58 | */
59 | void SetGeometry();
60 |
61 | /**
62 | * \fn CheckGeometry()
63 | * \brief check geometry for change
64 | * \return bool
65 | */
66 | bool CheckGeometry();
67 |
68 | /**
69 | * \fn GetGeometry()
70 | * \brief create new object
71 | * \return bool
72 | */
73 | bool GetGeometry();
74 |
75 | //members
76 |
77 | Handle(Geom2d_Arc) curGeom2d_Arc;
78 | double myRadius,tempRadius;
79 | double myFirstParameter,myLastParameter,tempFirstParameter,tempLastParameter;
80 | };
81 |
82 | #endif // Sketcher_PropertyArc_H
83 |
--------------------------------------------------------------------------------
/Sketcher_PropertyCircle.cxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_PropertyCircle.cxx
3 | * \brief Implementation file for the class Sketcher_PropertyCircle
4 | * \author Sergei Maslov
5 | */
6 | #include "Sketcher_PropertyCircle.hxx"
7 |
8 | /**
9 | * \fn Sketcher_PropertyCircle( QWidget* parent, const char* name, WFlags fl )
10 | * \brief Constructs a Sketcher_PropertyCircle which is a child of 'parent', with the name 'name' and widget flags set to 'f'
11 | * \param parent QWidget*
12 | * \param name const char*
13 | * \param fl WFlags
14 | */
15 | Sketcher_PropertyCircle::Sketcher_PropertyCircle( QWidget* parent, const char* name)
16 | : Sketcher_Property( parent, name)
17 | {
18 | if ( !name )
19 | setWindowTitle( "Property of Circle" );
20 | //setCaption( tr( "CircleProperties" ) );
21 |
22 | ////////////////////////////////////////////////////////////////////////////////
23 |
24 | TextLabelPoint1->setText( tr( "Center" ) );
25 | TextLabelRadius = new QLabel( "TextLabelRadius", GroupBoxGP);
26 | TextLabelRadius->setText( tr( "Radius" ) );
27 | LineEditRadius = new QLineEdit("LineEditRadius", GroupBoxGP);
28 |
29 | GroupBoxGPLayout->addWidget( TextLabelRadius, 1, 0 );
30 | GroupBoxGPLayout->addWidget( LineEditRadius, 1, 1 );
31 |
32 | ///////////////////////////////////////////////////////////////////////////////
33 |
34 | Init();
35 |
36 | ////////////////////////////////////////////////////////////////////////////////////
37 |
38 | }
39 |
40 | /**
41 | * \fn ~Sketcher_PropertyCircle()
42 | * \brief destructor
43 | */
44 | Sketcher_PropertyCircle::~Sketcher_PropertyCircle()
45 | {
46 | // no need to delete child widgets, Qt does it all for us
47 | }
48 |
49 |
50 | /**
51 | * \fn SetGeometry()
52 | * \brief show object geometry in dialog window
53 | * \return void
54 | */
55 | void Sketcher_PropertyCircle::SetGeometry()
56 | {
57 | curGeom2d_Circle = Handle(Geom2d_Circle)::DownCast(mySObject->GetGeometry());
58 |
59 | firstPnt2d = curGeom2d_Circle->Location();
60 | myRadius = curGeom2d_Circle->Radius();
61 |
62 | SetCoord(LineEditPoint1,firstPnt2d);
63 | LineEditRadius->setText(QString::number(myRadius));
64 | }
65 |
66 |
67 | /**
68 | * \fn CheckGeometry()
69 | * \brief check geometry for change
70 | * \return bool
71 | */
72 | bool Sketcher_PropertyCircle::CheckGeometry()
73 | {
74 | if (CheckCoord(LineEditPoint1,tempPnt2d ))
75 | {
76 | NumName = LineEditRadius->text();
77 | tempRadius = NumName.toDouble();
78 | if(NumName.contains(NumberExpr) == 0 && !NumName.isNull() && tempRadius > 0)
79 | return true;
80 | else LineEditRadius->selectAll();
81 | }
82 | return false;
83 | }
84 |
85 | /**
86 | * \fn GetGeometry()
87 | * \brief create new object
88 | * \return bool
89 | */
90 | bool Sketcher_PropertyCircle::GetGeometry()
91 | {
92 | if(!firstPnt2d.IsEqual(tempPnt2d,1.0e-6) || myRadius !=tempRadius)
93 | {
94 | firstPnt2d = tempPnt2d;
95 | myRadius = tempRadius;
96 |
97 | curGeom2d_Circle->SetLocation(firstPnt2d);
98 | curGeom2d_Circle->SetRadius(myRadius);
99 | Handle(Geom_Circle) newGeom_Circle = new Geom_Circle(myCoordinateSystem.Ax2(),myRadius);
100 | newGeom_Circle->SetLocation(ElCLib::To3d(myCoordinateSystem.Ax2(),firstPnt2d));
101 | Handle(AIS_Circle) newAIS_Circle = new AIS_Circle(newGeom_Circle);
102 |
103 | myContext->Remove(myAIS_Object, true);
104 | myAIS_Object = newAIS_Circle;
105 | return true;
106 | }
107 | return false;
108 | }
109 |
--------------------------------------------------------------------------------
/Sketcher_PropertyCircle.hxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_PropertyCircle.hxx
3 | * \brief Header file for the class Sketcher_PropertyCircle
4 | * \author Sergei Maslov
5 | */
6 | #ifndef Sketcher_PropertyCircle_H
7 | #define Sketcher_PropertyCircle_H
8 |
9 | #include "Sketcher_Property.hxx"
10 |
11 | #include
12 | #include
13 | #include
14 |
15 | //class editing circle
16 | class Sketcher_PropertyCircle : public Sketcher_Property
17 | {
18 | Q_OBJECT
19 |
20 | public:
21 |
22 | //methods
23 |
24 | /**
25 | * \fn Sketcher_PropertyCircle( QWidget* parent, const char* name, WFlags fl )
26 | * \brief Constructs a Sketcher_PropertyCircle which is a child of 'parent', with the name 'name' and widget flags set to 'f'
27 | * \param parent QWidget*
28 | * \param name const char*
29 | * \param fl WFlags
30 | */
31 | Sketcher_PropertyCircle( QWidget* parent = 0, const char* name = 0);
32 |
33 | /**
34 | * \fn ~Sketcher_PropertyCircle()
35 | * \brief destructor
36 | */
37 | ~Sketcher_PropertyCircle();
38 |
39 | //members
40 |
41 | QLabel* TextLabelRadius;
42 | QLineEdit* LineEditRadius;
43 |
44 | private:
45 |
46 | //method
47 |
48 | /**
49 | * \fn SetGeometry()
50 | * \brief show object geometry in dialog window
51 | * \return void
52 | */
53 | void SetGeometry();
54 |
55 | /**
56 | * \fn CheckGeometry()
57 | * \brief check geometry for change
58 | * \return bool
59 | */
60 | bool CheckGeometry();
61 |
62 | /**
63 | * \fn GetGeometry()
64 | * \brief create new object
65 | * \return bool
66 | */
67 | bool GetGeometry();
68 |
69 | //members
70 |
71 | Handle(Geom2d_Circle) curGeom2d_Circle;
72 | double myRadius,tempRadius;
73 |
74 | };
75 |
76 | #endif // Sketcher_PropertyCircle_H
77 |
--------------------------------------------------------------------------------
/Sketcher_PropertyLine.cxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_PropertyLine.cxx
3 | * \brief Implementation file for the class Sketcher_PropertyLine
4 | * \author Sergei Maslov
5 | */
6 | #include "Sketcher_PropertyLine.hxx"
7 |
8 | /**
9 | * \fn Sketcher_PropertyLine( QWidget* parent, const char* name, WFlags fl )
10 | * \brief Constructs a Sketcher_PropertyLine which is a child of 'parent', with the name 'name' and widget flags set to 'f'
11 | * \param parent QWidget*
12 | * \param name const char*
13 | * \param fl WFlags
14 | */
15 | Sketcher_PropertyLine::Sketcher_PropertyLine( QWidget* parent, const char* name)
16 | : Sketcher_Property( parent, name)
17 | {
18 | if ( !name )
19 | setWindowTitle( "Property of Line" );
20 | //setCaption( tr( "LinesProperties" ) );
21 |
22 | ////////////////////////////////////////////////////////////////////////////////
23 |
24 | TextLabelPoint1->setText( tr( "Point 1" ) );
25 | TextLabelPoint2 = new QLabel( "TextLabelPoint2", GroupBoxGP);
26 | TextLabelPoint2->setText( tr( "Point 2" ) );
27 | LineEditPoint2 = new QLineEdit( "LineEditPoint2", GroupBoxGP);
28 |
29 | GroupBoxGPLayout->addWidget( TextLabelPoint2, 1, 0 );
30 | GroupBoxGPLayout->addWidget( LineEditPoint2, 1, 1 );
31 |
32 | ///////////////////////////////////////////////////////////////////////////////
33 | Init();
34 |
35 | TextLabelLength = new QLabel("TextLabelLength", GroupBoxAttributes);
36 | TextLabelLength->setText( tr( "Length" ) );
37 | LineEditLength = new QLineEdit("LineEditLength", GroupBoxAttributes);
38 | LineEditLength->setEnabled( FALSE );
39 |
40 | GroupBoxAttributesLayout->addWidget( TextLabelLength, 4, 0 );
41 | GroupBoxAttributesLayout->addWidget( LineEditLength, 4, 1 );
42 |
43 | ////////////////////////////////////////////////////////////////////////////////////
44 |
45 | }
46 |
47 | /**
48 | * \fn ~Sketcher_PropertyLine()
49 | * \brief destructor
50 | */
51 | Sketcher_PropertyLine::~Sketcher_PropertyLine()
52 | {
53 | // no need to delete child widgets, Qt does it all for us
54 | }
55 |
56 | /**
57 | * \fn SetGeometry()
58 | * \brief show object geometry in dialog window
59 | * \return void
60 | */
61 | void Sketcher_PropertyLine::SetGeometry()
62 | {
63 | curGeom2d_Edge = Handle(Geom2d_Edge)::DownCast(mySObject->GetGeometry());
64 |
65 | firstPnt2d = curGeom2d_Edge->GetStart_Pnt();
66 | secondPnt2d = curGeom2d_Edge->GetEnd_Pnt();
67 |
68 | SetCoord(LineEditPoint1,firstPnt2d);
69 | SetCoord(LineEditPoint2,secondPnt2d);
70 | SetLineLength();
71 | }
72 |
73 | /**
74 | * \fn CheckGeometry()
75 | * \brief check geometry for change
76 | * \return bool
77 | */
78 | bool Sketcher_PropertyLine::CheckGeometry()
79 | {
80 | if (CheckCoord(LineEditPoint1,tempPnt2d ))
81 | return CheckCoord(LineEditPoint2,temp2Pnt2d);
82 | else return false;
83 | }
84 |
85 | /**
86 | * \fn GetGeometry()
87 | * \brief create new object
88 | * \return bool
89 | */
90 | bool Sketcher_PropertyLine::GetGeometry()
91 | {
92 | if(!firstPnt2d.IsEqual(tempPnt2d,1.0e-6) || !secondPnt2d.IsEqual(temp2Pnt2d,1.0e-6))
93 | {
94 | if (curGeom2d_Edge->SetPoints(tempPnt2d,temp2Pnt2d))
95 | {
96 | firstPnt2d = tempPnt2d;
97 | secondPnt2d = temp2Pnt2d;
98 |
99 | Handle (Geom_CartesianPoint) Point1 = new Geom_CartesianPoint(ElCLib::To3d(myCoordinateSystem.Ax2(),firstPnt2d));
100 | Handle (Geom_CartesianPoint) Point2 = new Geom_CartesianPoint(ElCLib::To3d(myCoordinateSystem.Ax2(),secondPnt2d));
101 | Handle(AIS_Line) newAIS_Line = new AIS_Line(Point1,Point2);
102 |
103 | myContext->Remove(myAIS_Object, true);
104 | myAIS_Object = newAIS_Line;
105 |
106 | SetLineLength();
107 | return true;
108 | }
109 | }
110 | return false;
111 | }
112 |
113 | /**
114 | * \fn SetLineLength()
115 | * \brief show line length in dialog window
116 | * \return void
117 | */
118 | void Sketcher_PropertyLine::SetLineLength()
119 | {
120 | double x = sqrt(pow((firstPnt2d.X()-secondPnt2d.X()),2) + pow((firstPnt2d.Y()-secondPnt2d.Y()),2));
121 | LineEditLength->setText(QString::number(x));
122 | }
123 |
124 |
--------------------------------------------------------------------------------
/Sketcher_PropertyLine.hxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_PropertyLine.hxx
3 | * \brief Header file for the class Sketcher_PropertyLine
4 | * \author Sergei Maslov
5 | */
6 | #ifndef Sketcher_PropertyLine_H
7 | #define Sketcher_PropertyLine_H
8 |
9 | #include "Sketcher_Property.hxx"
10 | #include "Geom2d_Edge.hxx"
11 |
12 | #include
13 | #include
14 |
15 | //class editing line (edge)
16 | class Sketcher_PropertyLine : public Sketcher_Property
17 | {
18 | Q_OBJECT
19 |
20 | public:
21 |
22 | //methods
23 |
24 | /**
25 | * \fn Sketcher_PropertyLine( QWidget* parent, const char* name, WFlags fl )
26 | * \brief Constructs a Sketcher_PropertyLine which is a child of 'parent', with the name 'name' and widget flags set to 'f'
27 | * \param parent QWidget*
28 | * \param name const char*
29 | * \param fl WFlags
30 | */
31 | Sketcher_PropertyLine( QWidget* parent = 0, const char* name = 0);
32 |
33 | /**
34 | * \fn ~Sketcher_PropertyLine()
35 | * \brief destructor
36 | */
37 | ~Sketcher_PropertyLine();
38 |
39 | //members
40 |
41 | QLabel* TextLabelPoint2;
42 | QLineEdit* LineEditPoint2;
43 |
44 | QLabel* TextLabelLength;
45 | QLineEdit* LineEditLength;
46 |
47 | private:
48 |
49 | //method
50 |
51 | /**
52 | * \fn SetGeometry()
53 | * \brief show object geometry in dialog window
54 | * \return void
55 | */
56 | void SetGeometry();
57 |
58 | /**
59 | * \fn CheckGeometry()
60 | * \brief check geometry for change
61 | * \return bool
62 | */
63 | bool CheckGeometry();
64 |
65 | /**
66 | * \fn GetGeometry()
67 | * \brief create new object
68 | * \return bool
69 | */
70 | bool GetGeometry();
71 |
72 | /**
73 | * \fn SetLineLength()
74 | * \brief show line length in dialog window
75 | * \return void
76 | */
77 | void SetLineLength();
78 |
79 | //members
80 |
81 | Handle(Geom2d_Edge) curGeom2d_Edge;
82 | gp_Pnt2d secondPnt2d,temp2Pnt2d;
83 |
84 | };
85 |
86 | #endif // Sketcher_PropertyLine_H
87 |
--------------------------------------------------------------------------------
/Sketcher_PropertyPoint.cxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_PropertyPoint.cxx
3 | * \brief Implementation file for the class Sketcher_PropertyPoint
4 | * \author Sergei Maslov
5 | */
6 | #include "Sketcher_PropertyPoint.hxx"
7 |
8 | /**
9 | * \fn Sketcher_PropertyPoint( QWidget* parent, const char* name, WFlags fl )
10 | * \brief Constructs a Sketcher_PropertyPoint which is a child of 'parent', with the name 'name' and widget flags set to 'f'
11 | * \param parent QWidget*
12 | * \param name const char*
13 | * \param fl WFlags
14 | */
15 | Sketcher_PropertyPoint::Sketcher_PropertyPoint( QWidget* parent, const char* name)
16 | : Sketcher_Property( parent, name)
17 | {
18 | if ( !name )
19 | setWindowTitle( "Property Points" );
20 | //setCaption( tr( "PointsProperties" ) );
21 |
22 | TextLabelPoint1->setText( tr( "Point " ) );
23 | isPointWindow = true;
24 | }
25 |
26 | /**
27 | * \fn ~Sketcher_PropertyPoint()
28 | * \brief destructor
29 | */
30 | Sketcher_PropertyPoint::~Sketcher_PropertyPoint()
31 | {
32 | // no need to delete child widgets, Qt does it all for us
33 | }
34 |
35 |
36 | /**
37 | * \fn SetGeometry()
38 | * \brief show object geometry in dialog window
39 | * \return void
40 | */
41 | void Sketcher_PropertyPoint::SetGeometry()
42 | {
43 | curGeom2d_Point = Handle(Geom2d_CartesianPoint)::DownCast(mySObject->GetGeometry());
44 | firstPnt2d = curGeom2d_Point->Pnt2d();
45 |
46 | SetCoord(LineEditPoint1,firstPnt2d);
47 | }
48 |
49 |
50 | /**
51 | * \fn CheckGeometry()
52 | * \brief check geometry for change
53 | * \return bool
54 | */
55 | bool Sketcher_PropertyPoint::CheckGeometry()
56 | {
57 | return CheckCoord(LineEditPoint1,tempPnt2d);
58 | }
59 |
60 | /**
61 | * \fn GetGeometry()
62 | * \brief create new object
63 | * \return bool
64 | */
65 | bool Sketcher_PropertyPoint::GetGeometry()
66 | {
67 | if(!firstPnt2d.IsEqual(tempPnt2d,1.0e-6))
68 | {
69 | firstPnt2d = tempPnt2d;
70 |
71 | curGeom2d_Point->SetPnt2d(firstPnt2d);
72 | Handle (Geom_CartesianPoint) newGeom_Point = new Geom_CartesianPoint(ElCLib::To3d(myCoordinateSystem.Ax2(),firstPnt2d));
73 | Handle(AIS_Point) newAIS_Point = new AIS_Point(newGeom_Point);
74 |
75 | myContext->Remove(myAIS_Object, true);
76 | myAIS_Object = newAIS_Point;
77 | return true;
78 | }
79 | return false;
80 | }
81 |
82 |
--------------------------------------------------------------------------------
/Sketcher_PropertyPoint.hxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_PropertyPoint.hxx
3 | * \brief Header file for the class Sketcher_PropertyPoint
4 | * \author Sergei Maslov
5 | */
6 | #ifndef Sketcher_PropertyPoint_H
7 | #define Sketcher_PropertyPoint_H
8 |
9 | #include "Sketcher_Property.hxx"
10 |
11 | #include
12 | #include
13 | #include
14 |
15 | //class editing point
16 | class Sketcher_PropertyPoint : public Sketcher_Property
17 | {
18 | Q_OBJECT
19 |
20 | public:
21 |
22 | //methods
23 |
24 | /**
25 | * \fn Sketcher_PropertyPoint( QWidget* parent, const char* name, WFlags fl )
26 | * \brief Constructs a Sketcher_PropertyPoint which is a child of 'parent', with the name 'name' and widget flags set to 'f'
27 | * \param parent QWidget*
28 | * \param name const char*
29 | * \param fl WFlags
30 | */
31 | Sketcher_PropertyPoint( QWidget* parent = 0, const char* name = 0);
32 |
33 | /**
34 | * \fn ~Sketcher_PropertyPoint()
35 | * \brief destructor
36 | */
37 | ~Sketcher_PropertyPoint();
38 |
39 |
40 | private:
41 |
42 | //method
43 |
44 | /**
45 | * \fn SetGeometry()
46 | * \brief show object geometry in dialog window
47 | * \return void
48 | */
49 | void SetGeometry();
50 |
51 | /**
52 | * \fn CheckGeometry()
53 | * \brief check geometry for change
54 | * \return bool
55 | */
56 | bool CheckGeometry();
57 |
58 | /**
59 | * \fn GetGeometry()
60 | * \brief create new object
61 | * \return bool
62 | */
63 | bool GetGeometry();
64 |
65 | //members
66 |
67 | Handle(Geom2d_CartesianPoint) curGeom2d_Point;
68 |
69 | };
70 |
71 | #endif // Sketcher_PropertyPoint_H
72 |
--------------------------------------------------------------------------------
/Sketcher_QtGUI.cxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_QtGUI.cxx
3 | * \brief Implementation file for the class Sketcher_QtGUI
4 | * \author Sergei Maslov
5 | */
6 | #include "Sketcher_QtGUI.hxx"
7 |
8 | /**
9 | * \fn Sketcher_QtGUI( QWidget* parent)
10 | * \brief Constructs a Sketcher_QtGUI
11 | * \param parent QWidget*
12 | */
13 | Sketcher_QtGUI::Sketcher_QtGUI(QWidget* parent)
14 | {
15 | prop_arc = new Sketcher_PropertyArc( parent, "Arc");
16 | prop_circle = new Sketcher_PropertyCircle( parent, "Circle");
17 | prop_line = new Sketcher_PropertyLine( parent, "Lines");
18 | prop_point = new Sketcher_PropertyPoint( parent, "Points");
19 | }
20 |
21 | /**
22 | * \fn ~Sketcher_GUI()
23 | * \brief destructor
24 | */
25 | Sketcher_QtGUI::~Sketcher_QtGUI()
26 | {
27 | // no need to delete child widgets, Qt does it all for us
28 | }
29 |
30 | /**
31 | * \fn SetContext(Handle(AIS_InteractiveContext)& theContext)
32 | * \brief pass context to property classes
33 | * \return void
34 | * \param theContext Handle(AIS_InteractiveContext)&
35 | */
36 | void Sketcher_QtGUI::SetContext (Handle(AIS_InteractiveContext)& theContext)
37 | {
38 | prop_arc->SetContext( theContext);
39 | prop_circle->SetContext( theContext);
40 | prop_line->SetContext( theContext);
41 | prop_point->SetContext( theContext);
42 | }
43 |
44 | /**
45 | * \fn SetAx3(const gp_Ax3& theAx3)
46 | * \brief pass coordinate system to property classes
47 | * \return void
48 | * \param theAx3 const gp_Ax3&
49 | */
50 | void Sketcher_QtGUI::SetAx3 (const gp_Ax3& theAx3)
51 | {
52 | prop_arc->SetAx3( theAx3);
53 | prop_circle->SetAx3( theAx3);
54 | prop_line->SetAx3( theAx3);
55 | prop_point->SetAx3( theAx3);
56 | }
57 |
58 | /**
59 | * \fn SetSketcher_Object(Handle(Sketcher_Object)& CurObject)
60 | * \brief determine property to show, pass object to this property class
61 | * \return void
62 | * \param CurObject Handle(Sketcher_Object)&
63 | */
64 | void Sketcher_QtGUI::SetSketcher_Object(Handle(Sketcher_Object)& CurObject)
65 | {
66 | if(!prop_arc->isHidden())
67 | prop_arc->close();
68 | if(!prop_circle->isHidden())
69 | prop_circle->close();
70 | if(!prop_line->isHidden())
71 | prop_line->close();
72 | if(!prop_point->isHidden())
73 | prop_point->close();
74 |
75 | switch (CurObject->GetGeometryType())
76 | {
77 | case ArcSketcherObject: prop_arc->SetObject(CurObject);
78 | break;
79 | case CircleSketcherObject: prop_circle->SetObject(CurObject);
80 | break;
81 | case LineSketcherObject: prop_line->SetObject(CurObject);
82 | break;
83 | case PointSketcherObject: prop_point->SetObject(CurObject);
84 | break;
85 | default:break;
86 | }
87 | }
88 |
89 |
--------------------------------------------------------------------------------
/Sketcher_QtGUI.hxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_QtGUI.hxx
3 | * \brief Header file for the class Sketcher_QtGUI
4 | * \author Sergei Maslov
5 | */
6 | #ifndef SKETCHER_QTGUI_H
7 | #define SKETCHER_QTGUI_H
8 |
9 | #include "Sketcher_GUI.hxx"
10 | #include "Sketcher_Object.hxx"
11 |
12 | #include "Sketcher_PropertyArc.hxx"
13 | #include "Sketcher_PropertyCircle.hxx"
14 | #include "Sketcher_PropertyLine.hxx"
15 | #include "Sketcher_PropertyPoint.hxx"
16 |
17 | #include
18 |
19 | class Sketcher_QtGUI : public Sketcher_GUI
20 | {
21 | public:
22 |
23 | /**
24 | * \fn Sketcher_QtGUI( QWidget* parent)
25 | * \brief Constructs a Sketcher_QtGUI
26 | * \param parent QWidget*
27 | */
28 | Sketcher_QtGUI(QWidget* parent);
29 |
30 | /**
31 | * \fn ~Sketcher_GUI()
32 | * \brief destructor
33 | */
34 | ~Sketcher_QtGUI();
35 |
36 | /**
37 | * \fn SetContext(Handle(AIS_InteractiveContext)& theContext)
38 | * \brief pass context to property classes
39 | * \return void
40 | * \param theContext Handle(AIS_InteractiveContext)&
41 | */
42 | void SetContext (Handle(AIS_InteractiveContext)& theContext);
43 |
44 | /**
45 | * \fn SetAx3(const gp_Ax3& theAx3)
46 | * \brief pass coordinate system to property classes
47 | * \return void
48 | * \param theAx3 const gp_Ax3&
49 | */
50 | void SetAx3 (const gp_Ax3& theAx3);
51 |
52 | /**
53 | * \fn SetSketcher_Object(Handle(Sketcher_Object)& CurObject)
54 | * \brief determine property to show, pass object to this property class
55 | * \return void
56 | * \param CurObject Handle(Sketcher_Object)&
57 | */
58 | void SetSketcher_Object(Handle(Sketcher_Object)& CurObject);
59 |
60 | private:
61 |
62 | //members
63 |
64 | Sketcher_PropertyArc* prop_arc;
65 | Sketcher_PropertyCircle* prop_circle;
66 | Sketcher_PropertyLine* prop_line;
67 | Sketcher_PropertyPoint* prop_point;
68 |
69 | };
70 |
71 | #endif // SKETCHER_QTGUI_H
--------------------------------------------------------------------------------
/Sketcher_Snap.cxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_Snap.cxx
3 | * \brief Implementation file for the class Sketcher_Snap
4 | * \author Sergei Maslov
5 | */
6 | #include "Sketcher_Snap.hxx"
7 |
8 | IMPLEMENT_STANDARD_RTTIEXT(Sketcher_Snap, Standard_Transient)
9 |
10 | /**
11 | * \fn Sketcher_Snap()
12 | * \brief Constructs a Sketcher_Snap
13 | */
14 | Sketcher_Snap::Sketcher_Snap()
15 | : curCoordinateSystem(gp::XOY()),
16 | FirstEdge(),SecondEdge()
17 | {
18 | curPnt2d = gp::Origin2d();
19 | objectPnt2d = gp::Origin2d();
20 | bestPnt2d = gp::Origin2d();
21 | findbestPnt2d = Standard_False;
22 |
23 | firstDisplay = Standard_True;
24 | myGeom_Point = new Geom_CartesianPoint(gp::Origin());
25 | myAIS_Point = new AIS_Point(myGeom_Point);
26 | myAIS_Point->SetColor(Quantity_NOC_CYAN1);
27 |
28 | minimumSnapDistance = MINIMUMSNAP;
29 | minDistance = 0;
30 | curDistance = 0;
31 | curGeom2d_Point = new Geom2d_CartesianPoint(curPnt2d);
32 | myPlane = new Geom_Plane(curCoordinateSystem);
33 | }
34 |
35 | /**
36 | * \fn ~Sketcher_Snap()
37 | * \brief Destructor
38 | */
39 | Sketcher_Snap::~Sketcher_Snap()
40 | {
41 | }
42 |
43 | /**
44 | * \fn SetContext(Handle(AIS_InteractiveContext)& theContext)
45 | * \brief set context
46 | * \return void
47 | * \param theContext Handle(AIS_InteractiveContext)&
48 | */
49 | void Sketcher_Snap::SetContext (Handle(AIS_InteractiveContext)& theContext)
50 | {
51 | myContext = theContext;
52 | }
53 |
54 | /**
55 | * \fn SetData(Handle(TColStd_HSequenceOfTransient)& thedata)
56 | * \brief set list of objects
57 | * \return void
58 | * \param thedata TColStd_HSequenceOfTransient)&
59 | */
60 | void Sketcher_Snap::SetData (Handle(TColStd_HSequenceOfTransient)& thedata)
61 | {
62 | data = thedata;
63 | }
64 |
65 | /**
66 | * \fn SetAx3(const gp_Ax3& theAx3)
67 | * \brief set coordinate system
68 | * \return void
69 | * \param theAx3 const gp_Ax3&
70 | */
71 | void Sketcher_Snap::SetAx3(const gp_Ax3 &theAx3)
72 | {
73 | curCoordinateSystem = theAx3;
74 | }
75 |
76 | /**
77 | * \fn SetMinDistance(const Standard_Real& aPrecise)
78 | * \brief set precise
79 | * \return void
80 | * \param aPrecise const Standard_Real&
81 | */
82 | void Sketcher_Snap::SetMinDistance(const Standard_Real& aPrecise)
83 | {
84 | minimumSnapDistance = aPrecise;
85 | }
86 |
87 | /**
88 | * \fn MouseInputEvent(const gp_Pnt2d& thePnt2d)
89 | * \brief input event handler
90 | * \return gp_Pnt2d
91 | * \param thePnt2d const gp_Pnt2d&
92 | */
93 | gp_Pnt2d Sketcher_Snap::MouseInputEvent(const gp_Pnt2d& tempPnt2d)
94 | {
95 | curPnt2d = tempPnt2d;
96 | SelectEvent();
97 | EraseSnap();
98 | return bestPnt2d;
99 | }
100 |
101 | /**
102 | * \fn MouseMoveEvent(const gp_Pnt2d& thePnt2d)
103 | * \brief mouse move handler
104 | * \return gp_Pnt2d
105 | * \param thePnt2d const gp_Pnt2d&
106 | */
107 | gp_Pnt2d Sketcher_Snap::MouseMoveEvent(const gp_Pnt2d& tempPnt2d)
108 | {
109 | curPnt2d = tempPnt2d;
110 | SelectEvent();
111 | if(findbestPnt2d)
112 | {
113 | myGeom_Point->SetPnt(ElCLib::To3d(curCoordinateSystem.Ax2(),bestPnt2d));
114 | myAIS_Point->SetComponent(myGeom_Point);
115 | if (firstDisplay)
116 | {
117 | myContext->Display(myAIS_Point,0,-1, true);
118 | DrawRelation();
119 | firstDisplay = Standard_False;
120 | }
121 | else
122 | {
123 | myContext->Redisplay(myAIS_Point, true);
124 | DrawRelation();
125 | }
126 | }
127 | else
128 | {
129 | myContext->Remove(myAIS_Point, true);
130 | EraseRelation();
131 | firstDisplay = Standard_True;
132 | }
133 |
134 | return bestPnt2d;
135 | }
136 |
137 | /**
138 | * \fn EraseSnap()
139 | * \brief cancel event handler
140 | * \return void
141 | */
142 | void Sketcher_Snap::EraseSnap()
143 | {
144 | firstDisplay = Standard_True;
145 | myContext->Remove(myAIS_Point, true);
146 | EraseRelation();
147 | }
148 |
149 | /**
150 | * \fn AnalyserEvent(const gp_Pnt2d& tempPnt2d, gp_Pnt2d& newPnt2d,Standard_Real& dist,Standard_Integer& type)
151 | * \brief get new point, minimum distance, snap type
152 | * \return Standard_Boolean
153 | * \param tempPnt2d const gp_Pnt2d&
154 | * \param newPnt2d const gp_Pnt2d&
155 | * \param dist Standard_Real&
156 | * \param type Standard_Integer&
157 | */
158 | Standard_Boolean Sketcher_Snap::AnalyserEvent(const gp_Pnt2d& tempPnt2d, gp_Pnt2d& newPnt2d,Standard_Real& dist,Standard_Integer& type)
159 | {
160 | curPnt2d = tempPnt2d;
161 | SelectEvent();
162 | newPnt2d = bestPnt2d;
163 | dist = minDistance;
164 | type = (Standard_Integer)GetSnapType();
165 | return findbestPnt2d;
166 | }
167 |
168 | /**
169 | * \fn DrawRelation()
170 | * \brief draw relation
171 | * \return void
172 | */
173 | void Sketcher_Snap::DrawRelation()
174 | {
175 | myContext->SetSelected(curHilightedObj, true);
176 | }
177 |
178 | /**
179 | * \fn EraseRelation()
180 | * \brief erase relation
181 | * \return void
182 | */
183 | void Sketcher_Snap::EraseRelation()
184 | {
185 | myContext->ClearSelected(true);
186 | }
187 |
188 | /**
189 | * \fn setFirstPnt(const gp_Pnt2d& p)
190 | * \brief set point for exceptions
191 | * \return void
192 | * \param p const gp_Pnt2d&
193 | */
194 | void Sketcher_Snap::setFirstPnt(const gp_Pnt2d& p)
195 | {
196 | }
197 |
198 | /**
199 | * \fn setFirstPnt(const gp_Pnt2d& p)
200 | * \brief set point and tangent type for exceptions
201 | * \return void
202 | * \param p const gp_Pnt2d&
203 | * \param ttype TangentType
204 | */
205 | void Sketcher_Snap::setFirstPnt(const gp_Pnt2d& p,TangentType ttype)
206 | {
207 | }
208 |
209 | /**
210 | * \fn countProject()
211 | * \brief find point projected on curve
212 | * \return Standard_Boolean
213 | */
214 | Standard_Boolean Sketcher_Snap::countProject()
215 | {
216 | if(ProjectOnCurve.NbPoints() > 0)
217 | {
218 | objectPnt2d = ProjectOnCurve.NearestPoint();
219 | return count();
220 | }
221 | else return Standard_False;
222 | }
223 |
224 | /**
225 | * \fn count()
226 | * \brief check distance to point
227 | * \return Standard_Boolean
228 | */
229 | Standard_Boolean Sketcher_Snap::count()
230 | {
231 | curDistance = objectPnt2d.Distance(curPnt2d);
232 | if(minDistance > curDistance)
233 | {
234 | minDistance = curDistance;
235 | return Standard_True;
236 | }
237 | else return Standard_False;
238 | }
239 |
240 |
241 |
--------------------------------------------------------------------------------
/Sketcher_Snap.hxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_Snap.hxx
3 | * \brief Header file for the class Sketcher_Snap
4 | * \author Sergei Maslov
5 | */
6 | #ifndef Sketcher_Snap_H
7 | #define Sketcher_Snap_H
8 |
9 | #include
10 | #include
11 | #include
12 |
13 | #include "Sketcher_Object.hxx"
14 | #include "Sketcher_SnapType.hxx"
15 |
16 | #include
17 | #include
18 |
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 |
25 | #include
26 | #include
27 | #include
28 |
29 | #include
30 | #include
31 | #include
32 | #include
33 |
34 | #define MINIMUMSNAP 25
35 | #define MINANGLE M_PI / 64
36 |
37 | class AIS_InteractiveContext;
38 | class AIS_Point;
39 | class Geom_CartesianPoint;
40 | class Geom2dAPI_ProjectPointOnCurve;
41 |
42 | DEFINE_STANDARD_HANDLE(Sketcher_Snap, Standard_Transient)
43 |
44 | //base class of Snap
45 | class Sketcher_Snap : public Standard_Transient
46 | {
47 | public:
48 | // Type management
49 | DEFINE_STANDARD_RTTIEXT(Sketcher_Snap, Standard_Transient)
50 |
51 | /**
52 | * \fn Sketcher_Snap()
53 | * \brief Constructs a Sketcher_Snap
54 | */
55 | Standard_EXPORT Sketcher_Snap();
56 |
57 | /**
58 | * \fn ~Sketcher_Snap()
59 | * \brief Destructor
60 | */
61 | Standard_EXPORT ~Sketcher_Snap();
62 |
63 | /**
64 | * \fn SetContext(Handle(AIS_InteractiveContext)& theContext)
65 | * \brief set context
66 | * \return void
67 | * \param theContext Handle(AIS_InteractiveContext)&
68 | */
69 | Standard_EXPORT void SetContext (Handle(AIS_InteractiveContext)& theContext);
70 | /**
71 | * \fn SetData(Handle(TColStd_HSequenceOfTransient)& thedata)
72 | * \brief set list of objects
73 | * \return void
74 | * \param thedata TColStd_HSequenceOfTransient)&
75 | */
76 | Standard_EXPORT void SetData (Handle(TColStd_HSequenceOfTransient)& thedata);
77 |
78 | /**
79 | * \fn SetAx3(const gp_Ax3& theAx3)
80 | * \brief set coordinate system
81 | * \return void
82 | * \param theAx3 const gp_Ax3&
83 | */
84 | Standard_EXPORT void SetAx3(const gp_Ax3 &theAx3);
85 |
86 | /**
87 | * \fn SetMinDistance(const Standard_Real& aPrecise)
88 | * \brief set precise
89 | * \return void
90 | * \param aPrecise const Standard_Real&
91 | */
92 | Standard_EXPORT void SetMinDistance(const Standard_Real& aPrecise);
93 |
94 | /**
95 | * \fn MouseInputEvent(const gp_Pnt2d& thePnt2d)
96 | * \brief input event handler
97 | * \return gp_Pnt2d
98 | * \param thePnt2d const gp_Pnt2d&
99 | */
100 | Standard_EXPORT virtual gp_Pnt2d MouseInputEvent(const gp_Pnt2d& tempPnt2d);
101 |
102 | /**
103 | * \fn MouseMoveEvent(const gp_Pnt2d& thePnt2d)
104 | * \brief mouse move handler
105 | * \return gp_Pnt2d
106 | * \param thePnt2d const gp_Pnt2d&
107 | */
108 | Standard_EXPORT gp_Pnt2d MouseMoveEvent(const gp_Pnt2d& tempPnt2d);
109 |
110 | /**
111 | * \fn EraseSnap()
112 | * \brief cancel event handler
113 | * \return void
114 | */
115 | Standard_EXPORT virtual void EraseSnap();
116 |
117 | /**
118 | * \fn AnalyserEvent(const gp_Pnt2d& tempPnt2d, gp_Pnt2d& newPnt2d,Standard_Real& dist,Standard_Integer& type)
119 | * \brief get new point, minimum distance, snap type
120 | * \return Standard_Boolean
121 | * \param tempPnt2d const gp_Pnt2d&
122 | * \param newPnt2d const gp_Pnt2d&
123 | * \param dist Standard_Real&
124 | * \param type Standard_Integer&
125 | */
126 | Standard_EXPORT Standard_Boolean AnalyserEvent(const gp_Pnt2d& tempPnt2d, gp_Pnt2d& newPnt2d,Standard_Real& dist,Standard_Integer& type);
127 |
128 | /**
129 | * \fn SelectEvent()
130 | * \brief find new point
131 | * \return void
132 | */
133 | Standard_EXPORT virtual void SelectEvent() = 0;
134 |
135 | /**
136 | * \fn GetSnapType()
137 | * \brief get Snap type
138 | * \return Sketcher_SnapType
139 | */
140 | Standard_EXPORT virtual Sketcher_SnapType GetSnapType() = 0;
141 | /**
142 | * \fn DrawRelation()
143 | * \brief draw relation
144 | * \return void
145 | */
146 | Standard_EXPORT virtual void DrawRelation();
147 |
148 | /**
149 | * \fn EraseRelation()
150 | * \brief erase relation
151 | * \return void
152 | */
153 | Standard_EXPORT virtual void EraseRelation();
154 |
155 | /**
156 | * \fn setFirstPnt(const gp_Pnt2d& p)
157 | * \brief set point for exceptions
158 | * \return void
159 | * \param p const gp_Pnt2d&
160 | */
161 | Standard_EXPORT virtual void setFirstPnt(const gp_Pnt2d& p);
162 |
163 | /**
164 | * \fn setFirstPnt(const gp_Pnt2d& p)
165 | * \brief set point and tangent type for exceptions
166 | * \return void
167 | * \param p const gp_Pnt2d&
168 | * \param ttype TangentType
169 | */
170 | Standard_EXPORT virtual void setFirstPnt(const gp_Pnt2d& p,TangentType ttype);
171 |
172 | protected:
173 |
174 | //methods
175 |
176 | /**
177 | * \fn countProject()
178 | * \brief find point projected on curve
179 | * \return Standard_Boolean
180 | */
181 | Standard_EXPORT Standard_Boolean countProject();
182 |
183 | /**
184 | * \fn count()
185 | * \brief check distance to point
186 | * \return Standard_Boolean
187 | */
188 | Standard_EXPORT Standard_Boolean count();
189 |
190 | //members
191 |
192 | Handle(TColStd_HSequenceOfTransient) data;
193 | Handle(AIS_InteractiveContext) myContext;
194 | gp_Ax3 curCoordinateSystem;
195 | Handle(Sketcher_Object) mySObject;
196 | Sketcher_ObjectGeometryType myGeometryType;
197 |
198 | Standard_Boolean firstDisplay;
199 | Handle(Geom_CartesianPoint) myGeom_Point;
200 | Handle(AIS_Point) myAIS_Point;
201 | Handle(AIS_InteractiveObject) curHilightedObj;
202 |
203 | gp_Pnt2d curPnt2d;
204 | gp_Pnt2d objectPnt2d;
205 | gp_Pnt2d bestPnt2d;
206 | Standard_Boolean findbestPnt2d;
207 |
208 | Handle(Geom2d_CartesianPoint) curGeom2d_Point;
209 | Standard_Real minimumSnapDistance;
210 | Standard_Real minDistance;
211 | Standard_Real curDistance;
212 | Geom2dAPI_ProjectPointOnCurve ProjectOnCurve;
213 |
214 | Handle(Geom_Plane) myPlane;
215 | TopoDS_Edge FirstEdge;
216 | TopoDS_Edge SecondEdge;
217 |
218 | };
219 |
220 | #endif
221 |
--------------------------------------------------------------------------------
/Sketcher_SnapCenter.cxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_SnapCenter.cxx
3 | * \brief Implementation file for the class Sketcher_SnapCenter
4 | * \author Sergei Maslov
5 | */
6 | #include "Sketcher_SnapCenter.hxx"
7 |
8 | IMPLEMENT_STANDARD_RTTIEXT(Sketcher_SnapCenter, Sketcher_Snap)
9 |
10 | /**
11 | * \fn Sketcher_SnapCenter()
12 | * \brief Constructs a Sketcher_SnapCenter
13 | */
14 | Sketcher_SnapCenter::Sketcher_SnapCenter()
15 | {
16 | }
17 |
18 | /**
19 | * \fn ~Sketcher_SnapCenter()
20 | * \brief Destructor
21 | */
22 | Sketcher_SnapCenter::~Sketcher_SnapCenter()
23 | {
24 | }
25 |
26 | /**
27 | * \fn SelectEvent()
28 | * \brief find center point of arc, circle
29 | * \return void
30 | */
31 | void Sketcher_SnapCenter::SelectEvent()
32 | {
33 | findbestPnt2d = Standard_False;
34 | minDistance = minimumSnapDistance;
35 |
36 | for( Standard_Integer i=1; i<=data->Length(); i++)
37 | {
38 | mySObject = Handle(Sketcher_Object)::DownCast(data->Value(i));
39 | myGeometryType = mySObject->GetGeometryType();
40 | switch (myGeometryType)
41 | {
42 | case PointSketcherObject: break;
43 | case LineSketcherObject: break;
44 | case CircleSketcherObject:
45 | case ArcSketcherObject: curGeom2d_Circle = Handle(Geom2d_Circle)::DownCast(mySObject->GetGeometry());
46 | ProjectOnCurve.Init(curPnt2d,curGeom2d_Circle);
47 | if(countProject())
48 | {
49 | bestPnt2d = curGeom2d_Circle->Location();
50 | curHilightedObj = mySObject->GetAIS_Object();
51 | }
52 | objectPnt2d = curGeom2d_Circle->Location();
53 | if(count())
54 | {
55 | bestPnt2d = objectPnt2d;
56 | curHilightedObj = mySObject->GetAIS_Object();
57 | }
58 | break;
59 | default:break;
60 | }
61 | }
62 |
63 | if(minDistance == minimumSnapDistance)
64 | bestPnt2d = curPnt2d;
65 | else findbestPnt2d = Standard_True;
66 |
67 | }
68 |
69 | /**
70 | * \fn GetSnapType()
71 | * \brief get Snap type
72 | * \return Sketcher_SnapType
73 | */
74 | Sketcher_SnapType Sketcher_SnapCenter::GetSnapType()
75 | {
76 | return SnapCenter;
77 | }
78 |
79 |
--------------------------------------------------------------------------------
/Sketcher_SnapCenter.hxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_SnapCenter.hxx
3 | * \brief Header file for the class Sketcher_SnapCenter
4 | * \author Sergei Maslov
5 | */
6 | #ifndef Sketcher_SnapCENTER_H
7 | #define Sketcher_SnapCENTER_H
8 |
9 | #include "Sketcher_Snap.hxx"
10 | #include
11 |
12 | class Geom2d_Circle;
13 |
14 | DEFINE_STANDARD_HANDLE(Sketcher_SnapCenter,Sketcher_Snap)
15 |
16 | //snap searching center curve/circle/arc
17 | class Sketcher_SnapCenter : public Sketcher_Snap
18 | {
19 | public:
20 | // Type management
21 | DEFINE_STANDARD_RTTIEXT(Sketcher_SnapCenter, Sketcher_Snap)
22 |
23 | /**
24 | * \fn Sketcher_SnapCenter()
25 | * \brief Constructs a Sketcher_SnapCenter
26 | */
27 | Standard_EXPORT Sketcher_SnapCenter();
28 |
29 | /**
30 | * \fn ~Sketcher_SnapCenter()
31 | * \brief Destructor
32 | */
33 | Standard_EXPORT ~Sketcher_SnapCenter();
34 |
35 | /**
36 | * \fn SelectEvent()
37 | * \brief find new point
38 | * \return void
39 | */
40 | Standard_EXPORT void SelectEvent();
41 |
42 | /**
43 | * \fn GetSnapType()
44 | * \brief get Snap type
45 | * \return Sketcher_SnapType
46 | */
47 | Standard_EXPORT Sketcher_SnapType GetSnapType();
48 |
49 | private:
50 |
51 | //members
52 |
53 | Handle(Geom2d_Circle) curGeom2d_Circle;
54 |
55 | };
56 |
57 | #endif
--------------------------------------------------------------------------------
/Sketcher_SnapEnd.cxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_SnapEnd.cxx
3 | * \brief Implementation file for the class Sketcher_SnapEnd
4 | * \author Sergei Maslov
5 | */
6 | #include "Sketcher_SnapEnd.hxx"
7 |
8 | IMPLEMENT_STANDARD_RTTIEXT(Sketcher_SnapEnd, Sketcher_Snap)
9 |
10 | /**
11 | * \fn Sketcher_SnapEnd()
12 | * \brief Constructs a Sketcher_SnapEnd
13 | */
14 | Sketcher_SnapEnd::Sketcher_SnapEnd()
15 | {
16 | }
17 |
18 | /**
19 | * \fn ~Sketcher_SnapEnd()
20 | * \brief Destructor
21 | */
22 | Sketcher_SnapEnd::~Sketcher_SnapEnd()
23 | {
24 | }
25 |
26 | /**
27 | * \fn SelectEvent()
28 | * \brief find point nearest to end line
29 | * \return void
30 | */
31 | void Sketcher_SnapEnd::SelectEvent()
32 | {
33 | findbestPnt2d = Standard_False;
34 | minDistance = minimumSnapDistance;
35 |
36 | for( Standard_Integer i=1; i<=data->Length(); i++)
37 | {
38 | mySObject = Handle(Sketcher_Object)::DownCast(data->Value(i));
39 | myGeometryType = mySObject->GetGeometryType();
40 | switch (myGeometryType)
41 | {
42 | case PointSketcherObject:
43 | curGeom2d_Point = Handle(Geom2d_CartesianPoint)::DownCast(mySObject->GetGeometry());
44 | objectPnt2d = curGeom2d_Point->Pnt2d();
45 | if(count())
46 | {
47 | bestPnt2d = objectPnt2d;
48 | curHilightedObj = mySObject->GetAIS_Object();
49 | }
50 | break;
51 | case LineSketcherObject:
52 | curGeom2d_Edge = Handle(Geom2d_Edge)::DownCast(mySObject->GetGeometry());
53 | objectPnt2d = curGeom2d_Edge->GetStart_Pnt();
54 | if(count())
55 | {
56 | bestPnt2d = objectPnt2d;
57 | curHilightedObj = mySObject->GetAIS_Object();
58 | }
59 | objectPnt2d = curGeom2d_Edge->GetEnd_Pnt();
60 | if(count())
61 | {
62 | bestPnt2d = objectPnt2d;
63 | curHilightedObj = mySObject->GetAIS_Object();
64 | }
65 | break;
66 | case CircleSketcherObject:
67 | break;
68 | case ArcSketcherObject:
69 | curGeom2d_Arc = Handle(Geom2d_Arc)::DownCast(mySObject->GetGeometry());
70 | objectPnt2d = curGeom2d_Arc->FirstPnt();
71 | if(count())
72 | {
73 | bestPnt2d = objectPnt2d;
74 | curHilightedObj = mySObject->GetAIS_Object();
75 | }
76 | objectPnt2d = curGeom2d_Arc->LastPnt();
77 | if(count())
78 | {
79 | bestPnt2d = objectPnt2d;
80 | curHilightedObj = mySObject->GetAIS_Object();
81 | }
82 | break;
83 | default:break;
84 | }
85 | }
86 | if(minDistance == minimumSnapDistance)
87 | bestPnt2d = curPnt2d;
88 | else findbestPnt2d = Standard_True;
89 | }
90 |
91 |
92 | /**
93 | * \fn GetSnapType()
94 | * \brief get Snap type
95 | * \return Sketcher_SnapType
96 | */
97 | Sketcher_SnapType Sketcher_SnapEnd::GetSnapType()
98 | {
99 | return SnapEnd;
100 | }
101 |
--------------------------------------------------------------------------------
/Sketcher_SnapEnd.hxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_SnapEnd.hxx
3 | * \brief Header file for the class Sketcher_SnapEnd
4 | * \author Sergei Maslov
5 | */
6 | #ifndef Sketcher_SnapEND_H
7 | #define Sketcher_SnapEND_H
8 |
9 | #include "Sketcher_Snap.hxx"
10 | #include "Geom2d_Edge.hxx"
11 | #include "Geom2d_Arc.hxx"
12 |
13 |
14 | DEFINE_STANDARD_HANDLE(Sketcher_SnapEnd,Sketcher_Snap)
15 |
16 | //snap searching end point of line/arc
17 | class Sketcher_SnapEnd : public Sketcher_Snap
18 | {
19 | public:
20 | // Type management
21 | DEFINE_STANDARD_RTTIEXT(Sketcher_SnapEnd, Sketcher_Snap)
22 |
23 | /**
24 | * \fn Sketcher_SnapEnd()
25 | * \brief Constructs a Sketcher_SnapEnd
26 | */
27 | Standard_EXPORT Sketcher_SnapEnd();
28 |
29 | /**
30 | * \fn ~Sketcher_SnapEnd()
31 | * \brief Destructor
32 | */
33 | Standard_EXPORT ~Sketcher_SnapEnd();
34 |
35 | /**
36 | * \fn SelectEvent()
37 | * \brief find new point
38 | * \return void
39 | */
40 | Standard_EXPORT void SelectEvent();
41 |
42 | /**
43 | * \fn GetSnapType()
44 | * \brief get Snap type
45 | * \return Sketcher_SnapType
46 | */
47 | Standard_EXPORT Sketcher_SnapType GetSnapType();
48 |
49 | private:
50 |
51 | //members
52 |
53 | Handle(Geom2d_Edge) curGeom2d_Edge;
54 | Handle(Geom2d_Arc) curGeom2d_Arc;
55 |
56 | };
57 |
58 | #endif
--------------------------------------------------------------------------------
/Sketcher_SnapIntersection.cxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_SnapIntersection.cxx
3 | * \brief Implementation file for the class Sketcher_SnapIntersection
4 | * \author Sergei Maslov
5 | */
6 | #include "Sketcher_SnapIntersection.hxx"
7 |
8 | IMPLEMENT_STANDARD_RTTIEXT(Sketcher_SnapIntersection, Sketcher_Snap)
9 |
10 | /**
11 | * \fn Sketcher_SnapIntersection()
12 | * \brief Constructs a Sketcher_SnapIntersection
13 | */
14 | Sketcher_SnapIntersection::Sketcher_SnapIntersection()
15 | {
16 | cur1Geom2d_Line = new Geom2d_Line(gp::Origin2d(),gp::DX2d());
17 | cur2Geom2d_Line = new Geom2d_Line(gp::Origin2d(),gp::DX2d());
18 | bpu = 0;
19 | }
20 |
21 |
22 | /**
23 | * \fn ~Sketcher_SnapIntersection()
24 | * \brief Destructor
25 | */
26 | Sketcher_SnapIntersection::~Sketcher_SnapIntersection()
27 | {
28 | }
29 |
30 | /**
31 | * \fn SelectEvent()
32 | * \brief find nearest intersection point
33 | * \return void
34 | */
35 | void Sketcher_SnapIntersection::SelectEvent()
36 | {
37 | findbestPnt2d = Standard_False;
38 | minDistance = minimumSnapDistance;
39 | for( Standard_Integer i=1; i<=data->Length(); i++)
40 | {
41 | mySObject = Handle(Sketcher_Object)::DownCast(data->Value(i));
42 | myGeometryType = mySObject->GetGeometryType();
43 | switch (myGeometryType)
44 | {
45 | case PointSketcherObject:
46 | curGeom2d_Point = Handle(Geom2d_CartesianPoint)::DownCast(mySObject->GetGeometry());
47 | objectPnt2d = curGeom2d_Point->Pnt2d();
48 | if(count())
49 | {
50 | bestPnt2d = objectPnt2d;
51 | curHilightedObj = mySObject->GetAIS_Object();
52 | curHilightedObj2 = curHilightedObj;
53 | }
54 | break;
55 | case LineSketcherObject:
56 | cur1Geom2d_Edge = Handle(Geom2d_Edge)::DownCast(mySObject->GetGeometry());
57 | cur1Geom2d_Line->SetLin2d(cur1Geom2d_Edge->Lin2d());
58 | cur1Geom2d_Curve = cur1Geom2d_Line;
59 | findSecondObject(i);
60 | break;
61 | case CircleSketcherObject:
62 | case ArcSketcherObject:
63 | cur1Geom2d_Curve = Handle(Geom2d_Curve)::DownCast(mySObject->GetGeometry());
64 | findSecondObject(i);
65 | break;
66 | default:break;
67 | }
68 | }
69 |
70 | if(minDistance == minimumSnapDistance)
71 | bestPnt2d = curPnt2d;
72 | else findbestPnt2d = Standard_True;
73 | }
74 |
75 | /**
76 | * \fn findSecondObject(Standard_Integer start)
77 | * \brief find intersection points for object with start index
78 | * \return void
79 | * \param start Standard_Integer
80 | */
81 | void Sketcher_SnapIntersection::findSecondObject(Standard_Integer start)
82 | {
83 | for( Standard_Integer j=start+1; j<=data->Length(); j++)
84 | {
85 | secondSObject = Handle(Sketcher_Object)::DownCast(data->Value(j));
86 | myGeometryType = secondSObject->GetGeometryType();
87 | switch (myGeometryType)
88 | {
89 | case PointSketcherObject:
90 | break;
91 | case LineSketcherObject:
92 | {
93 | cur2Geom2d_Edge = Handle(Geom2d_Edge)::DownCast(secondSObject->GetGeometry());
94 | cur2Geom2d_Line->SetLin2d(cur2Geom2d_Edge->Lin2d());
95 | my2dAPI_InterCurveCurve.Init(cur1Geom2d_Curve,cur2Geom2d_Line,1.0e-12);
96 | for( Standard_Integer k=1; k<=my2dAPI_InterCurveCurve.NbPoints(); k++)
97 | {
98 | objectPnt2d = my2dAPI_InterCurveCurve.Point(k);
99 | curDistance = objectPnt2d.Distance(curPnt2d);
100 | if(minDistance > curDistance)
101 | {
102 | bpu = ElCLib::Parameter(cur2Geom2d_Edge->Lin2d(),objectPnt2d);
103 | if( bpu > cur2Geom2d_Edge->StartParameter() && bpu < cur2Geom2d_Edge->EndParameter())
104 | {
105 | if (cur1Geom2d_Curve->IsKind(STANDARD_TYPE(Geom2d_Line)))
106 | {
107 | bpu = ElCLib::Parameter(cur1Geom2d_Edge->Lin2d(),objectPnt2d);
108 | if( bpu > cur1Geom2d_Edge->StartParameter() && bpu < cur1Geom2d_Edge->EndParameter())
109 | {
110 | bestPnt2d = objectPnt2d;
111 | minDistance = curDistance;
112 | curHilightedObj = mySObject->GetAIS_Object();
113 | curHilightedObj2 = secondSObject->GetAIS_Object();
114 | }
115 | }
116 | else
117 | {
118 | bestPnt2d = objectPnt2d;
119 | minDistance = curDistance;
120 | curHilightedObj = mySObject->GetAIS_Object();
121 | curHilightedObj2 = secondSObject->GetAIS_Object();
122 | }
123 | }
124 | }
125 | }
126 | }
127 | break;
128 | case CircleSketcherObject:
129 | case ArcSketcherObject:
130 | {
131 | cur2Geom2d_Curve = Handle(Geom2d_Curve)::DownCast(secondSObject->GetGeometry());
132 | my2dAPI_InterCurveCurve.Init(cur1Geom2d_Curve,cur2Geom2d_Curve,1.0e-12);
133 | for( Standard_Integer k=1; k<=my2dAPI_InterCurveCurve.NbPoints(); k++)
134 | {
135 | objectPnt2d = my2dAPI_InterCurveCurve.Point(k);
136 | curDistance = objectPnt2d.Distance(curPnt2d);
137 | if(minDistance > curDistance)
138 | {
139 | if (cur1Geom2d_Curve->IsKind(STANDARD_TYPE(Geom2d_Line)))
140 | {
141 | bpu = ElCLib::Parameter(cur1Geom2d_Edge->Lin2d(),objectPnt2d);
142 | if( bpu > cur1Geom2d_Edge->StartParameter() && bpu < cur1Geom2d_Edge->EndParameter())
143 | {
144 | bestPnt2d = objectPnt2d;
145 | minDistance = curDistance;
146 | curHilightedObj = mySObject->GetAIS_Object();
147 | curHilightedObj2 = secondSObject->GetAIS_Object();
148 | }
149 | }
150 | else
151 | {
152 | bestPnt2d = objectPnt2d;
153 | minDistance = curDistance;
154 | curHilightedObj = mySObject->GetAIS_Object();
155 | curHilightedObj2 = secondSObject->GetAIS_Object();
156 | }
157 | }
158 | }
159 | }
160 | break;
161 | default:break;
162 | }
163 | }
164 | }
165 |
166 |
167 | /**
168 | * \fn GetSnapType()
169 | * \brief get Snap type
170 | * \return Sketcher_SnapType
171 | */
172 | Sketcher_SnapType Sketcher_SnapIntersection::GetSnapType()
173 | {
174 | return SnapIntersection;
175 | }
176 |
177 |
178 | /**
179 | * \fn DrawRelation()
180 | * \brief draw relation
181 | * \return void
182 | */
183 | void Sketcher_SnapIntersection::DrawRelation()
184 | {
185 | myContext->SetSelected(curHilightedObj, false);
186 | myContext->SetSelected(curHilightedObj2, true);
187 | }
188 |
189 |
--------------------------------------------------------------------------------
/Sketcher_SnapIntersection.hxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_SnapIntersection.hxx
3 | * \brief Header file for the class Sketcher_SnapIntersection
4 | * \author Sergei Maslov
5 | */
6 | #ifndef Sketcher_SNAPIntersection_H
7 | #define Sketcher_SNAPIntersection_H
8 |
9 | #include "Sketcher_Snap.hxx"
10 | #include "Geom2d_Edge.hxx"
11 |
12 | #include
13 | #include
14 | #include
15 | #include
16 |
17 | class Geom2d_Curve;
18 |
19 | DEFINE_STANDARD_HANDLE(Sketcher_SnapIntersection,Sketcher_Snap)
20 |
21 | //snap searching intersection point of objects
22 | class Sketcher_SnapIntersection : public Sketcher_Snap
23 | {
24 | public:
25 | // Type management
26 | DEFINE_STANDARD_RTTIEXT(Sketcher_SnapIntersection, Sketcher_Snap)
27 |
28 | /**
29 | * \fn Sketcher_SnapIntersection()
30 | * \brief Constructs a Sketcher_SnapIntersection
31 | */
32 | Standard_EXPORT Sketcher_SnapIntersection();
33 |
34 | /**
35 | * \fn ~Sketcher_SnapIntersection()
36 | * \brief Destructor
37 | */
38 | Standard_EXPORT ~Sketcher_SnapIntersection();
39 |
40 | /**
41 | * \fn SelectEvent()
42 | * \brief find new point
43 | * \return void
44 | */
45 | Standard_EXPORT void SelectEvent();
46 |
47 | /**
48 | * \fn GetSnapType()
49 | * \brief get Snap type
50 | * \return Sketcher_SnapType
51 | */
52 | Standard_EXPORT Sketcher_SnapType GetSnapType();
53 |
54 | /**
55 | * \fn DrawRelation()
56 | * \brief draw relation
57 | * \return void
58 | */
59 | Standard_EXPORT virtual void DrawRelation();
60 |
61 | private:
62 |
63 | //method
64 |
65 | /**
66 | * \fn findSecondObject(Standard_Integer start)
67 | * \brief find intersection points for object with start index
68 | * \return void
69 | * \param start Standard_Integer
70 | */
71 | Standard_EXPORT void findSecondObject(Standard_Integer start);
72 |
73 | //members
74 |
75 | Handle(Sketcher_Object) secondSObject;
76 | Handle(Geom2d_Curve) cur1Geom2d_Curve;
77 | Handle(Geom2d_Curve) cur2Geom2d_Curve;
78 | Handle(Geom2d_Edge) cur1Geom2d_Edge;
79 | Handle(Geom2d_Edge) cur2Geom2d_Edge;
80 | Handle(Geom2d_Line) cur1Geom2d_Line;
81 | Handle(Geom2d_Line) cur2Geom2d_Line;
82 |
83 | Standard_Real bpu;
84 | Geom2dAPI_InterCurveCurve my2dAPI_InterCurveCurve;
85 |
86 | Handle(AIS_InteractiveObject) curHilightedObj2;
87 | };
88 |
89 | #endif
--------------------------------------------------------------------------------
/Sketcher_SnapLine.cxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_SnapLine.cxx
3 | * \brief Implementation file for the class Sketcher_SnapLine
4 | * \author Sergei Maslov
5 | */
6 | #include "Sketcher_SnapLine.hxx"
7 |
8 | IMPLEMENT_STANDARD_RTTIEXT(Sketcher_SnapLine, Sketcher_Snap)
9 |
10 | /**
11 | * \fn Sketcher_SnapLine()
12 | * \brief Constructs a Sketcher_SnapLine
13 | * \return void
14 | */
15 | Sketcher_SnapLine::Sketcher_SnapLine()
16 | {
17 | minAngle = 0;
18 | curAngle = 0;
19 | curDir2d = gp::DX2d();
20 | tempDir2d= gp::DX2d();
21 | tempGeom2d_Line = new Geom2d_Line(gp::Origin2d(),gp::DX2d());
22 | }
23 |
24 | /**
25 | * \fn ~Sketcher_SnapLine()
26 | * \brief Destructor
27 | */
28 | Sketcher_SnapLine::~Sketcher_SnapLine()
29 | {
30 | }
31 |
32 | /**
33 | * \fn SelectNearest()
34 | * \brief select nearest line
35 | * \return void
36 | */
37 | void Sketcher_SnapLine::SelectNearest()
38 | {
39 | findbestPnt2d = Standard_False;
40 | minDistance = minimumSnapDistance/2;
41 |
42 | for( Standard_Integer i=1; i<=data->Length(); i++)
43 | {
44 | mySObject = Handle(Sketcher_Object)::DownCast(data->Value(i));
45 | myGeometryType = mySObject->GetGeometryType();
46 | switch (myGeometryType)
47 | {
48 | case PointSketcherObject:
49 | break;
50 | case LineSketcherObject:
51 | curGeom2d_Line = Handle(Geom2d_Line)::DownCast(mySObject->GetGeometry());
52 | ProjectOnCurve.Init(curPnt2d,curGeom2d_Line);
53 | if(countProject())
54 | {
55 | nearestPnt2d = objectPnt2d;
56 | tempDir2d = curGeom2d_Line->Lin2d().Direction();
57 | curHilightedObj = mySObject->GetAIS_Object();
58 | mygp_Lin2 = ElCLib::To3d(curCoordinateSystem.Ax2(),curGeom2d_Line->Lin2d());
59 | }
60 | break;
61 | case CircleSketcherObject:
62 | case ArcSketcherObject:
63 | break;
64 | default:break;
65 | }
66 | }
67 | }
68 |
69 | /**
70 | * \fn checkparallel()
71 | * \brief check lines for parallel
72 | * \return void
73 | */
74 | void Sketcher_SnapLine::checkparallel()
75 | {
76 | if(curDir2d.IsParallel(tempDir2d,minAngle))
77 | if (ProjectPoint())
78 | {
79 | mygp_Lin2 = ElCLib::To3d(curCoordinateSystem.Ax2(),curGeom2d_Line->Lin2d());
80 | curAngle = curDir2d.Angle(tempDir2d);
81 | if (minAngle > curAngle)
82 | minAngle = curAngle;
83 | else minAngle = M_PI - curAngle;
84 | }
85 | }
86 |
87 | /**
88 | * \fn ProjectPoint()
89 | * \brief find point projected to line
90 | * \return Standard_Boolean
91 | */
92 | Standard_Boolean Sketcher_SnapLine::ProjectPoint()
93 | {
94 | tempGeom2d_Line->SetLocation(curGeom2d_Point->Pnt2d());
95 | tempGeom2d_Line->SetDirection(tempDir2d);
96 | ProjectOnCurve.Init(nearestPnt2d,tempGeom2d_Line);
97 | if(ProjectOnCurve.NbPoints() > 0)
98 | {
99 | mygp_Lin1 = ElCLib::To3d(curCoordinateSystem.Ax2(),tempGeom2d_Line->Lin2d());
100 |
101 | bestPnt2d = ProjectOnCurve.NearestPoint();
102 | return Standard_True;
103 | }
104 |
105 | return Standard_False;
106 | }
107 |
108 | /**
109 | * \fn ProjectPoint()
110 | * \brief set Edges to display relation
111 | * \return Standard_Boolean
112 | */
113 | void Sketcher_SnapLine::setEdges()
114 | {
115 | findbestPnt2d = Standard_True;
116 | BRepBuilderAPI_MakeEdge me1 (mygp_Lin1);
117 | BRepBuilderAPI_MakeEdge me2 (mygp_Lin2);
118 |
119 | if (me1.IsDone () && me2.IsDone () )
120 | {
121 | FirstEdge = me1.Edge();
122 | SecondEdge = me2.Edge();
123 | }
124 |
125 | minDistance = bestPnt2d.Distance(curPnt2d);
126 | }
127 |
128 | /**
129 | * \fn setFirstPnt(const gp_Pnt2d& p)
130 | * \brief set point for exceptions
131 | * \return void
132 | * \param p const gp_Pnt2d&
133 | */
134 | void Sketcher_SnapLine::setFirstPnt(const gp_Pnt2d& p)
135 | {
136 | curGeom2d_Point->SetPnt2d(p);
137 | }
138 |
139 |
--------------------------------------------------------------------------------
/Sketcher_SnapLine.hxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_SnapLine.hxx
3 | * \brief Header file for the class Sketcher_SnapLine
4 | * \author Sergei Maslov
5 | */
6 | #ifndef Sketcher_SnapLine_H
7 | #define Sketcher_SnapLine_H
8 |
9 | #include "Sketcher_Snap.hxx"
10 |
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include
16 | #include
17 |
18 | class gp_Dir2d;
19 | class Geom2d_Line;
20 |
21 | DEFINE_STANDARD_HANDLE(Sketcher_SnapLine,Sketcher_Snap)
22 |
23 | //base class of snaps searching parallel/perpendicular lines
24 | class Sketcher_SnapLine : public Sketcher_Snap
25 | {
26 | public:
27 | // Type management
28 | DEFINE_STANDARD_RTTIEXT(Sketcher_SnapLine, Sketcher_Snap)
29 |
30 | /**
31 | * \fn Sketcher_SnapLine()
32 | * \brief Constructs a Sketcher_SnapLine
33 | */
34 | Standard_EXPORT Sketcher_SnapLine();
35 |
36 | /**
37 | * \fn ~Sketcher_SnapLine()
38 | * \brief Destructor
39 | */
40 | Standard_EXPORT ~Sketcher_SnapLine();
41 |
42 | /**
43 | * \fn SelectEvent()
44 | * \brief find new point
45 | * \return void
46 | */
47 | Standard_EXPORT virtual void SelectEvent() = 0;
48 |
49 | /**
50 | * \fn GetSnapType()
51 | * \brief get Snap type
52 | * \return Sketcher_SnapType
53 | */
54 | Standard_EXPORT virtual Sketcher_SnapType GetSnapType() = 0;
55 |
56 | /**
57 | * \fn DrawRelation()
58 | * \brief draw relation
59 | * \return void
60 | */
61 | Standard_EXPORT virtual void DrawRelation() = 0;
62 |
63 | /**
64 | * \fn EraseRelation()
65 | * \brief erase relation
66 | * \return void
67 | */
68 | Standard_EXPORT virtual void EraseRelation() = 0;
69 |
70 | /**
71 | * \fn setFirstPnt(const gp_Pnt2d& p)
72 | * \brief set point for exceptions
73 | * \return void
74 | * \param p const gp_Pnt2d&
75 | */
76 | Standard_EXPORT void setFirstPnt(const gp_Pnt2d& p);
77 |
78 | protected:
79 |
80 | //methods
81 |
82 | /**
83 | * \fn SelectNearest()
84 | * \brief select nearest line
85 | * \return void
86 | */
87 | Standard_EXPORT void SelectNearest();
88 |
89 | /**
90 | * \fn checkparallel()
91 | * \brief check lines for parallel
92 | * \return void
93 | */
94 | Standard_EXPORT void checkparallel();
95 |
96 | /**
97 | * \fn ProjectPoint()
98 | * \brief find point projected to line
99 | * \return Standard_Boolean
100 | */
101 | Standard_EXPORT Standard_Boolean ProjectPoint();
102 |
103 | /**
104 | * \fn ProjectPoint()
105 | * \brief set Edges to display relation
106 | * \return Standard_Boolean
107 | */
108 | Standard_EXPORT void setEdges();
109 |
110 | //members
111 |
112 | Standard_Real minAngle;
113 | Standard_Real curAngle;
114 |
115 | gp_Pnt2d nearestPnt2d;
116 | gp_Dir2d curDir2d;
117 | gp_Dir2d tempDir2d;
118 | Handle(Geom2d_Line) curGeom2d_Line;
119 | Handle(Geom2d_Line) tempGeom2d_Line;
120 | gp_Lin mygp_Lin1,mygp_Lin2;
121 |
122 | };
123 |
124 | #endif
--------------------------------------------------------------------------------
/Sketcher_SnapLineParallel.cxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_SnapLineParallel.cxx
3 | * \brief Implementation file for the class Sketcher_SnapLineParallel
4 | * \author Sergei Maslov
5 | */
6 | #include "Sketcher_SnapLineParallel.hxx"
7 |
8 | IMPLEMENT_STANDARD_RTTIEXT(Sketcher_SnapLineParallel, Sketcher_SnapLine)
9 |
10 | /**
11 | * \fn Sketcher_SnapLineParallel()
12 | * \brief Constructs a Sketcher_SnapLineParallel
13 | */
14 | Sketcher_SnapLineParallel::Sketcher_SnapLineParallel()
15 | {
16 | myParRelation = new AIS_ParallelRelation(FirstEdge,SecondEdge,myPlane);
17 | }
18 |
19 |
20 | /**
21 | * \fn ~Sketcher_SnapLineParallel()
22 | * \brief Destructor
23 | */
24 | Sketcher_SnapLineParallel::~Sketcher_SnapLineParallel()
25 | {
26 | }
27 |
28 |
29 | /**
30 | * \fn SelectEvent()
31 | * \brief construct line parallel to existing line
32 | * \return void
33 | */
34 | void Sketcher_SnapLineParallel::SelectEvent()
35 | {
36 | SelectNearest();
37 | if(minDistance == minimumSnapDistance/2)
38 | {
39 | nearestPnt2d = curPnt2d;
40 | curDir2d = gp_Dir2d (gp_Vec2d(curGeom2d_Point->Pnt2d(),curPnt2d));
41 | minAngle = MINANGLE;
42 |
43 | for( Standard_Integer i=1; i<=data->Length(); i++)
44 | {
45 | mySObject = Handle(Sketcher_Object)::DownCast(data->Value(i));
46 | myGeometryType = mySObject->GetGeometryType();
47 | switch (myGeometryType)
48 | {
49 | case PointSketcherObject: break;
50 | case LineSketcherObject: curGeom2d_Line = Handle(Geom2d_Line)::DownCast(mySObject->GetGeometry());
51 | tempDir2d = curGeom2d_Line->Lin2d().Direction();
52 | checkparallel();
53 | break;
54 | case CircleSketcherObject: break;
55 | case ArcSketcherObject: break;
56 | default:break;
57 | }
58 | }
59 |
60 | if(minAngle == MINANGLE)
61 | bestPnt2d = curPnt2d;
62 | else setEdges();
63 |
64 | }
65 | else
66 | {
67 | ProjectPoint();
68 | setEdges();
69 | }
70 | }
71 |
72 |
73 | /**
74 | * \fn GetSnapType()
75 | * \brief get Snap type
76 | * \return Sketcher_SnapType
77 | */
78 | Sketcher_SnapType Sketcher_SnapLineParallel::GetSnapType()
79 | {
80 | return SnapParallel;
81 | }
82 |
83 | /**
84 | * \fn DrawRelation()
85 | * \brief draw relation
86 | * \return void
87 | */
88 | void Sketcher_SnapLineParallel::DrawRelation()
89 | {
90 | myParRelation->SetFirstShape(FirstEdge);
91 | myParRelation->SetSecondShape(SecondEdge);
92 | if(firstDisplay) myContext->Display(myParRelation,0,-1, true);
93 | else myContext->Redisplay(myParRelation, true);
94 | }
95 |
96 | /**
97 | * \fn EraseRelation()
98 | * \brief erase relation
99 | * \return void
100 | */
101 | void Sketcher_SnapLineParallel::EraseRelation()
102 | {
103 | myContext->Remove(myParRelation, true);
104 | }
105 |
--------------------------------------------------------------------------------
/Sketcher_SnapLineParallel.hxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_SnapLineParallel.hxx
3 | * \brief Header file for the class Sketcher_SnapLineParallel
4 | * \author Sergei Maslov
5 | */
6 | #ifndef Sketcher_SnapLineParallel_H
7 | #define Sketcher_SnapLineParallel_H
8 |
9 | #include "Sketcher_SnapLine.hxx"
10 | #include
11 |
12 |
13 | DEFINE_STANDARD_HANDLE(Sketcher_SnapLineParallel,Sketcher_SnapLine)
14 |
15 | //snap searching parallel lines
16 | class Sketcher_SnapLineParallel : public Sketcher_SnapLine
17 | {
18 | public:
19 | // Type management
20 | DEFINE_STANDARD_RTTIEXT(Sketcher_SnapLineParallel, Sketcher_SnapLine)
21 |
22 | /**
23 | * \fn Sketcher_SnapLineParallel()
24 | * \brief Constructs a Sketcher_SnapLineParallel
25 | */
26 | Standard_EXPORT Sketcher_SnapLineParallel();
27 |
28 | /**
29 | * \fn ~Sketcher_SnapLineParallel()
30 | * \brief Destructor
31 | */
32 | Standard_EXPORT ~Sketcher_SnapLineParallel();
33 |
34 | /**
35 | * \fn SelectEvent()
36 | * \brief find new point
37 | * \return void
38 | */
39 | Standard_EXPORT void SelectEvent();
40 |
41 | /**
42 | * \fn GetSnapType()
43 | * \brief get Snap type
44 | * \return Sketcher_SnapType
45 | */
46 | Standard_EXPORT Sketcher_SnapType GetSnapType();
47 |
48 | /**
49 | * \fn DrawRelation()
50 | * \brief draw relation
51 | * \return void
52 | */
53 | Standard_EXPORT void DrawRelation();
54 |
55 | /**
56 | * \fn EraseRelation()
57 | * \brief erase relation
58 | * \return void
59 | */
60 | Standard_EXPORT void EraseRelation();
61 |
62 | private:
63 |
64 | //members
65 |
66 | Handle(AIS_ParallelRelation) myParRelation;
67 |
68 | };
69 |
70 | #endif
--------------------------------------------------------------------------------
/Sketcher_SnapLinePerpendicular.cxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_SnapLinePerpendicular.cxx
3 | * \brief Implementation file for the class Sketcher_SnapLinePerpendicular
4 | * \author Sergei Maslov
5 | */
6 | #include "Sketcher_SnapLinePerpendicular.hxx"
7 |
8 | IMPLEMENT_STANDARD_RTTIEXT(Sketcher_SnapLinePerpendicular, Sketcher_SnapLine)
9 |
10 | /**
11 | * \fn Sketcher_SnapLinePerpendicular()
12 | * \brief Constructs a Sketcher_SnapLinePerpendicular
13 | */
14 | Sketcher_SnapLinePerpendicular::Sketcher_SnapLinePerpendicular()
15 | {
16 | myPerRelation = new AIS_PerpendicularRelation(FirstEdge,SecondEdge,myPlane);
17 | }
18 |
19 |
20 | /**
21 | * \fn ~Sketcher_SnapLinePerpendicular()
22 | * \brief Destructor
23 | */
24 | Sketcher_SnapLinePerpendicular::~Sketcher_SnapLinePerpendicular()
25 | {
26 | }
27 |
28 | /**
29 | * \fn SelectEvent()
30 | * \brief construct line perpendicular to existing line
31 | * \return void
32 | */
33 | void Sketcher_SnapLinePerpendicular::SelectEvent()
34 | {
35 | SelectNearest();
36 | if(minDistance == minimumSnapDistance/2)
37 | {
38 | nearestPnt2d = curPnt2d;
39 | curDir2d = gp_Dir2d (gp_Vec2d(curGeom2d_Point->Pnt2d(),curPnt2d));
40 | minAngle = MINANGLE;
41 |
42 | for( Standard_Integer i=1; i<=data->Length(); i++)
43 | {
44 | mySObject = Handle(Sketcher_Object)::DownCast(data->Value(i));
45 | myGeometryType = mySObject->GetGeometryType();
46 | switch (myGeometryType)
47 | {
48 | case PointSketcherObject:
49 | break;
50 | case LineSketcherObject:
51 | curGeom2d_Line = Handle(Geom2d_Line)::DownCast(mySObject->GetGeometry());
52 | ProjectOnCurve.Init(curPnt2d,curGeom2d_Line);
53 | if(ProjectOnCurve.NbPoints() > 0)
54 | {
55 | objectPnt2d = ProjectOnCurve.NearestPoint();
56 | gce_MakeDir2d MD2d(curPnt2d,objectPnt2d);
57 | tempDir2d = MD2d.Value();
58 | checkparallel();
59 | }
60 | break;
61 | case CircleSketcherObject:
62 | break;
63 | case ArcSketcherObject:
64 | break;
65 | default:break;
66 | }
67 | }
68 |
69 | if(minAngle == MINANGLE)
70 | bestPnt2d = curPnt2d;
71 | else setEdges();
72 | }
73 | else
74 | {
75 | gce_MakeDir2d MD2d(curPnt2d,nearestPnt2d);
76 | tempDir2d = MD2d.Value();
77 | ProjectPoint();
78 | setEdges();
79 | }
80 |
81 | minDistance = bestPnt2d.Distance(curPnt2d);
82 | }
83 |
84 |
85 | /**
86 | * \fn GetSnapType()
87 | * \brief get Snap type
88 | * \return Sketcher_SnapType
89 | */
90 | Sketcher_SnapType Sketcher_SnapLinePerpendicular::GetSnapType()
91 | {
92 | return SnapPerpendicular;
93 | }
94 |
95 | /**
96 | * \fn DrawRelation()
97 | * \brief draw relation
98 | * \return void
99 | */
100 | void Sketcher_SnapLinePerpendicular::DrawRelation()
101 | {
102 | myPerRelation->SetFirstShape(FirstEdge);
103 | myPerRelation->SetSecondShape(SecondEdge);
104 | if(firstDisplay) myContext->Display(myPerRelation,0,-1, true);
105 | else myContext->Redisplay(myPerRelation, true);
106 | }
107 |
108 | /**
109 | * \fn EraseRelation()
110 | * \brief erase relation
111 | * \return void
112 | */
113 | void Sketcher_SnapLinePerpendicular::EraseRelation()
114 | {
115 | myContext->Remove(myPerRelation, true);
116 | }
117 |
118 |
--------------------------------------------------------------------------------
/Sketcher_SnapLinePerpendicular.hxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_SnapLinePerpendicular.hxx
3 | * \brief Header file for the class Sketcher_SnapLinePerpendicular
4 | * \author Sergei Maslov
5 | */
6 | #ifndef Sketcher_SnapLinePerpendicular_H
7 | #define Sketcher_SnapLinePerpendicular_H
8 |
9 | #include "Sketcher_SnapLine.hxx"
10 | #include
11 |
12 | DEFINE_STANDARD_HANDLE(Sketcher_SnapLinePerpendicular,Sketcher_SnapLine)
13 |
14 | //snap searching perpendicular lines
15 | class Sketcher_SnapLinePerpendicular : public Sketcher_SnapLine
16 | {
17 | public:
18 | // Type management
19 | DEFINE_STANDARD_RTTIEXT(Sketcher_SnapLinePerpendicular, Sketcher_SnapLine)
20 |
21 | /**
22 | * \fn Sketcher_SnapLinePerpendicular()
23 | * \brief Constructs a Sketcher_SnapLinePerpendicular
24 | */
25 | Standard_EXPORT Sketcher_SnapLinePerpendicular();
26 |
27 | /**
28 | * \fn ~Sketcher_SnapLinePerpendicular()
29 | * \brief Destructor
30 | */
31 | Standard_EXPORT ~Sketcher_SnapLinePerpendicular();
32 |
33 | /**
34 | * \fn SelectEvent()
35 | * \brief find new point
36 | * \return void
37 | */
38 | Standard_EXPORT void SelectEvent();
39 |
40 | /**
41 | * \fn GetSnapType()
42 | * \brief get Snap type
43 | * \return Sketcher_SnapType
44 | */
45 | Standard_EXPORT Sketcher_SnapType GetSnapType();
46 |
47 | /**
48 | * \fn DrawRelation()
49 | * \brief draw relation
50 | * \return void
51 | */
52 | Standard_EXPORT void DrawRelation();
53 |
54 | /**
55 | * \fn EraseRelation()
56 | * \brief erase relation
57 | * \return void
58 | */
59 | Standard_EXPORT void EraseRelation();
60 |
61 | private:
62 |
63 | //members
64 |
65 | Handle(AIS_PerpendicularRelation) myPerRelation;
66 |
67 | };
68 |
69 | #endif
--------------------------------------------------------------------------------
/Sketcher_SnapMiddle.cxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_SnapMiddle.cxx
3 | * \brief Implementation file for the class Sketcher_SnapMiddle
4 | * \author Sergei Maslov
5 | */
6 | #include "Sketcher_SnapMiddle.hxx"
7 |
8 | IMPLEMENT_STANDARD_RTTIEXT(Sketcher_SnapMiddle, Sketcher_Snap)
9 |
10 | /**
11 | * \fn Sketcher_SnapMiddle()
12 | * \brief Constructs a Sketcher_SnapMiddle
13 | */
14 | Sketcher_SnapMiddle::Sketcher_SnapMiddle()
15 | {
16 | }
17 |
18 |
19 | /**
20 | * \fn ~Sketcher_SnapMiddle()
21 | * \brief Destructor
22 | */
23 | Sketcher_SnapMiddle::~Sketcher_SnapMiddle()
24 | {
25 | }
26 |
27 | /**
28 | * \fn SelectEvent()
29 | * \brief find point nearest to middle line
30 | * \return void
31 | */
32 | void Sketcher_SnapMiddle::SelectEvent()
33 | {
34 | findbestPnt2d = Standard_False;
35 | minDistance = minimumSnapDistance;
36 |
37 | for( Standard_Integer i=1; i<=data->Length(); i++)
38 | {
39 | mySObject = Handle(Sketcher_Object)::DownCast(data->Value(i));
40 | myGeometryType = mySObject->GetGeometryType();
41 | switch (myGeometryType)
42 | {
43 | case PointSketcherObject: curGeom2d_Point = Handle(Geom2d_CartesianPoint)::DownCast(mySObject->GetGeometry());
44 | objectPnt2d = curGeom2d_Point->Pnt2d();
45 | if(count())
46 | {
47 | bestPnt2d = objectPnt2d;
48 | curHilightedObj = mySObject->GetAIS_Object();
49 | }
50 | break;
51 | case LineSketcherObject: curGeom2d_Edge = Handle(Geom2d_Edge)::DownCast(mySObject->GetGeometry());
52 | ProjectOnCurve.Init(curPnt2d,curGeom2d_Edge,curGeom2d_Edge->StartParameter(),curGeom2d_Edge->EndParameter());
53 | if(countProject())
54 | {
55 | bestPnt2d = curGeom2d_Edge->MiddlePnt();
56 | curHilightedObj = mySObject->GetAIS_Object();
57 | }
58 | break;
59 | case CircleSketcherObject: break;
60 | case ArcSketcherObject: curGeom2d_Arc = Handle(Geom2d_Arc)::DownCast(mySObject->GetGeometry());
61 | ProjectOnCurve.Init(curPnt2d,curGeom2d_Arc);
62 | if(countProject())
63 | {
64 | bestPnt2d = curGeom2d_Arc->MiddlePnt();
65 | curHilightedObj = mySObject->GetAIS_Object();
66 | }
67 | break;
68 | default:break;
69 | }
70 | }
71 |
72 | if(minDistance == minimumSnapDistance)
73 | bestPnt2d = curPnt2d;
74 | else findbestPnt2d = Standard_True;
75 |
76 | minDistance = bestPnt2d.Distance(curPnt2d);
77 | }
78 |
79 |
80 | /**
81 | * \fn GetSnapType()
82 | * \brief get Snap type
83 | * \return Sketcher_SnapType
84 | */
85 | Sketcher_SnapType Sketcher_SnapMiddle::GetSnapType()
86 | {
87 | return SnapMiddle;
88 | }
89 |
90 |
--------------------------------------------------------------------------------
/Sketcher_SnapMiddle.hxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_SnapMiddle.hxx
3 | * \brief Header file for the class Sketcher_SnapMiddle
4 | * \author Sergei Maslov
5 | */
6 | #ifndef Sketcher_SnapMIDDLE_H
7 | #define Sketcher_SnapMIDDLE_H
8 |
9 | #include "Sketcher_Snap.hxx"
10 | #include "Geom2d_Edge.hxx"
11 | #include "Geom2d_Arc.hxx"
12 |
13 | DEFINE_STANDARD_HANDLE(Sketcher_SnapMiddle,Sketcher_Snap)
14 |
15 | //snap searching middle points of line/arc
16 | class Sketcher_SnapMiddle : public Sketcher_Snap
17 | {
18 | public:
19 | // Type management
20 | DEFINE_STANDARD_RTTIEXT(Sketcher_SnapMiddle, Sketcher_Snap)
21 |
22 | /**
23 | * \fn Sketcher_SnapMiddle()
24 | * \brief Constructs a Sketcher_SnapMiddle
25 | */
26 | Standard_EXPORT Sketcher_SnapMiddle();
27 |
28 | /**
29 | * \fn ~Sketcher_SnapMiddle()
30 | * \brief Destructor
31 | */
32 | Standard_EXPORT ~Sketcher_SnapMiddle();
33 |
34 | /**
35 | * \fn SelectEvent()
36 | * \brief find new point
37 | * \return void
38 | */
39 | Standard_EXPORT void SelectEvent();
40 |
41 | /**
42 | * \fn GetSnapType()
43 | * \brief get Snap type
44 | * \return Sketcher_SnapType
45 | */
46 | Standard_EXPORT Sketcher_SnapType GetSnapType();
47 |
48 | private:
49 |
50 | //members
51 |
52 | Handle(Geom2d_Edge) curGeom2d_Edge;
53 | Handle(Geom2d_Arc) curGeom2d_Arc;
54 |
55 | };
56 |
57 | #endif
--------------------------------------------------------------------------------
/Sketcher_SnapNearest.cxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_SnapNearest.cxx
3 | * \brief Implementation file for the class Sketcher_SnapNearest
4 | * \author Sergei Maslov
5 | */
6 | #include "Sketcher_SnapNearest.hxx"
7 |
8 | IMPLEMENT_STANDARD_RTTIEXT(Sketcher_SnapNearest, Sketcher_Snap)
9 |
10 | /**
11 | * \fn Sketcher_SnapNearest()
12 | * \brief Constructs a Sketcher_SnapNearest
13 | */
14 | Sketcher_SnapNearest::Sketcher_SnapNearest()
15 | {
16 | }
17 |
18 |
19 | /**
20 | * \fn ~Sketcher_SnapNearest()
21 | * \brief Destructor
22 | */
23 | Sketcher_SnapNearest::~Sketcher_SnapNearest()
24 | {
25 | }
26 |
27 | /**
28 | * \fn SelectEvent()
29 | * \brief find nearest point on curve
30 | * \return void
31 | */
32 | void Sketcher_SnapNearest::SelectEvent()
33 | {
34 | findbestPnt2d = Standard_False;
35 | minDistance = minimumSnapDistance;
36 |
37 | for( Standard_Integer i=1; i<=data->Length(); i++)
38 | {
39 | mySObject = Handle(Sketcher_Object)::DownCast(data->Value(i));
40 | myGeometryType = mySObject->GetGeometryType();
41 | switch (myGeometryType)
42 | {
43 | case PointSketcherObject: break;
44 | case LineSketcherObject:
45 | case CircleSketcherObject:
46 | case ArcSketcherObject: curGeom2d_Curve = Handle(Geom2d_Curve)::DownCast(mySObject->GetGeometry());
47 | ProjectOnCurve.Init(curPnt2d,curGeom2d_Curve);
48 | if(countProject())
49 | {
50 | bestPnt2d = objectPnt2d;
51 | curHilightedObj = mySObject->GetAIS_Object();
52 | }
53 | break;
54 | default:break;
55 | }
56 | }
57 |
58 | if(minDistance == minimumSnapDistance)
59 | bestPnt2d = curPnt2d;
60 | else findbestPnt2d = Standard_True;
61 | }
62 |
63 |
64 | /**
65 | * \fn GetSnapType()
66 | * \brief get Snap type
67 | * \return Sketcher_SnapType
68 | */
69 | Sketcher_SnapType Sketcher_SnapNearest::GetSnapType()
70 | {
71 | return SnapNearest;
72 | }
73 |
74 |
--------------------------------------------------------------------------------
/Sketcher_SnapNearest.hxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_SnapNearest.hxx
3 | * \brief Header file for the class Sketcher_SnapNearest
4 | * \author Sergei Maslov
5 | */
6 | #ifndef Sketcher_SnapNEAREST_H
7 | #define Sketcher_SnapNEAREST_H
8 |
9 | #include "Sketcher_Snap.hxx"
10 | #include
11 |
12 | class Geom2d_Curve;
13 |
14 | DEFINE_STANDARD_HANDLE(Sketcher_SnapNearest,Sketcher_Snap)
15 |
16 | //snap searching nearest point at line/circle/arc
17 | class Sketcher_SnapNearest : public Sketcher_Snap
18 | {
19 | public:
20 | // Type management
21 | DEFINE_STANDARD_RTTIEXT(Sketcher_SnapNearest, Sketcher_Snap)
22 |
23 | /**
24 | * \fn Sketcher_SnapNearest()
25 | * \brief Constructs a Sketcher_SnapNearest
26 | */
27 | Standard_EXPORT Sketcher_SnapNearest();
28 |
29 | /**
30 | * \fn ~Sketcher_SnapNearest()
31 | * \brief Destructor
32 | */
33 | Standard_EXPORT ~Sketcher_SnapNearest();
34 |
35 | /**
36 | * \fn SelectEvent()
37 | * \brief find new point
38 | * \return void
39 | */
40 | Standard_EXPORT void SelectEvent();
41 |
42 | /**
43 | * \fn GetSnapType()
44 | * \brief get Snap type
45 | * \return Sketcher_SnapType
46 | */
47 | Standard_EXPORT Sketcher_SnapType GetSnapType();
48 |
49 | private:
50 |
51 | //members
52 |
53 | Handle(Geom2d_Curve) curGeom2d_Curve;
54 |
55 | };
56 |
57 | #endif
--------------------------------------------------------------------------------
/Sketcher_SnapTangent.hxx:
--------------------------------------------------------------------------------
1 | /**
2 | * \file Sketcher_SnapTangent.hxx
3 | * \brief Header file for the class Sketcher_SnapTangent
4 | * \author Sergei Maslov
5 | */
6 | #ifndef Sketcher_SnapTangent_H
7 | #define Sketcher_SnapTangent_H
8 |
9 | #include "Sketcher_Snap.hxx"
10 | #include "Geom2d_Edge.hxx"
11 | #include "Geom2d_Arc.hxx"
12 | #include
13 | #include
14 | #include
15 |
16 | #include
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 |
24 | #include
25 | #include
26 | #include
27 |
28 | DEFINE_STANDARD_HANDLE(Sketcher_SnapTangent,Sketcher_Snap)
29 |
30 | //snap searching tangent to objects
31 | class Sketcher_SnapTangent : public Sketcher_Snap
32 | {
33 | public:
34 | // Type management
35 | DEFINE_STANDARD_RTTIEXT(Sketcher_SnapTangent, Sketcher_Snap)
36 |
37 | /**
38 | * \fn Sketcher_SnapTangent()
39 | * \brief Constructs a Sketcher_SnapTangent
40 | */
41 | Standard_EXPORT Sketcher_SnapTangent();
42 |
43 | /**
44 | * \fn ~Sketcher_SnapTangent()
45 | * \brief Destructor
46 | */
47 | Standard_EXPORT ~Sketcher_SnapTangent();
48 |
49 | /**
50 | * \fn MouseInputEvent(const gp_Pnt2d& thePnt2d)
51 | * \brief input event handler
52 | * \return gp_Pnt2d
53 | * \param thePnt2d const gp_Pnt2d&
54 | */
55 | Standard_EXPORT gp_Pnt2d MouseInputEvent(const gp_Pnt2d& tempPnt2d);
56 |
57 | /**
58 | * \fn EraseSnap()
59 | * \brief cancel event handler
60 | * \return void
61 | */
62 | Standard_EXPORT void EraseSnap();
63 |
64 | /**
65 | * \fn SelectEvent()
66 | * \brief find new point
67 | * \return void
68 | */
69 | Standard_EXPORT void SelectEvent();
70 |
71 | /**
72 | * \fn GetSnapType()
73 | * \brief get Snap type
74 | * \return Sketcher_SnapType
75 | */
76 | Standard_EXPORT Sketcher_SnapType GetSnapType();
77 |
78 | /**
79 | * \fn DrawRelation()
80 | * \brief draw relation
81 | * \return void
82 | */
83 | Standard_EXPORT void DrawRelation();
84 |
85 | /**
86 | * \fn EraseRelation()
87 | * \brief erase relation
88 | * \return void
89 | */
90 | Standard_EXPORT void EraseRelation();
91 |
92 | /**
93 | * \fn setFirstPnt(const gp_Pnt2d& p)
94 | * \brief set point and tangent type for exceptions
95 | * \return void
96 | * \param p const gp_Pnt2d&
97 | * \param ttype TangentType
98 | */
99 | Standard_EXPORT void setFirstPnt(const gp_Pnt2d& p,TangentType ttype);
100 |
101 | private:
102 |
103 | // methods
104 |
105 | /**
106 | * \fn SelectLine_FirstPntEvent()
107 | * \brief Find nearest point on curve and store it
108 | * \return void
109 | */
110 | Standard_EXPORT void SelectLine_FirstPntEvent();
111 |
112 | /**
113 | * \fn SelectLine_CheckFirstPntEvent()
114 | * \brief check first point of line belonging to circle/arc
115 | * \return void
116 | */
117 | Standard_EXPORT void SelectLine_CheckFirstPntEvent();
118 |
119 | /**
120 | * \fn SelectLine_FixEvent()
121 | * \brief find tangent line at first point
122 | * \return void
123 | */
124 | Standard_EXPORT void SelectLine_FixEvent();
125 |
126 | /**
127 | * \fn SelectLine_SecondPntEvent()
128 | * \brief find tangent line at second point
129 | * \return void
130 | */
131 | Standard_EXPORT void SelectLine_SecondPntEvent();
132 |
133 | /**
134 | * \fn SelectCurveCenterEvent()
135 | * \brief find tangent circle to curve
136 | * \return void
137 | */
138 | Standard_EXPORT void SelectCurveCenterEvent();
139 |
140 |
141 | //members
142 |
143 | TangentType myTangentType;
144 | Standard_Real radiusDistance;
145 |
146 | gp_Pnt2d myFirstPnt2d;
147 |
148 | //for tangent line first pnt
149 | Standard_Boolean FixFirstPnt;
150 | Standard_Real minAngle;
151 | Standard_Real curAngle;
152 | gp_Lin2d mylin2d;
153 | gp_Dir2d tempDir2d;
154 |
155 | Handle(Geom2d_Arc) curGeom2d_Arc;
156 | Handle(Geom2d_Circle) curGeom2d_Circle;
157 |
158 | Handle(Geom2d_Line) tempGeom2d_Line;
159 | Handle(Geom2d_Circle) tempGeom2d_Circle;
160 | Handle(Geom2d_Curve) tempGeom2d_Curve;
161 |
162 | Geom2dAPI_InterCurveCurve my2dAPI_InterCurveCurve;
163 | Handle(AIS_TangentRelation) myTanRelation;
164 |
165 |
166 | };
167 |
168 | #endif
--------------------------------------------------------------------------------
/Sketcher_SnapType.hxx:
--------------------------------------------------------------------------------
1 | #ifndef Sketcher_SnapType_HeaderFile
2 | #define Sketcher_SnapType_HeaderFile
3 |
4 | enum Sketcher_SnapType
5 | {
6 | SnapNothing,
7 | SnapEnd,
8 | SnapMiddle,
9 | SnapCenter,
10 | SnapNearest,
11 | SnapIntersection,
12 | SnapTangent,
13 | SnapParallel,
14 | SnapPerpendicular,
15 | SnapAnalyse
16 | };
17 |
18 | #endif
19 |
--------------------------------------------------------------------------------
/occQt.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 Shing Liu All Rights Reserved.
3 | *
4 | * File : occQt.h
5 | * Author : Shing Liu(eryar@163.com)
6 | * Date : 2018-01-08 20:00
7 | * Version : OpenCASCADE7.2.0 & Qt5.7.1
8 | *
9 | * Description : OpenCASCADE in Qt.
10 | */
11 |
12 | #ifndef OCCQT_H
13 | #define OCCQT_H
14 |
15 | #include "ui_occQt.h"
16 |
17 | #include
18 |
19 | class OccView;
20 |
21 | //! Qt main window which include OpenCASCADE for its central widget.
22 | class occQt : public QMainWindow
23 | {
24 | Q_OBJECT
25 |
26 | public:
27 | //! constructor/destructor.
28 | occQt(QWidget *parent = 0);
29 | ~occQt();
30 |
31 | protected:
32 | //! create all the actions.
33 | void createActions(void);
34 |
35 | //! create all the menus.
36 | void createMenus(void);
37 |
38 | //! create the toolbar.
39 | void createToolBars(void);
40 |
41 | //! make cylindrical helix.
42 | void makeCylindricalHelix(void);
43 |
44 | //! make conical helix.
45 | void makeConicalHelix(void);
46 |
47 | //! make toroidal helix.
48 | void makeToroidalHelix(void);
49 |
50 | private slots:
51 | //! show about box.
52 | void about(void);
53 |
54 | //! make box test.
55 | void makeBox(void);
56 |
57 | //! make cone test.
58 | void makeCone(void);
59 |
60 | //! make sphere test.
61 | void makeSphere(void);
62 |
63 | //! make cylinder test.
64 | void makeCylinder(void);
65 |
66 | //! make torus test.
67 | void makeTorus(void);
68 |
69 | //! fillet test.
70 | void makeFillet(void);
71 |
72 | //! chamfer test.
73 | void makeChamfer(void);
74 |
75 | //! test extrude algorithm.
76 | void makeExtrude(void);
77 |
78 | //! test revol algorithm.
79 | void makeRevol(void);
80 |
81 | //! test loft algorithm.
82 | void makeLoft(void);
83 |
84 | //! test boolean operation cut.
85 | void testCut(void);
86 |
87 | //! test boolean operation fuse.
88 | void testFuse(void);
89 |
90 | //! test boolean operation common.
91 | void testCommon(void);
92 |
93 | //! test helix shapes.
94 | void testHelix(void);
95 |
96 | private:
97 | Ui::occQtClass ui;
98 |
99 | // wrapped the widget for occ.
100 | OccView* myOccView;
101 | };
102 |
103 | #endif // OCCQT_H
104 |
--------------------------------------------------------------------------------
/occSketcher.pro:
--------------------------------------------------------------------------------
1 | #-------------------------------------------------
2 | #
3 | # Project created by QtCreator 2013-08-18T15:52:09
4 | #
5 | #-------------------------------------------------
6 |
7 | QT += core gui
8 |
9 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
10 |
11 | TARGET = occSketcher
12 | TEMPLATE = app
13 |
14 | SOURCES += Main.cxx \
15 | Sketcher.cxx
16 |
17 | CONFIG += c++11
18 |
19 | HEADERS += Sketcher.h
20 |
21 |
22 | RESOURCES += \
23 | occSketcher.qrc
24 |
25 | CASROOT = D:/OpenCASCADE-7.5.0/opencascade-7.5.0
26 |
27 | win32 {
28 | DEFINES += \
29 | WNT
30 | INCLUDEPATH += \
31 | $$(CASROOT)/inc
32 |
33 | win32-msvc2010 {
34 | compiler=vc10
35 | }
36 |
37 | win32-msvc2012 {
38 | compiler=vc11
39 | }
40 |
41 | win32-msvc2013 {
42 | compiler=vc12
43 | }
44 |
45 | win32-msvc2015 {
46 | compiler=vc14
47 | }
48 |
49 | # Determine 32 / 64 bit and debug / release build
50 | !contains(QMAKE_TARGET.arch, x86_64) {
51 | CONFIG(debug, debug|release) {
52 | message("Debug 32 build")
53 | LIBS += -L$$(CASROOT)/win32/$$compiler/libd
54 | }
55 | else {
56 | message("Release 32 build")
57 | LIBS += -L$$(CASROOT)/win32/$$compiler/lib
58 | }
59 | }
60 | else {
61 | CONFIG(debug, debug|release) {
62 | message("Debug 64 build")
63 | LIBS += -L$$(CASROOT)/win64/$$compiler/libd
64 | }
65 | else {
66 | message("Release 64 build")
67 | LIBS += -L$$(CASROOT)/win64/$$compiler/lib
68 | }
69 | }
70 | }
71 |
72 | linux-g++ {
73 | INCLUDEPATH += \
74 | $$(CASROOT)/include/opencascade
75 |
76 | LIBS += \
77 | -L$$(CASROOT)/lib
78 | }
79 |
80 | LIBS += \
81 | -lTKernel \
82 | -lTKMath \
83 | -lTKG3d \
84 | -lTKBRep \
85 | -lTKGeomBase\
86 | -lTKGeomAlgo\
87 | -lTKTopAlgo \
88 | -lTKPrim \
89 | -lTKBO \
90 | -lTKBool \
91 | -lTKOffset \
92 | -lTKService \
93 | -lTKV3d \
94 | -lTKOpenGl \
95 | -lTKFillet
96 |
--------------------------------------------------------------------------------
/occSketcher.qrc:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/occView.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2018 Shing Liu All Rights Reserved.
3 | *
4 | * File : OccView.h
5 | * Author : Shing Liu(eryar@163.com)
6 | * Date : 2018-01-09 21:00
7 | * Version : OpenCASCADE7.2.0 & Qt5.7.1
8 | *
9 | * Description : Adapte OpenCASCADE view for Qt.
10 | */
11 |
12 | #ifndef _OCCVIEW_H_
13 | #define _OCCVIEW_H_
14 |
15 | #include
16 |
17 | #include
18 |
19 | #include "Sketcher.hxx"
20 |
21 | class QMenu;
22 | class QRubberBand;
23 |
24 | //! adapted a QGLWidget for OpenCASCADE viewer.
25 | class OccView : public QWidget
26 | {
27 | Q_OBJECT
28 |
29 | public:
30 | //! mouse actions.
31 | enum CurrentAction3d
32 | {
33 | CurAction3d_Nothing,
34 | CurAction3d_DynamicZooming,
35 | CurAction3d_WindowZooming,
36 | CurAction3d_DynamicPanning,
37 | CurAction3d_GlobalPanning,
38 | CurAction3d_DynamicRotation,
39 | CurAction3d_Sketcher
40 | };
41 |
42 | public:
43 | //! constructor.
44 | OccView(QWidget* parent);
45 |
46 | const Handle(AIS_InteractiveContext)& getContext() const;
47 |
48 | signals:
49 | void selectionChanged(void);
50 |
51 | public slots:
52 | //! operations for the view.
53 | void pan(void);
54 | void fitAll(void);
55 | void reset(void);
56 | void zoom(void);
57 | void rotate(void);
58 |
59 | //!
60 | void drawLine();
61 |
62 | protected:
63 | virtual QPaintEngine* paintEngine() const;
64 |
65 | // Paint events.
66 | virtual void paintEvent(QPaintEvent* theEvent);
67 | virtual void resizeEvent(QResizeEvent* theEvent);
68 |
69 | // Mouse events.
70 | virtual void mousePressEvent(QMouseEvent* theEvent);
71 | virtual void mouseReleaseEvent(QMouseEvent* theEvent);
72 | virtual void mouseMoveEvent(QMouseEvent * theEvent);
73 | virtual void wheelEvent(QWheelEvent * theEvent);
74 |
75 | // Button events.
76 | virtual void onLButtonDown(const int theFlags, const QPoint thePoint);
77 | virtual void onMButtonDown(const int theFlags, const QPoint thePoint);
78 | virtual void onRButtonDown(const int theFlags, const QPoint thePoint);
79 | virtual void onMouseWheel(const int theFlags, const int theDelta, const QPoint thePoint);
80 | virtual void onLButtonUp(const int theFlags, const QPoint thePoint);
81 | virtual void onMButtonUp(const int theFlags, const QPoint thePoint);
82 | virtual void onRButtonUp(const int theFlags, const QPoint thePoint);
83 | virtual void onMouseMove(const int theFlags, const QPoint thePoint);
84 |
85 | // Popup menu.
86 | virtual void addItemInPopup(QMenu* theMenu);
87 |
88 | protected:
89 | void init(void);
90 | void popup(const int x, const int y);
91 | void dragEvent(const int x, const int y);
92 | void inputEvent(const int x, const int y);
93 | void moveEvent(const int x, const int y);
94 | void multiMoveEvent(const int x, const int y);
95 | void multiDragEvent(const int x, const int y);
96 | void multiInputEvent(const int x, const int y);
97 | void drawRubberBand(const int minX, const int minY, const int maxX, const int maxY);
98 | void panByMiddleButton(const QPoint& thePoint);
99 |
100 | private:
101 |
102 | //! the occ viewer.
103 | Handle(V3d_Viewer) myViewer;
104 |
105 | //! the occ view.
106 | Handle(V3d_View) myView;
107 |
108 | //! the occ context.
109 | Handle(AIS_InteractiveContext) myContext;
110 |
111 | //! save the mouse position.
112 | Standard_Integer myXmin;
113 | Standard_Integer myYmin;
114 | Standard_Integer myXmax;
115 | Standard_Integer myYmax;
116 |
117 | //! the mouse current mode.
118 | CurrentAction3d myCurrentMode;
119 |
120 | //! save the degenerate mode state.
121 | Standard_Boolean myDegenerateModeIsOn;
122 |
123 | //! rubber rectangle for the mouse selection.
124 | QRubberBand* myRectBand;
125 |
126 | Sketcher* mySketcher;
127 | };
128 |
129 | #endif // _OCCVIEW_H_
130 |
--------------------------------------------------------------------------------
/res/SampleImportExport.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/SampleImportExport.png
--------------------------------------------------------------------------------
/res/cascade.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/cascade.png
--------------------------------------------------------------------------------
/res/close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/close.png
--------------------------------------------------------------------------------
/res/cursor_rotate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/cursor_rotate.png
--------------------------------------------------------------------------------
/res/cursor_zoom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/cursor_zoom.png
--------------------------------------------------------------------------------
/res/delete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/delete.png
--------------------------------------------------------------------------------
/res/document.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/document.png
--------------------------------------------------------------------------------
/res/erase.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/erase.PNG
--------------------------------------------------------------------------------
/res/grid.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/grid.PNG
--------------------------------------------------------------------------------
/res/help.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/help.png
--------------------------------------------------------------------------------
/res/icon.qm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/icon.qm
--------------------------------------------------------------------------------
/res/inputArc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/inputArc.png
--------------------------------------------------------------------------------
/res/inputArc3p.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/inputArc3p.PNG
--------------------------------------------------------------------------------
/res/inputArcCenter2p.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/inputArcCenter2p.PNG
--------------------------------------------------------------------------------
/res/inputBezierCurve.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/inputBezierCurve.PNG
--------------------------------------------------------------------------------
/res/inputBsplineCurve.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/inputBsplineCurve.PNG
--------------------------------------------------------------------------------
/res/inputCircle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/inputCircle.png
--------------------------------------------------------------------------------
/res/inputCircle2.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/inputCircle2.PNG
--------------------------------------------------------------------------------
/res/inputCircle2PTan.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/inputCircle2PTan.PNG
--------------------------------------------------------------------------------
/res/inputCircle3p.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/inputCircle3p.PNG
--------------------------------------------------------------------------------
/res/inputCircle3tan.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/inputCircle3tan.PNG
--------------------------------------------------------------------------------
/res/inputCircleP2Tan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/inputCircleP2Tan.png
--------------------------------------------------------------------------------
/res/inputLine.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/inputLine.png
--------------------------------------------------------------------------------
/res/inputPoint.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/inputPoint.PNG
--------------------------------------------------------------------------------
/res/lamp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/lamp.png
--------------------------------------------------------------------------------
/res/new.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/new.png
--------------------------------------------------------------------------------
/res/plane.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/plane.PNG
--------------------------------------------------------------------------------
/res/property.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/property.PNG
--------------------------------------------------------------------------------
/res/redraw.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/redraw.png
--------------------------------------------------------------------------------
/res/snapanalyser.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/snapanalyser.PNG
--------------------------------------------------------------------------------
/res/snapcenter.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/snapcenter.PNG
--------------------------------------------------------------------------------
/res/snapend.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/snapend.PNG
--------------------------------------------------------------------------------
/res/snapintersection.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/snapintersection.PNG
--------------------------------------------------------------------------------
/res/snapmiddle.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/snapmiddle.PNG
--------------------------------------------------------------------------------
/res/snapnearest.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/snapnearest.PNG
--------------------------------------------------------------------------------
/res/snapnon.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/snapnon.PNG
--------------------------------------------------------------------------------
/res/snapparallel.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/snapparallel.PNG
--------------------------------------------------------------------------------
/res/snapperpendicular.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/snapperpendicular.PNG
--------------------------------------------------------------------------------
/res/snaptangent.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/snaptangent.PNG
--------------------------------------------------------------------------------
/res/string.qm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/string.qm
--------------------------------------------------------------------------------
/res/tile.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/tile.png
--------------------------------------------------------------------------------
/res/tool_color.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/tool_color.png
--------------------------------------------------------------------------------
/res/tool_delete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/tool_delete.png
--------------------------------------------------------------------------------
/res/tool_material.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/tool_material.png
--------------------------------------------------------------------------------
/res/tool_shading.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/tool_shading.png
--------------------------------------------------------------------------------
/res/tool_transparency.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/tool_transparency.png
--------------------------------------------------------------------------------
/res/tool_wireframe.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/tool_wireframe.png
--------------------------------------------------------------------------------
/res/trimcurve.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/trimcurve.PNG
--------------------------------------------------------------------------------
/res/view_axo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/view_axo.png
--------------------------------------------------------------------------------
/res/view_back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/view_back.png
--------------------------------------------------------------------------------
/res/view_bottom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/view_bottom.png
--------------------------------------------------------------------------------
/res/view_comp_off.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/view_comp_off.png
--------------------------------------------------------------------------------
/res/view_comp_on.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/view_comp_on.png
--------------------------------------------------------------------------------
/res/view_fitall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/view_fitall.png
--------------------------------------------------------------------------------
/res/view_fitarea.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/view_fitarea.png
--------------------------------------------------------------------------------
/res/view_front.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/view_front.png
--------------------------------------------------------------------------------
/res/view_glpan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/view_glpan.png
--------------------------------------------------------------------------------
/res/view_left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/view_left.png
--------------------------------------------------------------------------------
/res/view_pan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/view_pan.png
--------------------------------------------------------------------------------
/res/view_reset.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/view_reset.png
--------------------------------------------------------------------------------
/res/view_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/view_right.png
--------------------------------------------------------------------------------
/res/view_rotate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/view_rotate.png
--------------------------------------------------------------------------------
/res/view_top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/view_top.png
--------------------------------------------------------------------------------
/res/view_zoom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eryar/occSketcher/b786d0bf412761e471a2a935479ba9c950d16c86/res/view_zoom.png
--------------------------------------------------------------------------------