1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: PartSet_SketcherMgr.h
4 // Created: 19 Dec 2014
5 // Author: Vitaly SMETANNIKOV
7 #ifndef PartSet_SketcherMgr_H
8 #define PartSet_SketcherMgr_H
12 #include <ModelAPI_Feature.h>
13 #include <ModelAPI_Attribute.h>
14 #include <ModelAPI_CompositeFeature.h>
16 #include <ModuleBase_ViewerFilters.h>
18 #include <GeomAPI_Pln.h>
24 class ModuleBase_IViewWindow;
25 class ModuleBase_Operation;
30 * A class for management of sketch operations
32 class PARTSET_EXPORT PartSet_SketcherMgr : public QObject
36 PartSet_SketcherMgr(PartSet_Module* theModule);
38 virtual ~PartSet_SketcherMgr();
40 static QStringList sketchOperationIdList();
42 /// Launches the operation from current highlighting
45 // Returns current Sketch feature/ Returns NULL if there is no launched sketch operation
46 CompositeFeaturePtr activeSketch() const { return myCurrentSketch; }
48 /// Starts sketch operation
49 void startSketch(ModuleBase_Operation* theOperation);
51 /// Stops sketch operation
52 void stopSketch(ModuleBase_Operation* theOperation);
55 void onPlaneSelected(const std::shared_ptr<GeomAPI_Pln>& thePln);
59 void onMousePressed(ModuleBase_IViewWindow*, QMouseEvent*);
60 void onMouseReleased(ModuleBase_IViewWindow*, QMouseEvent*);
61 void onMouseMoved(ModuleBase_IViewWindow*, QMouseEvent*);
62 void onMouseDoubleClick(ModuleBase_IViewWindow*, QMouseEvent*);
65 /// Converts mouse position to 2d coordinates.
66 /// Member myCurrentSketch has to be correctly defined
67 void get2dPoint(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent,
68 double& theX, double& theY);
72 PartSet_Module* myModule;
76 double myCurX, myCurY;
78 CompositeFeaturePtr myCurrentSketch;
79 QList<FeaturePtr> myEditingFeatures;
80 QList<AttributePtr> myEditingAttr;
82 Handle(ModuleBase_ShapeInPlaneFilter) myPlaneFilter;