- void UpdateSelectionProp() {
- QAD_Study* aStudy = GetActiveStudy();
- QList<QAD_StudyFrame> aFrameList = aStudy->getStudyFrames();
-
- QString SCr, SCg, SCb;
- SCr = QAD_CONFIG->getSetting("SMESH:SettingsSelectColorRed");
- SCg = QAD_CONFIG->getSetting("SMESH:SettingsSelectColorGreen");
- SCb = QAD_CONFIG->getSetting("SMESH:SettingsSelectColorBlue");
- QColor aHiColor = Qt::white;
- if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
- aHiColor = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
-
- SCr = QAD_CONFIG->getSetting("SMESH:SettingsItemSelectColorRed");
- SCg = QAD_CONFIG->getSetting("SMESH:SettingsItemSelectColorGreen");
- SCb = QAD_CONFIG->getSetting("SMESH:SettingsItemSelectColorBlue");
- QColor aSelColor = Qt::yellow;
- if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
- aSelColor = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
- QString SW = QAD_CONFIG->getSetting("SMESH:SettingsItemSelectWidth");
- if (SW.isEmpty()) SW = "5";
-
- SCr = QAD_CONFIG->getSetting("SMESH:SettingsPreSelectColorRed");
- SCg = QAD_CONFIG->getSetting("SMESH:SettingsPreSelectColorGreen");
- SCb = QAD_CONFIG->getSetting("SMESH:SettingsPreSelectColorBlue");
- QColor aPreColor = Qt::cyan;
- if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
- aPreColor = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
- QString PW = QAD_CONFIG->getSetting("SMESH:SettingsPreSelectWidth");
- if (PW.isEmpty()) PW = "5";
-
- QString SP1 = QAD_CONFIG->getSetting("SMESH:SettingsNodeSelectTol");
- if (SP1.isEmpty()) SP1 = "0.025";
- QString SP2 = QAD_CONFIG->getSetting("SMESH:SettingsElementsSelectTol");
- if (SP2.isEmpty()) SP2 = "0.001";
-
- for (QAD_StudyFrame* aStudyFrame = aFrameList.first(); aStudyFrame; aStudyFrame = aFrameList.next()) {
- if (aStudyFrame->getTypeView() == VIEW_VTK) {
- VTKViewer_ViewFrame* aVtkViewFrame = GetVtkViewFrame(aStudyFrame);
- if (!aVtkViewFrame) continue;
- // update VTK viewer properties
- VTKViewer_RenderWindowInteractor* anInteractor = aVtkViewFrame->getRWInteractor();
- if (anInteractor) {
- // mesh element selection
- anInteractor->SetSelectionProp(aSelColor.red()/255., aSelColor.green()/255.,
- aSelColor.blue()/255., SW.toInt());
-
- // tolerances
- anInteractor->SetSelectionTolerance(SP1.toDouble(), SP2.toDouble());
-
- // pre-selection
- VTKViewer_InteractorStyleSALOME* aStyle = anInteractor->GetInteractorStyleSALOME();
- if (aStyle) {
- aStyle->setPreselectionProp(aPreColor.red()/255., aPreColor.green()/255.,
- aPreColor.blue()/255., PW.toInt());
- }
- }
+ void UpdateSelectionProp( SMESHGUI* theModule ) {
+ if( !theModule )
+ return;
+
+ SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( theModule->application() );
+ if( !app )
+ {
+ MESSAGE( "UpdateSelectionProp: Application is null" );
+ return;
+ }
+
+ SUIT_ViewManager* vm = app->activeViewManager();
+ if( !vm )
+ {
+ MESSAGE( "UpdateSelectionProp: View manager is null" );
+ return;
+ }
+
+ QPtrVector<SUIT_ViewWindow> views = vm->getViews();
+
+ SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( theModule );
+ if( !mgr )
+ {
+ MESSAGE( "UpdateSelectionProp: Resource manager is null" );
+ return;
+ }
+
+ QColor aHiColor = mgr->colorValue( "SMESH", "selection_object_color", Qt::white ),
+ aSelColor = mgr->colorValue( "SMESH", "selection_element_color", Qt::yellow ),
+ aPreColor = mgr->colorValue( "SMESH", "highlight_color", Qt::cyan );
+
+ int SW = mgr->integerValue( "SMESH", "selection_width", 5 ),
+ PW = mgr->integerValue( "SMESH", "highlight_width", 5 );
+
+ double SP1 = mgr->doubleValue( "SMESH", "selection_precision_node", 0.025 ),
+ SP2 = mgr->doubleValue( "SMESH", "selection_precision_element", 0.001 );
+
+ for ( int i=0, n=views.count(); i<n; i++ ){
+ // update VTK viewer properties
+ if(SVTK_ViewWindow* aVtkView = GetVtkViewWindow( views[i] )){
+ // mesh element selection
+ aVtkView->SetSelectionProp(aSelColor.red()/255.,
+ aSelColor.green()/255.,
+ aSelColor.blue()/255.,
+ SW );
+ // tolerances
+ aVtkView->SetSelectionTolerance(SP1, SP2);
+
+ // pre-selection
+ aVtkView->SetPreselectionProp(aPreColor.red()/255.,
+ aPreColor.green()/255.,
+ aPreColor.blue()/255.,
+ PW);