1 // File: PartSet_OperationSketchBase.cpp
2 // Created: 20 Apr 2014
3 // Author: Natalia ERMOLAEVA
5 #include <PartSet_OperationSketchBase.h>
6 #include <PartSet_Tools.h>
8 #include <SketchPlugin_Feature.h>
9 #include <V3d_View.hxx>
10 #include <AIS_Shape.hxx>
11 #include <AIS_DimensionSelectionMode.hxx>
21 PartSet_OperationSketchBase::PartSet_OperationSketchBase(const QString& theId,
23 : ModuleBase_Operation(theId, theParent)
27 PartSet_OperationSketchBase::~PartSet_OperationSketchBase()
31 boost::shared_ptr<GeomAPI_Shape> PartSet_OperationSketchBase::preview(
32 FeaturePtr theFeature)
34 boost::shared_ptr<SketchPlugin_Feature> aFeature =
35 boost::dynamic_pointer_cast<SketchPlugin_Feature>(theFeature);
37 return boost::shared_ptr<GeomAPI_Shape>();
38 return aFeature->preview();
41 std::map<FeaturePtr, boost::shared_ptr<GeomAPI_Shape> >
42 PartSet_OperationSketchBase::subPreview() const
44 return std::map<FeaturePtr, boost::shared_ptr<GeomAPI_Shape> >();
47 std::list<int> PartSet_OperationSketchBase::getSelectionModes(FeaturePtr theFeature) const
49 std::list<int> aModes;
50 if (PartSet_Tools::isConstraintFeature(theFeature->getKind())) {
52 aModes.push_back(AIS_DSM_Text);
53 aModes.push_back(AIS_DSM_Line);
56 aModes.push_back(AIS_Shape::SelectionMode((TopAbs_ShapeEnum)TopAbs_VERTEX));
57 aModes.push_back(AIS_Shape::SelectionMode((TopAbs_ShapeEnum)TopAbs_EDGE));
61 FeaturePtr PartSet_OperationSketchBase::createFeature(const bool theFlushMessage)
63 FeaturePtr aFeature = ModuleBase_Operation::createFeature(theFlushMessage);
65 emit featureConstructed(aFeature, FM_Activation);
70 void PartSet_OperationSketchBase::mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView,
71 const std::list<XGUI_ViewerPrs>& theSelected,
72 const std::list<XGUI_ViewerPrs>& theHighlighted)
75 void PartSet_OperationSketchBase::mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
76 const std::list<XGUI_ViewerPrs>& theSelected,
77 const std::list<XGUI_ViewerPrs>& theHighlighted)
80 void PartSet_OperationSketchBase::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView)
83 void PartSet_OperationSketchBase::mouseDoubleClick(QMouseEvent* theEvent, Handle_V3d_View theView,
84 const std::list<XGUI_ViewerPrs>& theSelected,
85 const std::list<XGUI_ViewerPrs>& theHighlighted)
89 void PartSet_OperationSketchBase::keyReleased(const int theKey)
92 case Qt::Key_Escape: {
101 void PartSet_OperationSketchBase::keyReleased(std::string theName, QKeyEvent* theEvent)
103 keyReleased(theEvent->key());
106 void PartSet_OperationSketchBase::restartOperation(const std::string& theType,
107 FeaturePtr theFeature)
109 emit launchOperation(theType, theFeature);