Salome HOME
Merge branch 'master' of newgeom:newgeom
[modules/shaper.git] / src / XGUI / XGUI_Displayer.h
1 // File:        XGUI_Displayer.h
2 // Created:     20 Apr 2014
3 // Author:      Natalia ERMOLAEVA
4
5 #ifndef XGUI_Displayer_H
6 #define XGUI_Displayer_H
7
8 #include "XGUI.h"
9
10 #include <QString>
11 #include <boost/shared_ptr.hpp>
12
13 #include <TopoDS_Shape.hxx>
14 #include <AIS_InteractiveObject.hxx>
15
16 #include <map>
17 #include <vector>
18
19 class XGUI_Viewer;
20 class ModelAPI_Feature;
21
22
23 /**\class XGUI_Displayer
24  * \ingroup GUI
25  * \brief Displayer. Provides mechanizm of display/erase of objects in the viewer
26  */
27 class XGUI_EXPORT XGUI_Displayer
28 {
29 public:
30   /// Constructor
31   /// \param theViewer the viewer
32   XGUI_Displayer(XGUI_Viewer* theViewer);
33   /// Destructor
34   virtual ~XGUI_Displayer();
35
36   /// Display the feature. Obtain the visualized object from the feature.
37   /// \param theFeature a feature instance
38   /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
39   void Display(boost::shared_ptr<ModelAPI_Feature> theFeature, const bool isUpdateViewer = true);
40
41   /// Display the feature and a shape. This shape would be associated to the given feature
42   /// \param theFeature a feature instance
43   /// \param theShape a shape
44   /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
45   void Display(boost::shared_ptr<ModelAPI_Feature> theFeature, const TopoDS_Shape& theShape,
46                const bool isUpdateViewer = true);
47   
48   /// Display the shape and activate selection of sub-shapes
49   /// \param theFeature a feature instance
50   /// \param theShape a shape
51   /// \param theMode a local selection mode
52   /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
53   void LocalSelection(boost::shared_ptr<ModelAPI_Feature> theFeature, const TopoDS_Shape& theShape,
54                       const int theMode, const bool isUpdateViewer = true);
55
56   /// Erase the feature and a shape.
57   /// \param theFeature a feature instance
58   /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
59   void Erase(boost::shared_ptr<ModelAPI_Feature> theFeature, const bool isUpdateViewer = true);
60
61   /// Deactivates selection of sub-shapes
62   /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
63   void GlobalSelection(const bool isUpdateViewer = true);
64
65 protected:
66   XGUI_Viewer* myViewer; ///< the viewer where the objects should be visualized
67   std::map<boost::shared_ptr<ModelAPI_Feature>, std::vector<Handle(AIS_InteractiveObject)> > myFeature2AISObjectMap;
68 };
69
70 #endif