]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Implementation of the 0021407: [CEA 515] Plot2d Display error labels around the point...
authorrnv <rnv@opencascade.com>
Thu, 26 Jan 2012 07:40:09 +0000 (07:40 +0000)
committerrnv <rnv@opencascade.com>
Thu, 26 Jan 2012 07:40:09 +0000 (07:40 +0000)
12 files changed:
idl/VISU_Gen.idl
src/VISUGUI/VISU_msg_en.ts
src/VISUGUI/VisuGUI.cxx
src/VISUGUI/VisuGUI.h
src/VISUGUI/VisuGUI_ActionsDef.h
src/VISUGUI/VisuGUI_Selection.cxx
src/VISUGUI/VisuGUI_Selection.h
src/VISUGUI/VisuGUI_SetupPlot2dDlg.cxx
src/VISUGUI/VisuGUI_SetupPlot2dDlg.h
src/VISU_I/VISU_Table_i.cc
src/VISU_I/VISU_Table_i.hh
src/VISU_I/VISU_Tools.cxx

index 93f064f72a5c9c5543a1c4ce6ffb51078e6b6ffc..524e741b32a645fc2d30a1e134ed62e7eb36e586 100644 (file)
@@ -326,6 +326,14 @@ module VISU {
     /*! Sets scaling coefficient of the curve to 1.0.
      */
     void RemoveScale();
+
+    /*!
+     * Switches on/off displaying of the deviation labels 
+     * on the curve.
+     * \param flag is used to switch on/off the deviation 
+     * labels on the curve.
+     */
+    void ShowDeviation(in boolean flag);
   };
 
   //-------------------------------------------------------
index 05b5f2b1030f1307ad662832445f691123ff4f62..8037777db8441b6c3454d0b91b82fffeacdf7556 100644 (file)
@@ -101,6 +101,10 @@ number of time stamps or number of components is not the same!</translation>
         <source>UNITS_LBL</source>
         <translation>Units</translation>
     </message>
+    <message>
+        <source>DVTN_LBL</source>
+        <translation>Deviation</translation>
+    </message>
     <message>
         <source>VISU_3DCACHE_PREFERENCES</source>
         <translation>3D Cache</translation>
@@ -1079,6 +1083,10 @@ Input value precision can be adjusted using
         <source>MEN_VISU_LINEQUAD_MODE</source>
         <translation>Lines</translation>
     </message>
+    <message>
+        <source>MEN_VISU_SHOW_DEVIATION</source>
+        <translation>Show Deviation</translation>
+    </message>
     <message>
         <source>TOOL_IMPORT</source>
         <translation>Import</translation>
index e5ea3f837822cc25043b909b3b3f33fc4fcfb10b..7a83d56e9bca8951af3021095f6f53c4791b5b5b 100644 (file)
@@ -1883,7 +1883,7 @@ VisuGUI
         _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
         _PTR(SObject) aSObject = aStudy->FindObjectID( aTable->GetObjectEntry() );
         if(IsSObjectTable(aSObject)){
-          VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this));
+          VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, aTable ,GetDesktop(this));
           if(aDlg->exec() == QDialog::Accepted){
             if(!IsStudyLocked(aStudy)){
               // if study is not locked - create new container, create curves and insert them
@@ -1898,7 +1898,10 @@ VisuGUI
                   for( int i = 0; i < verIndices.count(); i++ ){
                     bool isV2 = ver2Indices.contains(verIndices[i]);
                     VISU::Curve_var aCurveObject =
-                      GetVisuGen(this)->CreateCurveWithZExt(aTable->_this(), horIndex+1, verIndices[i]+1, zIndices[i]+1, isV2 );
+                      GetVisuGen(this)->CreateCurveWithZExt(aTable->_this(), 
+                                                            aDlg->idx(horIndex)+1, 
+                                                            aDlg->idx(verIndices[i])+1, 
+                                                            aDlg->idx(zIndices[i])+1, isV2 );
                     if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
                       bool isAuto;
                       int  marker, line, lineWidth;
@@ -1947,7 +1950,7 @@ VisuGUI
     // check if Table SObject is selected
     _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
     if(IsSObjectTable(aSObject)){
-      VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this));
+      VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, NULL, GetDesktop(this));
       if(aDlg->exec() == QDialog::Accepted){
         _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
         if(!IsStudyLocked(aStudy)){
@@ -3051,6 +3054,10 @@ VisuGUI
                tr("MEN_VISU_LINEQUAD_MODE"), "",0, aParent, true,
                this, SLOT(OnLineQuadMode()));
 
+  createAction(VISU_SHOW_DEVIATION, tr("MEN_VISU_SHOW_DEVIATION"),QIcon(),
+               tr("MEN_VISU_SHOW_DEVIATION"), "",0, aParent, true,
+               this, SLOT(OnShowDeviation()));
+
 }
 
 void
@@ -3264,6 +3271,8 @@ VisuGUI
 
   mgr->insert( action( VISU_CURVE_PROPS ), -1, -1, -1 ); // curve properties
   mgr->insert( action( VISU_CURVE_SCALE ), -1, -1, -1 ); // curve scale
+  //Show deviation command on curve
+  mgr->insert( action( VISU_SHOW_DEVIATION ), -1, -1, -1 ); // deviation
 
   mgr->insert( action( VISU_MULTIPR_FULL_RES ), -1, -1, -1 );
   mgr->insert( action( VISU_MULTIPR_MED_RES ), -1, -1, -1 );
@@ -3517,6 +3526,11 @@ VisuGUI
 
   mgr->setRule( action( VISU_FILE_INFO ), "selcount=1 and type in {'VISU::TRESULT'}" );
   mgr->setRule( action( VISU_EXPORT_MED ), "selcount=1 and type in {'VISU::TRESULT'}" );
+
+  aRule = "isPlot2dViewer and isVisible and selcount=1 and type='VISU::TCURVE' and hasDeviation";
+  mgr->setRule (action(VISU_SHOW_DEVIATION), aRule , QtxPopupMgr::VisibleRule);
+  aRule = "isPlot2dViewer and isVisible and selcount > 0 and type='VISU::TCURVE' and hasDeviation and isDeviationDisplayed";
+  mgr->setRule (action(VISU_SHOW_DEVIATION), aRule , QtxPopupMgr::ToggleRule);
 }
 
 void VisuGUI::createPanels()
@@ -4955,6 +4969,29 @@ bool VisuGUI::renameAllowed( const QString& entry) const {
   return false;
 }
 
+void VisuGUI::OnShowDeviation() {
+
+  VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
+  if(aSelectionInfo.size() != 1)
+    return;
+
+  VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
+  Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
+  VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
+  if(!aBase)
+    return;
+
+  if(aBase->GetType() == VISU::TCURVE) {
+    if(!IsStudyLocked(GetCStudy(GetAppStudy(this)))){
+      // Curve object
+      if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase)) {
+        aCurve->ShowDeviation(!aCurve->isDeviationShown());
+        PlotCurve(this, aCurve, VISU::eDisplay);
+      }
+    }
+  }
+}
+
 /*!
   Rename object by entry.
   \param entry entry of the object
index 173562582aaced9a80b0d1927292a8f975ddcbdd..be66a4c4c7771bb2490df65a8edab93967c20a3c 100644 (file)
@@ -205,6 +205,8 @@ protected slots:
   void OnArcQuadMode();
   void OnLineQuadMode();
 
+  void OnShowDeviation();
+
   // MULTIPR
   void OnMultiprViewFullRes();
   void OnMultiprViewMediumRes();
index a07f0a1f9548b8ec285f1911a87cdb1802609728..9af47041d869788aa9087dc37302fae087d0076a 100644 (file)
 #define VISU_ARCQUAD_MODE           4401
 #define VISU_LINEQUAD_MODE          4402
 
+#define VISU_SHOW_DEVIATION         4501
+
 #endif
index de21f171fcdc7805e0ccf1a0de5e759da3d5f112..7dd1929b74bb47bfa1a99fcbc7e34f7df269ecfb 100644 (file)
@@ -80,6 +80,8 @@ QVariant VisuGUI_Selection::parameter( const int ind, const QString& p ) const
     else if ( p == "isValuesLabeled"  ) val = QVariant( isValuesLabeled( ind ) );
     else if ( p == "isScalarBarVisible" ) val = QVariant( isScalarBarVisible( ind ) );
     else if ( p == "quadratic2DMode" ) val = QVariant( quadratic2DMode(ind) );
+    else if ( p == "hasDeviation" ) val = QVariant( hasDeviation(ind) );
+    else if ( p == "isDeviationDisplayed" ) val = QVariant( isDeviationDisplayed(ind) );
   }
 
   return val;
@@ -803,3 +805,44 @@ QString VisuGUI_Selection::quadratic2DMode( const int ind) const
 {
   return TPopupDispatcher<TGetQuadratic2DRepresentation>()(myModule, entry(ind));
 }
+
+
+bool VisuGUI_Selection::hasDeviation(const int ind) const {
+  SalomeApp_Study* aSStudy = GetStudy();
+  if ( !aSStudy )
+    return false;
+
+  _PTR(Study) aStudy = GetCStudy( aSStudy );
+  if ( aStudy ) {
+    _PTR(SObject) SO = aStudy->FindObjectID( (const char*) entry( ind ).toLatin1() );
+    if ( SO ) {
+      CORBA::Object_var anObj = VISU::ClientSObjectToObject( SO );
+      if( !CORBA::is_nil( anObj )) {
+        if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>( VISU::GetServant( anObj ).in()) ) {
+          return aCurve->hasDeviation();
+        }
+      }
+    }
+  }
+  return false;
+}
+
+bool VisuGUI_Selection::isDeviationDisplayed(const int ind) const {
+  SalomeApp_Study* aSStudy = GetStudy();
+  if ( !aSStudy )
+    return false;
+
+  _PTR(Study) aStudy = GetCStudy( aSStudy );
+  if ( aStudy ) {
+    _PTR(SObject) SO = aStudy->FindObjectID( (const char*) entry( ind ).toLatin1() );
+    if ( SO ) {
+      CORBA::Object_var anObj = VISU::ClientSObjectToObject( SO );
+      if( !CORBA::is_nil( anObj )) {
+        if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>( VISU::GetServant( anObj ).in()) ) {
+          return aCurve->isDeviationShown();
+        }
+      }
+    }
+  }
+  return false;
+}
\ No newline at end of file
index b452405f6882c670eb4b85e8b76ff94df00d3bf6..fa2115c6d6b404ac31eb5e1e7c7ba79182508bf5 100644 (file)
@@ -72,6 +72,8 @@ private:
   QString          resolutionState( const int ) const;
 
   QString          quadratic2DMode( const int ) const;
+  bool             hasDeviation(const int) const;
+  bool             isDeviationDisplayed(const int) const;
 
 private:
   bool             findDisplayedCurves( const int, bool ) const;
index 6cfda370cb1ebc2d1e6407e528ca65d9fbd75878..c17c910435b2cebec8491881bd2856e4f2d529b4 100644 (file)
@@ -68,8 +68,9 @@
 /*!
   Constructor
 */
-VisuGUI_SetupPlot2dDlg::VisuGUI_SetupPlot2dDlg( _PTR(SObject) object, QWidget* parent )
-    : QDialog( parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint)
+VisuGUI_SetupPlot2dDlg::VisuGUI_SetupPlot2dDlg( _PTR(SObject) object, VISU::Table_i* table , QWidget* parent )
+    : QDialog( parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
+    myTable(table)
 {
   setModal( true );
   setWindowTitle( tr("TLT_SETUP_PLOT2D") );
@@ -95,17 +96,20 @@ VisuGUI_SetupPlot2dDlg::VisuGUI_SetupPlot2dDlg( _PTR(SObject) object, QWidget* p
   QLabel* labAssigned = new QLabel( tr( "ASSIGNED" ),   frame );
   QLabel* labData = new QLabel( tr( "DATA_LBL" ),       frame );
   QLabel* labUnit = new QLabel( tr( "UNITS_LBL" ),      frame );
+  QLabel* labDvtn = new QLabel( tr( "DVTN_LBL" ),      frame );
   QLabel* labAttr = new QLabel( tr( "ATTRIBUTES_LBL" ), frame );
   labAxis->setAlignment( Qt::AlignCenter );
   labAssigned->setAlignment( Qt::AlignCenter );
   labData->setAlignment( Qt::AlignCenter );
   labUnit->setAlignment( Qt::AlignCenter );
+  labDvtn->setAlignment( Qt::AlignCenter );
   labAttr->setAlignment( Qt::AlignCenter );
   QFont font = labAxis->font(); font.setBold( true );
   labAxis->setFont( font );
   labAssigned->setFont( font );
   labData->setFont( font );
   labUnit->setFont( font );
+  labDvtn->setFont( font );
   labAttr->setFont( font );
 
   frameLayout->addWidget( labAxis, 0, 0, 1, 3 );
@@ -119,13 +123,19 @@ VisuGUI_SetupPlot2dDlg::VisuGUI_SetupPlot2dDlg( _PTR(SObject) object, QWidget* p
   frameLayout->addWidget( labData,          0,     6 );
       lin = new QFrame( frame ); lin->setFrameStyle( QFrame::VLine | QFrame::Sunken );
       frameLayout->addWidget( lin,          0,     7 );
+
   frameLayout->addWidget( labUnit,          0,     8 );
       lin = new QFrame( frame ); lin->setFrameStyle( QFrame::VLine | QFrame::Sunken );
       frameLayout->addWidget( lin,          0,     9 );
-  frameLayout->addWidget( labAttr, 0, 10, 1, 5 );
+
+  frameLayout->addWidget( labDvtn,          0,     10 );
+      lin = new QFrame( frame ); lin->setFrameStyle( QFrame::VLine | QFrame::Sunken );
+      frameLayout->addWidget( lin,          0,     11 );
+
+  frameLayout->addWidget( labAttr, 0, 12, 1, 5 );
   //frameLayout->setColStretch(               15, 5 );
   lin = new QFrame( frame ); lin->setFrameStyle( QFrame::HLine | QFrame::Sunken );
-  frameLayout->addWidget( lin, 1, 0, 1, 16 );
+  frameLayout->addWidget( lin, 1, 0, 1, 17 );
 
   int row = 2;
   _PTR(GenericAttribute)        anAttr;
@@ -143,8 +153,10 @@ VisuGUI_SetupPlot2dDlg::VisuGUI_SetupPlot2dDlg( _PTR(SObject) object, QWidget* p
         QStringList rows;
         for ( int i = 0; i < nbRows; i++ )
           rows.append( rowTitles[i].c_str() );
-
+        
+        int nbItems=0;
         for ( int i = 0; i < nbRows; i++ ) {
+          if(myTable && myTable->isDeviationRow(i)) continue;
           VisuGUI_ItemContainer* item = new VisuGUI_ItemContainer( this );
           item->createWidgets( frame, rows );
           frameLayout->addWidget( item->myHBtn,        row, 0 );
@@ -158,15 +170,25 @@ VisuGUI_SetupPlot2dDlg::VisuGUI_SetupPlot2dDlg( _PTR(SObject) object, QWidget* p
           frameLayout->addWidget( item->myUnitLab,     row, 8 );
           if ( rowUnits.size() > 0 )
             item->myUnitLab->setText( QString( rowUnits[ i ].c_str() ) );
-          frameLayout->addWidget( item->myAutoCheck,   row, 10 );
-          frameLayout->addWidget( item->myLineCombo,   row, 11 );
-          frameLayout->addWidget( item->myLineSpin,    row, 12 );
-          frameLayout->addWidget( item->myMarkerCombo, row, 13 );
-          frameLayout->addWidget( item->myColorBtn,    row, 14 );
+
+          frameLayout->addWidget( item->myDvtnLab,     row, 10 );
+          if(myTable && myTable->hasDeviationData(i)) {
+           QString lbl = VISU::Table_i::deviationLabel(myTable->getDeviationInfo(i));
+            if(lbl.size() > 0 )
+              item->myDvtnLab->setText(lbl);
+          }
+
+          frameLayout->addWidget( item->myAutoCheck,   row, 12 );
+          frameLayout->addWidget( item->myLineCombo,   row, 13 );
+          frameLayout->addWidget( item->myLineSpin,    row, 14 );
+          frameLayout->addWidget( item->myMarkerCombo, row, 15 );
+          frameLayout->addWidget( item->myColorBtn,    row, 16 );
           connect( item, SIGNAL( horToggled( bool ) ), this, SLOT( onHBtnToggled( bool ) ) );
           connect( item, SIGNAL( verToggled( bool ) ), this, SLOT( onVBtnToggled( bool ) ) );
           connect( item, SIGNAL( ver2Toggled( bool ) ), this, SLOT( onV2BtnToggled( bool ) ) );
           myItems.append( item );
+          myIdxMap[nbItems] = i;
+          nbItems++;
           row++;
         }
       }
@@ -186,8 +208,9 @@ VisuGUI_SetupPlot2dDlg::VisuGUI_SetupPlot2dDlg( _PTR(SObject) object, QWidget* p
         QStringList rows;
         for ( int i = 0; i < nbRows; i++ )
           rows.append( rowTitles[i].c_str() );
-
+        int nbItems = 0;
         for ( int i = 0; i < nbRows; i++ ) {
+          if(myTable && myTable->isDeviationRow(i)) continue;
           VisuGUI_ItemContainer* item = new VisuGUI_ItemContainer( this );
           item->createWidgets( frame, rows );
           frameLayout->addWidget( item->myHBtn,        row, 0 );
@@ -201,15 +224,27 @@ VisuGUI_SetupPlot2dDlg::VisuGUI_SetupPlot2dDlg( _PTR(SObject) object, QWidget* p
           frameLayout->addWidget( item->myUnitLab,     row, 8 );
           if ( rowUnits.size() > 0 )
             item->myUnitLab->setText( QString( rowUnits[ i ].c_str() ) );
-          frameLayout->addWidget( item->myAutoCheck,   row, 10 );
-          frameLayout->addWidget( item->myLineCombo,   row, 11 );
-          frameLayout->addWidget( item->myLineSpin,    row, 12 );
-          frameLayout->addWidget( item->myMarkerCombo, row, 13 );
-          frameLayout->addWidget( item->myColorBtn,    row, 14 );
+
+          frameLayout->addWidget( item->myDvtnLab,     row, 10 );
+
+          frameLayout->addWidget( item->myDvtnLab,     row, 10 );
+          if(myTable && myTable->hasDeviationData(i)) {
+           QString lbl = VISU::Table_i::deviationLabel(myTable->getDeviationInfo(i));
+            if(lbl.size() > 0 )
+              item->myDvtnLab->setText(lbl);
+          }
+
+          frameLayout->addWidget( item->myAutoCheck,   row, 12 );
+          frameLayout->addWidget( item->myLineCombo,   row, 13 );
+          frameLayout->addWidget( item->myLineSpin,    row, 14 );
+          frameLayout->addWidget( item->myMarkerCombo, row, 15 );
+          frameLayout->addWidget( item->myColorBtn,    row, 16 );
           connect( item, SIGNAL( horToggled( bool ) ), this, SLOT( onHBtnToggled( bool ) ) );
           connect( item, SIGNAL( verToggled( bool ) ), this, SLOT( onVBtnToggled( bool ) ) );
           connect( item, SIGNAL( ver2Toggled( bool ) ), this, SLOT( onV2BtnToggled( bool ) ) );
           myItems.append( item );
+          myIdxMap[nbItems] = i;
+          nbItems++;
           row++;
         }
       }
@@ -224,6 +259,11 @@ VisuGUI_SetupPlot2dDlg::VisuGUI_SetupPlot2dDlg( _PTR(SObject) object, QWidget* p
   frameLayout->addWidget( lin, 2, 5, row, 1 );
   lin = new QFrame( frame ); lin->setFrameStyle( QFrame::VLine | QFrame::Sunken );
   frameLayout->addWidget( lin, 2, 7, row, 1 );
+  lin = new QFrame( frame ); lin->setFrameStyle( QFrame::VLine | QFrame::Sunken );
+  frameLayout->addWidget( lin, 2, 9, row, 1 );
+  lin = new QFrame( frame ); lin->setFrameStyle( QFrame::VLine | QFrame::Sunken );
+  frameLayout->addWidget( lin, 2, 11, row, 1 );
+
   //frameLayout->setRowStretch( row+1, 5 );
 
   myView->setWidget( frame );
@@ -340,18 +380,18 @@ void VisuGUI_SetupPlot2dDlg::getCurves( QList<Plot2d_Curve*>& container )
           SPlot2d_Curve* curve = new SPlot2d_Curve();
           // curve titles
           if ( rowTitles.size() > 0 ) {
-            curve->setHorTitle( QString( rowTitles[ horIndex ].c_str() ) );
-            curve->setVerTitle( QString( rowTitles[ verIndex[i] ].c_str() ) );
+            curve->setHorTitle( QString( rowTitles[ idx(horIndex) ].c_str() ) );
+            curve->setVerTitle( QString( rowTitles[ idx(verIndex[i]) ].c_str() ) );
           }
           // curve units
           if ( rowUnits.size() > 0 ) {
-            curve->setHorUnits( QString( rowUnits[ horIndex ].c_str() ) );
-            curve->setVerUnits( QString( rowUnits[ verIndex[i] ].c_str() ) );
+            curve->setHorUnits( QString( rowUnits[ idx(horIndex) ].c_str() ) );
+            curve->setVerUnits( QString( rowUnits[ idx(verIndex[i]) ].c_str() ) );
           }
           // curve data
           int nbPoints = 0;
           for ( j = 1; j <= nbCols; j++ ) {
-            if ( tblIntAttr->HasValue( horIndex+1, j ) && tblIntAttr->HasValue( verIndex[i]+1, j ) )
+            if ( tblIntAttr->HasValue( idx(horIndex) + 1, j ) && tblIntAttr->HasValue( idx(verIndex[i])+1, j ) )
               nbPoints++;
           }
           if ( nbPoints > 0 ) {
@@ -359,10 +399,10 @@ void VisuGUI_SetupPlot2dDlg::getCurves( QList<Plot2d_Curve*>& container )
             double* yList = new double[ nbPoints ];
             QStringList zList;
             for ( j = 1; j <= nbCols; j++ ) {
-              if ( tblIntAttr->HasValue( horIndex+1, j ) && tblIntAttr->HasValue( verIndex[i]+1, j ) ) {
-                xList[j-1] = tblIntAttr->GetValue( horIndex   +1, j );
-                yList[j-1] = tblIntAttr->GetValue( verIndex[i]+1, j );
-                zList.append( QString( "%1" ).arg( tblIntAttr->GetValue( zIndices[i]+1, j ) ) );
+              if ( tblIntAttr->HasValue( idx(horIndex)+1, j ) && tblIntAttr->HasValue( idx(verIndex[i])+1, j ) ) {
+                xList[j-1] = tblIntAttr->GetValue( idx(horIndex)   +1, j );
+                yList[j-1] = tblIntAttr->GetValue( idx(verIndex[i])+1, j );
+                zList.append( QString( "%1" ).arg( tblIntAttr->GetValue( idx(zIndices[i])+1, j ) ) );
               }
             }
             curve->setData( xList, yList, nbPoints, zList );
@@ -394,18 +434,18 @@ void VisuGUI_SetupPlot2dDlg::getCurves( QList<Plot2d_Curve*>& container )
           SPlot2d_Curve* curve = new SPlot2d_Curve();
           // curve titles
           if ( rowTitles.size() > 0 ) {
-            curve->setHorTitle( QString( rowTitles[ horIndex ].c_str() ) );
-            curve->setVerTitle( QString( rowTitles[ verIndex[i] ].c_str() ) );
+            curve->setHorTitle( QString( rowTitles[ idx(horIndex) ].c_str() ) );
+            curve->setVerTitle( QString( rowTitles[ idx(verIndex[i]) ].c_str() ) );
           }
           // curve units
           if ( rowUnits.size() > 0 ) {
-            curve->setHorUnits( QString( rowUnits[ horIndex ].c_str() ) );
-            curve->setVerUnits( QString( rowUnits[ verIndex[i] ].c_str() ) );
+            curve->setHorUnits( QString( rowUnits[ idx(horIndex) ].c_str() ) );
+            curve->setVerUnits( QString( rowUnits[ idx(verIndex[i]) ].c_str() ) );
           }
           // curve data
           int nbPoints = 0;
           for ( j = 1; j <= nbCols; j++ ) {
-            if ( tblRealAttr->HasValue( horIndex+1, j ) && tblRealAttr->HasValue( verIndex[i]+1, j ) )
+            if ( tblRealAttr->HasValue( idx(horIndex)+1, j ) && tblRealAttr->HasValue( idx(verIndex[i])+1, j ) )
               nbPoints++;
           }
           if ( nbPoints > 0 ) {
@@ -413,10 +453,10 @@ void VisuGUI_SetupPlot2dDlg::getCurves( QList<Plot2d_Curve*>& container )
             double* yList = new double[ nbPoints ];
             QStringList zList;
             for ( j = 1; j <= nbCols; j++ ) {
-              if ( tblRealAttr->HasValue( horIndex+1, j ) && tblRealAttr->HasValue( verIndex[i]+1, j ) ) {
-                xList[j-1] = tblRealAttr->GetValue( horIndex   +1, j );
-                yList[j-1] = tblRealAttr->GetValue( verIndex[i]+1, j );
-                zList.append( QString( "%1" ).arg( tblIntAttr->GetValue( zIndices[i]+1, j ) ) );
+              if ( tblRealAttr->HasValue( idx(horIndex)+1, j ) && tblRealAttr->HasValue( idx(verIndex[i])+1, j ) ) {
+                xList[j-1] = tblRealAttr->GetValue( idx(horIndex)   +1, j );
+                yList[j-1] = tblRealAttr->GetValue( idx(verIndex[i])+1, j );
+                zList.append( QString( "%1" ).arg( tblIntAttr->GetValue( idx(zIndices[i])+1, j ) ) );
               }
             }
             curve->setData( xList, yList, nbPoints, zList );
@@ -628,6 +668,9 @@ void VisuGUI_ItemContainer::createWidgets( QWidget* parentWidget, const QStringL
   myTitleLab = new QLabel( parentWidget );
   myUnitLab  = new QLabel( parentWidget );
   myUnitLab->setAlignment( Qt::AlignCenter);
+
+  myDvtnLab = new QLabel( parentWidget );
+  myDvtnLab->setAlignment( Qt::AlignCenter);
   
   myAutoCheck = new QCheckBox( tr( "AUTO_CHECK_LBL" ), parentWidget );
   myAutoCheck->setChecked( true );
index a513bd12997a925bfed067dee623cf59176c3d36..660d188164e11c6292fb59201b97296276bfc476 100644 (file)
@@ -31,6 +31,8 @@
 
 #include <SALOMEDSClient_SObject.hxx>
 
+#include <VISU_Table_i.hh>
+
 #include <QDialog>
 #include <QList>
 
@@ -54,12 +56,13 @@ class VisuGUI_SetupPlot2dDlg : public QDialog
   Q_OBJECT
 
 public:
-  VisuGUI_SetupPlot2dDlg( _PTR(SObject) object, QWidget* parent = 0 );
+  VisuGUI_SetupPlot2dDlg( _PTR(SObject) object, VISU::Table_i* table ,QWidget* parent = 0 );
   ~VisuGUI_SetupPlot2dDlg();
 
   void getCurves( QList<Plot2d_Curve*>& container );
   void getCurvesSource( int& horIndex, QList<int>& verIndexes, QList<int>& ver2Indexes, QList<int>& zIndexes );
   bool getCurveAttributes( const int vIndex, bool& isAuto, int& marker, int& line, int& lineWidth, QColor& color);
+  int idx(const int i) const {return myIdxMap[i];}
 
 private:
   void keyPressEvent( QKeyEvent* e );
@@ -77,8 +80,10 @@ private:
   QPushButton*                myCancelBtn;
   QPushButton*                myHelpBtn;
   QList<VisuGUI_ItemContainer*> myItems;
+  QMap<int,int>                 myIdxMap;
 
   _PTR(SObject)               myObject;
+  VISU::Table_i*              myTable;
 };
 
 class VisuGUI_ItemContainer : public QObject
@@ -129,6 +134,7 @@ public:
   QToolButton*          myV2Btn;
   QLabel*               myTitleLab;
   QLabel*               myUnitLab;
+  QLabel*               myDvtnLab;
   QCheckBox*            myAutoCheck;
   QComboBox*            myLineCombo;
   SalomeApp_IntSpinBox* myLineSpin;
index 852f1404f43824c7c06d2706bbb1707429d0945d..304727b2993419c9e4f520e4fb104cd125de0051 100644 (file)
@@ -50,6 +50,28 @@ static int MYDEBUG = 0;
 #else
 static int MYDEBUG = 0;
 #endif
+
+//# Define delimeter
+#define TLT_DLM ":"
+
+//Absolute deviation
+#define D_MIN "min"
+#define D_MAX "max"
+
+//Percentage deviation
+#define D_PMIN "min%"
+#define D_PMAX "max%"
+
+#define D_EMIN "errmin"
+#define D_EMAX "errmax"
+
+#define D_EPMIN "errmin%"
+#define D_EPMAX "errmax%"
+
+#define D_ERR "error"
+#define D_ERRP "error%"
+
+
 //----------------------------------------------------------------
 //                      Table Object
 //----------------------------------------------------------------
@@ -78,6 +100,8 @@ VISU::Table_i::Table_i( SALOMEDS::Study_ptr theStudy, const char* theObjectEntry
   MESSAGE("Table_i::Table_i - "<<this);
   mySObj = theStudy->FindObjectID(theObjectEntry);
   myOrientation = VISU::Table::HORIZONTAL;
+  SetStudyDocument(theStudy);
+  BuildDeviationMap();
 }
 /*!
   Destructor
@@ -239,6 +263,259 @@ VISU::Table_i
     }
   }
 }
+//----------------------------------------------------------------------------
+bool 
+VISU::Table_i::parseTitle(const QString theTitle, 
+                          QString& theOutTitle,
+                          DeviationType& theType, 
+                          bool& isMin) {
+  QStringList lst = theTitle.split(TLT_DLM);
+  theType = NoneDvtn;
+  isMin = false;
+  theOutTitle.clear();
+  if(lst.size() >= 2) {
+    QString s1 = lst[0];
+    QString s2 = lst[1];
+    if(QString::compare(lst[0], D_MIN, Qt::CaseInsensitive) == 0){
+      theType = AbsoluteDvtn;
+      isMin = true;
+    } else if(QString::compare(lst[0], D_MAX, Qt::CaseInsensitive) == 0) {
+      theType = AbsoluteDvtn;
+      isMin = false;
+    } else if(QString::compare(lst[0], D_PMIN, Qt::CaseInsensitive) == 0) {
+      theType = PercentageDvtn;
+      isMin = true;
+    } else if(QString::compare(lst[0], D_PMAX, Qt::CaseInsensitive) == 0) {
+      theType = PercentageDvtn;
+      isMin = false;
+    } else if(QString::compare(lst[0], D_EMIN, Qt::CaseInsensitive) == 0) {
+      theType = ErrorDvtn;
+      isMin = true;
+    } else if(QString::compare(lst[0], D_EMAX, Qt::CaseInsensitive) == 0) {
+      theType = ErrorDvtn;
+      isMin = false;
+    } else if(QString::compare(lst[0], D_EPMIN, Qt::CaseInsensitive) == 0) {
+      theType = ErrorPercentageDvtn;
+      isMin = true;
+    } else if(QString::compare(lst[0], D_EPMAX, Qt::CaseInsensitive) == 0) {
+      theType = ErrorPercentageDvtn;
+      isMin = false;
+    } else if(QString::compare(lst[0], D_ERR, Qt::CaseInsensitive) == 0) {
+      theType = SimpleErrorDvtn;
+    } else if(QString::compare(lst[0], D_ERRP, Qt::CaseInsensitive) == 0) {
+      theType = SimpleErrorPercentageDvtn;
+    }
+  }
+  if(theType == NoneDvtn){
+    return false;
+  } else {
+    for(int i = 1; i < lst.size();i++ )
+      theOutTitle += lst[i];
+    return true;
+  }
+}
+//----------------------------------------------------------------------------
+double 
+VISU::Table_i 
+::calculateDeviation(DeviationType theType, double value,double deviationValue, bool isMin){
+  double result;
+  switch(theType) {
+    case AbsoluteDvtn: 
+      result = deviationValue;
+      break;
+    case PercentageDvtn: 
+      result = value*deviationValue;
+      break;
+    case SimpleErrorDvtn:
+    case ErrorDvtn: 
+      result = value + (isMin ? -1.0 : 1.0)*deviationValue; 
+      break;
+    case ErrorPercentageDvtn:   
+    case SimpleErrorPercentageDvtn: 
+      result = value *( 1 + (isMin ? -1.0 : 1.0)*deviationValue); 
+      break;
+    default: result = 0.;
+  }
+  return result;
+}
+
+QString 
+VISU::Table_i
+::deviationLabel(DeviationData* info) {
+  QString lbl;
+  if(info) {
+      bool add = true;
+      switch(info->minDeviation()){
+        case SimpleErrorDvtn:
+          lbl = D_ERR;
+          add = false;
+          break;
+        case SimpleErrorPercentageDvtn:
+          lbl = D_ERRP;
+          add = false;
+          break;
+        case AbsoluteDvtn:
+          lbl = D_MIN;
+          break;
+        case PercentageDvtn:
+          lbl = D_PMIN;
+          break;
+        case ErrorDvtn:
+          lbl = D_EMIN;
+          break;
+        case ErrorPercentageDvtn:
+          lbl = D_EPMIN;
+          break;
+      }
+      if(add) {
+        lbl += " / ";
+        switch(info->maxDeviation()){
+          case AbsoluteDvtn:
+            lbl += D_MAX;
+            break;
+          case PercentageDvtn:
+            lbl += D_PMAX;
+            break;
+          case ErrorDvtn:
+            lbl += D_EMAX;
+            break;
+          case ErrorPercentageDvtn:
+            lbl += D_EPMAX;
+            break;
+        }
+      }
+  }
+  return lbl;
+}
+
+//----------------------------------------------------------------------------
+bool
+VISU::Table_i
+::hasDeviationData(const int row) {
+  return myDeviationMap.contains(row);
+}
+
+//----------------------------------------------------------------------------
+VISU::DeviationData* 
+VISU::Table_i::getDeviationInfo(const int row) {
+  if(hasDeviationData(row))
+    return &myDeviationMap[row];
+  return NULL;
+}
+
+//----------------------------------------------------------------------------
+bool
+VISU::Table_i
+::isDeviationRow(const int row) {
+  DeviationMap::const_iterator it = myDeviationMap.begin();
+  for( ; it != myDeviationMap.end(); it++) {
+    if((*it).minRow() == row || (*it).maxRow() == row)
+      return true;
+  }
+  return false;
+}
+
+//----------------------------------------------------------------------------
+void
+VISU::Table_i
+::BuildDeviationMap() {
+  SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
+  SALOMEDS::GenericAttribute_var        anAttr;
+  SALOMEDS::AttributeTableOfInteger_var anInt;
+  SALOMEDS::AttributeTableOfReal_var    aReal;
+  SALOMEDS::StringSeq_var rowTitles;
+  SALOMEDS::StringSeq_var rowUnits;
+
+  if ( !mySObj->_is_nil() ) {
+    if ( Builder->FindAttribute( mySObj, anAttr, "AttributeTableOfInteger" ) ) {
+      anInt = SALOMEDS::AttributeTableOfInteger::_narrow( anAttr );
+      rowTitles = anInt->GetRowTitles();
+      rowUnits = anInt->GetRowUnits();
+    }
+    else if ( Builder->FindAttribute( mySObj, anAttr, "AttributeTableOfReal" ) ) {
+      aReal = SALOMEDS::AttributeTableOfReal::_narrow( anAttr );
+      rowTitles = aReal->GetRowTitles();
+      rowUnits = aReal->GetRowUnits();
+      }
+   }
+   int nbTitles = rowTitles->length();
+   int nbUnits = rowUnits->length();
+
+   QString realTitle;
+   DeviationType deviationType; 
+   bool isMin;
+
+   //Deviation candidates map:
+   //Key - title without keyword, pair { "deviation type" , "id of row" }
+   QMap<QString, QPair<DeviationType,int> > minCandidatesMap;
+   QMap<QString, QPair<DeviationType,int> > maxCandidatesMap;
+   QMap<QString, QPair<DeviationType,int> > CandidatesMap;
+   if( nbTitles > 0 ) {
+     for(int i = 0; i < nbTitles; i++ ) {
+       if(parseTitle(rowTitles[i].in(), realTitle, deviationType, isMin)) {
+         if( deviationType == SimpleErrorDvtn || deviationType == SimpleErrorPercentageDvtn ){
+           if(!CandidatesMap.contains(realTitle)) {
+              CandidatesMap[realTitle] = QPair<DeviationType, int>(deviationType,i);
+           } else {
+            minCandidatesMap.remove(realTitle);
+            maxCandidatesMap.remove(realTitle);
+            CandidatesMap.remove(realTitle);
+           }
+            continue;
+         }
+         if(isMin) {
+           if(!minCandidatesMap.contains(realTitle)){
+              minCandidatesMap[realTitle] = QPair<DeviationType, int>(deviationType,i);
+           } else {
+            minCandidatesMap.remove(realTitle);
+            maxCandidatesMap.remove(realTitle);
+            CandidatesMap.remove(realTitle);
+           }
+         } else {
+           if(!maxCandidatesMap.contains(realTitle)){
+              maxCandidatesMap[realTitle] = QPair<DeviationType, int>(deviationType,i);
+           } else {
+            minCandidatesMap.remove(realTitle);
+            maxCandidatesMap.remove(realTitle);
+            CandidatesMap.remove(realTitle);
+           }
+         }
+       }
+     }
+     QString currentTitle;
+     for(int i = 0; i < nbTitles; i++ ) {
+      currentTitle = rowTitles[i].in();
+      if(minCandidatesMap.contains(currentTitle) && maxCandidatesMap.contains(currentTitle)) {
+        //check for the units
+        if(nbUnits > 0) {
+          if(i < nbUnits) {
+            const char* s1 = rowUnits[i].in();
+            const char* s2 = rowUnits[minCandidatesMap[currentTitle].second].in();
+            const char* s3 = rowUnits[maxCandidatesMap[currentTitle].second].in();
+            if(strcmp(s1,s2) != 0 || strcmp(s1,s3) != 0 ) continue;
+          } else continue;
+        }
+        myDeviationMap[i] = DeviationData(minCandidatesMap[currentTitle].second,
+                                          maxCandidatesMap[currentTitle].second,
+                                          minCandidatesMap[currentTitle].first,
+                                          maxCandidatesMap[currentTitle].first);
+      } else if(CandidatesMap.contains(currentTitle)) {
+          //check for the units
+          if(nbUnits > 0) {
+            if(i < nbUnits) {
+              const char* s1 = rowUnits[i].in();
+              const char* s2 = rowUnits[CandidatesMap[currentTitle].second].in();
+              if(strcmp(s1,s2) != 0) continue;
+            } else continue;
+          }
+          myDeviationMap[i] = DeviationData(CandidatesMap[currentTitle].second,
+                                          CandidatesMap[currentTitle].second,
+                                          CandidatesMap[currentTitle].first,
+                                          CandidatesMap[currentTitle].first);
+      }
+     }
+   }
+}
 
 //----------------------------------------------------------------------------
 SALOMEDS::SObject_var
@@ -513,7 +790,7 @@ VISU::Curve_i::Curve_i( SALOMEDS::Study_ptr theStudy, Table_i* theTable,
                        CORBA::Long theHRow, CORBA::Long theVRow,
                        CORBA::Long theZRow, CORBA::Boolean theIsV2 )
 : PrsObject_i(theStudy), myTable( theTable ), myHRow( theHRow ),
-  myVRow( theVRow ), myZRow( theZRow ), myIsV2( theIsV2 )
+  myVRow( theVRow ), myZRow( theZRow ), myIsV2( theIsV2 ), myDeviationEnabled(false)
 {
   myAuto = true;
   myLine = VISU::Curve::SOLIDLINE;
@@ -920,6 +1197,88 @@ int VISU::Curve_i::GetData( double*& theHorList, double*& theVerList, QStringLis
   }
   return 0;
 }
+
+int VISU::Curve_i::GetDeviationData( double*& theMin, double*& theMax, QList<int>& theIndexes) {
+  if(!hasDeviation())
+    return 0;
+
+  theIndexes.clear();
+
+  DeviationData *info = myTable->getDeviationInfo(myVRow - 1);
+  int minRow = info->minRow() + 1;
+  int maxRow = info->maxRow() + 1;
+
+  SALOMEDS::SObject_var SO = GetStudyDocument()->FindObjectID(myTable->GetObjectEntry().c_str());
+  SALOMEDS::StudyBuilder_var Builder = GetStudyDocument()->NewBuilder();
+  SALOMEDS::GenericAttribute_var        anAttr;
+  SALOMEDS::AttributeTableOfInteger_var anInt;
+  SALOMEDS::AttributeTableOfReal_var    aReal;
+
+  int nbPoints = 0;
+  if ( !SO->_is_nil() ) {
+    if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) ) {
+      anInt = SALOMEDS::AttributeTableOfInteger::_narrow( anAttr );
+      int nbCols = anInt->GetNbColumns();
+      int nbRows = anInt->GetNbRows();
+      if ( nbCols > 0 && myHRow > 0 && myVRow && minRow > 0 && maxRow > 0 && 
+           myHRow <= nbRows &&  myVRow <= nbRows && minRow <= nbRows && maxRow <= nbRows ) {
+        for ( int j = 1; j <= nbCols; j++ ) {
+               if ( anInt->HasValue( myHRow, j ) && anInt->HasValue( myVRow, j ) && 
+               anInt->HasValue( minRow, j ) && anInt->HasValue( maxRow, j ) )
+                 nbPoints++;
+        }
+
+         if ( nbPoints > 0 ) {
+               theMin = new double[ nbPoints ];
+               theMax = new double[ nbPoints ];
+           int k = 0;
+          int value;
+               for ( int j = 1; j <= nbCols; j++ ) {
+                 if ( anInt->HasValue( myHRow, j ) && anInt->HasValue( myVRow, j ) &&
+                 anInt->HasValue( minRow, j ) && anInt->HasValue( maxRow, j )) {
+                 value = anInt->GetValue(myVRow,j);
+              theMin[k] = Table_i::calculateDeviation(info->minDeviation(),value, anInt->GetValue(minRow,j), true);
+                   theMax[k] = Table_i::calculateDeviation(info->maxDeviation(),value, anInt->GetValue(minRow,j), false);
+              k++;
+              theIndexes.push_back(j-1);
+            }
+          } // for ( ...
+        } // nbPoints > 0
+      } // nbCols > 0 && myHRow > 0 && myVRow ...
+    } // Builder->FindAttribute(...
+    else if( Builder->FindAttribute( SO, anAttr, "AttributeTableOfReal" ) ) {
+      aReal = SALOMEDS::AttributeTableOfReal::_narrow( anAttr );
+      int nbCols = aReal->GetNbColumns();
+      int nbRows = aReal->GetNbRows();
+      if ( nbCols > 0 && myHRow > 0 && myVRow && minRow > 0 && maxRow > 0 && 
+           myHRow <= nbRows &&  myVRow <= nbRows && minRow <= nbRows && maxRow <= nbRows) {
+        for ( int j = 1; j <= nbCols; j++ ) {
+               if ( aReal->HasValue( myHRow, j ) && aReal->HasValue( myVRow, j ) && 
+               aReal->HasValue( minRow, j ) && aReal->HasValue( maxRow, j ) )
+                 nbPoints++;
+        }
+
+         if ( nbPoints > 0 ) {
+               theMin = new double[ nbPoints ];
+               theMax = new double[ nbPoints ];
+           int k = 0;
+          double value;
+               for ( int j = 1; j <= nbCols; j++ ) {
+                 if ( aReal->HasValue( myHRow, j ) && aReal->HasValue( myVRow, j ) &&
+                 aReal->HasValue( minRow, j ) && aReal->HasValue( maxRow, j )) {
+              value =  aReal->GetValue(myVRow,j);
+              theMin[k] = Table_i::calculateDeviation(info->minDeviation(),value, aReal->GetValue(minRow,j), true);
+              theMax[k] = Table_i::calculateDeviation(info->maxDeviation(),value, aReal->GetValue(maxRow,j), false);
+              k++;
+              theIndexes.push_back(j-1);
+            }
+          } // for ( ..
+        } // nbPoints > 0
+      } // nbCols > 0 && myHRow > 0 && myVRow ...
+    } // Builder->FindAttribute( ...
+  } // !SO->_is_nil()
+  return nbPoints;
+}
 /*!
   Creates curve Plot2d presentation object
 */
@@ -1097,6 +1456,28 @@ VISU::ContainerSet VISU::Curve_i::getContainers() const {
   return myContainers;
 }
 
+/*!
+  Return true if on the curve were assigned deviation data
+*/
+bool VISU::Curve_i::hasDeviation() {
+  return myTable && myTable->hasDeviationData(myVRow-1);
+}
+
+/*!
+  Enable/disable deviation data displaying.
+*/
+void  VISU::Curve_i::ShowDeviation(CORBA::Boolean flag) {
+  if(flag && hasDeviation())
+    myDeviationEnabled = flag;
+  else
+    myDeviationEnabled = false;
+}
+/*!
+  Return enable deviation flag
+*/
+bool VISU::Curve_i::isDeviationShown() {
+  return myDeviationEnabled;
+}
 
 //----------------------------------------------------------------
 //                      Container Object
index c187a450b6b06f1278440c42d2287ac6854ceb0d..85b9c20923cbc8545aa0aec531888c6fd7bf1b1b 100644 (file)
 
 #include <QStringList>
 #include <QSet>
+#include <QMap>
 
 class SPlot2d_Curve;
 
-namespace VISU{
+namespace VISU {
+  typedef enum {NoneDvtn = 0, 
+                AbsoluteDvtn,
+                PercentageDvtn, 
+                ErrorDvtn, 
+                ErrorPercentageDvtn, 
+                SimpleErrorDvtn, 
+                SimpleErrorPercentageDvtn } DeviationType;
+
+  class VISU_I_EXPORT DeviationData {
+  public:
+    DeviationData(){
+      _minRow = -1;_maxRow = -1;
+      _minType = NoneDvtn;_maxType = NoneDvtn;
+    }
+    DeviationData(const int minC, const int maxC, 
+                  const DeviationType minT, const DeviationType maxT) {
+           _minRow = minC; _maxRow = maxC;
+           _minType = minT ; _maxType = maxT;
+    }
+    int minRow() const {return _minRow;}
+    int maxRow() const {return _maxRow;}
+    DeviationType minDeviation() const {return _minType;}
+    DeviationType maxDeviation() const {return _maxType;}
+
+  private:
+    int _minRow;
+    int _maxRow;
+    DeviationType _minType;
+    DeviationType _maxType;
+  };
+
+  typedef QMap<int, DeviationData> DeviationMap;
+
   //==============================================================================
   class VISU_I_EXPORT Table_i : public virtual POA_VISU::Table,
                   public virtual PrsObject_i
@@ -61,16 +95,21 @@ namespace VISU{
     virtual void SortByRow(CORBA::Long theRow, VISU::SortOrder theSortOrder, VISU::SortPolicy theSortPolicy);
     virtual void SortByColumn(CORBA::Long theColumn, VISU::SortOrder theSortOrder, VISU::SortPolicy theSortPolicy);
 
+    virtual bool            hasDeviationData(const int);
+    virtual bool            isDeviationRow(const int);
+    virtual DeviationData*  getDeviationInfo(const int);
     virtual void RemoveFromStudy();
 
   protected:
     Storable* Build(int theRestoring);
     void      UpdateCurves(std::map<int, int> theMixData);
+    void      BuildDeviationMap();
 
   protected:
     VISU::Table::Orientation myOrientation;
     std::string myTitle;
     SALOMEDS::SObject_var mySObj;
+    DeviationMap          myDeviationMap;
 
   public:
     virtual Storable* Create();
@@ -84,6 +123,15 @@ namespace VISU{
                                    const std::string& thePrefix,
                                    CORBA::Boolean theIsMultiFile);
 
+    static bool parseTitle(const QString theTitle, 
+                           QString& theOutTitle,
+                           DeviationType& theType, 
+                           bool& isMin);
+
+    static double calculateDeviation(DeviationType theType, double value,double deviationValue, bool isMin);
+
+    static QString deviationLabel(DeviationData* );
+
     virtual void ToStream( std::ostringstream& theStr );
     static const std::string myComment;
     virtual const char* GetComment() const;
@@ -137,6 +185,10 @@ namespace VISU{
 
     virtual SALOMEDS::SObject_var GetSObject();
 
+    virtual void ShowDeviation(CORBA::Boolean);
+    virtual bool isDeviationShown();
+    virtual bool hasDeviation();
+
   protected:
     Storable* Build(int theRestoring);
 
@@ -155,6 +207,7 @@ namespace VISU{
     bool                    myAuto;
     SALOMEDS::SObject_var   mySObj;
     ContainerSet            myContainers;
+    bool                    myDeviationEnabled;
 
   public:
     virtual Storable* Create();
@@ -193,6 +246,7 @@ namespace VISU{
     virtual std::string GetHorUnits();
     virtual std::string GetVerUnits();
     virtual int GetData( double*& theHorList, double*& theVerList, QStringList& );
+    virtual int GetDeviationData( double*& theMin, double*& theMax, QList<int>& );
 
     virtual SPlot2d_Curve* CreatePresentation();
   };
index f1eb06395510022f27ee61c0d1404ee1f8eec5fe..27ce0f6adf3c2698f106afd1dfc40e07e4907a05 100644 (file)
@@ -68,10 +68,23 @@ namespace VISU
         double* xList = 0;
         double* yList = 0;
         QStringList zList;
-        int     nbPoints = theCurve->GetData( xList, yList, zList );
+        int nbPoints = theCurve->GetData( xList, yList, zList );
         if ( nbPoints > 0 && xList && yList ) {
           plotCurve->setData( xList, yList, nbPoints, zList );
         }
+        if(theCurve->isDeviationShown()){
+          double* min = 0;
+          double* max = 0;
+          QList<int> indexes;
+          int nbPoints = theCurve->GetDeviationData( min, max, indexes );
+          if ( nbPoints > 0 && min && max ) {
+            plotCurve->setDeviationData(min, max, indexes);
+            delete min;
+            delete max;
+          }
+        } else {
+            plotCurve->clearDeviationData();
+        }
         if ( !theCurve->IsAuto() ) {
           plotCurve->setLine( (Plot2d::LineType)theCurve->GetLine(), theCurve->GetLineWidth() );
           plotCurve->setMarker( (Plot2d::MarkerType)theCurve->GetMarker() );