1 // File: PartSet_OperationSketchBase.cpp
2 // Created: 20 Apr 2014
3 // Author: Natalia ERMOLAEVA
5 #include <PartSet_OperationSketchBase.h>
6 #include <PartSet_Tools.h>
7 #include <ModelAPI_ResultBody.h>
9 #include <ModuleBase_IPropertyPanel.h>
10 #include <ModuleBase_IViewer.h>
11 #include <ModuleBase_ModelWidget.h>
12 #include <ModuleBase_WidgetValueFeature.h>
14 #include <SketchPlugin_Feature.h>
15 #include <V3d_View.hxx>
16 #include <AIS_Shape.hxx>
17 #include <AIS_DimensionSelectionMode.hxx>
20 #include <QMessageBox>
21 #include <QApplication>
29 PartSet_OperationSketchBase::PartSet_OperationSketchBase(const QString& theId, QObject* theParent)
30 : ModuleBase_Operation(theId, theParent)
34 PartSet_OperationSketchBase::~PartSet_OperationSketchBase()
38 boost::shared_ptr<GeomAPI_Shape> PartSet_OperationSketchBase::preview(FeaturePtr theFeature)
40 boost::shared_ptr<SketchPlugin_Feature> aFeature = boost::dynamic_pointer_cast<
41 SketchPlugin_Feature>(theFeature);
43 ResultPtr aRes = aFeature->firstResult();
44 ResultBodyPtr aBody = boost::dynamic_pointer_cast<ModelAPI_ResultBody>(aRes);
46 return aBody->shape();
48 return boost::shared_ptr<GeomAPI_Shape>();
51 std::list<FeaturePtr> PartSet_OperationSketchBase::subFeatures() const
53 return std::list<FeaturePtr>();
56 FeaturePtr PartSet_OperationSketchBase::createFeature(const bool theFlushMessage)
58 ModuleBase_Operation::createFeature(theFlushMessage);
60 emit featureConstructed(myFeature, FM_Activation);
64 void PartSet_OperationSketchBase::mousePressed(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer, ModuleBase_ISelection* theSelection)
67 void PartSet_OperationSketchBase::mouseReleased(
68 QMouseEvent* theEvent, ModuleBase_IViewer* theViewer,
69 ModuleBase_ISelection* theSelection)
72 void PartSet_OperationSketchBase::mouseMoved(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer)
75 void PartSet_OperationSketchBase::mouseDoubleClick(
76 QMouseEvent* theEvent, Handle_V3d_View theView,
77 ModuleBase_ISelection* theSelection)
81 void PartSet_OperationSketchBase::selectionChanged(ModuleBase_ISelection* theSelection)
85 void PartSet_OperationSketchBase::restartOperation(const std::string& theType, ObjectPtr theFeature)
87 FeaturePtr aFeature = ModelAPI_Feature::feature(theFeature);
89 QStringList aNested = this->nestedFeatures();
90 if (!aNested.isEmpty()) {
91 if (!aNested.contains(QString(aFeature->getKind().c_str())))
95 emit restartRequired(theType, theFeature);