X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHEXABLOCKGUI%2FHEXABLOCKGUI_SalomeTools.cxx;h=1dae5ca782ea2dfdedc600aabb0c3e7088aaa9be;hb=12cceffda96f1daef01df1fb7024cf164bf31067;hp=e28580f3d31a73e2a560c3b4d5c1226b164fde31;hpb=ab53385205fe062af0e87d4e14296b1492fe3611;p=modules%2Fhexablock.git diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_SalomeTools.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_SalomeTools.cxx index e28580f..1dae5ca 100644 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_SalomeTools.cxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_SalomeTools.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2009-2013 CEA/DEN, EDF R&D +// Copyright (C) 2009-2016 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -28,11 +28,8 @@ #include #include - - #include -#include #include #include @@ -89,45 +86,15 @@ namespace GUI } - _PTR(Study) GetActiveStudyDocument() + _PTR(Study) getStudy() { - SalomeApp_Study* aStudy = dynamic_cast(GetActiveStudy()); - if (aStudy) - return aStudy->studyDS(); - else - return _PTR(Study)(); - } - - - CORBA::Object_var corbaObj( _PTR(SObject) theSO ) - { - CORBA::Object_var aCorbaObj = CORBA::Object::_nil(); - if ( theSO ) { - std::string aValue = theSO->GetIOR(); - if (strcmp(aValue.c_str(), "") != 0) { - CORBA::ORB_ptr anORB = SalomeApp_Application::orb(); - aCorbaObj = anORB->string_to_object(aValue.c_str()); - } - } - return aCorbaObj._retn(); + static _PTR(Study) _study; + if(!_study) + _study = SalomeApp_Application::getStudy(); + return _study; } - CORBA::Object_var corbaObj( const Handle(SALOME_InteractiveObject)& theIO ) - { - CORBA::Object_var aCorbaObj = CORBA::Object::_nil(); - - if ( !theIO.IsNull() && theIO->hasEntry() ){ - _PTR(Study) aStudy = GetActiveStudyDocument(); - _PTR(SObject) aSObj = aStudy->FindObjectID(theIO->getEntry()); - aCorbaObj = corbaObj(aSObj); - } - return aCorbaObj._retn(); - } - - - - SALOME_Actor* findActorByEntry( SVTK_ViewWindow *theVtkViewWindow, const char* theEntry) { SALOME_Actor *foundActor = NULL; @@ -204,7 +171,10 @@ namespace GUI Handle(SelectMgr_Selection) sel = theObj->Selection( m ); for ( sel->Init(); sel->More(); sel->Next() ) { - Handle(SelectBasics_SensitiveEntity) entity = sel->Sensitive(); + const Handle(SelectMgr_SensitiveEntity) aHSenEntity = sel->Sensitive(); + if ( aHSenEntity.IsNull() ) + continue; + Handle(SelectBasics_SensitiveEntity) entity = aHSenEntity->BaseSensitive(); if ( entity.IsNull() ) continue;