]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Issue 0020665: [CEA 388] VISU2D :: right Y axis V5_1_main_20100401 V5_1_main_20100402
authorouv <ouv@opencascade.com>
Wed, 31 Mar 2010 08:00:36 +0000 (08:00 +0000)
committerouv <ouv@opencascade.com>
Wed, 31 Mar 2010 08:00:36 +0000 (08:00 +0000)
18 files changed:
doc/salome/gui/VISU/images/axis_bottom_left.png [new file with mode: 0644]
doc/salome/gui/VISU/images/axis_bottom_right.png [new file with mode: 0644]
doc/salome/gui/VISU/images/createcurves.png
doc/salome/gui/VISU/input/creating_curves.doc
idl/VISU_Gen.idl
src/ENGINE/VISU_Engine_i.cc
src/ENGINE/VISU_Engine_i.hh
src/VISUGUI/VisuGUI.cxx
src/VISUGUI/VisuGUI_SetupPlot2dDlg.cxx
src/VISUGUI/VisuGUI_SetupPlot2dDlg.h
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_SWIG/Makefile.am
src/VISU_SWIG/VISU_Example_09.py [new file with mode: 0644]
src/VISU_SWIG/visu.py

diff --git a/doc/salome/gui/VISU/images/axis_bottom_left.png b/doc/salome/gui/VISU/images/axis_bottom_left.png
new file mode 100644 (file)
index 0000000..97a9a27
Binary files /dev/null and b/doc/salome/gui/VISU/images/axis_bottom_left.png differ
diff --git a/doc/salome/gui/VISU/images/axis_bottom_right.png b/doc/salome/gui/VISU/images/axis_bottom_right.png
new file mode 100644 (file)
index 0000000..a7d1f15
Binary files /dev/null and b/doc/salome/gui/VISU/images/axis_bottom_right.png differ
index 20b93a3873fd2eda3e8b9f33149874f7126b37d5..6ae91d76dc3d6376a32249ccd93b722da2891998 100644 (file)
Binary files a/doc/salome/gui/VISU/images/createcurves.png and b/doc/salome/gui/VISU/images/createcurves.png differ
index 040eb240cf198ffda1fb4f6bdf8e05d9b8d84244..71c6d5d0d7e93cdcddf391a40b770de9f217f17c 100644 (file)
@@ -24,12 +24,22 @@ the data table by checking them in the \b Axis part of the dialog box:
 <ul>
 <li>\b H (horisontal) - the values of this column will correspond to
 X-coordinates of the curve.</li>
-<li>\b V (vertical) - the values of this column will correspond to
-Y-coordinates of the curve.</li>
+<li>\b V (vertical left) - the values of this column will correspond to
+Y-coordinates of the curve to be attached to the left vertical axis of
+the Plot2d viewer.</li>
+<li>\b V2 (vertical right) - the values of this column will correspond to
+Y-coordinates of the curve to be attached to the right vertical axis of
+the Plot2d viewer.</li>
+\note If there are several curves attached both to left and right
+vertical axes, they will be indicated by the following icons in the
+legend:
+\image html axis_bottom_left.png
+<br>
+\image html axis_bottom_right.png
 </ul>
 
 The column \b Assigned allows to represent the values assigned to the
-points of the curve (possible for V-rows only). Any row, even
+points of the curve (possible for V- and V2-rows only). Any row, even
 coinciding with the current or empty (no values assigned), can be
 represented. All values are indicated with tool tips over the
 corresponding curve points in the Plot2d viewer.
index c5e40f34a57569514a0d6d50c3a18f4b3399413c..544dad9b402d430a24b836801c5ee6d4aac5bdbc 100644 (file)
@@ -2478,8 +2478,8 @@ module VISU {
     /*!
      * Creates a curve on the basis of points, whose values are taken from the table.
      * \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 theHRow   Index of the row in the table: abscissa of the point.
+     * \param theVRow   Index of the row in the table: ordinate of the point.
      */
     Curve CreateCurve(in Table theTable, in long theHRow, in long theVRow);
     
@@ -2487,12 +2487,25 @@ module VISU {
      * 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).
+     * \param theHRow   Index of the row in the table: abscissa of the point.
+     * \param theVRow   Index of the row in the table: ordinate of the point.
+     * \param theZRow   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 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.
+     * The curve can be displayed using right axis of Plot2d view.
+     * \param theTable  Table containing the data for construction of curves.
+     * \param theHRow   Index of the row in the table: abscissa of the point.
+     * \param theVRow   Index of the row in the table: ordinate of the point.
+     * \param theZRow   Index of the row in the table: assigned value (so-called as Z).
+     * \param theIsV2   Flag allowed to display the curve using right axis of Plot2d view.
+     */    
+    Curve CreateCurveWithZExt( in Table theTable, in long theHRow, in long theVRow, in long theZRow,
+                               in boolean theIsV2 );
+
     /*!
      * Creates a presentation form containing an array of references to the curves.
      */
index 291258e40f58685bd6b459b7f13eb2f6ae3ec84c..ef22469f1f51c8442b3feccc0e3471f26185e45e 100644 (file)
@@ -406,6 +406,14 @@ namespace VISU{
     return myVisuGen->CreateCurveWithZ(theTable,theHRow,theVRow,theZRow);
   }
 
+  Curve_ptr  VISU_Gen_i::CreateCurveWithZExt(Table_ptr theTable,
+                                             CORBA::Long theHRow,
+                                             CORBA::Long theVRow,
+                                             CORBA::Long theZRow,
+                                             CORBA::Boolean theIsV2)
+  {
+    return myVisuGen->CreateCurveWithZExt(theTable,theHRow,theVRow,theZRow,theIsV2);
+  }
 
   Container_ptr VISU_Gen_i::CreateContainer(){
     return myVisuGen->CreateContainer();
index ecf428c2a8cb32993a7120390fc875c456426c7b..d921aa3741c8e30de8409e12d5304835225e1a46 100644 (file)
@@ -188,6 +188,8 @@ namespace VISU
     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 Curve_ptr CreateCurveWithZExt(Table_ptr theTable, CORBA::Long theHRow, CORBA::Long theVRow, CORBA::Long theZRow,
+                                          CORBA::Boolean theIsV2);
     virtual Container_ptr CreateContainer();
     virtual Animation_ptr CreateAnimation(View3D_ptr theView3d);
     virtual Evolution_ptr CreateEvolution(XYPlot_ptr theXYPlot);
index 330f6317863a1c6673fe0f917375781eb5dcd0d7..febb52c145a519ce24c78727985237bd9bff942a 100644 (file)
@@ -1744,14 +1744,16 @@ VisuGUI
               // 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;
-              QList<int> verIndices, zIndices;
-              aDlg->getCurvesSource( horIndex, verIndices, zIndices );
+              QList<int> verIndices, ver1Indices, ver2Indices, zIndices;
+              aDlg->getCurvesSource( horIndex, ver1Indices, ver2Indices, zIndices );
+              verIndices = ver1Indices + ver2Indices;
               if( horIndex >= 0 && verIndices.count() > 0 ){
                 CORBA::Object_var aContainerObj = GetVisuGen(this)->CreateContainer();
                 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObj).in())){
                   for( int i = 0; i < verIndices.count(); i++ ){
+                    bool isV2 = ver2Indices.contains(verIndices[i]);
                     VISU::Curve_var aCurveObject =
-                      GetVisuGen(this)->CreateCurveWithZ(aTable->_this(), horIndex+1, verIndices[i]+1, zIndices[i]+1 );
+                      GetVisuGen(this)->CreateCurveWithZExt(aTable->_this(), horIndex+1, verIndices[i]+1, zIndices[i]+1, isV2 );
                     if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
                       bool isAuto;
                       int  marker, line, lineWidth;
@@ -1807,16 +1809,18 @@ VisuGUI
           // 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;
-          QList<int> verIndices, zIndices;
-          aDlg->getCurvesSource( horIndex, verIndices, zIndices );
+          QList<int> verIndices, ver1Indices, ver2Indices, zIndices;
+          aDlg->getCurvesSource( horIndex, verIndices, ver2Indices, zIndices );
+          verIndices = ver1Indices + ver2Indices;
           if ( horIndex >= 0 && verIndices.count() > 0 ) {
             VISU::Table_var aTableObject = GetVisuGen(this)->CreateTable(aSObject->GetID().c_str());
             if(!CORBA::is_nil(aTableObject)){
               VISU::Container_var aContainerObject = GetVisuGen(this)->CreateContainer();
               VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObject).in());
               for ( int i = 0; i < verIndices.count(); i++ ) {
-                VISU::Curve_var aCurveObject = GetVisuGen(this)->CreateCurveWithZ
-                  ( aTableObject, horIndex+1, verIndices[i]+1, zIndices[i]+1 );
+                bool isV2 = ver2Indices.contains(verIndices[i]);
+                VISU::Curve_var aCurveObject = GetVisuGen(this)->CreateCurveWithZExt
+                  ( aTableObject, horIndex+1, verIndices[i]+1, zIndices[i]+1, isV2 );
                 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
                   bool isAuto;
                   int  marker, line, lineWidth;
index a12fad46b8127b8ee893e717bb50760097262000..2ac7f56743093c46e1e75caae2548e6d647d78b7 100644 (file)
@@ -108,24 +108,24 @@ VisuGUI_SetupPlot2dDlg::VisuGUI_SetupPlot2dDlg( _PTR(SObject) object, QWidget* p
   labUnit->setFont( font );
   labAttr->setFont( font );
 
-  frameLayout->addWidget( labAxis, 0, 0, 1, 2 );
+  frameLayout->addWidget( labAxis, 0, 0, 1, 3 );
       lin = new QFrame( frame ); lin->setFrameStyle( QFrame::VLine | QFrame::Sunken );
-      frameLayout->addWidget( lin,          0,     2 );
+      frameLayout->addWidget( lin,          0,     3 );
 
-  frameLayout->addWidget( labAssigned,      0,     3 );
+  frameLayout->addWidget( labAssigned,      0,     4 );
       lin = new QFrame( frame ); lin->setFrameStyle( QFrame::VLine | QFrame::Sunken );
-      frameLayout->addWidget( lin,          0,     4 );
+      frameLayout->addWidget( lin,          0,     5 );
 
-  frameLayout->addWidget( labData,          0,     5 );
+  frameLayout->addWidget( labData,          0,     6 );
       lin = new QFrame( frame ); lin->setFrameStyle( QFrame::VLine | QFrame::Sunken );
-      frameLayout->addWidget( lin,          0,     6 );
-  frameLayout->addWidget( labUnit,          0,     7 );
+      frameLayout->addWidget( lin,          0,     7 );
+  frameLayout->addWidget( labUnit,          0,     8 );
       lin = new QFrame( frame ); lin->setFrameStyle( QFrame::VLine | QFrame::Sunken );
-      frameLayout->addWidget( lin,          0,     8 );
-  frameLayout->addWidget( labAttr, 0,  9, 1, 5 );
-  //frameLayout->setColStretch(               14, 5 );
+      frameLayout->addWidget( lin,          0,     9 );
+  frameLayout->addWidget( labAttr, 0, 10, 1, 5 );
+  //frameLayout->setColStretch(               15, 5 );
   lin = new QFrame( frame ); lin->setFrameStyle( QFrame::HLine | QFrame::Sunken );
-  frameLayout->addWidget( lin, 1, 0, 1, 15 );
+  frameLayout->addWidget( lin, 1, 0, 1, 16 );
 
   int row = 2;
   _PTR(GenericAttribute)        anAttr;
@@ -149,21 +149,23 @@ VisuGUI_SetupPlot2dDlg::VisuGUI_SetupPlot2dDlg( _PTR(SObject) object, QWidget* p
           item->createWidgets( frame, rows );
           frameLayout->addWidget( item->myHBtn,        row, 0 );
           frameLayout->addWidget( item->myVBtn,        row, 1 );
-          frameLayout->addWidget( item->myAssigned,    row, 3 );
+          frameLayout->addWidget( item->myV2Btn,       row, 2 );
+          frameLayout->addWidget( item->myAssigned,    row, 4 );
 
-          frameLayout->addWidget( item->myTitleLab,    row, 5 );
+          frameLayout->addWidget( item->myTitleLab,    row, 6 );
           if ( rowTitles.size() > 0 )
             item->myTitleLab->setText( QString( rowTitles[ i ].c_str() ) );
-          frameLayout->addWidget( item->myUnitLab,     row, 7 );
+          frameLayout->addWidget( item->myUnitLab,     row, 8 );
           if ( rowUnits.size() > 0 )
             item->myUnitLab->setText( QString( rowUnits[ i ].c_str() ) );
-          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 );
+          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 );
           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 );
           row++;
         }
@@ -190,21 +192,23 @@ VisuGUI_SetupPlot2dDlg::VisuGUI_SetupPlot2dDlg( _PTR(SObject) object, QWidget* p
           item->createWidgets( frame, rows );
           frameLayout->addWidget( item->myHBtn,        row, 0 );
           frameLayout->addWidget( item->myVBtn,        row, 1 );
-          frameLayout->addWidget( item->myAssigned,    row, 3 );
+          frameLayout->addWidget( item->myV2Btn,       row, 2 );
+          frameLayout->addWidget( item->myAssigned,    row, 4 );
 
-          frameLayout->addWidget( item->myTitleLab,    row, 5 );
+          frameLayout->addWidget( item->myTitleLab,    row, 6 );
           if ( rowTitles.size() > 0 )
             item->myTitleLab->setText( QString( rowTitles[ i ].c_str() ) );
-          frameLayout->addWidget( item->myUnitLab,     row, 7 );
+          frameLayout->addWidget( item->myUnitLab,     row, 8 );
           if ( rowUnits.size() > 0 )
             item->myUnitLab->setText( QString( rowUnits[ i ].c_str() ) );
-          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 );
+          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 );
           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 );
           row++;
         }
@@ -215,11 +219,11 @@ VisuGUI_SetupPlot2dDlg::VisuGUI_SetupPlot2dDlg( _PTR(SObject) object, QWidget* p
     }
   }
   lin = new QFrame( frame ); lin->setFrameStyle( QFrame::VLine | QFrame::Sunken );
-  frameLayout->addWidget( lin, 2, 2, row, 1 );
+  frameLayout->addWidget( lin, 2, 3, row, 1 );
   lin = new QFrame( frame ); lin->setFrameStyle( QFrame::VLine | QFrame::Sunken );
-  frameLayout->addWidget( lin, 2, 4, row, 1 );
+  frameLayout->addWidget( lin, 2, 5, row, 1 );
   lin = new QFrame( frame ); lin->setFrameStyle( QFrame::VLine | QFrame::Sunken );
-  frameLayout->addWidget( lin, 2, 6, row, 1 );
+  frameLayout->addWidget( lin, 2, 7, row, 1 );
   //frameLayout->setRowStretch( row+1, 5 );
 
   myView->setWidget( frame );
@@ -263,7 +267,7 @@ 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, QList<int>& verIndexes,
-                                              QList<int>& zIndices )
+                                              QList<int>& ver2Indexes, QList<int>& zIndices )
 {
   /* collecting horizontal and vertical axis items */
   horIndex = -1;
@@ -272,11 +276,15 @@ void VisuGUI_SetupPlot2dDlg::getCurvesSource( int& horIndex, QList<int>& verInde
     if ( myItems.at( i )->isHorizontalOn() ) {
       horIndex = i;
     }
-    else if ( myItems.at( i )->isVerticalOn() ) {
-      verIndexes.append( i );
+    else {
+      if ( myItems.at( i )->isVerticalOn() ) {
+        verIndexes.append( i );
+      }
+      else if ( myItems.at( i )->isVertical2On() ) {
+        ver2Indexes.append( i );
+      }
       zIndices.append( myItems.at( i )->assigned() );
     }
-    
   }
 }
 /*!
@@ -314,9 +322,9 @@ void VisuGUI_SetupPlot2dDlg::getCurves( QList<Plot2d_Curve*>& container )
   /* collecting horizontal and vertical axis items */
   int horIndex;
   int i, j;
-  QList<int> verIndex, zIndices;
-  getCurvesSource( horIndex, verIndex, zIndices );
-  if ( horIndex < 0 || verIndex.isEmpty() ) /* no curves can be created */
+  QList<int> verIndex, ver2Index, zIndices;
+  getCurvesSource( horIndex, verIndex, ver2Index, zIndices );
+  if ( horIndex < 0 || verIndex.isEmpty() && ver2Index.isEmpty() ) /* no curves can be created */
     return;
     
   /* Try table of integer */
@@ -484,6 +492,48 @@ void VisuGUI_SetupPlot2dDlg::onVBtnToggled( bool on )
   }
   enableControls();
 }
+/*!
+  Slot, called when any <V2> button is clicked
+*/
+void VisuGUI_SetupPlot2dDlg::onV2BtnToggled( bool on )
+{
+  VisuGUI_ItemContainer* item = ( VisuGUI_ItemContainer* )sender();
+  QList<VisuGUI_ItemContainer*> itemList;
+  //itemList.setAutoDelete( false );
+  item->myAssigned->setEnabled( on );
+  int i;
+  if ( on ) {
+    int totalOn = 0;
+    for ( i = 0; i < myItems.count(); i++ ) {
+      if ( myItems.at( i ) != item && !myItems.at( i )->isHorizontalOn() ) {
+        if ( myItems.at( i )->myUnitLab->text() == item->myUnitLab->text() ) {
+          if ( myItems.at( i )->isVertical2On() )
+            totalOn++;
+          else
+            itemList.append( myItems.at( i ) );
+        }
+        else {
+          myItems.at( i )->setVertical2On( false );
+        }
+      }
+    }
+    if ( totalOn == 0 && !itemList.isEmpty() && 
+         SUIT_MessageBox::information( this, 
+                                       this->windowTitle(), 
+                                       tr( "QUE_WANT_SAME_UNITS" ),
+                                       tr( "BUT_YES" ), 
+                                       tr( "BUT_NO" ), 
+                                       1, 1 ) == 0 )
+    {
+      for ( i = 0; i < itemList.count(); i++ ) {
+        itemList.at( i )->blockSignals( true );
+        itemList.at( i )->setVertical2On( true );
+        itemList.at( i )->blockSignals( false );
+      }
+    }
+  }
+  enableControls();
+}
 /*!
   Slot, called when <Help> button is clicked
 */
@@ -522,9 +572,10 @@ void VisuGUI_SetupPlot2dDlg::enableControls()
     }
   }
   for ( int i = 0; i < myItems.count(); i++ ) {
-    if ( myItems.at( i )->isVerticalOn() )
+    bool isVOn = myItems.at( i )->isVerticalOn() || myItems.at( i )->isVertical2On();
+    if ( isVOn )
       bVSet = true;
-    myItems.at( i )->enableWidgets( bHSet && myItems.at( i )->isVerticalOn() );
+    myItems.at( i )->enableWidgets( bHSet && isVOn );
   }
   myOkBtn->setEnabled( bHSet && bVSet );
 }
@@ -569,6 +620,11 @@ void VisuGUI_ItemContainer::createWidgets( QWidget* parentWidget, const QStringL
   myVBtn->setCheckable( true );
   myVBtn->setChecked( false );
   
+  myV2Btn = new QToolButton( parentWidget );
+  myV2Btn->setText( tr( "V2" ) );
+  myV2Btn->setCheckable( true );
+  myV2Btn->setChecked( false );
+  
   myTitleLab = new QLabel( parentWidget );
   myUnitLab  = new QLabel( parentWidget );
   myUnitLab->setAlignment( Qt::AlignCenter);
@@ -618,6 +674,7 @@ void VisuGUI_ItemContainer::createWidgets( QWidget* parentWidget, const QStringL
   //connect( myColorBtn,  SIGNAL( clicked() ),       this, SLOT( onColorChanged() ) );
   connect( myHBtn,      SIGNAL( toggled( bool ) ), this, SLOT( onHVToggled( bool ) ) );
   connect( myVBtn,      SIGNAL( toggled( bool ) ), this, SLOT( onHVToggled( bool ) ) );
+  connect( myV2Btn,     SIGNAL( toggled( bool ) ), this, SLOT( onHVToggled( bool ) ) );
   setColor( QColor( 0, 0, 0 ) );
   updateState();
 }
@@ -644,19 +701,33 @@ bool VisuGUI_ItemContainer::isHorizontalOn() const
   return myHBtn->isChecked();
 }
 /*!
-  Sets vertical button's state on
+  Sets first vertical button's state on
 */
 void VisuGUI_ItemContainer::setVerticalOn( bool on )
 {
   myVBtn->setChecked( on );
 }
 /*!
-  Gets vertical button's state
+  Gets first vertical button's state
 */
 bool VisuGUI_ItemContainer::isVerticalOn() const
 {
   return myVBtn->isChecked();
 }
+/*!
+  Sets second vertical button's state on
+*/
+void VisuGUI_ItemContainer::setVertical2On( bool on )
+{
+  myV2Btn->setChecked( on );
+}
+/*!
+  Gets second vertical button's state
+*/
+bool VisuGUI_ItemContainer::isVertical2On() const
+{
+  return myV2Btn->isChecked();
+}
 /*!
   Sets item AutoAssign flag state
 */
@@ -764,21 +835,46 @@ void VisuGUI_ItemContainer::onHVToggled( bool on )
       if ( myVBtn->isChecked() ) {
 //      blockSignals( true );
         myVBtn->setChecked( false );
+//      blockSignals( false );
+      }
+      else if ( myV2Btn->isChecked() ) {
+//      blockSignals( true );
+        myV2Btn->setChecked( false );
 //      blockSignals( false );
       }
     }
     emit horToggled( on );
   }
-  else {
+  else if ( snd == myVBtn ) {
     if ( on ) {
       if ( myHBtn->isChecked() ) {
 //      blockSignals( true );
         myHBtn->setChecked( false );
+//      blockSignals( false );
+      }
+      else if ( myV2Btn->isChecked() ) {
+//      blockSignals( true );
+        myV2Btn->setChecked( false );
 //      blockSignals( false );
       }
     }
     emit verToggled( on );
   }
+  else {
+    if ( on ) {
+      if ( myHBtn->isChecked() ) {
+//      blockSignals( true );
+        myHBtn->setChecked( false );
+//      blockSignals( false );
+      }
+      else if ( myVBtn->isChecked() ) {
+//      blockSignals( true );
+        myVBtn->setChecked( false );
+//      blockSignals( false );
+      }
+    }
+    emit ver2Toggled( on );
+  }
 }
 
 /*!
@@ -786,7 +882,7 @@ void VisuGUI_ItemContainer::onHVToggled( bool on )
 */
 int VisuGUI_ItemContainer::assigned() const
 {
-  if( isVerticalOn() )
+  if( isVerticalOn() || isVertical2On() )
     return myAssigned->currentIndex()-1;
   else
     return -1;
index 985c34f7c46c8ef19f7cb3f306f634df8c89f71e..d530402e7a990a994b9001c6a6999fdceb9f6752 100644 (file)
@@ -57,7 +57,7 @@ public:
   ~VisuGUI_SetupPlot2dDlg();
 
   void getCurves( QList<Plot2d_Curve*>& container );
-  void getCurvesSource( int& horIndex, QList<int>& verIndexes, QList<int>& zIndexes );
+  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);
 
 private:
@@ -66,6 +66,7 @@ private:
 private slots:
   void onHBtnToggled( bool );
   void onVBtnToggled( bool );
+  void onV2BtnToggled( bool );
   void onHelp();
   void enableControls();
 
@@ -93,6 +94,8 @@ public:
   bool   isHorizontalOn() const;
   void   setVerticalOn( bool on );
   bool   isVerticalOn() const;
+  void   setVertical2On( bool on );
+  bool   isVertical2On() const;
   bool   isAutoAssign() const;
   void   setAutoAssign( bool on );
   void   setLine( const int line, const int width );
@@ -111,6 +114,7 @@ signals:
   void   autoClicked();
   void   horToggled( bool );
   void   verToggled( bool );
+  void   ver2Toggled( bool );
 
 public slots:
   void   onAutoChanged();
@@ -121,6 +125,7 @@ public:
   bool                  myEnabled;
   QToolButton*          myHBtn;
   QToolButton*          myVBtn;
+  QToolButton*          myV2Btn;
   QLabel*               myTitleLab;
   QLabel*               myUnitLab;
   QCheckBox*            myAutoCheck;
index 6ef7dee1927a99f9b65862727c20e7bd70ab48bf..aafb1b5e6bc2c2b8ee51804140b42402e6fcdbfe 100644 (file)
@@ -1560,16 +1560,21 @@ namespace VISU
           if(Curve_i* aServant = dynamic_cast<Curve_i*>(GetServant(anObj).in()))
           {
            bool withZ = aServant->GetZRow()>0;
+            bool isV2 = aServant->GetIsV2();
              
            theStr << thePrefix << "aName2ObjectMap['" << aName << "'] = visu.CreateCurve";
-           if( withZ )
+           if( isV2 )
+             theStr << "WithZExt";
+           else if( withZ )
              theStr << "WithZ";
            theStr << "(" <<
               theArgumentName<< // table
-                ", "<<aServant->GetHRow()<< // H row
-                  ", "<<aServant->GetVRow(); // V row
-           if( withZ )
+              ", "<<aServant->GetHRow()<< // H row
+              ", "<<aServant->GetVRow(); // V row
+           if( withZ || isV2 )
              theStr << ", " << aServant->GetZRow(); // Z row
+           if( isV2 )
+             theStr << ", " << aServant->GetIsV2(); // right axis
 
            theStr << ", '"<<aServant->GetTitle()<<"'"; // title
            SALOMEDS::Color aColor = aServant->GetColor();
index 657ab889abc8359eb4996e6334b820048c2c88c0..c61da4cd59bdd125497a8ab82c3f68af66a5c561 100644 (file)
@@ -1435,7 +1435,7 @@ namespace VISU
                CORBA::Long theHRow,
                CORBA::Long theVRow)
   {
-    return CreateCurveWithZ( theTable, theHRow, theVRow, 0 );
+    return CreateCurveWithZExt( theTable, theHRow, theVRow, 0, false );
   }
 
 
@@ -1446,13 +1446,26 @@ namespace VISU
                     CORBA::Long theHRow,
                     CORBA::Long theVRow,
                     CORBA::Long theZRow)
+  {
+    return CreateCurveWithZExt( theTable, theHRow, theVRow, theZRow, false );
+  }
+
+
+  //---------------------------------------------------------------
+  Curve_ptr
+  VISU_Gen_i
+  ::CreateCurveWithZExt(Table_ptr theTable,
+                        CORBA::Long theHRow,
+                        CORBA::Long theVRow,
+                        CORBA::Long theZRow,
+                        CORBA::Boolean theIsV2)
   {
     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,theZRow);
+    Curve_i* pPresent = new Curve_i(myStudyDocument,pTable,theHRow,theVRow,theZRow,theIsV2);
     if(pPresent->Create() != NULL)
       return pPresent->_this();
     else{
@@ -1462,7 +1475,6 @@ namespace VISU
   }
 
 
-
   //---------------------------------------------------------------
   Container_ptr
   VISU_Gen_i
index 216f0601e7d4c15d455f9ec5ff0749fff43d85ba..b66db20a5622e2cf99b4cde6e89e0964ec481914 100644 (file)
@@ -273,12 +273,21 @@ 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);
+                     CORBA::Long theHRow, 
+                     CORBA::Long theVRow,
+                     CORBA::Long theZRow);
+
+    virtual
+    Curve_ptr
+    CreateCurveWithZExt(Table_ptr theTable, 
+                        CORBA::Long theHRow, 
+                        CORBA::Long theVRow,
+                        CORBA::Long theZRow,
+                        CORBA::Boolean theIsV2);
 
     virtual
     Container_ptr 
index bad23432ba71366cd278c2b38b637f2962db9e39..530704d8a9906e9b22a3d0b6cc0343587f377896 100644 (file)
@@ -388,9 +388,9 @@ const char* VISU::Curve_i::GetComment() const
 */
 VISU::Curve_i::Curve_i( SALOMEDS::Study_ptr theStudy, Table_i* theTable,
                        CORBA::Long theHRow, CORBA::Long theVRow,
-                       CORBA::Long theZRow )
+                       CORBA::Long theZRow, CORBA::Boolean theIsV2 )
 : PrsObject_i(theStudy), myTable( theTable ), myHRow( theHRow ),
-  myVRow( theVRow ), myZRow( theZRow )
+  myVRow( theVRow ), myZRow( theZRow ), myIsV2( theIsV2 )
 {
   myAuto = true;
   myLine = VISU::Curve::SOLIDLINE;
@@ -777,6 +777,7 @@ int VISU::Curve_i::GetData( double*& theHorList, double*& theVerList, QStringLis
 SPlot2d_Curve* VISU::Curve_i::CreatePresentation()
 {
   SPlot2d_Curve* crv = new SPlot2d_Curve();
+  crv->setYAxis( myIsV2 ? QwtPlot::yRight : QwtPlot::yLeft );
   crv->setHorTitle( GetHorTitle().c_str() );
   string tlt = GetTitle();
   if ( tlt.length() <= 0 )
@@ -821,6 +822,9 @@ VISU::Storable* VISU::Curve_i::Restore( const Storable::TRestoringMap& theMap, S
   bool ok = false;
   QString z_str = VISU::Storable::FindValue(theMap,"myZRow", &ok);
   myZRow = ok ? z_str.toInt() : 0;
+  ok = false;
+  QString v2_str = VISU::Storable::FindValue(theMap,"myIsV2", &ok);
+  myIsV2 = ok ? v2_str.toInt() : false;
 
   myColor.R = VISU::Storable::FindValue(theMap,"myColor.R").toDouble();
   myColor.G = VISU::Storable::FindValue(theMap,"myColor.G").toDouble();
@@ -840,6 +844,7 @@ void VISU::Curve_i::ToStream( std::ostringstream& theStr )
   Storable::DataToStream( theStr, "myHRow",      myHRow );
   Storable::DataToStream( theStr, "myVRow",      myVRow );
   Storable::DataToStream( theStr, "myZRow",      myZRow );
+  Storable::DataToStream( theStr, "myIsV2",      myIsV2 );
   Storable::DataToStream( theStr, "myColor.R",   myColor.R );
   Storable::DataToStream( theStr, "myColor.G",   myColor.G );
   Storable::DataToStream( theStr, "myColor.B",   myColor.B );
@@ -865,7 +870,7 @@ VISU::Storable* VISU::Curve_i::StorableEngine(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, 0 );
+    VISU::Curve_i* pResent = new VISU::Curve_i( aStudy, pTable, 0, 0, 0, false );
     return pResent->Restore( theMap, theSObject);
   }
   return NULL;
index 78c6776a0baad284834162fdf5f673a884636f1c..ca35887d428c4165a9db94e92737b5d7ef5148ef 100644 (file)
@@ -96,7 +96,8 @@ namespace VISU{
     Curve_i( const Curve_i& );
   public:
     Curve_i( SALOMEDS::Study_ptr theStudy, Table_i* theTable,
-            CORBA::Long theHRow, CORBA::Long theVRow, CORBA::Long theZRow );
+            CORBA::Long theHRow, CORBA::Long theVRow, CORBA::Long theZRow,
+             CORBA::Boolean theIsV2 );
     virtual ~Curve_i();
     virtual VISU::VISUType GetType() { return VISU::TCURVE;};
 
@@ -125,6 +126,7 @@ namespace VISU{
     int                     myHRow;
     int                     myVRow;
     int                     myZRow;
+    bool                    myIsV2;
     struct SALOMEDS::Color  myColor;
     VISU::Curve::MarkerType myMarker;
     VISU::Curve::LineType   myLine;
@@ -139,6 +141,7 @@ namespace VISU{
     int GetHRow() const { return myHRow;}
     int GetVRow() const { return myVRow;}
     int GetZRow() const { return myZRow;}
+    int GetIsV2() const { return myIsV2;}
 
     virtual Storable* Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr theSO);
 
index db0513ea011130879e78057acfa59258235a22cd..c093a2674eacfac3e669db848489526083a68a80 100644 (file)
@@ -63,7 +63,8 @@ dist_salomescript_DATA = batchmode_visu.py batchmode_visu_table.py batchmode_vis
        visu_succcessive_animation.py visu_apply_properties.py visu_apply_properties_successive.py \
        batchmode_visu_view.py visu_cache.py visu_pointmap3d.py visu_view3d_parameters.py visu_evolution.py \
        VISU_Example_01.py VISU_Example_02.py VISU_Example_03.py VISU_Example_04.py \
-       VISU_Example_05.py VISU_Example_06.py VISU_Example_07.py VISU_Example_08.py
+       VISU_Example_05.py VISU_Example_06.py VISU_Example_07.py VISU_Example_08.py \
+       VISU_Example_09.py
 
 nodist_salomescript_DATA = libVISU_Swig.py 
 
diff --git a/src/VISU_SWIG/VISU_Example_09.py b/src/VISU_SWIG/VISU_Example_09.py
new file mode 100644 (file)
index 0000000..8e58801
--- /dev/null
@@ -0,0 +1,89 @@
+#  -*- coding: iso-8859-1 -*-
+#  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+#  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+#  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Lesser General Public
+#  License as published by the Free Software Foundation; either
+#  version 2.1 of the License.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public
+#  License along with this library; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+#  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+# Displaying curves attached to different Y axes of Plot2d view
+#
+import salome
+import time
+import SALOMEDS
+import VISU
+
+sleep_delay = 1
+
+# >>> Getting study builder
+myStudy = salome.myStudy
+myBuilder = myStudy.NewBuilder()
+
+# >>> Getting (loading) VISU component
+myVisu = salome.lcc.FindOrLoadComponent("FactoryServer", "VISU")
+myComponent = myStudy.FindComponent("VISU")
+myVisu.SetCurrentStudy(myStudy)
+if not myComponent:
+   myComponent = myBuilder.NewComponent("VISU")
+   aName = myBuilder.FindOrCreateAttribute(myComponent, "AttributeName")
+   aName.SetValue( salome.sg.getComponentUserName("VISU") )
+
+   A2 = myBuilder.FindOrCreateAttribute(myComponent, "AttributePixMap");
+   aPixmap = A2._narrow(SALOMEDS.AttributePixMap);
+   aPixmap.SetPixMap( "ICON_OBJBROWSER_Visu" );
+   
+   myBuilder.DefineComponentInstance(myComponent,myVisu)
+
+# >>> Creating object with Table
+aTableObject = myBuilder.NewObject(myComponent)
+aTableName = myBuilder.FindOrCreateAttribute(aTableObject, "AttributeName")
+aTableName.SetValue("TestTable")
+aTable = myBuilder.FindOrCreateAttribute(aTableObject, "AttributeTableOfReal")
+
+aTable.AddRow([0,1,2,3,4,5,6,7,8,9,10])
+aTable.AddRow([2000,1900,1800,1700,1600,1500,1400,1300,1200,1100,1000])
+aTable.AddRow([1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.5,6.0])
+aTable.SetTitle("Test table")
+aTable.SetRowTitle(1,"Time")
+aTable.SetRowUnit(1,"s")
+aTable.SetRowTitle(2,"Mass")
+aTable.SetRowUnit(2,"kg")
+aTable.SetRowTitle(3,"Temperature")
+aTable.SetRowUnit(3,"K")
+
+# >>> Create table of integer
+aVisuTable = myVisu.CreateTable(aTableObject.GetID())
+
+# >>> Create curve attached to the left axis
+aCurve1 = myVisu.CreateCurveWithZExt(aVisuTable, 1, 2, 0, False)
+
+# >>> Create curve attached to the right axis
+aCurve2 = myVisu.CreateCurveWithZExt(aVisuTable, 1, 3, 1, True)
+
+# >>> Create container and insert curves
+aContainer = myVisu.CreateContainer()
+aContainer.AddCurve(aCurve1)
+aContainer.AddCurve(aCurve2)
+
+# >>> Create XY plot and display container
+myViewManager = myVisu.GetViewManager();
+myView = myViewManager.CreateXYPlot();
+myView.SetTitle("The viewer for curves")
+myView.Display(aContainer)
+
+# >>> Update Object Browser
+salome.sg.updateObjBrowser(1)
index 50a3aea739d6af62e8c3be54ce245eb3da19b658..ba3f2422cc2898de5b6cf5c2b11909c263592fa3 100644 (file)
@@ -1181,3 +1181,25 @@ def CreateCurve( theTable, theHRow, theVRow, theTitle, theColor, theMarker, theL
         curve.SetLine( theLineType, theLineWidth )
         pass
     return curve
+
+def CreateCurveWithZ( theTable, theHRow, theVRow, theZRow, theTitle, theColor, theMarker, theLineType, theLineWidth ):
+    if theTitle is None: return
+    curve = myLocalVisu.CreateCurveWithZ( theTable, theHRow, theVRow, theZRow );
+    if curve:
+        curve.SetTitle( theTitle )
+        curve.SetColor( theColor )
+        curve.SetMarker( theMarker )
+        curve.SetLine( theLineType, theLineWidth )
+        pass
+    return curve
+
+def CreateCurveWithZExt( theTable, theHRow, theVRow, theZRow, theIsV2, theTitle, theColor, theMarker, theLineType, theLineWidth ):
+    if theTitle is None: return
+    curve = myLocalVisu.CreateCurveWithZExt( theTable, theHRow, theVRow, theZRow, theIsV2 );
+    if curve:
+        curve.SetTitle( theTitle )
+        curve.SetColor( theColor )
+        curve.SetMarker( theMarker )
+        curve.SetLine( theLineType, theLineWidth )
+        pass
+    return curve