- Handle(AIS_Shape) anAIS;
- if (IsVisible(theFeature)) {
- anAIS = Handle(AIS_Shape)::DownCast(myFeature2AISObjectMap[theFeature]);
- if (!anAIS.IsNull()) {
- // if the AIS object is displayed in the opened local context in some mode, additional
- // AIS sub objects are created there. They should be rebuild for correct selecting.
- // It is possible to correct it by closing local context before the shape set and opening
- // after. Another workaround to thrown down the selection and reselecting the AIS.
- // If there was a problem here, try the first solution with close/open local context.
- anAIS->Set(theShape);
- anAIS->Redisplay();
-
- /*if (aContext->IsSelected(anAIS)) {
- aContext->AddOrRemoveSelected(anAIS, false);
- aContext->AddOrRemoveSelected(anAIS, false);
- //aContext->SetSelected(anAIS, false);
- }*/
- }
+ if (isVisible(theFeature) && !myFeature2AISObjectMap[theFeature].IsNull()) {
+ aContext->RecomputeSelectionOnly(theAIS);