- ids->length( 1 );
- GEOM::GEOM_Object_var compSub = geomGen->AddSubShape( aSubGeomVar, ids );
- if ( !compSub->_is_nil() )
- {
- GEOM::ListOfGO_var shared = sop->GetSharedShapes( mainGeom,
- compSub,
- compSub->GetShapeType() );
- geomGen->RemoveObject( compSub );
- compSub->UnRegister();
- if ( shared->length() > 0 ) {
- geomGen->RemoveObject( shared[0] );
- shared[0]->UnRegister();
- }
- return ( shared->length() > 0 );
- }
+ GEOM_Client geomClient;
+ TopoDS_Shape subShape = geomClient.GetShape( geomGen, aSubGeomVar );
+ TopoDS_Shape mainShape = geomClient.GetShape( geomGen, mainGeom );
+ if ( subShape.IsNull() || mainShape.IsNull() )
+ return false;
+
+ TopAbs_ShapeEnum subType = getGroupType( subShape );
+ TopTools_IndexedMapOfShape subMap;
+ TopExp::MapShapes( subShape, subType, subMap );
+ for ( TopExp_Explorer exp( mainShape, subType ); exp.More(); exp.Next() )
+ if ( subMap.Contains( exp.Current() ))
+ return true;