Restore selection after operation edit.
aViewer->enableMultiselection(theEnabled);
}
-void PartSet_Module::onStopSelection(const std::list<XGUI_ViewerPrs>& theFeatures, const bool isStop)
+void PartSet_Module::onStopSelection(const std::list<XGUI_ViewerPrs>& theFeatures, const bool isStop,
+ const bool isToSelect)
{
XGUI_Displayer* aDisplayer = myWorkshop->displayer();
aDisplayer->StopSelection(theFeatures, isStop, false);
activateFeature((*anIt).feature(), false);
}
}
- aDisplayer->SetSelected(theFeatures, false);
+ if (isToSelect)
+ aDisplayer->SetSelected(theFeatures, false);
aDisplayer->UpdateViewer();
}
connect(aPreviewOp, SIGNAL(multiSelectionEnabled(bool)),
this, SLOT(onMultiSelectionEnabled(bool)));
- connect(aPreviewOp, SIGNAL(stopSelection(const std::list<XGUI_ViewerPrs>&, const bool)),
- this, SLOT(onStopSelection(const std::list<XGUI_ViewerPrs>&, const bool)));
+ connect(aPreviewOp, SIGNAL(stopSelection(const std::list<XGUI_ViewerPrs>&, const bool, const bool)),
+ this, SLOT(onStopSelection(const std::list<XGUI_ViewerPrs>&, const bool, const bool)));
PartSet_OperationSketch* aSketchOp = dynamic_cast<PartSet_OperationSketch*>(aPreviewOp);
if (aSketchOp) {
/// \param theEnabled the enabled state
void onMultiSelectionEnabled(bool theEnabled);
- /// SLOT, to stop or start selection for the features
+ /// SLOT, to stop or start selection mode for the features
/// \param theFeatures a list of features to be disabled
/// \param theToStop the boolean state whether it it stopped or non stopped
- void onStopSelection(const std::list<XGUI_ViewerPrs>& theFeatures, const bool isStop);
+ /// \param isToSelect the boolean state whether the features should be selected
+ void onStopSelection(const std::list<XGUI_ViewerPrs>& theFeatures, const bool isStop,
+ const bool isToSelect);
/// SLOT, to visualize the feature in another local context mode
/// \param theFeature the feature to be put in another local context mode
std::list<int> PartSet_OperationEditLine::getSelectionModes(boost::shared_ptr<ModelAPI_Feature> theFeature) const
{
- std::list<int> aModes;
- aModes.push_back(-1);
- return aModes;
- //return PartSet_OperationSketchBase::getSelectionModes(theFeature);
+ return PartSet_OperationSketchBase::getSelectionModes(theFeature);
}
void PartSet_OperationEditLine::init(boost::shared_ptr<ModelAPI_Feature> theFeature,
{
std::list<XGUI_ViewerPrs> aFeatures = myFeatures;
if (myFeatures.size() == 1) {
- boost::shared_ptr<ModelAPI_Feature> aFeature;
- if (!theSelected.empty())
- aFeature = theSelected.front().feature();
-
- if (aFeature == feature())
+ if (theSelected.empty())
return;
-
- commit();
- if (aFeature)
- emit launchOperation(PartSet_OperationEditLine::Type(), aFeature);
+
+ boost::shared_ptr<ModelAPI_Feature> aFeature = theSelected.front().feature();
+ commit();
+ emit launchOperation(PartSet_OperationEditLine::Type(), aFeature);
}
else {
commit();
{
// do nothing in order to do not create a new feature
emit multiSelectionEnabled(false);
- emit stopSelection(myFeatures, true);
+ emit stopSelection(myFeatures, true, false);
myCurPoint.clear();
}
void PartSet_OperationEditLine::stopOperation()
{
emit multiSelectionEnabled(true);
- emit stopSelection(myFeatures, false);
+ bool isSelectFeatures = myFeatures.size() > 1;
+ emit stopSelection(myFeatures, false, isSelectFeatures);
myFeatures.clear();
}
/// signal to enable/disable selection in the viewer
/// \param theFeatures a list of features to be disabled
/// \param theToStop the boolean state whether it it stopped or non stopped
- void stopSelection(const std::list<XGUI_ViewerPrs>& theFeatures, const bool theToStop);
+ /// \param isToSelect the boolean state whether the features should be selected
+ void stopSelection(const std::list<XGUI_ViewerPrs>& theFeatures, const bool theToStop,
+ const bool isToSelect);
/// signal to enable/disable usual selection in the viewer
/// \param theEnabled the boolean state
continue;
if (isStop) {
- aContext->ClearSelected();
- aContext->Deactivate(anAIS);
-
QColor aColor(Qt::white);
anAIS->SetColor(Quantity_Color(aColor.red()/255., aColor.green()/255., aColor.blue()/255., Quantity_TOC_RGB));
anAIS->Redisplay();