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>
18 PartSet_OperationSketchBase::PartSet_OperationSketchBase(const QString& theId,
20 : ModuleBase_Operation(theId, theParent)
24 PartSet_OperationSketchBase::~PartSet_OperationSketchBase()
28 boost::shared_ptr<GeomAPI_Shape> PartSet_OperationSketchBase::preview(
29 boost::shared_ptr<ModelAPI_Feature> theFeature) const
31 boost::shared_ptr<SketchPlugin_Feature> aFeature =
32 boost::dynamic_pointer_cast<SketchPlugin_Feature>(theFeature);
33 if (!aFeature) { // if it is reference to a object feature
34 boost::shared_ptr<ModelAPI_Object> anObj =
35 boost::dynamic_pointer_cast<ModelAPI_Object>(theFeature);
37 aFeature = boost::dynamic_pointer_cast<SketchPlugin_Feature>(anObj->featureRef());
39 return aFeature->preview();
42 std::map<boost::shared_ptr<ModelAPI_Feature>, boost::shared_ptr<GeomAPI_Shape> >
43 PartSet_OperationSketchBase::preview() const
45 return std::map<boost::shared_ptr<ModelAPI_Feature>, boost::shared_ptr<GeomAPI_Shape> >();
48 std::list<int> PartSet_OperationSketchBase::getSelectionModes(boost::shared_ptr<ModelAPI_Feature> theFeature) const
50 std::list<int> aModes;
51 aModes.push_back(TopAbs_VERTEX);
52 aModes.push_back(TopAbs_EDGE);
55 boost::shared_ptr<ModelAPI_Feature> PartSet_OperationSketchBase::createFeature()
57 boost::shared_ptr<ModelAPI_Feature> aFeature = ModuleBase_Operation::createFeature();
59 emit featureConstructed(aFeature, FM_Activation);
64 void PartSet_OperationSketchBase::mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView,
65 const std::list<XGUI_ViewerPrs>& theSelected)
68 void PartSet_OperationSketchBase::mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
69 const std::list<XGUI_ViewerPrs>& theSelected)
72 void PartSet_OperationSketchBase::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView)
76 void PartSet_OperationSketchBase::keyReleased(const int theKey)
79 case Qt::Key_Escape: {