X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPartSet%2FPartSet_Module.cpp;h=9714f41a54fd2fc31dcf91f8146006516d36a403;hb=d6b11c0c3f199211e054533ba92bdadf5c7a65f4;hp=94c577a55272a5a9b85722926c92af717655dfad;hpb=b1eedc1c758fe498ba735720e355210dbb811ffe;p=modules%2Fshaper.git diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 94c577a55..9714f41a5 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -113,6 +113,7 @@ void PartSet_Module::registerValidators() aFactory->registerValidator("PartSet_RadiusValidator", new PartSet_RadiusValidator); aFactory->registerValidator("PartSet_RigidValidator", new PartSet_RigidValidator); aFactory->registerValidator("PartSet_DifferentObjects", new PartSet_DifferentObjectsValidator); + aFactory->registerValidator("PartSet_SketchValidator", new PartSet_SketchValidator); } void PartSet_Module::registerFilters() @@ -129,6 +130,11 @@ void PartSet_Module::operationCommitted(ModuleBase_Operation* theOperation) { if (theOperation->isEditOperation()) return; + // the selection is cleared after commit the create operation + // in order to do not use the same selected objects in the restarted operation + // for common behaviour, the selection is cleared even if the operation is not restarted + myWorkshop->viewer()->AISContext()->ClearSelected(); + /// Restart sketcher operations automatically FeaturePtr aFeature = theOperation->feature(); std::shared_ptr aSPFeature = @@ -137,6 +143,7 @@ void PartSet_Module::operationCommitted(ModuleBase_Operation* theOperation) myRestartingMode == RM_EmptyFeatureUsed)) { myLastOperationId = theOperation->id(); myLastFeature = myRestartingMode == RM_LastFeatureUsed ? theOperation->feature() : FeaturePtr(); + launchOperation(myLastOperationId); } breakOperationSequence(); @@ -228,35 +235,35 @@ void PartSet_Module::propertyPanelDefined(ModuleBase_Operation* theOperation) void PartSet_Module::onSelectionChanged() { ModuleBase_Operation* aOperation = myWorkshop->currentOperation(); + if (!aOperation) + return; + bool isSketcherOp = false; // An edit operation is enable only if the current opeation is the sketch operation - if (aOperation && mySketchMgr->activeSketch()) { + if (mySketchMgr->activeSketch()) { if (PartSet_Tools::sketchPlane(mySketchMgr->activeSketch())) isSketcherOp = (aOperation->id().toStdString() == SketchPlugin_Sketch::ID()); } - if (!isSketcherOp) - return; - - // Editing of constraints can be done on selection - ModuleBase_ISelection* aSelect = myWorkshop->selection(); - QList aSelected = aSelect->getSelected(); - if (aSelected.size() == 1) { - ModuleBase_ViewerPrs aPrs = aSelected.first(); - ObjectPtr aObject = aPrs.object(); - FeaturePtr aFeature = ModelAPI_Feature::feature(aObject); - if (aFeature) { - std::string aId = aFeature->getKind(); - if ((aId == SketchPlugin_ConstraintRadius::ID()) || - (aId == SketchPlugin_ConstraintLength::ID()) || - (aId == SketchPlugin_ConstraintDistance::ID())) { - editFeature(aFeature); + if (isSketcherOp) { + // Editing of constraints can be done on selection + ModuleBase_ISelection* aSelect = myWorkshop->selection(); + QList aSelected = aSelect->getSelected(); + if (aSelected.size() == 1) { + ModuleBase_ViewerPrs aPrs = aSelected.first(); + ObjectPtr aObject = aPrs.object(); + FeaturePtr aFeature = ModelAPI_Feature::feature(aObject); + if (aFeature) { + std::string aId = aFeature->getKind(); + if ((aId == SketchPlugin_ConstraintRadius::ID()) || + (aId == SketchPlugin_ConstraintLength::ID()) || + (aId == SketchPlugin_ConstraintDistance::ID())) { + editFeature(aFeature); + } } } - } + } } - // after movement the solver will call the update event: optimization - void PartSet_Module::onKeyRelease(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent) { XGUI_ModuleConnector* aConnector = dynamic_cast(workshop()); @@ -303,7 +310,7 @@ void PartSet_Module::onNoMoreWidgets() } } -void PartSet_Module::onVertexSelected(ObjectPtr theObject, const TopoDS_Shape& theShape) +void PartSet_Module::onVertexSelected() { ModuleBase_Operation* aOperation = myWorkshop->currentOperation(); if (aOperation->id().toStdString() == SketchPlugin_Line::ID()) { @@ -335,8 +342,7 @@ QWidget* PartSet_Module::createWidgetByType(const std::string& theType, QWidget* aWgt->setWorkshop(aWorkshop); aWgt->setSketch(mySketchMgr->activeSketch()); - connect(aWgt, SIGNAL(vertexSelected(ObjectPtr, const TopoDS_Shape&)), - this, SLOT(onVertexSelected(ObjectPtr, const TopoDS_Shape&))); + connect(aWgt, SIGNAL(vertexSelected()), this, SLOT(onVertexSelected())); theModelWidgets.append(aWgt); return aWgt->getControl();