]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Improvement 0018029: Hide scalar bar
authorvsv <vsv@opencascade.com>
Tue, 11 Nov 2008 09:25:01 +0000 (09:25 +0000)
committervsv <vsv@opencascade.com>
Tue, 11 Nov 2008 09:25:01 +0000 (09:25 +0000)
idl/VISU_Gen.idl
src/VISUGUI/VISU_msg_en.ts
src/VISUGUI/VisuGUI_Prs3dDlg.cxx
src/VISUGUI/VisuGUI_Prs3dDlg.h
src/VISU_I/VISU_DumpPython.cc
src/VISU_I/VISU_ScalarMap_i.cc
src/VISU_I/VISU_ScalarMap_i.hh

index 007d86fa749afbcbc85721cdb9dcc84da977a252..b1faa0adb70799ffa9053cf8276d1294367a96ac 100644 (file)
@@ -711,6 +711,9 @@ module VISU {
 
   interface ScalarMap : ColoredPrs3d, ScaledPrs3d {
 
+    boolean IsBarVisible();
+    void SetBarVisible(in boolean theVisible);
+
   };
 
   //-------------------------------------------------------
index df589e92dc5d2913e2447d0ad00e31d6373df404..c69d08dcf95ff84f6c6eea049c006383b1399cc4 100644 (file)
@@ -2932,6 +2932,10 @@ Please, provide non-empty resulting presentation.</translation>
             <source>WRN_LOGARITHMIC_RANGE</source>
             <translation>Logarithmic scaling: use imposed range values > 0</translation>
         </message>
+        <message>
+            <source>HIDE_SCALAR_BAR</source>
+            <translation>Hide scalar bar</translation>
+        </message>
     </context>
     <context>
         <name>VisuGUI_DeformedShapeAndScalarMapDlg</name>
index 9554ce2f2aa5fd14f8f8face22aa9db312c57465..d2c7fdee2a61671c031043bde4722f9feae450d7 100644 (file)
@@ -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) {
index 087f783618877c95f1e04937a76ea1092d70795c..676487f7d4ec7d8899005a012ce84ce51b23e679 100644 (file)
@@ -208,6 +208,7 @@ class VisuGUI_ScalarBarPane : public QWidget//QVBox
   QCheckBox*      CBSave;
   QCheckBox*      CBLog;
   QCheckBox*      CBDistr;
+  QCheckBox*      myHideBar;
 
   QLabel*         myModeLbl;
   QComboBox*      myModeCombo;
index 46c50b8b3d805f35a7dd9fcac94c9ddfcf21768e..df9d6ebbd640859bb38e67b2791d7a8c0dbfae84 100644 (file)
@@ -434,7 +434,9 @@ namespace VISU
       aParam = "VISU.LOGARITHMIC";
       break;
     }
+    std::string aVisible = theServant->IsBarVisible()? "True" : "False";
     theStr<<thePrefix<<theName<<".SetScaling("<<aParam<<")"<<endl;
+    theStr<<thePrefix<<theName<<".SetBarVisible("<<aVisible<<")"<<endl;
 
     return thePrefix;
   }
index ef94d2d2c052e72576f7ff49298caa828e8f2a63..98dcb95baaa8d064b13d06d3d96c715dafb020d3 100644 (file)
@@ -172,7 +172,8 @@ VISU::ScalarMap_i
 //----------------------------------------------------------------------------
 VISU::ScalarMap_i::
 ScalarMap_i(EPublishInStudyMode thePublishInStudyMode) :
-  ColoredPrs3d_i(thePublishInStudyMode)
+  ColoredPrs3d_i(thePublishInStudyMode),
+  myShowBar(true)
 {}
 
 //----------------------------------------------------------------------------
@@ -192,7 +193,7 @@ VISU::ScalarMap_i
     ScalarMap_i* anOrigin = const_cast<ScalarMap_i*>(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);
index ef19121c73b61bdb5804fffb2971d884e653dbbb..4a74f9df17b2296eaa1486e6f9e44b3ee868d10a 100644 (file)
@@ -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;
   };
 }