]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramWidget.cxx
BUG histogram
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / pPlotter / HistogramWidget.cxx
index 8466cdadf16b1e7d0f6b2c62c19b77e93e1761d1..affe13c876cbe3c28c0a631115771bc2ce2acfc8 100644 (file)
@@ -145,6 +145,7 @@ HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint
                        yValues[4]=0;
                        
                        pGraphicalFunction * tf = plotter ->getFunctionForVectors( xValues, 5, yValues, 5 ); 
+               printf("EED %p HistogramWidget::drawTransferenceFunction %p\n", this , tf);             
                        // Including and drawing the created function in the plotter
                        if (tf)
                        {
@@ -266,8 +267,12 @@ HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint
        */
        bool  HistogramWidget::addPointToTransferenceFunction(double x, double y)
        {
+               bool result=false;
                pGraphicalFunction* tf=plotter->getFunction(idTransferenceFunction);
-               return tf->AddPoint(x,y);
+printf("EED %p HistogramWidget::addPointToTransferenceFunction tp%p x%f y%f %d\n",this, tf, x ,y, idTransferenceFunction);
+               if (tf!=NULL) { result=tf->AddPoint(x,y); }
+               
+               return result;
        }
        /*
                add a color point to the histogram
@@ -294,15 +299,16 @@ HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint
                {
                        // we have to erase the points
                        pGraphicalFunction* tf=plotter->getFunction(idTransferenceFunction);
-                       int numOfPoints=tf->getSizePoints();
-                       int i=numOfPoints-1;//-2;
-                       while(i>=0)
-                       {
-                               tf->deletePointAt(i);
-                               i--;
-                       }
-                       
-               }
+                       if (tf!=NULL){
+                               int numOfPoints=tf->getSizePoints();
+                               int i=numOfPoints-1;//-2;
+                               while(i>=0)
+                               {
+                                       tf->deletePointAt(i);
+                                       i--;
+                               } // while
+                       } // if tf
+               } // if transferenceFunctionHasPoints
                
        //we set for actual the histogram
                //plotter->setActual()