Merging with V3_1_0a

This commit is contained in:
apo 2005-10-10 08:30:56 +00:00
parent 4384337d18
commit e356c6f27e
2 changed files with 136 additions and 78 deletions

View File

@ -26,8 +26,6 @@
#include "SMESHGUI.h" #include "SMESHGUI.h"
#include "SMESHGUI_InitMeshDlg.h"
#include "SMESHGUI_AddSubMeshDlg.h"
#include "SMESHGUI_NodesDlg.h" #include "SMESHGUI_NodesDlg.h"
#include "SMESHGUI_TransparencyDlg.h" #include "SMESHGUI_TransparencyDlg.h"
#include "SMESHGUI_ClippingDlg.h" #include "SMESHGUI_ClippingDlg.h"
@ -66,6 +64,7 @@
#include "SMESHGUI_Selection.h" #include "SMESHGUI_Selection.h"
#include "SMESHGUI_CreatePolyhedralVolumeDlg.h" #include "SMESHGUI_CreatePolyhedralVolumeDlg.h"
#include "SMESHGUI_MeshOp.h" #include "SMESHGUI_MeshOp.h"
#include "SMESHGUI_Displayer.h"
#include "SMESHGUI_Utils.h" #include "SMESHGUI_Utils.h"
#include "SMESHGUI_GEOMGenUtils.h" #include "SMESHGUI_GEOMGenUtils.h"
@ -94,8 +93,9 @@
#include <SVTK_ViewWindow.h> #include <SVTK_ViewWindow.h>
#include <SVTK_ViewModel.h> #include <SVTK_ViewModel.h>
#include <SVTK_InteractorStyle.h>
#include <VTKViewer_ViewManager.h> #include <SVTK_RenderWindowInteractor.h>
#include <SVTK_ViewManager.h>
#include "OB_Browser.h" #include "OB_Browser.h"
@ -804,8 +804,9 @@ SalomeApp_Module( "SMESH" )
myComponentSMESH = SMESH::SMESH_Gen::_narrow( comp ); myComponentSMESH = SMESH::SMESH_Gen::_narrow( comp );
} }
myActiveDialogBox = 0 ; myActiveDialogBox = 0;
myState = -1 ; myState = -1;
myDisplayer = 0;
SMESH::GetFilterManager(); SMESH::GetFilterManager();
SMESH::GetPattern(); SMESH::GetPattern();
@ -822,6 +823,7 @@ SalomeApp_Module( "SMESH" )
SMESHGUI::~SMESHGUI() SMESHGUI::~SMESHGUI()
{ {
SMESH::GetFilterManager()->Destroy(); SMESH::GetFilterManager()->Destroy();
SMESH::GetFilterManager() = SMESH::FilterManager::_nil();
} }
//============================================================================= //=============================================================================
@ -1056,6 +1058,10 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
if( !mgr ) if( !mgr )
return false; return false;
if (CORBA::is_nil(GetSMESHGen()->GetCurrentStudy())) {
GetSMESHGen()->SetCurrentStudy(_CAST(Study,aStudy)->GetStudy());
}
SUIT_ViewWindow* view = application()->desktop()->activeWindow(); SUIT_ViewWindow* view = application()->desktop()->activeWindow();
SVTK_ViewWindow* vtkwnd = dynamic_cast<SVTK_ViewWindow*>( view ); SVTK_ViewWindow* vtkwnd = dynamic_cast<SVTK_ViewWindow*>( view );
@ -1153,12 +1159,46 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
} }
SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr(); SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
SALOME_ListIO selected; SALOME_ListIO sel_objects, to_process;
if (aSel) if (aSel)
aSel->selectedObjects( selected ); aSel->selectedObjects( sel_objects );
SALOME_ListIteratorOfListIO anIt( sel_objects );
for( ; anIt.More(); anIt.Next() )
{
Handle( SALOME_InteractiveObject ) obj = anIt.Value();
if( obj->hasEntry() )
{
_PTR(SObject) SO = activeStudy()->studyDS()->FindObjectID( obj->getEntry() );
if( SO && QString( SO->GetID().c_str() ) == SO->GetFatherComponent()->GetID().c_str() )
{ //component is selected
_PTR(SComponent) SC( SO->GetFatherComponent() );
_PTR(ChildIterator) anIter ( activeStudy()->studyDS()->NewChildIterator( SC ) );
anIter->InitEx( true );
while( anIter->More() )
{
_PTR(SObject) valSO ( anIter->Value() );
_PTR(SObject) refSO;
if( !valSO->ReferencedObject( refSO ) )
{
QString id = valSO->GetID().c_str(),
comp = SC->ComponentDataType().c_str(),
val = valSO->GetName().c_str();
Handle( SALOME_InteractiveObject ) new_obj =
new SALOME_InteractiveObject( id.latin1(), comp.latin1(), val.latin1() );
to_process.Append( new_obj );
}
anIter->Next();
}
continue;
}
}
to_process.Append( obj );
}
if (vtkwnd) { if (vtkwnd) {
SALOME_ListIteratorOfListIO It (selected); SALOME_ListIteratorOfListIO It( to_process );
for (; It.More(); It.Next()) { for (; It.More(); It.Next()) {
Handle(SALOME_InteractiveObject) IOS = It.Value(); Handle(SALOME_InteractiveObject) IOS = It.Value();
if (IOS->hasEntry()) { if (IOS->hasEntry()) {
@ -1174,7 +1214,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
aSel->setSelectedObjects( l1 ); aSel->setSelectedObjects( l1 );
} }
else else
aSel->setSelectedObjects( selected ); aSel->setSelectedObjects( to_process );
break; break;
} }
@ -2546,7 +2586,8 @@ void SMESHGUI::initialize( CAM_Application* app )
QString lc = QtxPopupMgr::Selection::defEquality(); QString lc = QtxPopupMgr::Selection::defEquality();
QString aClient = QString( "%1client in {%2}" ).arg( lc ).arg( "'VTKViewer'" ); QString aClient = QString( "%1client in {%2}" ).arg( lc ).arg( "'VTKViewer'" );
QString aType = QString( "%1type in {%2}" ).arg( QtxPopupMgr::Selection::defEquality() ).arg( mesh_group ); QString aType = QString( "%1type in {%2}" ).arg( QtxPopupMgr::Selection::defEquality() );
aType = aType.arg( mesh_group );
QString aMeshInVTK = aClient + "&&" + aType; QString aMeshInVTK = aClient + "&&" + aType;
//------------------------------------------------- //-------------------------------------------------
@ -2713,17 +2754,19 @@ void SMESHGUI::initialize( CAM_Application* app )
// Display / Erase // Display / Erase
//------------------------------------------------- //-------------------------------------------------
aClient = "($client in {'VTKViewer' 'ObjectBrowser'})"; aClient = "($client in {'VTKViewer' 'ObjectBrowser'})";
QString anActiveVTK = QString("activeView = '%1'").arg(VTKViewer_Viewer::Type()); QString anActiveVTK = QString("activeView = '%1'").arg(SVTK_Viewer::Type());
QString aSelCount = QString( "%1 > 0" ).arg( QtxPopupMgr::Selection::defSelCountParam() ); QString aSelCount = QString( "%1 > 0" ).arg( QtxPopupMgr::Selection::defSelCountParam() );
QString aRule = aClient + " and " + aType + " and " + aSelCount + " and " + anActiveVTK;
QString aRule = "$component={'SMESH'} and ( type='Component' or (" + aClient + " and " +
aType + " and " + aSelCount + " and " + anActiveVTK + " and " + isNotEmpty + " %1 ) )";
popupMgr()->insert( action( 301 ), -1, -1 ); // DISPLAY popupMgr()->insert( action( 301 ), -1, -1 ); // DISPLAY
popupMgr()->setRule( action( 301 ), aRule + "&&" + isNotEmpty + "&&" + isInvisible, true); popupMgr()->setRule( action( 301 ), aRule.arg( "and (not isVisible)" ), true);
popupMgr()->insert( action( 300 ), -1, -1 ); // ERASE popupMgr()->insert( action( 300 ), -1, -1 ); // ERASE
popupMgr()->setRule( action( 300 ), aRule + "&&" + isNotEmpty + "&& isVisible", true ); popupMgr()->setRule( action( 300 ), aRule.arg( "and isVisible" ), true );
popupMgr()->insert( action( 302 ), -1, -1 ); // DISPLAY_ONLY popupMgr()->insert( action( 302 ), -1, -1 ); // DISPLAY_ONLY
popupMgr()->setRule( action( 302 ), aRule + "&&" + isNotEmpty, true ); popupMgr()->setRule( action( 302 ), aRule.arg( "" ), true );
popupMgr()->insert( separator(), -1, -1 ); popupMgr()->insert( separator(), -1, -1 );
@ -2798,7 +2841,7 @@ void SMESHGUI::viewManagers( QStringList& list ) const
void SMESHGUI::onViewManagerAdded( SUIT_ViewManager* mgr ) void SMESHGUI::onViewManagerAdded( SUIT_ViewManager* mgr )
{ {
if ( dynamic_cast<VTKViewer_ViewManager*>( mgr ) ) if ( dynamic_cast<SVTK_ViewManager*>( mgr ) )
SMESH::UpdateSelectionProp( this ); SMESH::UpdateSelectionProp( this );
} }
@ -2967,6 +3010,11 @@ void SMESHGUI::createPreferences()
void SMESHGUI::preferencesChanged( const QString& sect, const QString& name ) void SMESHGUI::preferencesChanged( const QString& sect, const QString& name )
{ {
if( sect=="SMESH" )
if( name=="selection_object_color" || name=="selection_element_color" ||
name=="selection_width" || name=="highlight_color" || name=="highlight_width" ||
name=="selection_precision_node" || name=="selection_precision_element" )
SMESH::UpdateSelectionProp( this );
} }
//================================================================================ //================================================================================
@ -3045,13 +3093,14 @@ SalomeApp_Operation* SMESHGUI::createOperation( const int id ) const
break; break;
} }
if( !op )
op = SalomeApp_Module::createOperation( id );
return op; return op;
} }
SalomeApp_Displayer* SMESHGUI::displayer()
{
if( !myDisplayer )
myDisplayer = new SMESHGUI_Displayer( dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() ) );
return myDisplayer;
}

View File

@ -84,12 +84,16 @@ QtxValue SMESHGUI_Selection::param( const int ind, const QString& p ) const
else if ( p=="displayMode" ) val = QtxValue( displayMode( ind ) ); else if ( p=="displayMode" ) val = QtxValue( displayMode( ind ) );
else if ( p=="isComputable" ) val = QtxValue( isComputable( ind ) ); else if ( p=="isComputable" ) val = QtxValue( isComputable( ind ) );
else if ( p=="hasReference" ) val = QtxValue( hasReference( ind ) ); else if ( p=="hasReference" ) val = QtxValue( hasReference( ind ) );
else if ( p=="isVisible" ) val = QtxValue( isVisible( ind ) ); // else if ( p=="isVisible" ) val = QtxValue( isVisible( ind ) );
// printf( "--> param() : [%s] = %s (%s)\n", p.latin1(), val.toString().latin1(), val.typeName() ); // printf( "--> param() : [%s] = %s (%s)\n", p.latin1(), val.toString().latin1(), val.typeName() );
//if ( val.type() == QVariant::List ) //if ( val.type() == QVariant::List )
//cout << "size: " << val.toList().count() << endl; //cout << "size: " << val.toList().count() << endl;
if( val.isValid() )
return val; return val;
else
return SalomeApp_Selection::param( ind, p );
} }
//======================================================================= //=======================================================================
@ -346,6 +350,9 @@ int SMESHGUI_Selection::type( const QString& entry, _PTR(Study) study )
if( objComponent->ComponentDataType()!="SMESH" ) if( objComponent->ComponentDataType()!="SMESH" )
return -1; return -1;
if( objComponent->GetIOR()==obj->GetIOR() )
return COMPONENT;
int aLevel = obj->Depth() - objComponent->Depth(), int aLevel = obj->Depth() - objComponent->Depth(),
aFTag = objFather->Tag(), aFTag = objFather->Tag(),
anOTag = obj->Tag(), anOTag = obj->Tag(),
@ -427,6 +434,8 @@ QString SMESHGUI_Selection::typeName( const int t )
return "Mesh compound"; return "Mesh compound";
case GROUP: case GROUP:
return "Group"; return "Group";
case COMPONENT:
return "Component";
default: default:
return "Unknown"; return "Unknown";
} }