+ {
+ if ( myObjectKind == KIND_POLYLINEXY && ( myObjectFlags & ClosedPolyline ) ) {
+ // check if the polyline is closed
+ Handle(HYDROData_PolylineXY) aPolylineObj =
+ Handle(HYDROData_PolylineXY)::DownCast( anObject );
+ if ( !aPolylineObj.IsNull() && aPolylineObj->IsClosed() ) {
+ anObjName = aPolylineObj->GetName();
+ }
+ } else {
+ anObjName = anObject->GetName();
+ }
+
+ // Check if the same object has not been selected in other selectors of the same parent widget.
+ if ( !anObjName.isEmpty() )
+ {
+ QList<HYDROGUI_ObjSelector*> aSelectors = parentWidget()->findChildren<HYDROGUI_ObjSelector*>();
+ foreach( HYDROGUI_ObjSelector* aSelector, aSelectors )
+ {
+ if( aSelector != this && ( aSelector->GetName() == anObjName ) )
+ {
+ // Forbid selection of the same object
+ emit alreadySelected( anObjName );
+ return;
+ }
+ }
+ }
+ }