X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FpPlotter%2FHistogramWidget.cxx;h=affe13c876cbe3c28c0a631115771bc2ce2acfc8;hb=096822cf3513065cfa25e378679339a5ae4684cf;hp=4febab2d37b4d3e9fd3d3f6e0b5a350540a0c115;hpb=c5feadbb145eecf6d73f793535b7e23eb18db2cb;p=creaMaracasVisu.git diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramWidget.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramWidget.cxx index 4febab2..affe13c 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramWidget.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/HistogramWidget.cxx @@ -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()