X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FPartSet%2FPartSet_OperationSketchBase.cpp;h=d8cd8ec7e860324884ff529f4daa330cc5282783;hb=add875fff5ce228a4914fcc323fdb911a1042b21;hp=9dd3141eb50135b8836616dde205871b20884857;hpb=730e32c2a13c666f4d76808b4904c5727e3d11af;p=modules%2Fshaper.git diff --git a/src/PartSet/PartSet_OperationSketchBase.cpp b/src/PartSet/PartSet_OperationSketchBase.cpp index 9dd3141eb..d8cd8ec7e 100644 --- a/src/PartSet/PartSet_OperationSketchBase.cpp +++ b/src/PartSet/PartSet_OperationSketchBase.cpp @@ -6,6 +6,10 @@ #include #include +#include +#include +#include + #include #include #include @@ -48,20 +52,6 @@ std::list PartSet_OperationSketchBase::subFeatures() const return std::list(); } -std::list PartSet_OperationSketchBase::getSelectionModes(ObjectPtr theFeature) const -{ - //TODO: Define position of selection modes definition - std::list aModes; - FeaturePtr aFeature = boost::dynamic_pointer_cast(theFeature); - if (aFeature && PartSet_Tools::isConstraintFeature(aFeature->getKind())) { - aModes.push_back(AIS_DSM_Text); - aModes.push_back(AIS_DSM_Line); - } else { - 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); @@ -98,11 +88,34 @@ void PartSet_OperationSketchBase::restartOperation(const std::string& theType, O if (aFeature) { QStringList aNested = this->nestedFeatures(); if (!aNested.isEmpty()) { - if (aNested.contains(QString(aFeature->getKind().c_str()))) - emit restartRequired(theType, theFeature); - else + if (!aNested.contains(QString(aFeature->getKind().c_str()))) return; } } emit restartRequired(theType, theFeature); } + + + +void PartSet_OperationSketchBase::activateByPreselection() +{ + if (!myPropertyPanel) + return; + ModuleBase_ModelWidget* aActiveWgt = myPropertyPanel->activeWidget(); + if ((myPreSelection.size() > 0) && aActiveWgt) { + const ModuleBase_ViewerPrs& aPrs = myPreSelection.front(); + ModuleBase_WidgetValueFeature aValue; + aValue.setObject(aPrs.object()); + if (aActiveWgt->setValue(&aValue)) { + myPreSelection.remove(aPrs); + if(isValid()) { + //myActiveWidget = NULL; + commit(); + } else { + myPropertyPanel->activateNextWidget(); + //emit activateNextWidget(myActiveWidget); + } + } + // If preselection is enough to make a valid feature - apply it immediately + } +}