// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
globalSelection( GEOM_ALLOBJECTS, true );
- delete myDisplayer;
+ if (myDisplayer)
+ delete myDisplayer;
}
//================================================================
SalomeApp_Study* aDoc = getStudy();
if ( aDoc && aDoc->studyDS() ) {
_PTR(Study) aStudy = aDoc->studyDS();
- _PTR(SObject) aSObj (aStudy->FindObjectIOR(SalomeApp_Application::orb()->object_to_string(object)));
+ CORBA::String_var objStr = SalomeApp_Application::orb()->object_to_string(object);
+ _PTR(SObject) aSObj (aStudy->FindObjectIOR(string(objStr.in())));
if ( aSObj ) {
_PTR(ChildIterator) anIt ( aStudy->NewChildIterator( aSObj ) );
for ( anIt->InitEx( true ); anIt->More(); anIt->Next() ) {
getDisplayer()->SetToActivate( activate );
// Make a reference to GEOM_Object
- getDisplayer()->SetName( SalomeApp_Application::orb()->object_to_string( object ) );
+ CORBA::String_var objStr = SalomeApp_Application::orb()->object_to_string( object );
+ getDisplayer()->SetName( objStr.in() );
// Build prs
SALOME_Prs* aPrs = getDisplayer()->BuildPrs( object );
{
SalomeApp_Study* study = getStudy();
if ( study ) {
- string IOR = GEOMBase::GetIORFromObject( object);
+ char * objIOR = GEOMBase::GetIORFromObject( object );
+ string IOR( objIOR );
+ free( objIOR );
if ( IOR != "" ) {
_PTR(SObject) SO ( study->studyDS()->FindObjectIOR( IOR ) );
if ( SO ) {
- return TCollection_AsciiString((char*)SO->GetID().c_str()).ToCString();
+ return TCollection_AsciiString((char*)SO->GetID().c_str()).ToCString();
}
}
}
if ( CORBA::is_nil( theObj ) )
return;
- string IOR = SalomeApp_Application::orb()->object_to_string( theObj );
- TCollection_AsciiString asciiIOR( strdup( IOR.c_str() ) );
+ CORBA::String_var IOR = SalomeApp_Application::orb()->object_to_string( theObj );
+ TCollection_AsciiString asciiIOR( (char *)IOR.in() );
GEOM_Client().RemoveShapeFromBuffer( asciiIOR );
if ( !getStudy() || !getStudy()->studyDS() )
return;
_PTR(Study) aStudy = getStudy()->studyDS();
- _PTR(SObject) aSObj ( aStudy->FindObjectIOR( IOR ) );
+ _PTR(SObject) aSObj ( aStudy->FindObjectIOR( string( IOR ) ) );
if ( !aSObj )
return;
else {
const int nbObjs = objects.size();
bool withChildren = false;
+ int aNumber = 1;
for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it ) {
if ( publish ) {
- QString aName("");
- if ( nbObjs > 1 )
- aName = strlen( getNewObjectName() ) ? GEOMBase::GetDefaultName( getNewObjectName() ) : GEOMBase::GetDefaultName( getPrefix( *it ) );
- else {
- aName = getNewObjectName();
+ QString aName = getNewObjectName();
+ if ( nbObjs > 1 ) {
+ if (aName.isEmpty())
+ aName = getPrefix(*it);
+ if (nbObjs <= 30) {
+ // Try to find a unique name
+ aName = GEOMBase::GetDefaultName(aName);
+ } else {
+ // Don't check name uniqueness in case of numerous objects
+ aName = aName + "_" + QString::number(aNumber++);
+ }
+ } else {
// PAL6521: use a prefix, if some dialog box doesn't reimplement getNewObjectName()
if ( aName.isEmpty() )
aName = GEOMBase::GetDefaultName( getPrefix( *it ) );