X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPartSet%2FPartSet_Module.cpp;h=d2c0d9de888270eb9e21938692d81e911602edaa;hb=d22fc665c79c31c9eea0625e04c2e941adfdf7be;hp=8f0252c8b50e9946416b66a7d149e2a7fd97ec1a;hpb=a226d633772b2f4c5e327b7451147912e4f84efb;p=modules%2Fshaper.git diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 8f0252c8b..d2c0d9de8 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -1,7 +1,6 @@ #include #include #include -#include #include #include #include @@ -18,6 +17,7 @@ #include #include #include +#include #include #include @@ -185,6 +185,7 @@ void PartSet_Module::onOperationStopped(ModuleBase_Operation* theOperation) aDisplayer->activate(*anIt, aModes); } aDisplayer->activate(aFeature, aModes); + aDisplayer->clearSelected(); } } }// else { @@ -216,24 +217,6 @@ void PartSet_Module::onMousePressed(QMouseEvent* theEvent) dynamic_cast(workshop()->currentOperation()); if (aPreviewOp) { ModuleBase_ISelection* aSelection = workshop()->selection(); - // Initialise operation with preliminary selection - //QList aSelected = aSelection->getSelected(); - //QList aHighlighted = aSelection->getHighlighted(); - //QList aObjList; - //bool aHasShift = (theEvent->modifiers() & Qt::ShiftModifier); - //if (aHasShift) { - // foreach(ModuleBase_ViewerPrs aPrs, aSelected) - // aObjList.append(aPrs.object()); - - // foreach (ModuleBase_ViewerPrs aPrs, aHighlighted) { - // if (!aObjList.contains(aPrs.object())) - // aObjList.append(aPrs.object()); - // } - //} else { - // foreach(ModuleBase_ViewerPrs aPrs, aHighlighted) - // aObjList.append(aPrs.object()); - //} - //onSetSelection(aObjList); aPreviewOp->mousePressed(theEvent, myWorkshop->viewer(), aSelection); } } @@ -281,6 +264,10 @@ void PartSet_Module::onMouseDoubleClick(QMouseEvent* theEvent) void PartSet_Module::onPlaneSelected(double theX, double theY, double theZ) { myWorkshop->viewer()->setViewProjection(theX, theY, theZ); +} + +void PartSet_Module::onSketchLaunched() +{ xWorkshop()->actionsMgr()->update(); // Set working plane ModuleBase_Operation* anOperation = myWorkshop->currentOperation(); @@ -310,17 +297,17 @@ void PartSet_Module::onRestartOperation(std::string theName, ObjectPtr theObject } ModuleBase_ISelection* aSelection = workshop()->selection(); // Initialise operation with preliminary selection - aSketchOp->initSelection(aSelection); - } //else if (aFeature) { - //anOperation->setFeature(aFeature); + aSketchOp->initSelection(aSelection, myWorkshop->viewer()); + } else if (aFeature) { // In case of edit operation: set the previously created feature to the operation + anOperation->setFeature(aFeature); ////Deactivate result of current feature in order to avoid its selection - //XGUI_Displayer* aDisplayer = xWorkshop()->displayer(); - //std::list aResults = aFeature->results(); - //std::list::const_iterator aIt; - //for (aIt = aResults.cbegin(); aIt != aResults.cend(); ++aIt) { - // aDisplayer->deactivate(*aIt); - //} - //} + XGUI_Displayer* aDisplayer = xWorkshop()->displayer(); + std::list aResults = aFeature->results(); + std::list::const_iterator aIt; + for (aIt = aResults.cbegin(); aIt != aResults.cend(); ++aIt) { + aDisplayer->deactivate(*aIt); + } + } sendOperation(anOperation); xWorkshop()->actionsMgr()->updateCheckState(); } @@ -365,13 +352,14 @@ void PartSet_Module::setSketchingMode(const gp_Pln& thePln) // Clear standard selection modes aDisplayer->setSelectionModes(aModes); aDisplayer->openLocalContext(); - // Get default selection modes - aModes = sketchSelectionModes(ObjectPtr()); - aDisplayer->activateObjectsOutOfContext(aModes); // Set filter mySketchFilter = new ModuleBase_ShapeInPlaneFilter(thePln); aDisplayer->addSelectionFilter(mySketchFilter); + + // Get default selection modes + aModes = sketchSelectionModes(ObjectPtr()); + aDisplayer->activateObjectsOutOfContext(aModes); } void PartSet_Module::onFeatureConstructed(ObjectPtr theFeature, int theMode) @@ -417,8 +405,6 @@ ModuleBase_Operation* PartSet_Module::createOperation(const std::string& theCmdI } if (PartSet_OperationFeatureCreate::canProcessKind(theCmdId)) { anOperation = new PartSet_OperationFeatureCreate(theCmdId.c_str(), this, aSketch); - } else if (theCmdId == PartSet_OperationFeatureEditMulti::Type()) { - anOperation = new PartSet_OperationFeatureEditMulti(theCmdId.c_str(), this, aSketch); } else if (theCmdId == PartSet_OperationFeatureEdit::Type()) { anOperation = new PartSet_OperationFeatureEdit(theCmdId.c_str(), this, aSketch); } @@ -462,6 +448,7 @@ ModuleBase_Operation* PartSet_Module::createOperation(const std::string& theCmdI connect(aSketchOp, SIGNAL(planeSelected(double, double, double)), this, SLOT(onPlaneSelected(double, double, double))); connect(aSketchOp, SIGNAL(fitAllView()), this, SLOT(onFitAllView())); + connect(aSketchOp, SIGNAL(launchSketch()), this, SLOT(onSketchLaunched())); } } @@ -608,11 +595,13 @@ void PartSet_Module::onSelectionChanged() QList aSelected = aSelect->getSelected(); // We need to stop edit operation if selection is cleared if (aSelected.size() == 0) { - PartSet_OperationFeatureEdit* anEditOp = + // do not perform commit of the current edit operation here, because + // this functionality is realized inside this operation + /*PartSet_OperationFeatureEdit* anEditOp = dynamic_cast(myWorkshop->currentOperation()); if (!anEditOp) return; - anEditOp->commit(); + anEditOp->commit();*/ } else { PartSet_OperationSketchBase* aSketchOp = dynamic_cast(myWorkshop->currentOperation());