mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-05-14 08:50:48 +05:00
Fixed problem: it's impossible to delete main object if its subshape have been used for annother geometrical object creation
This commit is contained in:
parent
aa13d2abfd
commit
02aab3a5b3
@ -309,23 +309,12 @@ void GEOMToolsGUI::OnEditDelete()
|
|||||||
_PTR(ChildIterator) it (aStudy->NewChildIterator(aGeom));
|
_PTR(ChildIterator) it (aStudy->NewChildIterator(aGeom));
|
||||||
for ( it->InitEx( true ); it->More(); it->Next() ) {
|
for ( it->InitEx( true ); it->More(); it->Next() ) {
|
||||||
_PTR(SObject) chobj (it->Value());
|
_PTR(SObject) chobj (it->Value());
|
||||||
CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject(chobj);
|
if(CheckSubObjectInUse(chobj, obj, aStudy)) return;
|
||||||
GEOM::GEOM_Object_var geomObj = GEOM::GEOM_Object::_narrow( corbaObj );
|
//check subobjects
|
||||||
if( CORBA::is_nil(geomObj) )
|
for (_PTR(ChildIterator) it (aStudy->NewChildIterator(obj)); it->More(); it->Next()) {
|
||||||
continue;
|
_PTR(SObject) child (it->Value());
|
||||||
GEOM::ListOfGO_var list = geomObj->GetDependency();
|
if(CheckSubObjectInUse( chobj, child, aStudy)) return;
|
||||||
if( list->length() > 1 )
|
}
|
||||||
for(int i = 0; i < list->length(); i++ ){
|
|
||||||
CORBA::Object_var corbaObj_rem = GeometryGUI::ClientSObjectToObject(obj);
|
|
||||||
GEOM::GEOM_Object_var geomObj_rem = GEOM::GEOM_Object::_narrow( corbaObj_rem );
|
|
||||||
if( list[i]->_is_equivalent( geomObj_rem ) ){
|
|
||||||
SUIT_MessageBox::warn1 ( app->desktop(),
|
|
||||||
QObject::tr("WRN_WARNING"),
|
|
||||||
QObject::tr("DEP_OBJECT"),
|
|
||||||
QObject::tr("BUT_OK") );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoveObjectWithChildren(obj, aStudy, views, disp);
|
RemoveObjectWithChildren(obj, aStudy, views, disp);
|
||||||
@ -681,6 +670,39 @@ void GEOMToolsGUI::RemoveObjectWithChildren(_PTR(SObject) obj,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=====================================================================================
|
||||||
|
// function : CheckSubObjectInUse
|
||||||
|
// purpose : to be used by OnEditDelete() method
|
||||||
|
//=====================================================================================
|
||||||
|
bool GEOMToolsGUI::CheckSubObjectInUse(_PTR(SObject) checkobj,
|
||||||
|
_PTR(SObject) remobj,
|
||||||
|
_PTR(Study) aStudy)
|
||||||
|
{
|
||||||
|
CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject(checkobj);
|
||||||
|
GEOM::GEOM_Object_var geomObj = GEOM::GEOM_Object::_narrow( corbaObj );
|
||||||
|
if( CORBA::is_nil(geomObj) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
GEOM::ListOfGO_var list = geomObj->GetDependency();
|
||||||
|
if( list->length() > 1 )
|
||||||
|
for(int i = 0; i < list->length(); i++ ){
|
||||||
|
CORBA::Object_var corbaObj_rem = GeometryGUI::ClientSObjectToObject(remobj);
|
||||||
|
GEOM::GEOM_Object_var geomObj_rem = GEOM::GEOM_Object::_narrow( corbaObj_rem );
|
||||||
|
if( list[i]->_is_equivalent( geomObj_rem ) ){
|
||||||
|
SalomeApp_Application* app =
|
||||||
|
dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
|
||||||
|
|
||||||
|
SUIT_MessageBox::warn1 ( app->desktop(),
|
||||||
|
QObject::tr("WRN_WARNING"),
|
||||||
|
QObject::tr("DEP_OBJECT"),
|
||||||
|
QObject::tr("BUT_OK") );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//=====================================================================================
|
//=====================================================================================
|
||||||
// EXPORTED METHODS
|
// EXPORTED METHODS
|
||||||
//=====================================================================================
|
//=====================================================================================
|
||||||
|
@ -89,6 +89,12 @@ private:
|
|||||||
_PTR(Study) aStudy,
|
_PTR(Study) aStudy,
|
||||||
QPtrList<SALOME_View> views,
|
QPtrList<SALOME_View> views,
|
||||||
GEOM_Displayer* disp);
|
GEOM_Displayer* disp);
|
||||||
|
|
||||||
|
//checks if the object passed as the first argument depends on the second arguments
|
||||||
|
bool CheckSubObjectInUse(_PTR(SObject) checkobj,
|
||||||
|
_PTR(SObject) remobj,
|
||||||
|
_PTR(Study) aStudy);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user