1 // File: XGUI_Displayer.h
2 // Created: 20 Apr 2014
3 // Author: Natalia ERMOLAEVA
5 #ifndef XGUI_Displayer_H
6 #define XGUI_Displayer_H
11 #include <boost/shared_ptr.hpp>
13 #include <TopoDS_Shape.hxx>
14 #include <AIS_InteractiveObject.hxx>
15 #include <AIS_InteractiveContext.hxx>
21 class ModelAPI_Feature;
24 /**\class XGUI_Displayer
26 * \brief Displayer. Provides mechanizm of display/erase of objects in the viewer
28 class XGUI_EXPORT XGUI_Displayer
32 /// \param theViewer the viewer
33 XGUI_Displayer(const Handle(AIS_InteractiveContext)& theAIS);
35 virtual ~XGUI_Displayer();
37 /// Set AIS_InteractiveContext object in case if it was changed
38 /// or can not be initialized in constructor
39 void setAISContext(const Handle(AIS_InteractiveContext)& theAIS);
41 /// Display the feature. Obtain the visualized object from the feature.
42 /// \param theFeature a feature instance
43 /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
44 void Display(boost::shared_ptr<ModelAPI_Feature> theFeature, const bool isUpdateViewer = true);
46 /// Display the feature and a shape. This shape would be associated to the given feature
47 /// \param theFeature a feature instance
48 /// \param theShape a shape
49 /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
50 void Display(boost::shared_ptr<ModelAPI_Feature> theFeature, const TopoDS_Shape& theShape,
51 const bool isUpdateViewer = true);
53 /// Display the shape and activate selection of sub-shapes
54 /// \param theFeature a feature instance
55 /// \param theShape a shape
56 /// \param theMode a local selection mode
57 /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
58 void LocalSelection(boost::shared_ptr<ModelAPI_Feature> theFeature, const TopoDS_Shape& theShape,
59 const int theMode, const bool isUpdateViewer = true);
61 /// Erase the feature and a shape.
62 /// \param theFeature a feature instance
63 /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
64 void Erase(boost::shared_ptr<ModelAPI_Feature> theFeature, const bool isUpdateViewer = true);
66 /// Deactivates selection of sub-shapes
67 /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
68 void GlobalSelection(const bool isUpdateViewer = true);
70 /// Activate local selection
71 /// \param theAIS the list of objects
72 /// \param theMode the selection mode
73 /// \param isUpdateViewer the state wether the viewer should be updated immediatelly
74 void setLocalSelection(const AIS_ListOfInteractive& theAISObjects, const int theMode,
75 const bool isUpdateViewer);
76 /// Deactivate local selection
77 /// \param isUpdateViewer the state wether the viewer should be updated immediatelly
78 void setGlobalSelection(const bool isUpdateViewer);
80 /// Returns currently installed AIS_InteractiveContext
81 Handle(AIS_InteractiveContext) AISContext() const { return myAISContext; }
84 ///< the viewer where the objects should be visualized
85 Handle(AIS_InteractiveContext) myAISContext;
86 std::map<boost::shared_ptr<ModelAPI_Feature>, std::vector<Handle(AIS_InteractiveObject)> > myFeature2AISObjectMap;