}
// collect information about existing profiles
- QStringList aProfiles = HYDROGUI_Tool::FindExistingObjectsNames( doc(), KIND_PROFILE );
+ QStringList aProfiles = HYDROGUI_Tool::FindExistingObjectsNames( doc(), KIND_PROFILE, true );
aPanel->setObjectName( anObjectName );
#include <HYDROData_Iterator.h>
#include <HYDROData_ImmersibleZone.h>
#include <HYDROData_Tool.h>
+#include <HYDROData_Profile.h>
#include <GEOMBase.h>
}
QStringList HYDROGUI_Tool::FindExistingObjectsNames( const Handle(HYDROData_Document)& theDoc,
- const ObjectKind theObjectKind )
+ const ObjectKind theObjectKind,
+ bool isCheckValidProfile )
{
QStringList aNames;
HYDROData_Iterator anIter( theDoc, theObjectKind );
for ( ; anIter.More(); anIter.Next() ) {
Handle(HYDROData_Entity) anObject = anIter.Current();
- if( !anObject.IsNull() ) {
- aNames.append( anObject->GetName() );
+
+ bool isOK = !anObject.IsNull();
+
+ if( isOK && isCheckValidProfile )
+ {
+ Handle_HYDROData_Profile aProfile = Handle_HYDROData_Profile::DownCast( anObject );
+ if( !aProfile.IsNull() && !aProfile->IsValid() )
+ isOK = false;
}
+
+ if( isOK )
+ aNames.append( anObject->GetName() );
}
return aNames;
* \return list of names
*/
static QStringList FindExistingObjectsNames( const Handle(HYDROData_Document)& theDoc,
- const ObjectKind theObjectKind );
+ const ObjectKind theObjectKind,
+ bool isCheckValidProfile = false );
/**
* \brief Converts coordinate value to string.