+//================================================================
+// Function : selectObjects
+// Purpose : Selects list of objects
+//================================================================
+bool GEOMBase_Helper::selectObjects( ObjectList& objects )
+{
+ SUIT_DataOwnerPtrList aList;
+ ObjectList::iterator anIter;
+ for ( anIter = objects.begin(); anIter != objects.end(); ++anIter )
+ {
+ std::string entry = getEntry( *anIter );
+ QString aEntry( entry.c_str() );
+ LightApp_DataOwner* anOwher = new LightApp_DataOwner( aEntry );
+ aList.append( anOwher );
+ }
+
+ SUIT_Session* session = SUIT_Session::session();
+ SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
+ if ( !app )
+ return false;
+
+ LightApp_SelectionMgr* aMgr = app->selectionMgr();
+ if ( !aMgr )
+ return false;
+
+ aMgr->setSelected( aList, false );
+
+ return true;
+}
+
+//================================================================
+// Function : findObjectInFather
+// Purpose : It should return an object if its founded in study or
+// return Null object if the object is not founded
+//================================================================
+GEOM::GEOM_Object_ptr GEOMBase_Helper::findObjectInFather( GEOM::GEOM_Object_ptr theFather, const QString& theName)
+{
+ SalomeApp_Application* app =
+ dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+ SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+ _PTR(Study) aDStudy = appStudy->studyDS();
+ std::string IOR = GEOMBase::GetIORFromObject( theFather );
+ _PTR(SObject) SObj ( aDStudy->FindObjectIOR( IOR ) );
+
+ bool inStudy = false;
+ GEOM::GEOM_Object_var aReturnObject;
+ for (_PTR(ChildIterator) iit (aDStudy->NewChildIterator( SObj )); iit->More() && !inStudy; iit->Next()) {
+ _PTR(SObject) child (iit->Value());
+ QString aChildName = child->GetName().c_str();
+ if (aChildName == theName) {
+ inStudy = true;
+ CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject(iit->Value());
+ aReturnObject = GEOM::GEOM_Object::_narrow( corbaObj );
+ }
+ }
+ if (inStudy)
+ return aReturnObject._retn();
+
+ return GEOM::GEOM_Object::_nil();
+}
+
+//================================================================
+// Function : addSubshapesToStudy
+// Purpose : Virtual method to add subshapes if needs
+//================================================================
+void GEOMBase_Helper::addSubshapesToStudy()
+{
+ //Impemented in Dialogs, called from Accept method
+}
+
+//================================================================
+// Function : addSubshapesToFather
+// Purpose : Method to add Father Subshapes to Study if it`s not exist
+//================================================================
+void GEOMBase_Helper::addSubshapesToFather( QMap<QString, GEOM::GEOM_Object_var>& theMap )
+{
+ //GetStudyDS
+ SalomeApp_Application* app =
+ dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+ SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+ _PTR(Study) aDStudy = appStudy->studyDS();
+
+ GEOM::GEOM_IGroupOperations_var anOp = getGeomEngine()->GetIGroupOperations( getStudyId() );
+
+ for( QMap<QString, GEOM::GEOM_Object_var>::Iterator it = theMap.begin(); it != theMap.end(); it++ )
+ {
+ if ( !anOp->_is_nil() ) {
+ GEOM::GEOM_Object_var aFatherObj = anOp->GetMainShape( it.value() );
+ if ( !aFatherObj->_is_nil() ) {
+ GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aFatherObj, it.key().toLatin1().data() );
+
+ //Add Object to study if its not exist
+ if ( aFindedObject == GEOM::GEOM_Object::_nil() )
+ GeometryGUI::GetGeomGen()->AddInStudy(GeometryGUI::ClientStudyToStudy(aDStudy),
+ it.value(), it.key().toLatin1().data(), aFatherObj );
+ }
+ }
+ else {
+ //cout << " anOperations is NULL! " << endl;
+ }
+ }
+}
+
+