1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: PartSet_WidgetPoint2dDistance.h
4 // Created: 23 June 2014
5 // Author: Vitaly Smetannikov
7 #ifndef PartSet_WidgetPoint2dDistance_H
8 #define PartSet_WidgetPoint2dDistance_H
11 #include <ModuleBase_WidgetDoubleValue.h>
13 #include <ModelAPI_CompositeFeature.h>
17 class ModuleBase_IViewWindow;
20 class PARTSET_EXPORT PartSet_WidgetPoint2dDistance : public ModuleBase_WidgetDoubleValue
25 /// \theParent the parent object
26 /// \theData the widget configuation. The attribute of the model widget is obtained from
27 PartSet_WidgetPoint2dDistance(QWidget* theParent, const Config_WidgetAPI* theData,
28 const std::string& theParentId);
30 virtual ~PartSet_WidgetPoint2dDistance();
32 /// The methiod called when widget is activated
33 virtual void activate();
35 /// The methiod called when widget is deactivated
36 virtual void deactivate();
38 /// Set the given wrapped value to the current widget
39 /// This value should be processed in the widget according to the needs
40 /// \param theValue the wrapped widget value
41 //virtual bool setValue(ModuleBase_WidgetValue* theValue);
43 XGUI_Workshop* workshop() const { return myWorkshop; }
45 void setWorkshop(XGUI_Workshop* theWork) { myWorkshop = theWork; }
47 /// \returns the sketch instance
48 CompositeFeaturePtr sketch() const { return mySketch; }
49 void setSketch(CompositeFeaturePtr theSketch) { mySketch = theSketch; }
52 void onMouseRelease(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
53 void onMouseMove(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
56 /// Set the second point which defines a value in the widget as a distance with a first point defined by feature
57 void setPoint(FeaturePtr theFeature, const std::shared_ptr<GeomAPI_Pnt2d>& thePnt);
60 void onValuesChanged();
63 XGUI_Workshop* myWorkshop;
64 std::string myFirstPntName;
66 CompositeFeaturePtr mySketch;