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);
70 /// Fills the attribute with the value of the selected owner
71 /// \param thePrs a selected owner
72 virtual bool setSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
75 /// Checks the widget validity. By default, it returns true.
76 /// \param thePrs a selected presentation in the view
77 /// \return a boolean value
78 //virtual bool isValidSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
80 /// Return an object and geom shape by the viewer presentation
81 /// \param thePrs a selection
82 /// \param theObject an output object
83 /// \param theShape a shape of the selection
84 //virtual void getGeomSelection(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs,
85 // ObjectPtr& theObject,
86 // GeomShapePtr& theShape);
87 void fillObjectShapes(const ObjectPtr& theObject);
90 /// The methiod called when widget is activated
91 virtual void activateCustom();
94 std::shared_ptr<ModuleBase_ViewerPrs> myCurrentSubShape;
95 std::map<ObjectPtr, std::set<GeomShapePtr> > myCashedShapes;
97 /// Pointer to a sketch
98 CompositeFeaturePtr mySketch;