for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it ) {
GEOM::GEOM_Object_var obj=*it;
if ( publish ) {
- QString aName = getNewObjectName();
- if ( nbObjs > 1 ) {
- if (aName.isEmpty())
- aName = getPrefix(obj);
- if (nbObjs <= 30) {
- // Try to find a unique name
- aName = GEOMBase::GetDefaultName(aName, extractPrefix());
+ QString aName = getObjectName(obj);
+ if (aName.isEmpty()) {
+ aName = getNewObjectName();
+ if ( nbObjs > 1 ) {
+ if (aName.isEmpty())
+ aName = getPrefix(obj);
+ if (nbObjs <= 30) {
+ // Try to find a unique name
+ aName = GEOMBase::GetDefaultName(aName, extractPrefix());
+ } else {
+ // Don't check name uniqueness in case of numerous objects
+ aName = aName + "_" + QString::number(aNumber++);
+ }
} else {
- // Don't check name uniqueness in case of numerous objects
- aName = aName + "_" + QString::number(aNumber++);
+ // PAL6521: use a prefix, if some dialog box doesn't reimplement getNewObjectName()
+ if ( aName.isEmpty() )
+ aName = GEOMBase::GetDefaultName( getPrefix( obj ) );
}
- } else {
- // PAL6521: use a prefix, if some dialog box doesn't reimplement getNewObjectName()
- if ( aName.isEmpty() )
- aName = GEOMBase::GetDefaultName( getPrefix( obj ) );
}
anEntryList << addInStudy( obj, aName.toLatin1().constData() );
// updateView=false
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
// Purpose : Redefine this method to return proper name for a new object
// for <theObj> or a nil reference if <theObj> should be published
// 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 void addSubshapesToStudy();