X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FPartSet%2FPartSet_OperationSketchBase.cpp;h=1f7550403123cabec03ac0a7ad79dacf3d6a482b;hb=09f9714f3df9f24a6dd80e0219a94d347dad9cd2;hp=5934e46d198a112f713f7c7790e6cad444905525;hpb=0caee92b045249b15dd6df72d52b44335e05cc3f;p=modules%2Fshaper.git diff --git a/src/PartSet/PartSet_OperationSketchBase.cpp b/src/PartSet/PartSet_OperationSketchBase.cpp index 5934e46d1..1f7550403 100644 --- a/src/PartSet/PartSet_OperationSketchBase.cpp +++ b/src/PartSet/PartSet_OperationSketchBase.cpp @@ -6,6 +6,11 @@ #include #include +#include +#include +#include +#include + #include #include #include @@ -21,9 +26,8 @@ using namespace std; -PartSet_OperationSketchBase::PartSet_OperationSketchBase(const QString& theId, - QObject* theParent) -: ModuleBase_Operation(theId, theParent) +PartSet_OperationSketchBase::PartSet_OperationSketchBase(const QString& theId, QObject* theParent) + : ModuleBase_Operation(theId, theParent) { } @@ -31,11 +35,10 @@ PartSet_OperationSketchBase::~PartSet_OperationSketchBase() { } -boost::shared_ptr PartSet_OperationSketchBase::preview( - FeaturePtr theFeature) +boost::shared_ptr PartSet_OperationSketchBase::preview(FeaturePtr theFeature) { - boost::shared_ptr aFeature = - boost::dynamic_pointer_cast(theFeature); + boost::shared_ptr aFeature = boost::dynamic_pointer_cast< + SketchPlugin_Feature>(theFeature); if (aFeature) { ResultPtr aRes = aFeature->firstResult(); ResultBodyPtr aBody = boost::dynamic_pointer_cast(aRes); @@ -50,22 +53,6 @@ std::list PartSet_OperationSketchBase::subFeatures() const return std::list(); } -std::list PartSet_OperationSketchBase::getSelectionModes(ObjectPtr theFeature) const -{ - std::list aModes; - FeaturePtr aFeature = boost::dynamic_pointer_cast(theFeature); - if (aFeature) { - if (PartSet_Tools::isConstraintFeature(aFeature->getKind())) { - aModes.clear(); - aModes.push_back(AIS_DSM_Text); - aModes.push_back(AIS_DSM_Line); - return aModes; - } - } - aModes.push_back(AIS_Shape::SelectionMode((TopAbs_ShapeEnum)TopAbs_VERTEX)); - aModes.push_back(AIS_Shape::SelectionMode((TopAbs_ShapeEnum)TopAbs_EDGE)); - return aModes; -} FeaturePtr PartSet_OperationSketchBase::createFeature(const bool theFlushMessage) { ModuleBase_Operation::createFeature(theFlushMessage); @@ -74,53 +61,38 @@ FeaturePtr PartSet_OperationSketchBase::createFeature(const bool theFlushMessage return myFeature; } - -void PartSet_OperationSketchBase::mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView, - const std::list& theSelected, - const std::list& theHighlighted) +void PartSet_OperationSketchBase::mousePressed(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer, ModuleBase_ISelection* theSelection) { } -void PartSet_OperationSketchBase::mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView, - const std::list& theSelected, - const std::list& theHighlighted) +void PartSet_OperationSketchBase::mouseReleased( + QMouseEvent* theEvent, ModuleBase_IViewer* theViewer, + ModuleBase_ISelection* theSelection) { } -void PartSet_OperationSketchBase::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView) +void PartSet_OperationSketchBase::mouseMoved(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer) { } -void PartSet_OperationSketchBase::mouseDoubleClick(QMouseEvent* theEvent, Handle_V3d_View theView, - const std::list& theSelected, - const std::list& theHighlighted) +void PartSet_OperationSketchBase::mouseDoubleClick( + QMouseEvent* theEvent, Handle_V3d_View theView, + ModuleBase_ISelection* theSelection) { } -void PartSet_OperationSketchBase::keyReleased(const int theKey) +void PartSet_OperationSketchBase::selectionChanged(ModuleBase_ISelection* theSelection) { - switch (theKey) { - case Qt::Key_Escape: { - bool toAbort = true; - if (isModified()) { - int anAnswer = QMessageBox::question(qApp->activeWindow(), tr("Cancel operation"), - tr("Operation %1 will be cancelled. Continue?").arg(id()), - QMessageBox::Yes, QMessageBox::No); - toAbort = (anAnswer == QMessageBox::Yes); - } - if (toAbort) - abort(); - } - break; - default: - break; - } } -void PartSet_OperationSketchBase::keyReleased(std::string theName, QKeyEvent* theEvent) +void PartSet_OperationSketchBase::restartOperation(const std::string& theType, ObjectPtr theFeature) { - keyReleased(theEvent->key()); + FeaturePtr aFeature = ModelAPI_Feature::feature(theFeature); + if (aFeature) { + QStringList aNested = this->nestedFeatures(); + if (!aNested.isEmpty()) { + if (!aNested.contains(QString(aFeature->getKind().c_str()))) + return; + } + } + emit restartRequired(theType, theFeature); } -void PartSet_OperationSketchBase::restartOperation(const std::string& theType, - ObjectPtr theFeature) -{ - emit launchOperation(theType, theFeature); -} +