X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPartSet%2FPartSet_OperationSketchBase.cpp;h=310658e9b317d2f37fb77bac03014f0687e6e0ed;hb=9e869ede4d8c56262bb20534543c2bf56cd6a91b;hp=4512ffb6a4e3193516b8d275b2e031059d00fc56;hpb=e3cdcd3e1329acba45cd12baf064345ab94fd98b;p=modules%2Fshaper.git diff --git a/src/PartSet/PartSet_OperationSketchBase.cpp b/src/PartSet/PartSet_OperationSketchBase.cpp index 4512ffb6a..310658e9b 100644 --- a/src/PartSet/PartSet_OperationSketchBase.cpp +++ b/src/PartSet/PartSet_OperationSketchBase.cpp @@ -3,11 +3,22 @@ // Author: Natalia ERMOLAEVA #include +#include +#include -#include -#include +#include +#include +#include +#include +#include #include +#include +#include + +#include +#include +#include #ifdef _DEBUG #include @@ -15,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) { } @@ -25,49 +35,64 @@ PartSet_OperationSketchBase::~PartSet_OperationSketchBase() { } -boost::shared_ptr PartSet_OperationSketchBase::preview( - boost::shared_ptr theFeature) const +std::shared_ptr PartSet_OperationSketchBase::preview(FeaturePtr theFeature) { - boost::shared_ptr aFeature = - boost::dynamic_pointer_cast(theFeature); - if (!aFeature) { // if it is reference to a object feature - boost::shared_ptr anObj = - boost::dynamic_pointer_cast(theFeature); - if (anObj) - aFeature = boost::dynamic_pointer_cast(anObj->featureRef()); + std::shared_ptr aFeature = std::dynamic_pointer_cast< + SketchPlugin_Feature>(theFeature); + if (aFeature) { + ResultPtr aRes = aFeature->firstResult(); + ResultBodyPtr aBody = std::dynamic_pointer_cast(aRes); + if (aBody) + return aBody->shape(); } - return aFeature->preview(); + return std::shared_ptr(); } -std::map, boost::shared_ptr > - PartSet_OperationSketchBase::preview() const +std::list PartSet_OperationSketchBase::subFeatures() const { - return std::map, boost::shared_ptr >(); + return std::list(); } -std::list PartSet_OperationSketchBase::getSelectionModes(boost::shared_ptr theFeature) const +FeaturePtr PartSet_OperationSketchBase::createFeature(const bool theFlushMessage) { - std::list aModes; - aModes.push_back(TopAbs_VERTEX); - aModes.push_back(TopAbs_EDGE); - return aModes; + ModuleBase_Operation::createFeature(theFlushMessage); + if (myFeature) + emit featureConstructed(myFeature, FM_Activation); + return myFeature; } -boost::shared_ptr PartSet_OperationSketchBase::createFeature() + +void PartSet_OperationSketchBase::mousePressed(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer, ModuleBase_ISelection* theSelection) { - boost::shared_ptr aFeature = ModuleBase_Operation::createFeature(); - emit featureConstructed(aFeature, FM_Activation); - return aFeature; } - - -void PartSet_OperationSketchBase::mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView, - const std::list& theSelected) +void PartSet_OperationSketchBase::mouseReleased( + QMouseEvent* theEvent, ModuleBase_IViewer* theViewer, + ModuleBase_ISelection* theSelection) { } -void PartSet_OperationSketchBase::mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView, - const std::list& theSelected) +void PartSet_OperationSketchBase::mouseMoved(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer) { } -void PartSet_OperationSketchBase::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView) +void PartSet_OperationSketchBase::mouseDoubleClick( + QMouseEvent* theEvent, Handle_V3d_View theView, + ModuleBase_ISelection* theSelection) { } + +void PartSet_OperationSketchBase::selectionChanged(ModuleBase_ISelection* theSelection) +{ +} + +void PartSet_OperationSketchBase::restartOperation(const std::string& theType, ObjectPtr theFeature) +{ + 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); +} + +