]> Creatis software - creaMaracasVisu.git/blobdiff - bbtk/src/bbmaracasvisuPlotterView.cxx
#
[creaMaracasVisu.git] / bbtk / src / bbmaracasvisuPlotterView.cxx
index 4f3f520e30a41024dd055f07aaf02bec1cc20c5d..f48e2d26e0b18cad2d3e9eb269b551935b532b24 100644 (file)
@@ -39,13 +39,13 @@ BBTK_BLACK_BOX_IMPLEMENTATION(PlotterView,bbtk::WxBlackBox);
 //---------------------------------------------------
 void PlotterView::Process()
 {
-                       
-       if (bbGetInputInX().size()==bbGetInputInY().size() ) {
 
+       double lim=1;
+
+       if (bbGetInputInX().size()==bbGetInputInY().size() ) 
+    {
                pGraphicalFunction *pGF  = mwxwidget->getFunction(0);
                pGraphicalFunction *pGF2 = mwxwidget->getFunction(1);
-
-
        // EED 2020-01-22
                if (pGF!=NULL)  
                { 
@@ -80,14 +80,10 @@ void PlotterView::Process()
                        mwxwidget->deleteFunction(pGF2); 
                        pGF2=NULL; 
                }
-
-
-               
                        if ( (bbGetInputInY().size()!=0) && (pGF==NULL) )               
                        {
                                // avoid 'taking address of temporary '
                                //pGraphicalFunction *pGF = mwxwidget->getFunctionForVectors( &(bbGetInputInX()), &(bbGetInputInY()) ); // taking address of temporary ! JPRx
-                       
                                std::vector<double> inX;
                                if (bbGetInputInX().size()==0)
                                {
@@ -100,16 +96,28 @@ void PlotterView::Process()
                                        inX = bbGetInputInX();
                                } // if bbGetInputInX
                                std::vector<double> inY = bbGetInputInY();
-                        
-                               pGF = mwxwidget->getFunctionForVectors( &inX, &inY ); 
-                               mwxwidget->addFunction(pGF);            
+
+                               bool ok=false;
+                               int i, size = inY.size();
+                               for ( i=0 ; i<size ; i++ )
+                               {       
+                                       if ((inY[i]>-lim) && (inY[i]<lim)) { inY[i]=0; } 
+                                       if ((inY[i]<-lim) || (inY[i]>lim)) {ok=true;}
+                               }// for
+                               if (ok==true) 
+                               {
+                                       pGF = mwxwidget->getFunctionForVectors( &inX, &inY ); 
+                                       mwxwidget->addFunction(pGF);            
+                               } else {
+                                       printf("EED Warnning!!  PlotterView::Process   function y with CEROS  ????..... \n");
+                               } // if ok
+
                        } // if bbGetInputInY
 
-                       if ((bbGetInputInY2().size()!=0)&& (pGF2==NULL)         )
+                       if ((bbGetInputInY2().size()!=0)&& (pGF2==NULL) )
                        {
                                // avoid 'taking address of temporary '
                                //pGraphicalFunction *pGF = mwxwidget->getFunctionForVectors( &(bbGetInputInX()), &(bbGetInputInY()) ); // taking address of temporary ! JPRx
-                       
                                std::vector<double> inX2;
                                if (bbGetInputInX().size()==0)
                                {
@@ -121,11 +129,25 @@ void PlotterView::Process()
                                } else {
                                        inX2 = bbGetInputInX();
                                } // if bbGetInputInX
-                               std::vector<double> inY2 = bbGetInputInY();
-                               pGF2 = mwxwidget->getFunctionForVectors( &inX2, &inY2 ); 
-                               mwxwidget->addFunction(pGF2);           
+                               std::vector<double> inY2 = bbGetInputInY2();
+
+                               bool ok2=false;
+                               int i, size = inY2.size();
+                               for ( i=0 ; i<size ; i++ )
+                               {       
+                                       if ((inY2[i]>-lim) && (inY2[i]<lim)) { inY2[i]=0; } 
+                                       if ((inY2[i]<-lim) || (inY2[i]>lim)) {ok2=true;}
+                               }// for
+                               if (ok2==true) 
+                               {
+                                       pGF2 = mwxwidget->getFunctionForVectors( &inX2, &inY2 ); 
+                                       mwxwidget->addFunction(pGF2);           
+                               } else {
+                                       printf("EED Warnning!!  PlotterView::Process   function y2 with CEROS  ????..... \n");
+                               } // if ok2
+
+
                        } // if bbGetInputInY
-                       
                
        /* EED 2020-01-22
 
@@ -180,13 +202,10 @@ void PlotterView::Process()
                        }  // for       
                }// if pGF
        */
-
                mwxwidget->UpdateAll();
-
        } else {
                printf("EED Warnning... PlotterView::Process()   Size of vecto X and Y is not coherent.\n");
        } // InX.size InY.size
-
 }