#include "VisuGUI_Slider.h"
#include "VisuGUI_Sweep.h"
-
+#include <VISU_ScalarMapAct.h>
+#include <VISU_GaussPtsAct.h>
+#include <VisuGUI_ValuesLabelingDlg.h>
using namespace VISU;
createAction( VISU_FILTERSCALARS, tr("MEN_FILTER_SCALARS"), QIcon(),
tr("MEN_FILTER_SCALARS"), "", 0, aParent, false,
this, SLOT(OnFilterScalars()));
+
+ createAction( VISU_VALUES_LABELING, tr("MEN_VALUES_LABELING"), QIcon(),
+ tr("MEN_VALUES_LABELING"), "", 0, aParent, true,
+ this, SLOT(OnValuesLabeling()));
+
+ createAction( VISU_VALUES_LABELING_PARAMS, tr("VISU_VALUES_LABELING_PARAMS"), QIcon(),
+ tr("VISU_VALUES_LABELING_PARAMS"), "", 0, aParent, false,
+ this, SLOT(OnValuesLabelingParams()));
+
}
void
// delete
mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 );
+
+ // labeling
+ mgr->insert( separator(), -1, -1, -1 );
+ mgr->insert( action( VISU_VALUES_LABELING ), -1, -1, -1 );
+ mgr->insert( action( VISU_VALUES_LABELING_PARAMS ), -1, -1, -1 );
+ mgr->insert( separator(), -1, -1, -1 );
// table commands
mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table
aRule = "selcount=1 and $type in { " + aSimplePrsAll + "}";
mgr->setRule( action( VISU_FILTERSCALARS ), aRule );
+
+ // labeling
+
+ aRule = "hasActor=1 and selcount=1 and $type in { 'VISU::TGAUSSPOINTS'" + aPrsAll + " }";
+ mgr->setRule( action( VISU_VALUES_LABELING ), aRule, QtxPopupMgr::VisibleRule );
+ mgr->setRule( action( VISU_VALUES_LABELING ), "{true} in $isValuesLabeled", QtxPopupMgr::ToggleRule );
+ mgr->setRule( action( VISU_VALUES_LABELING_PARAMS ), aRule, QtxPopupMgr::VisibleRule );
// view parameters
aRule = "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'";
int fontGr = addPreference( tr( "VISU_FONT" ), sbarTab );
setPreferenceProperty( fontGr, "columns", 2 );
- int tfont = addPreference( tr( "VISU_TITLE" ), fontGr, LightApp_Preferences::Font, "VISU", "scalar_bar_title_font" );
+ addVtkFontPref( tr( "VISU_TITLE" ), fontGr, "scalar_bar_title_font", false );
addPreference( tr( "VISU_TITLE" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_title_color" );
- int lfont = addPreference( tr( "VISU_LABELS" ), fontGr, LightApp_Preferences::Font, "VISU", "scalar_bar_label_font" );
- addPreference( tr( "VISU_LABELS" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_label_color" );
- QStringList fam;
- fam.append( tr( "VISU_FONT_ARIAL" ) );
- fam.append( tr( "VISU_FONT_COURIER" ) );
- fam.append( tr( "VISU_FONT_TIMES" ) );
- int wflag = ( QtxFontEdit::All & ( ~( QtxFontEdit::Size | QtxFontEdit::UserSize ) ) );
-
- setPreferenceProperty( tfont, "families", fam );
- setPreferenceProperty( tfont, "system", false );
- setPreferenceProperty( tfont, "widget_flags", wflag );
- setPreferenceProperty( lfont, "families", fam );
- setPreferenceProperty( lfont, "system", false );
- setPreferenceProperty( lfont, "widget_flags", wflag );
+ addVtkFontPref( tr( "VISU_LABELS" ), fontGr, "scalar_bar_label_font", false );
+ addPreference( tr( "VISU_LABELS" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_label_color" );
// group: "Colors & Labels"
int colorsLabelsGr = addPreference( tr( "VISU_COLORS_AND_LABELS" ), sbarTab );
addPreference( tr( "VISU_SHOW_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_manifold_edges" );
addPreference( tr( "VISU_SHOW_NON_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_non_manifold_edges" );
//addPreference( tr( "VISU_FEATURE_EDGES_COLORING" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "feature_edges_coloring" );
+
+ // TAB: "Values labels"
+
+ int valLblTab = addPreference( tr( "VALUES_LABELING" ) );
+
+ // "Font" group
+ int valLblFontGr = addPreference( tr( "VISU_FONT" ), valLblTab );
+ setPreferenceProperty( valLblFontGr, "columns", 2 );
+
+ // font
+ addVtkFontPref( tr( "LABELS" ), valLblFontGr, "values_labeling_font", true );
+
+ // color
+ addPreference( tr( "COLOR" ), valLblFontGr,
+ LightApp_Preferences::Color, "VISU", "values_labeling_color" );
+
}
void VisuGUI::preferencesChanged( const QString& a, const QString& b)
VisuGUI_FilterScalarsDlg* aDlg = new VisuGUI_FilterScalarsDlg( this );
aDlg->show();
}
+
+/*!
+ \brief SLOT called when "Labeling" popup menu item of presentation is clicked
+ activates/deactivates labeling of results of the screen. This functionality works
+ to numbering in SMESH module but is intended for showing results on the screen
+ instead of elements numbers
+ \sa OnValuesLabelingParams()
+*/
+void VisuGUI::OnValuesLabeling()
+{
+ // to do: rewrite for several actors if necessary
+
+ VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects( this );
+ if ( aSelectionInfo.empty() )
+ return;
+
+ TSelectionItem aSelectionItem = GetSelectedObjects(this).front();
+ VISU::Prs3d_i* aPrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase);
+ if(!aPrs3d)
+ return;
+
+ SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
+ if(!aViewWindow)
+ return;
+
+ VISU_Actor* anActor = FindActor(aViewWindow, aPrs3d);
+ if(!anActor)
+ return;
+
+ if( VISU_ScalarMapAct* aScalarMapActor = dynamic_cast<VISU_ScalarMapAct*>(anActor) )
+ {
+ aScalarMapActor->SetValuesLabeled( !aScalarMapActor->GetValuesLabeled() );
+ aViewWindow->Repaint();
+ }
+ else if( VISU_GaussPtsAct* aGaussPtsAct = dynamic_cast<VISU_GaussPtsAct*>(anActor) )
+ {
+ aGaussPtsAct->SetValuesLabeled( !aGaussPtsAct->GetValuesLabeled() );
+ aViewWindow->Repaint();
+ }
+}
+
+/*!
+ \brief SLOT called when "Labeling parameters" popup menu item of presentation
+ is clicked launch dialog box for changing parameters of labeling
+ \sa OnValuesLabeling()
+*/
+void VisuGUI::OnValuesLabelingParams()
+{
+ Handle(SALOME_InteractiveObject) anIO;
+ if ( VISU::Prs3d_i* aPrs3d = GetPrsToModify( this, anIO ) )
+ EditPrs3d<VISU::ColoredPrs3d_i, VisuGUI_ValuesLabelingDlg, 1>(this, anIO, aPrs3d);
+}
+/*!
+ \brief Adds preferences for dfont of VTK viewer
+ \param label label
+ \param pIf group identifier
+ \param param parameter
+ \return identifier of preferences
+*/
+int VisuGUI::addVtkFontPref(
+ const QString& label,
+ const int pId,
+ const QString& param,
+ const bool useSize )
+{
+ int tfont = addPreference( label, pId, LightApp_Preferences::Font, "VISU", param );
+
+ setPreferenceProperty( tfont, "mode", QtxFontEdit::Custom );
+
+ QStringList fam;
+ fam.append( tr( "VISU_FONT_ARIAL" ) );
+ fam.append( tr( "VISU_FONT_COURIER" ) );
+ fam.append( tr( "VISU_FONT_TIMES" ) );
+
+ setPreferenceProperty( tfont, "fonts", fam );
+
+ int f = QtxFontEdit::Family | QtxFontEdit::Bold | QtxFontEdit::Italic | QtxFontEdit::Shadow;
+ if ( useSize )
+ f |= QtxFontEdit::UserSize | QtxFontEdit::Size;
+
+ setPreferenceProperty( tfont, "features", f );
+
+ return tfont;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+