- for ( ic->InitSelected(); ic->MoreSelected(); ic->NextSelected() )
- {
- Handle(StdSelect_BRepOwner) anOwner = Handle(StdSelect_BRepOwner)::DownCast(ic->SelectedOwner());
- if ( anOwner.IsNull() )
- continue;
-
- Handle(AIS_InteractiveObject) io = Handle(AIS_InteractiveObject)::DownCast( anOwner->Selectable() );
-
- QString entryStr = entry( io );
- int index = -1;
-
- if ( anOwner->ComesFromDecomposition() ) // == Local Selection
- {
- TopoDS_Shape subShape = anOwner->Shape();
- Handle(AIS_Shape) aisShape = Handle(AIS_Shape)::DownCast( io );
- if ( !aisShape.IsNull() )
- {
- TopoDS_Shape bigShape = aisShape->Shape();
-
- TopTools_IndexedMapOfShape subShapes;
- TopExp::MapShapes( bigShape, subShapes );
- index = subShapes.FindIndex( subShape );
- }
- }
-
- if ( !entryStr.isEmpty() )
- {
- LightApp_DataOwner* owner;
- if ( index > -1 ) // Local Selection
- owner = new LightApp_DataSubOwner( entryStr, index );
- else // Global Selection
- owner = new LightApp_DataOwner( entryStr );
-
- aList.append( SUIT_DataOwnerPtr( owner ) );
- }
- }
+ Handle(StdSelect_BRepOwner) anOwner = Handle(StdSelect_BRepOwner)::DownCast(ic->SelectedOwner());
+ if (anOwner.IsNull())
+ continue;
+
+ Handle(AIS_InteractiveObject) io = Handle(AIS_InteractiveObject)::DownCast(anOwner->Selectable());
+
+ QString entryStr = entry(io);
+ int index = -1;
+
+ if (anOwner->ComesFromDecomposition()) // == Local Selection
+ {
+ TopoDS_Shape subShape = anOwner->Shape();
+ Handle(AIS_Shape) aisShape = Handle(AIS_Shape)::DownCast(io);
+ if (!aisShape.IsNull())
+ {
+ TopoDS_Shape bigShape = aisShape->Shape();
+
+ if (!bigShape.IsEqual(curBigShape))
+ {
+ curBigShape = bigShape;
+ subShapes.Clear();
+ TopExp::MapShapes(bigShape, subShapes);
+ }
+ index = subShapes.FindIndex(subShape);
+ }
+ }
+
+ if (!entryStr.isEmpty())
+ {
+ LightApp_DataOwner* owner;
+ if (index > -1) // Local Selection
+ owner = new LightApp_DataSubOwner (entryStr, index);
+ else // Global Selection
+ owner = new LightApp_DataOwner (entryStr);
+
+ aList.append(SUIT_DataOwnerPtr(owner));
+ }