]> SALOME platform Git repositories - modules/shaper.git/blob - src/PartSet/PartSet_WidgetSubShapeSelector.h
Salome HOME
34e7b371a4cc6fd6135f2e4e175730dc5b1a1267
[modules/shaper.git] / src / PartSet / PartSet_WidgetSubShapeSelector.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        PartSet_WidgetSubShapeSelector.h
4 // Created:     21 Jul 2016
5 // Author:      Natalia ERMOLAEVA
6
7
8 #ifndef PartSet_WidgetSubShapeSelector_H
9 #define PartSet_WidgetSubShapeSelector_H
10
11 #include "PartSet.h"
12
13 #include <PartSet_WidgetShapeSelector.h>
14 #include <PartSet_MouseProcessor.h>
15
16 #include <QObject>
17
18 #include <set>
19 #include <map>
20
21 class ModuleBase_IWorkshop;
22 class Config_WidgetAPI;
23 class ModuleBase_IViewWindow;
24 class ModuleBase_ViewerPrs;
25
26 class QWidget;
27 class QMouseEvent;
28
29 /**
30 * \ingroup Modules
31 * Customosation of PartSet_WidgetSubShapeSelector in order to visualize sub-shape 
32 * by mouse move over shape in the viewer. Split of the object is performed by
33 * coincident points to the object. Segment between nearest coincidence is highlighted
34 */
35 class PARTSET_EXPORT PartSet_WidgetSubShapeSelector: public PartSet_WidgetShapeSelector,
36                                                      public PartSet_MouseProcessor
37 {
38 Q_OBJECT
39  public:
40   /// Constructor
41   /// \param theParent the parent object
42   /// \param theWorkshop instance of workshop interface
43   /// \param theData the widget configuation. The attribute of the model widget is obtained from
44   PartSet_WidgetSubShapeSelector(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop,
45                                  const Config_WidgetAPI* theData);
46
47   virtual ~PartSet_WidgetSubShapeSelector();
48
49   /// The methiod called when widget is deactivated
50   virtual void deactivate();
51
52   /// Processing the mouse move event in the viewer
53   /// \param theWindow a view window
54   /// \param theEvent a mouse event
55   virtual void mouseMoved(ModuleBase_IViewWindow* theWindow, QMouseEvent* theEvent);
56
57   /// Returns values which should be highlighted when the whidget is active
58   /// \param theValues a list of presentations
59   virtual void getHighlighted(QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues);
60
61 protected:
62   /// Checks the widget validity. By default, it returns true.
63   /// \param thePrs a selected presentation in the view
64   /// \return a boolean value
65   //virtual bool isValidSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
66
67   /// Return an object and geom shape by the viewer presentation
68   /// \param thePrs a selection
69   /// \param theObject an output object
70   /// \param theShape a shape of the selection
71   //virtual void getGeomSelection(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs,
72   //                              ObjectPtr& theObject,
73   //                              GeomShapePtr& theShape);
74   void fillObjectShapes(const ObjectPtr& theObject);
75
76 protected:
77   /// The methiod called when widget is activated
78   virtual void activateCustom();
79
80 protected:
81   std::shared_ptr<ModuleBase_ViewerPrs> myCurrentSubShape;
82   std::map<ObjectPtr, std::set<GeomShapePtr> > myCashedShapes;
83 };
84
85 #endif