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 <ModelAPI_Object.h>
10 #include <V3d_View.hxx>
20 PartSet_OperationSketchBase::PartSet_OperationSketchBase(const QString& theId,
22 : ModuleBase_Operation(theId, theParent)
26 PartSet_OperationSketchBase::~PartSet_OperationSketchBase()
30 boost::shared_ptr<GeomAPI_Shape> PartSet_OperationSketchBase::preview(
31 boost::shared_ptr<ModelAPI_Feature> theFeature) const
33 boost::shared_ptr<SketchPlugin_Feature> aFeature =
34 boost::dynamic_pointer_cast<SketchPlugin_Feature>(theFeature);
35 if (!aFeature) { // if it is reference to a object feature
36 boost::shared_ptr<ModelAPI_Object> anObj =
37 boost::dynamic_pointer_cast<ModelAPI_Object>(theFeature);
39 aFeature = boost::dynamic_pointer_cast<SketchPlugin_Feature>(anObj->featureRef());
42 return boost::shared_ptr<GeomAPI_Shape>();
43 return aFeature->preview();
46 std::map<boost::shared_ptr<ModelAPI_Feature>, boost::shared_ptr<GeomAPI_Shape> >
47 PartSet_OperationSketchBase::subPreview() const
49 return std::map<boost::shared_ptr<ModelAPI_Feature>, boost::shared_ptr<GeomAPI_Shape> >();
52 std::list<int> PartSet_OperationSketchBase::getSelectionModes(boost::shared_ptr<ModelAPI_Feature> theFeature) const
54 std::list<int> aModes;
55 aModes.push_back(TopAbs_VERTEX);
56 aModes.push_back(TopAbs_EDGE);
59 boost::shared_ptr<ModelAPI_Feature> PartSet_OperationSketchBase::createFeature(const bool theFlushMessage)
61 boost::shared_ptr<ModelAPI_Feature> aFeature = ModuleBase_Operation::createFeature(theFlushMessage);
63 emit featureConstructed(aFeature, FM_Activation);
68 void PartSet_OperationSketchBase::mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView,
69 const std::list<XGUI_ViewerPrs>& theSelected,
70 const std::list<XGUI_ViewerPrs>& theHighlighted)
73 void PartSet_OperationSketchBase::mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
74 const std::list<XGUI_ViewerPrs>& theSelected,
75 const std::list<XGUI_ViewerPrs>& theHighlighted)
78 void PartSet_OperationSketchBase::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView)
82 void PartSet_OperationSketchBase::keyReleased(const int theKey)
85 case Qt::Key_Escape: {
94 void PartSet_OperationSketchBase::keyReleased(std::string theName, QKeyEvent* theEvent)
96 keyReleased(theEvent->key());