X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FpPlotter%2FpPlotterWindow.cxx;h=ea0be8fe85c003f009ff38ad7860058f22605576;hb=26602dbd774eb346068faea73004618887508484;hp=b07e111fde985f905fd287f3ded77e7f9da2f90d;hpb=e4ef2b5df5aac431ff3b806f83b7dd5e55e89d86;p=creaMaracasVisu.git diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterWindow.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterWindow.cxx index b07e111..ea0be8f 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterWindow.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterWindow.cxx @@ -75,26 +75,26 @@ IMPLEMENT_CLASS(pPlotterWindow, mpWindow) //---------------------------------------------------------------------------- BEGIN_EVENT_TABLE(pPlotterWindow,mpWindow) -EVT_MOTION (pPlotterWindow::onMouseMove) -EVT_LEFT_DCLICK(pPlotterWindow::onChangeActual) -EVT_LEFT_DOWN(pPlotterWindow::onAddPoint) -EVT_MENU(pwID_DELPOINT, pPlotterWindow::onDeletePoint) -EVT_MENU(pwID_SHOWPOINTS, pPlotterWindow::onShowPoints) -EVT_MENU(pwID_STARTDRAWING, pPlotterWindow::onStartDrawing) -//EVT_MENU(pwID_DELFUNCTION,pPlotterWindow::onDeleteFunction) -EVT_MENU(pwID_STOPDRAWING, pPlotterWindow::onStopDrawing) -EVT_MENU(pwID_ADDNEWPOINT, pPlotterWindow::onAddNewPoint) -EVT_MENU(pwID_NOSHOWPOINTS, pPlotterWindow::onNoShowPoints) -EVT_MENU(pwID_MYZOOMOUT,pPlotterWindow::onMyZoomOut) -EVT_MENU(pwID_MYZOOMIN,pPlotterWindow::onMyZoomIn) -EVT_MENU(pwID_SPLINE,pPlotterWindow::onSplinePoints) -EVT_MENU(pwID_LINE,pPlotterWindow::onLine) -EVT_MENU(pwID_SAVE,pPlotterWindow::onSave) -EVT_MENU(pwID_LOAD,pPlotterWindow::onLoad) -EVT_MENU(pwID_CHANGECOLOR,pPlotterWindow::onChangeColor) -EVT_MENU( mpID_LINE_GUIDES, pPlotterWindow::OnGuideLines) -EVT_MENU( pwID_TRASLATEACTUALFUNCTION, pPlotterWindow::onMoveFunction) -EVT_LEFT_UP(pPlotterWindow::onLeftUp) + EVT_MOTION (pPlotterWindow::onMouseMove) + EVT_LEFT_DCLICK(pPlotterWindow::onChangeActual) + EVT_LEFT_DOWN(pPlotterWindow::onAddPoint) + EVT_MENU(pwID_DELPOINT, pPlotterWindow::onDeletePoint) + EVT_MENU(pwID_SHOWPOINTS, pPlotterWindow::onShowPoints) + EVT_MENU(pwID_STARTDRAWING, pPlotterWindow::onStartDrawing) + //EVT_MENU(pwID_DELFUNCTION,pPlotterWindow::onDeleteFunction) + EVT_MENU(pwID_STOPDRAWING, pPlotterWindow::onStopDrawing) + EVT_MENU(pwID_ADDNEWPOINT, pPlotterWindow::onAddNewPoint) + EVT_MENU(pwID_NOSHOWPOINTS, pPlotterWindow::onNoShowPoints) + EVT_MENU(pwID_MYZOOMOUT,pPlotterWindow::onMyZoomOut) + EVT_MENU(pwID_MYZOOMIN,pPlotterWindow::onMyZoomIn) + EVT_MENU(pwID_SPLINE,pPlotterWindow::onSplinePoints) + EVT_MENU(pwID_LINE,pPlotterWindow::onLine) + EVT_MENU(pwID_SAVE,pPlotterWindow::onSave) + EVT_MENU(pwID_LOAD,pPlotterWindow::onLoad) + EVT_MENU(pwID_CHANGECOLOR,pPlotterWindow::onChangeColor) + EVT_MENU( mpID_LINE_GUIDES, pPlotterWindow::OnGuideLines) + EVT_MENU( pwID_TRASLATEACTUALFUNCTION, pPlotterWindow::onMoveFunction) + EVT_LEFT_UP(pPlotterWindow::onLeftUp) END_EVENT_TABLE() //---------------------------------------------------------------------------- @@ -1740,12 +1740,20 @@ void pPlotterWindow :: OnGuideLines (wxCommandEvent &event) */ pGraphicalFunction* pPlotterWindow::getFunction(int index) { - wxNode* node=functions.Item(index); - if(node==NULL){ + wxNode* node=NULL; + if (functions.size()>index) + { + node=functions.Item(index); + } // if + + if(node==NULL) + { return NULL; - } + } // if node return (pGraphicalFunction*)node->GetData(); } + + /* move the functions that the user wants to move and that were set in functionsToMove @@ -1755,9 +1763,7 @@ pGraphicalFunction* pPlotterWindow::getFunction(int index) @param porcentageMaxX:the percentage that the maxShowed of the functions have to be move 0<=porcentageMaxX<=1 - */ - void pPlotterWindow::moveFunctions( float porcentageMinX,float porcentageMaxX) { //Adding the actual function