]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramWidget.cxx
no message
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / pPlotter / HistogramWidget.cxx
index 4febab2d37b4d3e9fd3d3f6e0b5a350540a0c115..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)
                        {
@@ -171,8 +172,10 @@ HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id, const wxPoint
                GetClientSize(&scrX,&scrY);
                plotter->SetSize(scrX,scrY);
                pGraphicalFunction* actual=plotter->getFunction(idTransferenceFunction);
-               actual->setScreens(scrX,scrY);
-               actual->setScales();
+               if(actual!=NULL){
+                       actual->setScreens(scrX,scrY);
+                       actual->setScales();
+               }
                
        }
        /*
@@ -264,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
@@ -292,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()