return;
}
+ QObjectPtrList aSelObjects = getSumList(aHighlighted, aSelected);
if ((aHighlighted.size() == 1) && (aSelected.size() == 0)) {
// Move by selected shape (vertex). Can be used only for single selection
foreach(ModuleBase_ViewerPrs aPrs, aHighlighted) {
}
} else {
// Provide multi-selection. Can be used only for features
- QList<ObjectPtr> aObjects = getSumList(aHighlighted, aSelected);
- foreach (ObjectPtr aObj, aObjects) {
+ foreach (ObjectPtr aObj, aSelObjects) {
FeaturePtr aFeature = ModelAPI_Feature::feature(aObj);
if (aFeature && (!myEditingFeatures.contains(aFeature)))
myEditingFeatures.append(aFeature);
get2dPoint(theWnd, theEvent, myCurX, myCurY);
myDragDone = false;
myWorkshop->viewer()->enableSelection(false);
-
launchEditing();
} else if (isSketchOpe && isEditing) {
void XGUI_Displayer::setSelected(const QObjectPtrList& theResults, const bool isUpdateViewer)
{
Handle(AIS_InteractiveContext) aContext = AISContext();
- // we need to unhighligth objects manually in the current local context
- // in couple with the selection clear (TODO)
- Handle(AIS_LocalContext) aLocalContext = aContext->LocalContext();
- if (!aLocalContext.IsNull())
- aLocalContext->UnhilightLastDetected(myWorkshop->viewer()->activeView());
-
- aContext->ClearSelected();
- foreach(ObjectPtr aResult, theResults)
- {
- if (isVisible(aResult)) {
- AISObjectPtr anObj = myResult2AISObjectMap[aResult];
- Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
- if (!anAIS.IsNull())
- aContext->SetSelected(anAIS, false);
+ if (aContext.IsNull())
+ return;
+ if (aContext->HasOpenedContext()) {
+ aContext->UnhilightSelected();
+ aContext->ClearSelected();
+ foreach(ObjectPtr aResult, theResults) {
+ if (isVisible(aResult)) {
+ AISObjectPtr anObj = myResult2AISObjectMap[aResult];
+ Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
+ if (!anAIS.IsNull())
+ aContext->SetSelected(anAIS, false);
+ }
+ }
+ } else {
+ aContext->UnhilightCurrents();
+ aContext->ClearCurrents();
+ foreach(ObjectPtr aResult, theResults) {
+ if (isVisible(aResult)) {
+ AISObjectPtr anObj = myResult2AISObjectMap[aResult];
+ Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
+ if (!anAIS.IsNull())
+ aContext->SetCurrentObject(anAIS, false);
+ }
}
}
if (isUpdateViewer)
aContext->AddFilter(aIt.Value());
}
// Restore selection
- //AIS_ListIteratorOfListOfInteractive aIt(aAisList);
- //for(; aIt.More(); aIt.Next()) {
- // if (aContext->IsDisplayed(aIt.Value()))
- // aContext->SetSelected(aIt.Value(), false);
+ //AIS_ListIteratorOfListOfInteractive aIt2(aAisList);
+ //for(; aIt2.More(); aIt2.Next()) {
+ // aContext->SetSelected(aIt2.Value(), false);
//}
}
}
myActiveSelectionModes.clear();
// Restore selection
- //AIS_ListIteratorOfListOfInteractive aIt(aAisList);
- //for(; aIt.More(); aIt.Next()) {
- // if (aContext->IsDisplayed(aIt.Value()))
- // aContext->SetCurrentObject(aIt.Value(), false);
+ //AIS_ListIteratorOfListOfInteractive aIt2(aAisList);
+ //for(; aIt2.More(); aIt2.Next()) {
+ // if (aContext->IsDisplayed(aIt2.Value()))
+ // aContext->SetCurrentObject(aIt2.Value(), false);
//}
}
}