-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathSketcher_QtGUI.cxx
88 lines (81 loc) · 2.31 KB
/
Sketcher_QtGUI.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/**
* \file Sketcher_QtGUI.cxx
* \brief Implementation file for the class Sketcher_QtGUI
* \author <a href="mailto:[email protected]?subject=Sketcher_QtGUI.cxx">Sergei Maslov</a>
*/
#include "Sketcher_QtGUI.hxx"
/**
* \fn Sketcher_QtGUI( QWidget* parent)
* \brief Constructs a Sketcher_QtGUI
* \param parent QWidget*
*/
Sketcher_QtGUI::Sketcher_QtGUI(QWidget* parent)
{
prop_arc = new Sketcher_PropertyArc( parent, "Arc");
prop_circle = new Sketcher_PropertyCircle( parent, "Circle");
prop_line = new Sketcher_PropertyLine( parent, "Lines");
prop_point = new Sketcher_PropertyPoint( parent, "Points");
}
/**
* \fn ~Sketcher_GUI()
* \brief destructor
*/
Sketcher_QtGUI::~Sketcher_QtGUI()
{
// no need to delete child widgets, Qt does it all for us
}
/**
* \fn SetContext(Handle(AIS_InteractiveContext)& theContext)
* \brief pass context to property classes
* \return void
* \param theContext Handle(AIS_InteractiveContext)&
*/
void Sketcher_QtGUI::SetContext (Handle(AIS_InteractiveContext)& theContext)
{
prop_arc->SetContext( theContext);
prop_circle->SetContext( theContext);
prop_line->SetContext( theContext);
prop_point->SetContext( theContext);
}
/**
* \fn SetAx3(const gp_Ax3& theAx3)
* \brief pass coordinate system to property classes
* \return void
* \param theAx3 const gp_Ax3&
*/
void Sketcher_QtGUI::SetAx3 (const gp_Ax3& theAx3)
{
prop_arc->SetAx3( theAx3);
prop_circle->SetAx3( theAx3);
prop_line->SetAx3( theAx3);
prop_point->SetAx3( theAx3);
}
/**
* \fn SetSketcher_Object(Handle(Sketcher_Object)& CurObject)
* \brief determine property to show, pass object to this property class
* \return void
* \param CurObject Handle(Sketcher_Object)&
*/
void Sketcher_QtGUI::SetSketcher_Object(Handle(Sketcher_Object)& CurObject)
{
if(!prop_arc->isHidden())
prop_arc->close();
if(!prop_circle->isHidden())
prop_circle->close();
if(!prop_line->isHidden())
prop_line->close();
if(!prop_point->isHidden())
prop_point->close();
switch (CurObject->GetGeometryType())
{
case ArcSketcherObject: prop_arc->SetObject(CurObject);
break;
case CircleSketcherObject: prop_circle->SetObject(CurObject);
break;
case LineSketcherObject: prop_line->SetObject(CurObject);
break;
case PointSketcherObject: prop_point->SetObject(CurObject);
break;
default:break;
}
}