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::list<FeaturePtr> PartSet_OperationSketchBase::subFeatures() const
43 return std::list<FeaturePtr>();
46 std::list<int> PartSet_OperationSketchBase::getSelectionModes(FeaturePtr theFeature) const
48 std::list<int> aModes;
49 if (PartSet_Tools::isConstraintFeature(theFeature->getKind())) {
51 aModes.push_back(AIS_DSM_Text);
52 aModes.push_back(AIS_DSM_Line);
55 aModes.push_back(AIS_Shape::SelectionMode((TopAbs_ShapeEnum)TopAbs_VERTEX));
56 aModes.push_back(AIS_Shape::SelectionMode((TopAbs_ShapeEnum)TopAbs_EDGE));
60 FeaturePtr PartSet_OperationSketchBase::createFeature(const bool theFlushMessage)
62 FeaturePtr aFeature = ModuleBase_Operation::createFeature(theFlushMessage);
64 emit featureConstructed(aFeature, FM_Activation);
69 void PartSet_OperationSketchBase::mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView,
70 const std::list<XGUI_ViewerPrs>& theSelected,
71 const std::list<XGUI_ViewerPrs>& theHighlighted)
74 void PartSet_OperationSketchBase::mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
75 const std::list<XGUI_ViewerPrs>& theSelected,
76 const std::list<XGUI_ViewerPrs>& theHighlighted)
79 void PartSet_OperationSketchBase::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView)
82 void PartSet_OperationSketchBase::mouseDoubleClick(QMouseEvent* theEvent, Handle_V3d_View theView,
83 const std::list<XGUI_ViewerPrs>& theSelected,
84 const std::list<XGUI_ViewerPrs>& theHighlighted)
88 void PartSet_OperationSketchBase::keyReleased(const int theKey)
91 case Qt::Key_Escape: {
100 void PartSet_OperationSketchBase::keyReleased(std::string theName, QKeyEvent* theEvent)
102 keyReleased(theEvent->key());
105 void PartSet_OperationSketchBase::restartOperation(const std::string& theType,
106 FeaturePtr theFeature)
108 emit launchOperation(theType, theFeature);