mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-30 21:00:32 +05:00
PAL13473 (Build repetitive mesh):
add a) int GetObjectId(CORBA::Object_ptr), b) TInterface::_var_type GetObjectByOldId( const int oldID )
This commit is contained in:
parent
b73a16f1cd
commit
5b836386bb
@ -104,6 +104,15 @@ public:
|
|||||||
void mapOldToNew( const int oldId, const int newId ) {
|
void mapOldToNew( const int oldId, const int newId ) {
|
||||||
mapIdToId[ oldId ] = newId;
|
mapIdToId[ oldId ] = newId;
|
||||||
}
|
}
|
||||||
|
// get old id by a new one
|
||||||
|
int getOldId( const int newId ) {
|
||||||
|
map<int, int>::iterator imap;
|
||||||
|
for ( imap = mapIdToId.begin(); imap != mapIdToId.end(); ++imap ) {
|
||||||
|
if ( imap->second == newId )
|
||||||
|
return imap->first;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// get next free object identifier
|
// get next free object identifier
|
||||||
@ -399,6 +408,21 @@ public:
|
|||||||
// Register an object in a StudyContext; return object id
|
// Register an object in a StudyContext; return object id
|
||||||
int RegisterObject(CORBA::Object_ptr theObject);
|
int RegisterObject(CORBA::Object_ptr theObject);
|
||||||
|
|
||||||
|
// Return id of registered object
|
||||||
|
int GetObjectId(CORBA::Object_ptr theObject);
|
||||||
|
|
||||||
|
// Return an object that previously had an oldID
|
||||||
|
template<class TInterface>
|
||||||
|
typename TInterface::_var_type GetObjectByOldId( const int oldID )
|
||||||
|
{
|
||||||
|
if ( StudyContext* myStudyContext = GetCurrentStudyContext() ) {
|
||||||
|
string ior = myStudyContext->getIORbyOldId( oldID );
|
||||||
|
if ( !ior.empty() )
|
||||||
|
return TInterface::_narrow(GetORB()->string_to_object( ior.c_str() ));
|
||||||
|
}
|
||||||
|
return TInterface::_nil();
|
||||||
|
}
|
||||||
|
|
||||||
// Get current study ID
|
// Get current study ID
|
||||||
int GetCurrentStudyID()
|
int GetCurrentStudyID()
|
||||||
{ return myCurrentStudy->_is_nil() ? -1 : myCurrentStudy->StudyId(); }
|
{ return myCurrentStudy->_is_nil() ? -1 : myCurrentStudy->StudyId(); }
|
||||||
|
Loading…
Reference in New Issue
Block a user