mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-04-15 21:21:22 +05:00
add virtual method getObjectName() to check if a GEOM_Object already has a name
This commit is contained in:
parent
15854f5a98
commit
f74d6b98cb
@ -862,7 +862,9 @@ bool GEOMBase_Helper::onAccept( const bool publish, const bool useTransaction, b
|
|||||||
for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it ) {
|
for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it ) {
|
||||||
GEOM::GEOM_Object_var obj=*it;
|
GEOM::GEOM_Object_var obj=*it;
|
||||||
if ( publish ) {
|
if ( publish ) {
|
||||||
QString aName = getNewObjectName();
|
QString aName = getObjectName(obj);
|
||||||
|
if (aName.isEmpty()) {
|
||||||
|
aName = getNewObjectName();
|
||||||
if ( nbObjs > 1 ) {
|
if ( nbObjs > 1 ) {
|
||||||
if (aName.isEmpty())
|
if (aName.isEmpty())
|
||||||
aName = getPrefix(obj);
|
aName = getPrefix(obj);
|
||||||
@ -878,6 +880,7 @@ bool GEOMBase_Helper::onAccept( const bool publish, const bool useTransaction, b
|
|||||||
if ( aName.isEmpty() )
|
if ( aName.isEmpty() )
|
||||||
aName = GEOMBase::GetDefaultName( getPrefix( obj ) );
|
aName = GEOMBase::GetDefaultName( getPrefix( obj ) );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
anEntryList << addInStudy( obj, aName.toLatin1().constData() );
|
anEntryList << addInStudy( obj, aName.toLatin1().constData() );
|
||||||
// updateView=false
|
// updateView=false
|
||||||
display( obj, false );
|
display( obj, false );
|
||||||
@ -1002,6 +1005,15 @@ GEOM::GEOM_Object_ptr GEOMBase_Helper::getFather( GEOM::GEOM_Object_ptr theObj )
|
|||||||
return GEOM::GEOM_Object::_nil();
|
return GEOM::GEOM_Object::_nil();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================
|
||||||
|
// Function : getObjectName
|
||||||
|
// Purpose : Redefine this method to return proper name for the given object
|
||||||
|
//================================================================
|
||||||
|
QString GEOMBase_Helper::getObjectName(GEOM::GEOM_Object_ptr object) const
|
||||||
|
{
|
||||||
|
return QString::null;
|
||||||
|
}
|
||||||
|
|
||||||
//================================================================
|
//================================================================
|
||||||
// Function : getNewObjectName
|
// Function : getNewObjectName
|
||||||
// Purpose : Redefine this method to return proper name for a new object
|
// Purpose : Redefine this method to return proper name for a new object
|
||||||
|
@ -164,6 +164,7 @@ protected:
|
|||||||
// as a top-level object.
|
// as a top-level object.
|
||||||
|
|
||||||
virtual QString getNewObjectName() const;
|
virtual QString getNewObjectName() const;
|
||||||
|
virtual QString getObjectName(GEOM::GEOM_Object_ptr object) const;
|
||||||
virtual bool extractPrefix() const;
|
virtual bool extractPrefix() const;
|
||||||
virtual void addSubshapesToStudy();
|
virtual void addSubshapesToStudy();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user