1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: PartSet_WidgetSubShapeSelector.h
4 // Created: 21 Jul 2016
5 // Author: Natalia ERMOLAEVA
8 #ifndef PartSet_WidgetSubShapeSelector_H
9 #define PartSet_WidgetSubShapeSelector_H
13 #include <ModuleBase_WidgetShapeSelector.h>
14 #include <PartSet_MouseProcessor.h>
16 #include <ModelAPI_CompositeFeature.h>
23 class ModuleBase_IWorkshop;
24 class Config_WidgetAPI;
25 class ModuleBase_IViewWindow;
26 class ModuleBase_ViewerPrs;
33 * Customosation of PartSet_WidgetSubShapeSelector in order to visualize sub-shape
34 * by mouse move over shape in the viewer. Split of the object is performed by
35 * coincident points to the object. Segment between nearest coincidence is highlighted
37 class PARTSET_EXPORT PartSet_WidgetSubShapeSelector: public ModuleBase_WidgetShapeSelector,
38 public PartSet_MouseProcessor
43 /// \param theParent the parent object
44 /// \param theWorkshop instance of workshop interface
45 /// \param theData the widget configuation. The attribute of the model widget is obtained from
46 PartSet_WidgetSubShapeSelector(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop,
47 const Config_WidgetAPI* theData);
49 virtual ~PartSet_WidgetSubShapeSelector();
52 /// \param theSketch a sketcher object
53 void setSketcher(CompositeFeaturePtr theSketch) { mySketch = theSketch; }
55 /// Retrurns installed sketcher
56 CompositeFeaturePtr sketch() const { return mySketch; }
58 /// The methiod called when widget is deactivated
59 virtual void deactivate();
61 /// Processing the mouse move event in the viewer
62 /// \param theWindow a view window
63 /// \param theEvent a mouse event
64 virtual void mouseMoved(ModuleBase_IViewWindow* theWindow, QMouseEvent* theEvent);
66 /// Returns values which should be highlighted when the whidget is active
67 /// \param theValues a list of presentations
68 virtual void getHighlighted(QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues);
71 /// Checks the widget validity. By default, it returns true.
72 /// \param thePrs a selected presentation in the view
73 /// \return a boolean value
74 //virtual bool isValidSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
76 /// Return an object and geom shape by the viewer presentation
77 /// \param thePrs a selection
78 /// \param theObject an output object
79 /// \param theShape a shape of the selection
80 //virtual void getGeomSelection(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs,
81 // ObjectPtr& theObject,
82 // GeomShapePtr& theShape);
83 void fillObjectShapes(const ObjectPtr& theObject);
86 /// The methiod called when widget is activated
87 virtual void activateCustom();
90 std::shared_ptr<ModuleBase_ViewerPrs> myCurrentSubShape;
91 std::map<ObjectPtr, std::set<GeomShapePtr> > myCashedShapes;
93 /// Pointer to a sketch
94 CompositeFeaturePtr mySketch;