1 // File: PartSet_WidgetPoint2dDistance.h
2 // Created: 23 June 2014
3 // Author: Vitaly Smetannikov
5 #ifndef PartSet_WidgetPoint2dDistance_H
6 #define PartSet_WidgetPoint2dDistance_H
9 #include <ModuleBase_WidgetDoubleValue.h>
11 #include <ModelAPI_CompositeFeature.h>
15 class ModuleBase_IViewWindow;
18 class PARTSET_EXPORT PartSet_WidgetPoint2dDistance : public ModuleBase_WidgetDoubleValue
23 /// \theParent the parent object
24 /// \theData the widget configuation. The attribute of the model widget is obtained from
25 PartSet_WidgetPoint2dDistance(QWidget* theParent, const Config_WidgetAPI* theData,
26 const std::string& theParentId);
28 virtual ~PartSet_WidgetPoint2dDistance();
30 /// The methiod called when widget is activated
31 virtual void activate();
33 /// The methiod called when widget is deactivated
34 virtual void deactivate();
36 /// Set the given wrapped value to the current widget
37 /// This value should be processed in the widget according to the needs
38 /// \param theValue the wrapped widget value
39 //virtual bool setValue(ModuleBase_WidgetValue* theValue);
41 XGUI_Workshop* workshop() const { return myWorkshop; }
43 void setWorkshop(XGUI_Workshop* theWork) { myWorkshop = theWork; }
45 /// \returns the sketch instance
46 CompositeFeaturePtr sketch() const { return mySketch; }
47 void setSketch(CompositeFeaturePtr theSketch) { mySketch = theSketch; }
50 void onMouseRelease(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
51 void onMouseMove(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent);
54 /// Set the second point which defines a value in the widget as a distance with a first point defined by feature
55 void setPoint(FeaturePtr theFeature, const std::shared_ptr<GeomAPI_Pnt2d>& thePnt);
58 XGUI_Workshop* myWorkshop;
59 std::string myFirstPntName;
61 CompositeFeaturePtr mySketch;