1 // File: PartSet_OperationSketchBase.cpp
2 // Created: 20 Apr 2014
3 // Author: Natalia ERMOLAEVA
5 #include <PartSet_OperationSketchBase.h>
7 #include <SketchPlugin_Feature.h>
8 #include <SketchPlugin_ConstraintLength.h>
10 #include <V3d_View.hxx>
11 #include <AIS_Shape.hxx>
12 #include <AIS_DimensionSelectionMode.hxx>
22 PartSet_OperationSketchBase::PartSet_OperationSketchBase(const QString& theId,
24 : ModuleBase_Operation(theId, theParent)
28 PartSet_OperationSketchBase::~PartSet_OperationSketchBase()
32 boost::shared_ptr<GeomAPI_Shape> PartSet_OperationSketchBase::preview(
33 FeaturePtr theFeature)
35 boost::shared_ptr<SketchPlugin_Feature> aFeature =
36 boost::dynamic_pointer_cast<SketchPlugin_Feature>(theFeature);
38 return boost::shared_ptr<GeomAPI_Shape>();
39 return aFeature->preview();
42 std::map<FeaturePtr, boost::shared_ptr<GeomAPI_Shape> >
43 PartSet_OperationSketchBase::subPreview() const
45 return std::map<FeaturePtr, boost::shared_ptr<GeomAPI_Shape> >();
48 std::list<int> PartSet_OperationSketchBase::getSelectionModes(FeaturePtr theFeature) const
50 std::list<int> aModes;
51 if (theFeature->getKind() == SKETCH_CONSTRAINT_LENGTH_KIND) {
53 aModes.push_back(AIS_DSM_Text);
54 aModes.push_back(AIS_DSM_Line);
57 aModes.push_back(AIS_Shape::SelectionMode((TopAbs_ShapeEnum)TopAbs_VERTEX));
58 aModes.push_back(AIS_Shape::SelectionMode((TopAbs_ShapeEnum)TopAbs_EDGE));
62 FeaturePtr PartSet_OperationSketchBase::createFeature(const bool theFlushMessage)
64 FeaturePtr aFeature = ModuleBase_Operation::createFeature(theFlushMessage);
66 emit featureConstructed(aFeature, FM_Activation);
71 void PartSet_OperationSketchBase::mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView,
72 const std::list<XGUI_ViewerPrs>& theSelected,
73 const std::list<XGUI_ViewerPrs>& theHighlighted)
76 void PartSet_OperationSketchBase::mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
77 const std::list<XGUI_ViewerPrs>& theSelected,
78 const std::list<XGUI_ViewerPrs>& theHighlighted)
81 void PartSet_OperationSketchBase::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView)
84 void PartSet_OperationSketchBase::mouseDoubleClick(QMouseEvent* theEvent, Handle_V3d_View theView,
85 const std::list<XGUI_ViewerPrs>& theSelected,
86 const std::list<XGUI_ViewerPrs>& theHighlighted)
90 void PartSet_OperationSketchBase::keyReleased(const int theKey)
93 case Qt::Key_Escape: {
102 void PartSet_OperationSketchBase::keyReleased(std::string theName, QKeyEvent* theEvent)
104 keyReleased(theEvent->key());
107 void PartSet_OperationSketchBase::restartOperation(const std::string& theType,
108 FeaturePtr theFeature)
110 emit launchOperation(theType, theFeature);