]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
PAL13244 - tooltips over curve points must show assigned value
authorasl <asl@opencascade.com>
Tue, 22 Aug 2006 05:32:21 +0000 (05:32 +0000)
committerasl <asl@opencascade.com>
Tue, 22 Aug 2006 05:32:21 +0000 (05:32 +0000)
14 files changed:
idl/VISU_Gen.idl
src/ENGINE/VISU_Engine_i.cc
src/ENGINE/VISU_Engine_i.hh
src/VISUGUI/VISU_msg_en.po
src/VISUGUI/VisuGUI.cxx
src/VISUGUI/VisuGUI_SetupPlot2dDlg.cxx
src/VISUGUI/VisuGUI_SetupPlot2dDlg.h
src/VISUGUI/VisuGUI_Tools.cxx
src/VISU_I/VISU_DumpPython.cc
src/VISU_I/VISU_Gen_i.cc
src/VISU_I/VISU_Gen_i.hh
src/VISU_I/VISU_Table_i.cc
src/VISU_I/VISU_Table_i.hh
src/VISU_I/VISU_ViewManager_i.cc

index 4bb0aecede315cfb8d19c690a328926e02de68c0..2f1d27f9c008597788b7deadc7c690724a4c0ff7 100644 (file)
@@ -1594,6 +1594,16 @@ module VISU {
      * \param VRow  Index of the row in the table:  ordinate of the point.
      */
     Curve CreateCurve(in Table theTable, in long theHRow, in long theVRow);
+    
+    /*!
+     * Creates a curve on the basis of points, whose values are taken from the table.
+     * Each point has also assigned value, that will be shown as tooltip in Plot2d 
+     * \param theTable  Table containing the data for construction of curves.
+     * \param HRow  Index of the row in the table:  abscissa of the point.
+     * \param VRow  Index of the row in the table:  ordinate of the point.
+     * \param ZRow  Index of the row in the table:  assigned value (so-called as Z).
+     */    
+    Curve CreateCurveWithZ( in Table theTable, in long theHRow, in long theVRow, in long theZRow );
 
     /*!
      * Creates a presentation form containing an array of references to the curves.
index 3798473e842ef48d85c7608cd6df79424eb5f9c5..0563dad2b58238f88a1bdb38a619b98c493b8334 100644 (file)
@@ -334,6 +334,14 @@ namespace VISU{
     return myVisuGen->CreateCurve(theTable,theHRow,theVRow);
   }
 
+  Curve_ptr VISU_Gen_i::CreateCurveWithZ(Table_ptr theTable, 
+                                   CORBA::Long theHRow,
+                                   CORBA::Long theVRow,
+                                   CORBA::Long theZRow)
+  {
+    return myVisuGen->CreateCurveWithZ(theTable,theHRow,theVRow,theZRow);
+  }
+
 
   Container_ptr VISU_Gen_i::CreateContainer(){
     return myVisuGen->CreateContainer();
index 223a5996ac180307b1384f5a3a58bf9beeb5c644..3f605b435e65e61e1ca1a7eaa3f048b7d0419a4f 100644 (file)
@@ -108,6 +108,7 @@ namespace VISU{
     //Create Digital Presentation
     virtual Table_ptr CreateTable(const char* theTableEntry);
     virtual Curve_ptr CreateCurve(Table_ptr theTable, CORBA::Long theHRow, CORBA::Long theVRow);
+    virtual Curve_ptr CreateCurveWithZ(Table_ptr theTable, CORBA::Long theHRow, CORBA::Long theVRow, CORBA::Long theZRow);
     virtual Container_ptr CreateContainer();
     virtual Animation_ptr CreateAnimation(View3D_ptr theView3d);
     
index c5683bd15ca902d8a2879fffa02485ae692b59b4..eebc49c8fbd7aea26381c270127bbed0542a0668 100644 (file)
@@ -1194,6 +1194,9 @@ msgstr "Attributes"
 msgid "AXIS_LBL"
 msgstr "Axis"
 
+msgid "ASSIGNED"
+msgstr "Assigned"
+
 #: VisuGUI_SetupPlot2dDlg.cxx:69
 msgid "DATA_LBL"
 msgstr "Data"
index 82afc07cb30a900d38c2cba1092592a69845a7bb..8266ce946340111e04c392d9c4a006a855177532 100644 (file)
@@ -1214,8 +1214,8 @@ OnPlotData()
                 // if study is not locked - create new container, create curves and insert them
                 // into container, then plot container if current viewer is of VIEW_PLOT2D type
                 int horIndex;
-                QValueList<int> verIndices;
-                dlg->getCurvesSource( horIndex, verIndices );
+                QValueList<int> verIndices, zIndices;
+                dlg->getCurvesSource( horIndex, verIndices, zIndices );
                 if ( horIndex >= 0 && verIndices.count() > 0 ) {
                   CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer();
                   if( !CORBA::is_nil( aContainer ) ) {
@@ -1224,7 +1224,7 @@ OnPlotData()
                     if ( pContainer ) {
                       for ( int i = 0; i < verIndices.count(); i++ ) {
                         CORBA::Object_var aNewCurve =
-                          GetVisuGen(this)->CreateCurve( table->_this(), horIndex+1, verIndices[i]+1 );
+                          GetVisuGen(this)->CreateCurveWithZ( table->_this(), horIndex+1, verIndices[i]+1, zIndices[i]+1 );
                         if( !CORBA::is_nil( aNewCurve ) ) {
                           VISU::Curve_i* pCrv =
                             dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
@@ -1284,8 +1284,8 @@ OnPlotData()
           // if study is not locked - create new table and container objects, create curves
           // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
           int horIndex;
-          QValueList<int> verIndices;
-          dlg->getCurvesSource( horIndex, verIndices );
+          QValueList<int> verIndices, zIndices;
+          dlg->getCurvesSource( horIndex, verIndices, zIndices );
           if ( horIndex >= 0 && verIndices.count() > 0 ) {
             CORBA::Object_var aTable = GetVisuGen(this)->CreateTable( SO->GetID().c_str() );
             CORBA::Object_var aContainer = GetVisuGen(this)->CreateContainer();
@@ -1295,8 +1295,8 @@ OnPlotData()
 
               if ( pContainer && pTable ) {
                 for ( int i = 0; i < verIndices.count(); i++ ) {
-                  CORBA::Object_var aNewCurve = GetVisuGen(this)->CreateCurve
-                    ( pTable->_this(), horIndex+1, verIndices[i]+1 );
+                  CORBA::Object_var aNewCurve = GetVisuGen(this)->CreateCurveWithZ
+                    ( pTable->_this(), horIndex+1, verIndices[i]+1, zIndices[i]+1 );
                   if( !CORBA::is_nil( aNewCurve ) ) {
                     VISU::Curve_i* pCrv = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aNewCurve).in());
                     if ( pCrv ) {
index 1c185b413c3ca4d1c7e2448f17dc32e89bc00889..81e8fcc146d66d648c230be74792fa198f73ffc5 100644 (file)
@@ -88,15 +88,18 @@ VisuGUI_SetupPlot2dDlg::VisuGUI_SetupPlot2dDlg( _PTR(SObject) object, QWidget* p
   QFrame* lin;
 
   QLabel* labAxis = new QLabel( tr( "AXIS_LBL" ),       frame );
+  QLabel* labAssigned = new QLabel( tr( "ASSIGNED" ),   frame );
   QLabel* labData = new QLabel( tr( "DATA_LBL" ),       frame );
   QLabel* labUnit = new QLabel( tr( "UNITS_LBL" ),      frame );
   QLabel* labAttr = new QLabel( tr( "ATTRIBUTES_LBL" ), frame );
   labAxis->setAlignment( AlignCenter );
+  labAssigned->setAlignment( AlignCenter );
   labData->setAlignment( AlignCenter );
   labUnit->setAlignment( AlignCenter );
   labAttr->setAlignment( AlignCenter );
   QFont font = labAxis->font(); font.setBold( true );
   labAxis->setFont( font );
+  labAssigned->setFont( font );
   labData->setFont( font );
   labUnit->setFont( font );
   labAttr->setFont( font );
@@ -104,16 +107,21 @@ VisuGUI_SetupPlot2dDlg::VisuGUI_SetupPlot2dDlg( _PTR(SObject) object, QWidget* p
   frameLayout->addMultiCellWidget( labAxis, 0,  0, 0, 1 );
       lin = new QFrame( frame ); lin->setFrameStyle( QFrame::VLine | QFrame::Sunken );
       frameLayout->addWidget( lin,          0,     2 );
-  frameLayout->addWidget( labData,          0,     3 );
+
+  frameLayout->addWidget( labAssigned,      0,     3 );
       lin = new QFrame( frame ); lin->setFrameStyle( QFrame::VLine | QFrame::Sunken );
       frameLayout->addWidget( lin,          0,     4 );
-  frameLayout->addWidget( labUnit,          0,     5 );
+
+  frameLayout->addWidget( labData,          0,     5 );
       lin = new QFrame( frame ); lin->setFrameStyle( QFrame::VLine | QFrame::Sunken );
       frameLayout->addWidget( lin,          0,     6 );
-  frameLayout->addMultiCellWidget( labAttr, 0,  0, 7, 11 );
-  frameLayout->setColStretch(               12, 5 );
+  frameLayout->addWidget( labUnit,          0,     7 );
+      lin = new QFrame( frame ); lin->setFrameStyle( QFrame::VLine | QFrame::Sunken );
+      frameLayout->addWidget( lin,          0,     8 );
+  frameLayout->addMultiCellWidget( labAttr, 0,  0, 9, 13 );
+  frameLayout->setColStretch(               14, 5 );
   lin = new QFrame( frame ); lin->setFrameStyle( QFrame::HLine | QFrame::Sunken );
-  frameLayout->addMultiCellWidget( lin, 1, 1, 0, 12 );
+  frameLayout->addMultiCellWidget( lin, 1, 1, 0, 14 );
 
   int row = 2;
   _PTR(GenericAttribute)        anAttr;
@@ -128,22 +136,28 @@ VisuGUI_SetupPlot2dDlg::VisuGUI_SetupPlot2dDlg( _PTR(SObject) object, QWidget* p
        int nbRows = tblIntAttr->GetNbRows() ; 
        vector<string> rowTitles = tblIntAttr->GetRowTitles();
        vector<string> rowUnits  = tblIntAttr->GetRowUnits();
+       QStringList rows;
+       for ( int i = 0; i < nbRows; i++ )
+         rows.append( rowTitles[i] );
+
        for ( int i = 0; i < nbRows; i++ ) {
          VisuGUI_ItemContainer* item = new VisuGUI_ItemContainer( this );
-         item->createWidgets( frame );
+         item->createWidgets( frame, rows );
          frameLayout->addWidget( item->myHBtn,        row, 0 );
          frameLayout->addWidget( item->myVBtn,        row, 1 );
-         frameLayout->addWidget( item->myTitleLab,    row, 3 );
+         frameLayout->addWidget( item->myAssigned,    row, 3 );
+
+         frameLayout->addWidget( item->myTitleLab,    row, 5 );
          if ( rowTitles.size() > 0 )
            item->myTitleLab->setText( QString( rowTitles[ i ].c_str() ) );
-         frameLayout->addWidget( item->myUnitLab,     row, 5 );
+         frameLayout->addWidget( item->myUnitLab,     row, 7 );
          if ( rowUnits.size() > 0 )
            item->myUnitLab->setText( QString( rowUnits[ i ].c_str() ) );
-         frameLayout->addWidget( item->myAutoCheck,   row, 7 );
-         frameLayout->addWidget( item->myLineCombo,   row, 8 );
-         frameLayout->addWidget( item->myLineSpin,    row, 9 );
-         frameLayout->addWidget( item->myMarkerCombo, row, 10 );
-         frameLayout->addWidget( item->myColorBtn,    row, 11 );
+         frameLayout->addWidget( item->myAutoCheck,   row, 9 );
+         frameLayout->addWidget( item->myLineCombo,   row, 10 );
+         frameLayout->addWidget( item->myLineSpin,    row, 11 );
+         frameLayout->addWidget( item->myMarkerCombo, row, 12 );
+         frameLayout->addWidget( item->myColorBtn,    row, 13 );
          connect( item, SIGNAL( horToggled( bool ) ), this, SLOT( onHBtnToggled( bool ) ) );
          connect( item, SIGNAL( verToggled( bool ) ), this, SLOT( onVBtnToggled( bool ) ) );
          myItems.append( item );
@@ -163,22 +177,28 @@ VisuGUI_SetupPlot2dDlg::VisuGUI_SetupPlot2dDlg( _PTR(SObject) object, QWidget* p
        int nbRows = tblRealAttr->GetNbRows() ; 
        vector<string> rowTitles = tblRealAttr->GetRowTitles();
        vector<string> rowUnits  = tblRealAttr->GetRowUnits();
+       QStringList rows;
+       for ( int i = 0; i < nbRows; i++ )
+         rows.append( rowTitles[i] );
+
        for ( int i = 0; i < nbRows; i++ ) {
          VisuGUI_ItemContainer* item = new VisuGUI_ItemContainer( this );
-         item->createWidgets( frame );
+         item->createWidgets( frame, rows );
          frameLayout->addWidget( item->myHBtn,        row, 0 );
          frameLayout->addWidget( item->myVBtn,        row, 1 );
-         frameLayout->addWidget( item->myTitleLab,    row, 3 );
+         frameLayout->addWidget( item->myAssigned,    row, 3 );
+
+         frameLayout->addWidget( item->myTitleLab,    row, 5 );
          if ( rowTitles.size() > 0 )
            item->myTitleLab->setText( QString( rowTitles[ i ].c_str() ) );
-         frameLayout->addWidget( item->myUnitLab,     row, 5 );
+         frameLayout->addWidget( item->myUnitLab,     row, 7 );
          if ( rowUnits.size() > 0 )
            item->myUnitLab->setText( QString( rowUnits[ i ].c_str() ) );
-         frameLayout->addWidget( item->myAutoCheck,   row, 7 );
-         frameLayout->addWidget( item->myLineCombo,   row, 8 );
-         frameLayout->addWidget( item->myLineSpin,    row, 9 );
-         frameLayout->addWidget( item->myMarkerCombo, row, 10 );
-         frameLayout->addWidget( item->myColorBtn,    row, 11 );
+         frameLayout->addWidget( item->myAutoCheck,   row, 9 );
+         frameLayout->addWidget( item->myLineCombo,   row, 10 );
+         frameLayout->addWidget( item->myLineSpin,    row, 11 );
+         frameLayout->addWidget( item->myMarkerCombo, row, 12 );
+         frameLayout->addWidget( item->myColorBtn,    row, 13 );
          connect( item, SIGNAL( horToggled( bool ) ), this, SLOT( onHBtnToggled( bool ) ) );
          connect( item, SIGNAL( verToggled( bool ) ), this, SLOT( onVBtnToggled( bool ) ) );
          myItems.append( item );
@@ -237,7 +257,8 @@ VisuGUI_SetupPlot2dDlg::~VisuGUI_SetupPlot2dDlg()
 /*!
   Gets curves info ( indexes of row data in the table for horizontal and verical axes )
 */
-void VisuGUI_SetupPlot2dDlg::getCurvesSource( int& horIndex, QValueList<int>& verIndexes )
+void VisuGUI_SetupPlot2dDlg::getCurvesSource( int& horIndex, QValueList<int>& verIndexes,
+                                             QValueList<int>& zIndices )
 {
   /* collecting horizontal and vertical axis items */
   horIndex = -1;
@@ -248,7 +269,9 @@ void VisuGUI_SetupPlot2dDlg::getCurvesSource( int& horIndex, QValueList<int>& ve
     }
     else if ( myItems.at( i )->isVerticalOn() ) {
       verIndexes.append( i );
+      zIndices.append( myItems.at( i )->assigned() );
     }
+    
   }
 }
 /*!
@@ -286,8 +309,8 @@ void VisuGUI_SetupPlot2dDlg::getCurves( QPtrList<Plot2d_Curve>& container )
   /* collecting horizontal and vertical axis items */
   int horIndex;
   int i, j;
-  QValueList<int> verIndex;
-  getCurvesSource( horIndex, verIndex );
+  QValueList<int> verIndex, zIndices;
+  getCurvesSource( horIndex, verIndex, zIndices );
   if ( horIndex < 0 || verIndex.isEmpty() ) /* no curves can be created */
     return;
     
@@ -321,13 +344,15 @@ void VisuGUI_SetupPlot2dDlg::getCurves( QPtrList<Plot2d_Curve>& container )
          if ( nbPoints > 0 ) {
            double* xList = new double[ nbPoints ];
            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 ) ) );
              }
            }
-           curve->setData( xList, yList, nbPoints );
+           curve->setData( xList, yList, nbPoints, zList );
          }
          // curve attributes
          curve->setLine( (Plot2d_Curve::LineType)myItems.at( verIndex[i] )->getLine(), myItems.at( verIndex[i] )->getLineWidth() );
@@ -373,13 +398,15 @@ void VisuGUI_SetupPlot2dDlg::getCurves( QPtrList<Plot2d_Curve>& container )
          if ( nbPoints > 0 ) {
            double* xList = new double[ nbPoints ];
            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 ) ) );
              }
            }
-           curve->setData( xList, yList, nbPoints );
+           curve->setData( xList, yList, nbPoints, zList );
          }
          // curve attributes
          curve->setLine( (Plot2d_Curve::LineType)myItems.at( verIndex[i] )->getLine(), myItems.at( verIndex[i] )->getLineWidth() );
@@ -418,6 +445,7 @@ void VisuGUI_SetupPlot2dDlg::onVBtnToggled( bool on )
   VisuGUI_ItemContainer* item = ( VisuGUI_ItemContainer* )sender();
   QPtrList<VisuGUI_ItemContainer> itemList;
   itemList.setAutoDelete( false );
+  item->myAssigned->setEnabled( on );
   int i;
   if ( on ) {
     int totalOn = 0;
@@ -521,7 +549,7 @@ VisuGUI_ItemContainer::VisuGUI_ItemContainer( QObject* parent, const char* name
 /*!
   Creates widgets
 */
-void VisuGUI_ItemContainer::createWidgets( QWidget* parentWidget )
+void VisuGUI_ItemContainer::createWidgets( QWidget* parentWidget, const QStringList& lst )
 {
   myHBtn = new QToolButton( parentWidget );
   myHBtn->setText( tr( "H" ) );
@@ -567,6 +595,13 @@ void VisuGUI_ItemContainer::createWidgets( QWidget* parentWidget )
 
   myColorBtn = new QToolButton( parentWidget );
   myColorBtn->setMinimumWidth( 20 );
+
+  myAssigned = new QComboBox( false, parentWidget );
+  myAssigned->insertItem( "" );
+  QStringList::const_iterator anIt = lst.begin(), aLast = lst.end();
+  for( ; anIt!=aLast; anIt++ )
+    myAssigned->insertItem( *anIt );
+  myAssigned->setEnabled( false );
  
   connect( myAutoCheck, SIGNAL( clicked() ),       this, SLOT( onAutoChanged() ) );
   connect( myColorBtn,  SIGNAL( clicked() ),       this, SLOT( onColorChanged() ) );
@@ -738,3 +773,14 @@ void VisuGUI_ItemContainer::onHVToggled( bool on )
     emit verToggled( on );
   }
 }
+
+/*!
+  \return index of assigned row (0, if there is no assigned row)
+*/
+int VisuGUI_ItemContainer::assigned() const
+{
+  if( isVerticalOn() )
+    return myAssigned->currentItem()-1;
+  else
+    return -1;
+}
index dd8a0f9d5d6ef50fbe8c02d0b15d2143ab23ea9a..234a28704cdf406af6e00aa7dfa69e76c0244e4d 100644 (file)
@@ -54,7 +54,7 @@ public:
   ~VisuGUI_SetupPlot2dDlg();
 
   void getCurves( QPtrList<Plot2d_Curve>& container );
-  void getCurvesSource( int& horIndex, QValueList<int>& verIndexes );
+  void getCurvesSource( int& horIndex, QValueList<int>& verIndexes, QValueList<int>& zIndexes );
   bool getCurveAttributes( const int vIndex, bool& isAuto, int& marker, int& line, int& lineWidth, QColor& color);
 
 private:
@@ -83,7 +83,7 @@ class VisuGUI_ItemContainer : public QObject
 public:
   VisuGUI_ItemContainer( QObject* parent = 0, const char* name = 0 );
   
-  void   createWidgets( QWidget* parentWidget );
+  void   createWidgets( QWidget* parentWidget, const QStringList& );
   void   enableWidgets( bool enable );
 
   void   setHorizontalOn( bool on );
@@ -99,6 +99,7 @@ public:
   int    getMarker() const;
   void   setColor( const QColor& color );
   QColor getColor() const;
+  int    assigned() const;
 
 protected:
   void   updateState();
@@ -122,7 +123,7 @@ public:
   QCheckBox*            myAutoCheck;
   QComboBox*            myLineCombo;
   QSpinBox*             myLineSpin;
-  QComboBox*            myMarkerCombo;
+  QComboBox*            myMarkerCombo, *myAssigned;
   QToolButton*          myColorBtn;
 };
 
index 11f1c6545f2050c2f801498c300560092aee8223..f9ea32df126fa8ad8b97be5e44f3dd72cec0fd02 100644 (file)
@@ -825,9 +825,10 @@ namespace VISU
         plotCurve->setVerUnits( theCurve->GetVerUnits().c_str() );
         double* xList = 0;
         double* yList = 0;
-        int     nbPoints = theCurve->GetData( xList, yList );
+       QStringList zList;
+        int     nbPoints = theCurve->GetData( xList, yList, zList );
         if ( nbPoints > 0 && xList && yList ) {
-          plotCurve->setData( xList, yList, nbPoints );
+          plotCurve->setData( xList, yList, nbPoints, zList );
         }
         if ( !theCurve->IsAuto() ) {
           plotCurve->setLine( (Plot2d_Curve::LineType)theCurve->GetLine(), theCurve->GetLineWidth() );
index 2a97ac829b095dd75e698b07a1d56739f681f951..a2e810a8711ee7edd5f21ea816b754ad72c08421 100644 (file)
@@ -967,11 +967,19 @@ namespace VISU
         case VISU::TCURVE:
           if(Curve_i* aServant = dynamic_cast<Curve_i*>(GetServant(anObj).in()))
           {
-           theStr << thePrefix << "aName2ObjectMap['" << aName << "'] = visu.CreateCurve(" <<
+           bool withZ = aServant->GetZRow()>0;
+             
+           theStr << thePrefix << "aName2ObjectMap['" << aName << "'] = visu.CreateCurve";
+           if( withZ )
+             theStr << "WithZ";
+           theStr << "(" <<
               theArgumentName<< // table
                 ","<<aServant->GetHRow()<< // H row
-                  ","<<aServant->GetVRow()<< // V row
-                    ",'"<<aServant->GetTitle()<<"'"; // title
+                  ","<<aServant->GetVRow(); // V row
+           if( withZ )
+             theStr << "," << aServant->GetZRow(); // Z row
+
+           theStr << ",'"<<aServant->GetTitle()<<"'"; // title
            SALOMEDS::Color aColor = aServant->GetColor();
            theStr << ",SALOMEDS.Color("<<
              aColor.R<<","<<aColor.G<<","<<aColor.B<<")"; // color
index 8823e2f61099888aa94d21be00247b9f92a6eb55..98b81da56ffc00e3f094eebd174eb997cf104708 100644 (file)
@@ -845,13 +845,21 @@ namespace VISU
   Curve_ptr VISU_Gen_i::CreateCurve(Table_ptr theTable,
                                    CORBA::Long theHRow,
                                    CORBA::Long theVRow)
+  {
+    return CreateCurveWithZ( theTable, theHRow, theVRow, 0 );
+  }
+
+  Curve_ptr VISU_Gen_i::CreateCurveWithZ(Table_ptr theTable,
+                                   CORBA::Long theHRow,
+                                   CORBA::Long theVRow,
+                                   CORBA::Long theZRow)
   {
     if(myStudyDocument->GetProperties()->IsLocked())
       return Curve::_nil();
     Mutex mt(myMutex);
     PortableServer::POA_ptr aPOA = GetPOA();
     Table_i* pTable = dynamic_cast<Table_i*>(aPOA->reference_to_servant(theTable));
-    Curve_i* pPresent = new Curve_i(myStudyDocument,pTable,theHRow,theVRow);
+    Curve_i* pPresent = new Curve_i(myStudyDocument,pTable,theHRow,theVRow,theZRow);
     if(pPresent->Create() != NULL)
       return pPresent->_this();
     else{
index 1a90cd8e2b660a2fc063f644419156077433b6b5..1a5f6f8282b3f9c9cfb40f77187be3f05eb0bb22 100644 (file)
@@ -285,6 +285,12 @@ namespace VISU
     CreateCurve(Table_ptr theTable, 
                CORBA::Long theHRow, 
                CORBA::Long theVRow);
+    virtual
+    Curve_ptr
+    CreateCurveWithZ(Table_ptr theTable, 
+               CORBA::Long theHRow, 
+               CORBA::Long theVRow,
+               CORBA::Long theZRow);
 
     virtual
     Container_ptr 
index 4713feda4ef26700f8578bd94ce48c4731c4aa79..cb64212609ee4b554372f319d359d7218639816f 100644 (file)
@@ -329,8 +329,11 @@ const char* VISU::Curve_i::GetComment() const
   Constructor
   NB : theHRow, theVRow are the indexes of rows in the Table object and numbered from the 1 to GetNbRows()
 */
-VISU::Curve_i::Curve_i(SALOMEDS::Study_ptr theStudy, Table_i* theTable, CORBA::Long theHRow, CORBA::Long theVRow )
-     : PrsObject_i(theStudy), myTable( theTable ), myHRow( theHRow ), myVRow( theVRow )
+VISU::Curve_i::Curve_i( SALOMEDS::Study_ptr theStudy, Table_i* theTable,
+                       CORBA::Long theHRow, CORBA::Long theVRow,
+                       CORBA::Long theZRow )
+: PrsObject_i(theStudy), myTable( theTable ), myHRow( theHRow ),
+  myVRow( theVRow ), myZRow( theZRow )
 {
   myAuto = true;
   myLine = VISU::Curve::SOLIDLINE;
@@ -533,7 +536,7 @@ string VISU::Curve_i::GetVerUnits()
 /*!
   Gets curve data
 */
-int VISU::Curve_i::GetData( double*& theHorList, double*& theVerList )
+int VISU::Curve_i::GetData( double*& theHorList, double*& theVerList, QStringList& zList )
 {
   theHorList = 0; theVerList = 0;
   // getting table SObject by it's entry
@@ -542,10 +545,13 @@ int VISU::Curve_i::GetData( double*& theHorList, double*& theVerList )
   SALOMEDS::GenericAttribute_var        anAttr;
   SALOMEDS::AttributeTableOfInteger_var anInt;
   SALOMEDS::AttributeTableOfReal_var    aReal;
+
+  QString tip = "%1: %2", z_data;
+
   if ( !SO->_is_nil() ) {
     if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfInteger" ) ) {
       anInt = SALOMEDS::AttributeTableOfInteger::_narrow( anAttr );
-      int nbCols = anInt->GetNbColumns() ;
+      int nbCols = anInt->GetNbColumns(), nbRows = anInt->GetNbRows();
       if ( nbCols > 0 && myHRow > 0 && myHRow <= anInt->GetNbRows() && myVRow > 0 && myVRow <= anInt->GetNbRows() ) {
        int nbPoints = 0;
        for ( int j = 1; j <= nbCols; j++ ) {
@@ -556,10 +562,24 @@ int VISU::Curve_i::GetData( double*& theHorList, double*& theVerList )
          theHorList = new double[ nbPoints ];
          theVerList = new double[ nbPoints ];
          int k = 0;
+
+         SALOMEDS::StringSeq_var rowTitles = anInt->GetRowTitles();
+
          for ( int j = 1; j <= nbCols; j++ ) {
            if ( anInt->HasValue( myHRow, j ) && anInt->HasValue( myVRow, j ) ) {
              theHorList[k] = anInt->GetValue( myHRow, j );
              theVerList[k] = anInt->GetValue( myVRow, j );
+
+             z_data = tip.arg( GetHorTitle().c_str() ).arg( theHorList[k] ) + "\n";
+             z_data += tip.arg( GetVerTitle().c_str() ).arg( theVerList[k] );
+
+             if( myZRow>0 && myZRow<=nbRows && anInt->HasValue( myZRow, j ) )
+             {
+               string title;
+               title = rowTitles[ myZRow-1 ];
+               z_data += "\n" + tip.arg( title.c_str() ).arg( anInt->GetValue( myZRow, j ) );
+             }
+             zList.append( z_data );
              k++;
            }
          }
@@ -569,7 +589,7 @@ int VISU::Curve_i::GetData( double*& theHorList, double*& theVerList )
     }
     else if ( Builder->FindAttribute( SO, anAttr, "AttributeTableOfReal" ) ) {
       aReal = SALOMEDS::AttributeTableOfReal::_narrow( anAttr );
-      int nbCols = aReal->GetNbColumns() ;
+      int nbCols = aReal->GetNbColumns(), nbRows = aReal->GetNbRows();
       if ( nbCols > 0 && myHRow > 0 && myHRow <= aReal->GetNbRows() && myVRow > 0 && myVRow <= aReal->GetNbRows() ) {
        int nbPoints = 0;
        for ( int j = 1; j <= nbCols; j++ ) {
@@ -580,10 +600,24 @@ int VISU::Curve_i::GetData( double*& theHorList, double*& theVerList )
          theHorList = new double[ nbPoints ];
          theVerList = new double[ nbPoints ];
          int k = 0;
+
+         SALOMEDS::StringSeq_var rowTitles = aReal->GetRowTitles();
+
          for ( int j = 1; j <= nbCols; j++ ) {
            if ( aReal->HasValue( myHRow, j ) && aReal->HasValue( myVRow, j ) ) {
              theHorList[k] = aReal->GetValue( myHRow, j );
              theVerList[k] = aReal->GetValue( myVRow, j );
+
+             z_data = tip.arg( GetHorTitle().c_str() ).arg( theHorList[k] ) + "\n";
+             z_data += tip.arg( GetVerTitle().c_str() ).arg( theVerList[k] );
+
+             if( myZRow>0 && myZRow<=nbRows && aReal->HasValue( myZRow, j ) )
+             {
+               string title;
+               title = rowTitles[ myZRow-1 ];
+               z_data += "\n" + tip.arg( title.c_str() ).arg( aReal->GetValue( myZRow, j ) );
+             }
+             zList.append( z_data );
              k++;
            }
          }
@@ -611,9 +645,10 @@ SPlot2d_Curve* VISU::Curve_i::CreatePresentation()
   crv->setVerUnits( GetVerUnits().c_str() );
   double* xList = 0;
   double* yList = 0;
-  int     nbPoints = GetData( xList, yList );
+  QStringList zList;
+  int     nbPoints = GetData( xList, yList, zList );
   if ( nbPoints > 0 && xList && yList ) {
-    crv->setData( xList, yList, nbPoints );
+    crv->setData( xList, yList, nbPoints, zList );
   }
   //cout << "********** Number of points: " << nbPoints <<endl;
   //for ( int i =0 ; i < nbPoints; i++ ) {
@@ -639,6 +674,10 @@ VISU::Storable* VISU::Curve_i::Restore( const Storable::TRestoringMap& theMap, S
   myName = VISU::Storable::FindValue(theMap,"myName").latin1();
   myHRow = VISU::Storable::FindValue(theMap,"myHRow").toInt();
   myVRow = VISU::Storable::FindValue(theMap,"myVRow").toInt();
+  bool ok = false;
+  QString z_str = VISU::Storable::FindValue(theMap,"myZRow", &ok);
+  myZRow = ok ? z_str.toInt() : 0;
+
   myColor.R = VISU::Storable::FindValue(theMap,"myColor.R").toDouble();
   myColor.G = VISU::Storable::FindValue(theMap,"myColor.G").toDouble();
   myColor.B = VISU::Storable::FindValue(theMap,"myColor.B").toDouble();
@@ -656,6 +695,7 @@ void VISU::Curve_i::ToStream( std::ostringstream& theStr )
   Storable::DataToStream( theStr, "myName",      myName.c_str() );
   Storable::DataToStream( theStr, "myHRow",      myHRow );
   Storable::DataToStream( theStr, "myVRow",      myVRow );
+  Storable::DataToStream( theStr, "myZRow",      myZRow );
   Storable::DataToStream( theStr, "myColor.R",   myColor.R );
   Storable::DataToStream( theStr, "myColor.G",   myColor.G );
   Storable::DataToStream( theStr, "myColor.B",   myColor.B );
@@ -679,7 +719,7 @@ VISU::Storable* VISU::Curve_i::Restore(SALOMEDS::SObject_ptr theSObject,
   SALOMEDS::Study_var aStudy = theSObject->GetStudy();
   VISU::Table_i* pTable = GetTable(aStudy, theSObject->GetFather());
   if( pTable != NULL ) {
-    VISU::Curve_i* pResent = new VISU::Curve_i( aStudy, pTable, 0, 0 );
+    VISU::Curve_i* pResent = new VISU::Curve_i( aStudy, pTable, 0, 0, 0 );
     return pResent->Restore( theMap, theSObject);
   }
   return NULL;
index 80d2a11f5725c1f0f9a333bfcc1482128bc07120..ceb9eade3172660c028f0d02119f6f31c3249151 100644 (file)
@@ -91,7 +91,8 @@ namespace VISU{
     Curve_i();
     Curve_i( const Curve_i& );
   public:
-    Curve_i( SALOMEDS::Study_ptr theStudy, Table_i* theTable, CORBA::Long theHRow, CORBA::Long theVRow );
+    Curve_i( SALOMEDS::Study_ptr theStudy, Table_i* theTable,
+            CORBA::Long theHRow, CORBA::Long theVRow, CORBA::Long theZRow );
     virtual ~Curve_i();
     virtual VISU::VISUType GetType() { return VISU::TCURVE;};
 
@@ -120,6 +121,7 @@ namespace VISU{
     Table_i*                myTable;
     int                     myHRow;
     int                     myVRow;
+    int                     myZRow;
     struct SALOMEDS::Color  myColor;
     VISU::Curve::MarkerType myMarker;
     VISU::Curve::LineType   myLine;
@@ -133,6 +135,7 @@ namespace VISU{
 
     int GetHRow() const { return myHRow;}
     int GetVRow() const { return myVRow;}
+    int GetZRow() const { return myZRow;}
 
     virtual Storable* Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr theSO);
 
@@ -152,7 +155,7 @@ namespace VISU{
     virtual std::string GetVerTitle();
     virtual std::string GetHorUnits();
     virtual std::string GetVerUnits();
-    virtual int    GetData( double*& theHorList, double*& theVerList );
+    virtual int GetData( double*& theHorList, double*& theVerList, QStringList& );
 
     virtual SPlot2d_Curve* CreatePresentation();
   };
index 29c69d215329ec00af4c72e545299389e48626fb..cb6425f49db1ecf6c4f9ca6ef8a32aca6a1eff5c 100644 (file)
@@ -360,9 +360,10 @@ namespace VISU {
            aSPlot2dC->setVerUnits( theCurve->GetVerUnits().c_str() );
            double* xList = 0;
            double* yList = 0;
-           int     nbPoints = theCurve->GetData( xList, yList );
+           QStringList zList;
+           int     nbPoints = theCurve->GetData( xList, yList, zList );
            if (nbPoints > 0 && xList && yList) {
-             aSPlot2dC->setData( xList, yList, nbPoints );
+             aSPlot2dC->setData( xList, yList, nbPoints, zList );
            }
            if (!theCurve->IsAuto()) {
              aSPlot2dC->setLine((Plot2d_Curve::LineType)theCurve->GetLine(),
@@ -408,9 +409,10 @@ namespace VISU {
            aSPlot2dC->setVerUnits( theCurve->GetVerUnits().c_str() );
            double* xList = 0;
            double* yList = 0;
-           int     nbPoints = theCurve->GetData( xList, yList );
+           QStringList zList;
+           int     nbPoints = theCurve->GetData( xList, yList, zList );
            if ( nbPoints > 0 && xList && yList ) {
-             aSPlot2dC->setData( xList, yList, nbPoints );
+             aSPlot2dC->setData( xList, yList, nbPoints, zList );
            }
            if ( !theCurve->IsAuto() ) {
              aSPlot2dC->setLine((Plot2d_Curve::LineType)theCurve->GetLine(), theCurve->GetLineWidth());