Salome HOME
refs #30 - Sketch base GUI: create, draw lines
[modules/shaper.git] / src / XGUI / XGUI_Displayer.cpp
1 #include "XGUI_Displayer.h"
2 #include "XGUI_Tools.h"
3 #include "XGUI_Viewer.h"
4
5 #include <ModelAPI_Document.h>
6
7 #include <AIS_InteractiveContext.hxx>
8 #include <AIS_Shape.hxx>
9
10 /*!
11  \brief Constructor
12  */
13 XGUI_Displayer::XGUI_Displayer(XGUI_Viewer* theViewer)
14 : myViewer(theViewer)
15 {
16 }
17
18 /*!
19  \brief Destructor
20  */
21 XGUI_Displayer::~XGUI_Displayer()
22 {
23 }
24
25 /*!
26  * Display the feature
27  * \param theFeature a feature instance
28  */
29 void XGUI_Displayer::Display(std::shared_ptr<ModelAPI_Feature> theFeature)
30 {
31 }
32
33 /*!
34  * Display the feature and a shape. This shape would be associated to the given feature
35  * \param theFeature a feature instance
36  * \param theFeature a shape
37  */
38 void XGUI_Displayer::Display(std::shared_ptr<ModelAPI_Feature> theFeature,
39                              const TopoDS_Shape& theShape)
40 {
41   Handle(AIS_InteractiveContext) aContext = myViewer->AISContext();
42
43   Handle(AIS_Shape) anAIS = new AIS_Shape(theShape);
44   aContext->Display(anAIS, Standard_False);
45
46   aContext->UpdateCurrentViewer();
47 }
48
49 /*!
50  * Erase the feature and a shape.
51  * \param theFeature a feature instance
52  * \param theFeature a shape
53  */
54 void XGUI_Displayer::Erase(std::shared_ptr<ModelAPI_Feature> theFeature,
55                            const TopoDS_Shape& theShape)
56 {
57   Handle(AIS_InteractiveContext) aContext = myViewer->AISContext();
58   aContext->EraseAll();
59 }