]> SALOME platform Git repositories - modules/shaper.git/blob - src/PartSet/PartSet_WidgetSubShapeSelector.h
Salome HOME
4c094579948f9078025575d63f4b2672a31a77c9
[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   /// Processing the mouse move event in the viewer
50   /// \param theWindow a view window
51   /// \param theEvent a mouse event
52   virtual void mouseMoved(ModuleBase_IViewWindow* theWindow, QMouseEvent* theEvent);
53
54   /// Returns values which should be highlighted when the whidget is active
55   /// \param theValues a list of presentations
56   virtual void getHighlighted(QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues);
57
58 protected:
59   /// Checks the widget validity. By default, it returns true.
60   /// \param thePrs a selected presentation in the view
61   /// \return a boolean value
62   //virtual bool isValidSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
63
64   /// Return an object and geom shape by the viewer presentation
65   /// \param thePrs a selection
66   /// \param theObject an output object
67   /// \param theShape a shape of the selection
68   //virtual void getGeomSelection(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs,
69   //                              ObjectPtr& theObject,
70   //                              GeomShapePtr& theShape);
71   void fillObjectShapes(const ObjectPtr& theObject);
72
73 protected:
74   std::shared_ptr<ModuleBase_ViewerPrs> myCurrentSubShape;
75   std::map<ObjectPtr, std::set<GeomShapePtr> > myCashedShapes;
76 };
77
78 #endif