X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI.cxx;h=1e32566a2be0ffef17e99556a01b7a642d8c2dd2;hp=6f4e1d7cb2047f3b2a225b02f1535664edcc0236;hb=0a237be4b91b6db526b340c534f40a385d6d65ab;hpb=7b4c10fd0e3bd5f6612582fb9ef39965b8f0055a diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index 6f4e1d7cb..1e32566a2 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -120,6 +120,7 @@ #include #include #include +#include #include #include #include @@ -1919,8 +1920,8 @@ void SMESHGUI::OnEditDelete() SalomeApp_Application* anApp = dynamic_cast( SUIT_Session::session()->activeApplication() ); - // Put the whole hierarchy of sub-objects of the selected SO's into a list and - // then treat them all starting from the deepest objects (at list back) + // Put one level of sub-objects of the selected SO's into a list + // in order to get objects inside folders like "Assigned Algorithms" std::list< _PTR(SObject) > listSO; SALOME_ListIteratorOfListIO It(selected); for( ; It.More(); It.Next()) // loop on selected IO's @@ -1941,43 +1942,47 @@ void SMESHGUI::OnEditDelete() aSO = aRefSObject; // Delete main Object instead of reference listSO.push_back( aSO ); - std::list< _PTR(SObject) >::iterator itSO = --listSO.end(); - for ( ; itSO != listSO.end(); ++itSO ) { - _PTR(ChildIterator) it = aStudy->NewChildIterator( *itSO ); - for (it->InitEx(false); it->More(); it->Next()) - listSO.push_back( it->Value() ); - } + + _PTR(ChildIterator) it = aStudy->NewChildIterator( aSO ); + for (it->InitEx(false); it->More(); it->Next()) + listSO.push_back( it->Value() ); } } // Check if none of objects to delete is referred from outside std::list< _PTR(SObject) >::reverse_iterator ritSO; + std::vector< _PTR(SObject) > subSO; for ( ritSO = listSO.rbegin(); ritSO != listSO.rend(); ++ritSO ) { _PTR(SObject) SO = *ritSO; if ( !SO ) continue; - std::vector<_PTR(SObject)> aReferences = aStudy->FindDependances( *ritSO ); - for (size_t i = 0; i < aReferences.size(); i++) { - _PTR(SComponent) aComponent = aReferences[i]->GetFatherComponent(); - std::string type = aComponent->ComponentDataType(); - if ( type != "SMESH" ) - { - SUIT_MessageBox::warning( anApp->desktop(), - QObject::tr("WRN_WARNING"), - QObject::tr("DEP_OBJECT") ); - return; // outside SMESH, there is an object depending on a SMESH object + + int nbChildren = SO->GetLastChildTag(); + subSO.clear(); + subSO.reserve( 1 + nbChildren ); + subSO.push_back( SO ); + if ( nbChildren > 0 ) + { + _PTR(ChildIterator) it = aStudy->NewChildIterator( SO ); + for ( it->InitEx( true ); it->More(); it->Next() ) + subSO.push_back( it->Value() ); + } + for ( size_t i = 0; i < subSO.size(); ++i ) + { + std::vector<_PTR(SObject)> aReferences = aStudy->FindDependances( subSO[i] ); + for ( size_t j = 0; j < aReferences.size(); j++ ) { + _PTR(SComponent) aComponent = aReferences[j]->GetFatherComponent(); + std::string type = aComponent->ComponentDataType(); + if ( type != "SMESH" ) + { + SUIT_MessageBox::warning( anApp->desktop(), + QObject::tr("WRN_WARNING"), + QObject::tr("DEP_OBJECT") ); + return; // outside SMESH, there is an object depending on a SMESH object + } } } } - // Call mesh->Clear() to prevent loading mesh from file caused by hypotheses removal - for( It.Initialize( selected ); It.More(); It.Next()) // loop on selected IO's - { - Handle(SALOME_InteractiveObject) IObject = It.Value(); - SMESH::SMESH_Mesh_var mesh = SMESH::IObjectToInterface< SMESH::SMESH_Mesh >( IObject ); - if ( !mesh->_is_nil() ) - mesh->Clear(); - } - // Treat SO's in the list starting from the back aStudyBuilder->NewCommand(); // There is a transaction for ( ritSO = listSO.rbegin(); ritSO != listSO.rend(); ++ritSO ) @@ -1987,7 +1992,7 @@ void SMESHGUI::OnEditDelete() std::string anEntry = SO->GetID(); /** Erase graphical object and remove all its data **/ - if(SO->FindAttribute(anAttr, "AttributeIOR")) { + if ( SO->FindAttribute( anAttr, "AttributeIOR" )) { SMESH::RemoveVisualObjectWithActors( anEntry.c_str(), true); } /** Remove an object from data structures **/ @@ -2540,6 +2545,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) #ifndef DISABLE_PLOT2DVIEWER SMESH::ProcessIn2DViewers(anActor,SMESH::RemoveFrom2dViewer); #endif + anActor->UpdateFilter(); } } } @@ -2726,6 +2732,10 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) else aSel->setSelectedObjects( to_process ); + if ( vtkwnd && vtkwnd->GetRenderer() && !isStudyLocked() && + ( theCommandID==SMESHOp::OpShow || theCommandID==SMESHOp::OpShowOnly ) ) + vtkwnd->GetRenderer()->AdjustActors(); + break; } @@ -3719,6 +3729,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) case SMESHOp::OpPropertiesVolume: case SMESHOp::OpMinimumDistance: case SMESHOp::OpBoundingBox: + case SMESHOp::OpAngle: { int page = SMESHGUI_MeasureDlg::MinDistance; if ( theCommandID == SMESHOp::OpBoundingBox ) @@ -3729,6 +3740,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) page = SMESHGUI_MeasureDlg::Area; else if ( theCommandID == SMESHOp::OpPropertiesVolume ) page = SMESHGUI_MeasureDlg::Volume; + else if ( theCommandID == SMESHOp::OpAngle ) + page = SMESHGUI_MeasureDlg::Angle; EmitSignalDeactivateDialog(); SMESHGUI_MeasureDlg* dlg = new SMESHGUI_MeasureDlg( SMESHGUI::desktop(), page ); @@ -4063,6 +4076,7 @@ void SMESHGUI::initialize( CAM_Application* app ) createSMESHAction( SMESHOp::OpPropertiesLength, "MEASURE_LENGTH", "ICON_MEASURE_LENGTH" ); createSMESHAction( SMESHOp::OpPropertiesArea, "MEASURE_AREA", "ICON_MEASURE_AREA" ); createSMESHAction( SMESHOp::OpPropertiesVolume, "MEASURE_VOLUME", "ICON_MEASURE_VOLUME" ); + createSMESHAction( SMESHOp::OpAngle, "MEASURE_ANGLE", "ICON_MEASURE_ANGLE" ); createSMESHAction( SMESHOp::OpHide, "HIDE", "ICON_HIDE" ); createSMESHAction( SMESHOp::OpShow, "SHOW", "ICON_SHOW" ); @@ -4270,6 +4284,7 @@ void SMESHGUI::initialize( CAM_Application* app ) createMenu( SMESHOp::OpMinimumDistance, measureId, -1 ); createMenu( SMESHOp::OpBoundingBox, measureId, -1 ); + createMenu( SMESHOp::OpAngle, measureId, -1 ); createMenu( SMESHOp::OpPropertiesLength, basicPropId, -1 ); createMenu( SMESHOp::OpPropertiesArea, basicPropId, -1 ); createMenu( SMESHOp::OpPropertiesVolume, basicPropId, -1 ); @@ -4981,9 +4996,9 @@ void SMESHGUI::contextMenuPopup( const QString& client, QMenu* menu, QString& ti _PTR(Study) study = appStudy->studyDS(); _PTR(SObject) obj = study->FindObjectID( io->getEntry() ); if ( obj ) { - QString aName = QString( SMESH::fromUtf8(obj->GetName()) ); - while ( aName.at( aName.length() - 1 ) == ' ' ) // Remove extraspaces in Name of Popup - aName.remove( (aName.length() - 1), 1 ); + QString aName = SMESH::fromUtf8( obj->GetName()); + while ( !aName.isEmpty() && aName.at( aName.length() - 1 ) == ' ' ) // Remove extraspaces in Name of Popup + aName.remove(( aName.length() - 1 ), 1 ); title = aName; } } @@ -5081,6 +5096,9 @@ void SMESHGUI::createPreferences() int dispgroup = addPreference( tr( "PREF_DISPLAY_MODE_GROUP" ), genTab ); setPreferenceProperty( dispgroup, "columns", 2 ); + + addPreference( tr( "PREF_FITALL_ON_DISPLAYONLY" ), dispgroup, LightApp_Preferences::Bool, "SMESH", "fitall_on_displayonly" ); + int dispmode = addPreference( tr( "PREF_DISPLAY_MODE" ), dispgroup, LightApp_Preferences::Selector, "SMESH", "display_mode" ); QStringList modes; modes.append( tr("MEN_WIRE") ); @@ -5466,13 +5484,13 @@ void SMESHGUI::preferencesChanged( const QString& sect, const QString& name ) std::string aWarning; SUIT_ResourceMgr* aResourceMgr = SMESH::GetResourceMgr(this); - if ( name== "selection_object_color" || - name=="selection_element_color" || - name== "highlight_color" || - name=="selection_precision_node" || - name=="selection_precision_element" || - name=="selection_precision_object" || - name=="selection_increment") + if ( name == "selection_object_color" || + name == "selection_element_color" || + name == "highlight_color" || + name == "selection_precision_node" || + name == "selection_precision_element" || + name == "selection_precision_object" || + name == "selection_increment") { SMESH::UpdateSelectionProp( this ); }