Salome HOME
Implementation of the "21384: [CEA 508] Plot2d Allow user to rescale curve" isuue.
authorana <ana@opencascade.com>
Wed, 26 Oct 2011 12:16:10 +0000 (12:16 +0000)
committerana <ana@opencascade.com>
Wed, 26 Oct 2011 12:16:10 +0000 (12:16 +0000)
src/VISU_I/VISU_Table_i.cc
src/VISU_I/VISU_Table_i.hh
src/VISU_I/VISU_Tools.cxx
src/VISU_I/VISU_ViewManager_i.cc

index 66c975816ed7a545acc440c18a2ac4267786d698..852f1404f43824c7c06d2706bbb1707429d0945d 100644 (file)
@@ -520,6 +520,7 @@ VISU::Curve_i::Curve_i( SALOMEDS::Study_ptr theStudy, Table_i* theTable,
   myLineWidth = 0;
   myMarker = VISU::Curve::CIRCLE;
   myColor.R = 0.0; myColor.G = 0.0; myColor.B = 0.0;
+  myScale = 1.0;
 }
 /*!
   Destructor
@@ -605,6 +606,31 @@ VISU::Curve_i
   return myLineWidth;
 }
 
+//----------------------------------------------------------------------------
+void 
+VISU::Curve_i
+::SetScale( CORBA::Double theCoef )
+{
+  myScale = theCoef;  
+  UpdatePlot2d( this, eUpdateData );
+}
+
+//----------------------------------------------------------------------------
+CORBA::Double 
+VISU::Curve_i
+::GetScale()
+{
+  return myScale;    
+}
+
+//----------------------------------------------------------------------------
+void 
+VISU::Curve_i
+::RemoveScale()
+{
+  SetScale( 1.0 );
+}
+
 //----------------------------------------------------------------------------
 /*!
   Creates curve object
@@ -952,6 +978,8 @@ VISU::Storable* VISU::Curve_i::Restore( const Storable::TRestoringMap& theMap, S
   QString v2_str = VISU::Storable::FindValue(theMap,"myIsV2", &ok);
   myIsV2 = ok ? v2_str.toInt() : false;
 
+  QString scale_str = VISU::Storable::FindValue(theMap,"myScale", &ok);
+  myScale = ok ? scale_str.toDouble() : 1.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();
@@ -971,6 +999,7 @@ void VISU::Curve_i::ToStream( std::ostringstream& theStr )
   Storable::DataToStream( theStr, "myVRow",      myVRow );
   Storable::DataToStream( theStr, "myZRow",      myZRow );
   Storable::DataToStream( theStr, "myIsV2",      myIsV2 );
+  Storable::DataToStream( theStr, "myScale",     myScale );
   Storable::DataToStream( theStr, "myColor.R",   myColor.R );
   Storable::DataToStream( theStr, "myColor.G",   myColor.G );
   Storable::DataToStream( theStr, "myColor.B",   myColor.B );
index 29a30b9ced8a01cf6834848f6747137039795037..c187a450b6b06f1278440c42d2287ac6854ceb0d 100644 (file)
@@ -125,6 +125,10 @@ namespace VISU{
     virtual VISU::Curve::LineType GetLine();
     virtual CORBA::Long GetLineWidth();
 
+    virtual void SetScale( CORBA::Double theCoef );
+    virtual CORBA::Double GetScale();
+    virtual void RemoveScale();
+
     virtual void addContainer(const QString& id);
     virtual void removeContainer(const QString& id);
     virtual ContainerSet getContainers() const;
@@ -142,6 +146,7 @@ namespace VISU{
     int                     myVRow;
     int                     myZRow;
     bool                    myIsV2;
+    double                  myScale;
     struct SALOMEDS::Color  myColor;
     VISU::Curve::MarkerType myMarker;
     VISU::Curve::LineType   myLine;
index 2b9e98a4e9765ee53b689aa0592c0f3d26c4242b..f1eb06395510022f27ee61c0d1404ee1f8eec5fe 100644 (file)
@@ -64,6 +64,7 @@ namespace VISU
         plotCurve->setVerTitle( theCurve->GetName().c_str() );
         plotCurve->setHorUnits( theCurve->GetHorUnits().c_str() );
         plotCurve->setVerUnits( theCurve->GetVerUnits().c_str() );
+       plotCurve->setScale( theCurve->GetScale() );
         double* xList = 0;
         double* yList = 0;
         QStringList zList;
index cf3594506005594805999603678206add7621c3b..d87a546c31da2ba776899e33cc992b6c8bfc8f0a 100644 (file)
@@ -439,6 +439,7 @@ namespace VISU {
               !strcmp(theCurve->GetEntry().c_str(), aSPlot2dC->getIO()->getEntry())) {
             if (theDisplaying == eUpdateData) {
               if(MYDEBUG) MESSAGE("UpdatePlot2d - updating data : curve - " << aSPlot2dC);
+              aSPlot2dC->setScale(theCurve->GetScale());
             }
             else {
               if(MYDEBUG) MESSAGE("UpdatePlot2d - displaying : curve - " << aSPlot2dC);