From: vsv Date: Tue, 11 Nov 2008 09:25:01 +0000 (+0000) Subject: Improvement 0018029: Hide scalar bar X-Git-Tag: Phase8_Part1_16122008~16 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7b0129a28824a6de4fa6e3cf1a57cd5e5480d418;p=modules%2Fvisu.git Improvement 0018029: Hide scalar bar --- diff --git a/idl/VISU_Gen.idl b/idl/VISU_Gen.idl index 007d86fa..b1faa0ad 100644 --- a/idl/VISU_Gen.idl +++ b/idl/VISU_Gen.idl @@ -711,6 +711,9 @@ module VISU { interface ScalarMap : ColoredPrs3d, ScaledPrs3d { + boolean IsBarVisible(); + void SetBarVisible(in boolean theVisible); + }; //------------------------------------------------------- diff --git a/src/VISUGUI/VISU_msg_en.ts b/src/VISUGUI/VISU_msg_en.ts index df589e92..c69d08dc 100644 --- a/src/VISUGUI/VISU_msg_en.ts +++ b/src/VISUGUI/VISU_msg_en.ts @@ -2932,6 +2932,10 @@ Please, provide non-empty resulting presentation. WRN_LOGARITHMIC_RANGE Logarithmic scaling: use imposed range values > 0 + + HIDE_SCALAR_BAR + Hide scalar bar + VisuGUI_DeformedShapeAndScalarMapDlg diff --git a/src/VISUGUI/VisuGUI_Prs3dDlg.cxx b/src/VISUGUI/VisuGUI_Prs3dDlg.cxx index 9554ce2f..d2c7fdee 100644 --- a/src/VISUGUI/VisuGUI_Prs3dDlg.cxx +++ b/src/VISUGUI/VisuGUI_Prs3dDlg.cxx @@ -602,20 +602,16 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview ) myHorBW = aResourceMgr->integerValue("VISU", propertyName + "bar_width", 0); myHorBH = aResourceMgr->integerValue("VISU", propertyName + "bar_height",0); - aMainLayout->setSpacing(6); - //setMargin(11); + //aMainLayout->setSpacing(6); // Range ============================================================ RangeGroup = new QButtonGroup ( this ); QGroupBox* aGB = new QGroupBox( tr("SCALAR_RANGE_GRP"),this ); aMainLayout->addWidget( aGB ); - //RangeGroup->setColumnLayout(0, Qt::Vertical ); - //RangeGroup->layout()->setSpacing( 0 ); - //RangeGroup->layout()->setMargin( 0 ); QGridLayout* RangeGroupLayout = new QGridLayout( aGB ); RangeGroupLayout->setAlignment( Qt::AlignTop ); - RangeGroupLayout->setSpacing( 6 ); - RangeGroupLayout->setMargin( 11 ); + //RangeGroupLayout->setSpacing( 6 ); + //RangeGroupLayout->setMargin( 11 ); myModeLbl = new QLabel("Scalar Mode", aGB); @@ -632,7 +628,7 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview ) MinEdit = new QLineEdit( aGB ); MinEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - MinEdit->setMinimumWidth( 70 ); + //MinEdit->setMinimumWidth( 70 ); MinEdit->setValidator( new QDoubleValidator(this) ); MinEdit->setText( "0.0" ); QLabel* MinLabel = new QLabel (tr("LBL_MIN"), aGB); @@ -641,7 +637,7 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview ) MaxEdit = new QLineEdit( aGB ); MaxEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - MaxEdit->setMinimumWidth( 70 ); + //MaxEdit->setMinimumWidth( 70 ); MaxEdit->setValidator( new QDoubleValidator(this) ); MaxEdit->setText( "0.0" ); QLabel* MaxLabel = new QLabel (tr("LBL_MAX"), aGB); @@ -658,18 +654,13 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview ) RangeGroupLayout->addWidget( MaxLabel, 2, 2 ); RangeGroupLayout->addWidget( MaxEdit, 2, 3 ); - //TopLayout->addWidget( RangeGroup ); - // Colors and Labels ======================================================== QGroupBox* ColLabGroup = new QGroupBox (tr("COLORS_LABELS_GRP"), this); aMainLayout->addWidget( ColLabGroup ); - //ColLabGroup->setColumnLayout(0, Qt::Vertical ); - //ColLabGroup->layout()->setSpacing( 0 ); - //ColLabGroup->layout()->setMargin( 0 ); QGridLayout* ColLabGroupLayout = new QGridLayout( ColLabGroup ); ColLabGroupLayout->setAlignment( Qt::AlignTop ); - ColLabGroupLayout->setSpacing( 6 ); - ColLabGroupLayout->setMargin( 11 ); + //ColLabGroupLayout->setSpacing( 6 ); + //ColLabGroupLayout->setMargin( 11 ); QLabel* ColorLabel = new QLabel (tr("LBL_NB_COLORS"), ColLabGroup); ColorSpin = new QSpinBox( ColLabGroup ); @@ -677,7 +668,7 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview ) ColorSpin->setMaximum( 256 ); ColorSpin->setSingleStep( 1 ); ColorSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - ColorSpin->setMinimumWidth( 70 ); + //ColorSpin->setMinimumWidth( 70 ); ColorSpin->setValue( 64 ); QLabel* LabelLabel = new QLabel (tr("LBL_NB_LABELS"), ColLabGroup); @@ -687,7 +678,7 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview ) LabelSpin->setSingleStep( 1 ); LabelSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - LabelSpin->setMinimumWidth( 70 ); + //LabelSpin->setMinimumWidth( 70 ); LabelSpin->setValue( 5 ); ColLabGroupLayout->addWidget( ColorLabel, 0, 0); @@ -695,19 +686,14 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview ) ColLabGroupLayout->addWidget( LabelLabel, 0, 2); ColLabGroupLayout->addWidget( LabelSpin, 0, 3); - //TopLayout->addWidget( ColLabGroup ); - // Orientation ========================================================== QButtonGroup* OrientGroup = new QButtonGroup ( this ); QGroupBox* OrientGB = new QGroupBox( tr("ORIENTATION_GRP"),this ); aMainLayout->addWidget( OrientGB ); - //OrientGroup->setColumnLayout(0, Qt::Vertical ); - //OrientGroup->layout()->setSpacing( 0 ); - //OrientGroup->layout()->setMargin( 0 ); QGridLayout* OrientGroupLayout = new QGridLayout( OrientGB ); OrientGroupLayout->setAlignment( Qt::AlignTop ); - OrientGroupLayout->setSpacing( 6 ); - OrientGroupLayout->setMargin( 11 ); + //OrientGroupLayout->setSpacing( 6 ); + //OrientGroupLayout->setMargin( 11 ); RBvert = new QRadioButton (tr("VERTICAL_BTN"), OrientGB); RBvert->setChecked( true ); @@ -717,31 +703,26 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview ) OrientGroupLayout->addWidget( RBvert, 0, 0 ); OrientGroupLayout->addWidget( RBhori, 0, 1 ); - // TopLayout->addWidget( OrientGroup ); - // Origin =============================================================== QGroupBox* OriginGroup = new QGroupBox (tr("ORIGIN_GRP"), this); aMainLayout->addWidget( OriginGroup ); - //OriginGroup->setColumnLayout(0, Qt::Vertical ); - //OriginGroup->layout()->setSpacing( 0 ); - // OriginGroup->layout()->setMargin( 0 ); QGridLayout* OriginGroupLayout = new QGridLayout( OriginGroup ); OriginGroupLayout->setAlignment( Qt::AlignTop ); - OriginGroupLayout->setSpacing( 6 ); - OriginGroupLayout->setMargin( 11 ); + //OriginGroupLayout->setSpacing( 6 ); + //OriginGroupLayout->setMargin( 11 ); QLabel* XLabel = new QLabel (tr("LBL_X"), OriginGroup); XSpin = new QtxDoubleSpinBox( OriginGroup ); VISU::initSpinBox(XSpin, 0.0, +1.0); XSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - XSpin->setMinimumWidth( 70 ); + //XSpin->setMinimumWidth( 70 ); XSpin->setValue( 0.01 ); QLabel* YLabel = new QLabel (tr("LBL_Y"), OriginGroup); YSpin = new QtxDoubleSpinBox( OriginGroup ); VISU::initSpinBox(YSpin, 0.0, +1.0); YSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - YSpin->setMinimumWidth( 70 ); + //YSpin->setMinimumWidth( 70 ); YSpin->setValue( 0.01 ); OriginGroupLayout->addWidget( XLabel, 0, 0); @@ -749,31 +730,26 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview ) OriginGroupLayout->addWidget( YLabel, 0, 2); OriginGroupLayout->addWidget( YSpin, 0, 3); - //TopLayout->addWidget( OriginGroup ); - // Dimensions ========================================================= QGroupBox* DimGroup = new QGroupBox (tr("DIMENSIONS_GRP"), this ); aMainLayout->addWidget( DimGroup ); - //DimGroup->setColumnLayout(0, Qt::Vertical ); - //DimGroup->layout()->setSpacing( 0 ); - //DimGroup->layout()->setMargin( 0 ); QGridLayout* DimGroupLayout = new QGridLayout( DimGroup ); DimGroupLayout->setAlignment( Qt::AlignTop ); - DimGroupLayout->setSpacing( 6 ); - DimGroupLayout->setMargin( 11 ); + //DimGroupLayout->setSpacing( 6 ); + //DimGroupLayout->setMargin( 11 ); QLabel* WidthLabel = new QLabel (tr("LBL_WIDTH"), DimGroup); WidthSpin = new QtxDoubleSpinBox( DimGroup ); VISU::initSpinBox(WidthSpin, 0.0, +1.0); WidthSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - WidthSpin->setMinimumWidth( 70 ); + //WidthSpin->setMinimumWidth( 70 ); WidthSpin->setValue( 0.1 ); QLabel* HeightLabel = new QLabel (tr("LBL_HEIGHT"), DimGroup); HeightSpin = new QtxDoubleSpinBox( DimGroup ); VISU::initSpinBox(HeightSpin, 0.0, +1.0); HeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - HeightSpin->setMinimumWidth( 70 ); + //HeightSpin->setMinimumWidth( 70 ); HeightSpin->setValue( 0.8 ); DimGroupLayout->addWidget( WidthLabel, 0, 0); @@ -781,8 +757,6 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview ) DimGroupLayout->addWidget( HeightLabel, 0, 2); DimGroupLayout->addWidget( HeightSpin, 0, 3); - //TopLayout->addWidget( DimGroup ); - // Save check box =========================================================== QWidget* aSaveBox = new QWidget(this); aMainLayout->addWidget( aSaveBox ); @@ -796,21 +770,24 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview ) QGroupBox* CheckGroup = new QGroupBox("", this ); aMainLayout->addWidget( CheckGroup ); - QHBoxLayout* CheckGroupLayout = new QHBoxLayout( CheckGroup ); + //QHBoxLayout* CheckGroupLayout = new QHBoxLayout( CheckGroup ); + QGridLayout* CheckGroupLayout = new QGridLayout( CheckGroup ); myPreviewCheck = new QCheckBox(tr("LBL_SHOW_PREVIEW"), CheckGroup); myPreviewCheck->setChecked(false); - //myPreviewCheck->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - CheckGroupLayout->addWidget(myPreviewCheck); + CheckGroupLayout->addWidget(myPreviewCheck, 0, 0); + myHideBar = new QCheckBox(tr("HIDE_SCALAR_BAR"), CheckGroup); + myHideBar->setChecked(false); + CheckGroupLayout->addWidget(myHideBar, 0, 1); + // RKV : Begin CBDistr = new QCheckBox (tr("SHOW_DISTRIBUTION"), CheckGroup); - //CBDistr->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - CheckGroupLayout->addWidget(CBDistr); + CheckGroupLayout->addWidget(CBDistr, 1, 0); // RKV : End if (!thePreview) { CBSave = new QCheckBox (tr("SAVE_DEFAULT_CHK"), CheckGroup); - CheckGroupLayout->addWidget( CBSave ); + CheckGroupLayout->addWidget( CBSave, 1, 1 ); } else { CBSave = 0; @@ -828,7 +805,6 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane( QWidget* parent, bool thePreview ) myBarDlg->setUnitsVisible(aResourceMgr->booleanValue("VISU", propertyName + "display_units", true)); // signals and slots connections =========================================== - // connect( RangeGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( changeRange( int ) ) ); connect( RBFrange, SIGNAL( toggled( bool ) ), this, SLOT( onFieldRange( bool ) ) ); connect( RBIrange, SIGNAL( toggled( bool ) ), this, SLOT( onImposedRange( bool ) ) ); @@ -1106,6 +1082,8 @@ void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs) myScalarMap->IsItalicLabel(), myScalarMap->IsShadowLabel()); + myHideBar->setChecked(!myScalarMap->IsBarVisible()); + // Draw Preview if (myPreviewCheck->isChecked()) { createScalarBar(); @@ -1158,6 +1136,7 @@ void VisuGUI_ScalarBarPane::createScalarBar() VISU_ScalarBarActor* aScalarBarActor = myPreviewActor->GetScalarBar(); myPreviewActor->GetScalarBar()->VisibilityOn(); myPreviewActor->PickableOff(); + //myPreviewActor->SetBarVisibility(!myHideBar->isChecked()); myScalarMapPL->SetScalarMode(myModeCombo->currentIndex()); if(isLogarithmic()) @@ -1322,6 +1301,8 @@ int VisuGUI_ScalarBarPane::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs) { myScalarMap->SetLabels(LabelSpin->value()); myScalarMap->SetIsDistributionVisible(isShowDistribution()); // RKV + myScalarMap->SetBarVisible(!myHideBar->isChecked()); + if (isToSave()) storeToResources(); if (myIsStoreTextProp) { diff --git a/src/VISUGUI/VisuGUI_Prs3dDlg.h b/src/VISUGUI/VisuGUI_Prs3dDlg.h index 087f7836..676487f7 100644 --- a/src/VISUGUI/VisuGUI_Prs3dDlg.h +++ b/src/VISUGUI/VisuGUI_Prs3dDlg.h @@ -208,6 +208,7 @@ class VisuGUI_ScalarBarPane : public QWidget//QVBox QCheckBox* CBSave; QCheckBox* CBLog; QCheckBox* CBDistr; + QCheckBox* myHideBar; QLabel* myModeLbl; QComboBox* myModeCombo; diff --git a/src/VISU_I/VISU_DumpPython.cc b/src/VISU_I/VISU_DumpPython.cc index 46c50b8b..df9d6ebb 100644 --- a/src/VISU_I/VISU_DumpPython.cc +++ b/src/VISU_I/VISU_DumpPython.cc @@ -434,7 +434,9 @@ namespace VISU aParam = "VISU.LOGARITHMIC"; break; } + std::string aVisible = theServant->IsBarVisible()? "True" : "False"; theStr<(aPrs3d); SetScaling(anOrigin->GetScaling()); - + SetBarVisible(anOrigin->IsBarVisible()); Update(); } } @@ -218,6 +219,7 @@ VISU::ScalarMap_i else SetScaling(VISU::LINEAR); + myShowBar = true; return this; } @@ -240,6 +242,9 @@ VISU::ScalarMap_i SetScaling(VISU::Scaling(VISU::Storable::FindValue(theMap,"myScaling").toInt())); + QString aVal = VISU::Storable::FindValue(theMap,"myShowBar", "1"); + SetBarVisible((aVal.toInt() == 1)? true : false); + // Check if the icon needs to be updated, update if necessary SALOMEDS::Study_var aStudy = theSObject->GetStudy(); SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); @@ -262,6 +267,7 @@ VISU::ScalarMap_i TSuperClass::ToStream(theStr); Storable::DataToStream( theStr, "myScaling", GetScaling() ); + Storable::DataToStream( theStr, "myShowBar", (IsBarVisible()? 1:0) ); } @@ -363,6 +369,12 @@ VISU::ScalarMap_i return IsPossible(GetCResult(),GetCMeshName(),GetEntity(),GetCFieldName(),GetTimeStampNumber(),true); } +void VISU::ScalarMap_i::SetBarVisible(CORBA::Boolean theVisible) +{ + VISU::TSetModified aModified(this); + myShowBar = theVisible; + myParamsTime.Modified(); +} //---------------------------------------------------------------------------- void @@ -387,7 +399,7 @@ VISU::ScalarMap_i VISU_ScalarMapAct* anActor = VISU_ScalarMapAct::New(); try{ TSuperClass::CreateActor(anActor); - anActor->SetBarVisibility(true); + anActor->SetBarVisibility(myShowBar); SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); int aDispMode = aResourceMgr->integerValue("VISU", "scalar_map_represent", 2); bool toShrink = aResourceMgr->booleanValue("VISU", "scalar_map_shrink", false); @@ -474,6 +486,8 @@ VISU::ScalarMap_i IsItalicLabel()? aLabelProp->ItalicOn() : aLabelProp->ItalicOff(); IsShadowLabel()? aLabelProp->ShadowOn() : aLabelProp->ShadowOff(); + anActor->SetBarVisibility(myShowBar); + aScalarBar->Modified(); } TSuperClass::UpdateActor(theActor); diff --git a/src/VISU_I/VISU_ScalarMap_i.hh b/src/VISU_I/VISU_ScalarMap_i.hh index ef19121c..4a74f9df 100644 --- a/src/VISU_I/VISU_ScalarMap_i.hh +++ b/src/VISU_I/VISU_ScalarMap_i.hh @@ -98,6 +98,10 @@ namespace VISU { return myScalarMapPL; } + + virtual CORBA::Boolean IsBarVisible() { return myShowBar; } + + virtual void SetBarVisible(CORBA::Boolean theVisible); protected: //! Redefines VISU_ColoredPrs3d_i::DoSetInput @@ -189,6 +193,7 @@ namespace VISU private: VISU_ScalarMapPL* myScalarMapPL; + bool myShowBar; }; }