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=d6fb1d5d3e478c70b90f5a4e27874e1478905195;hp=7442ce91f2029233afcb0ecb4e8b0f675fd8f606;hpb=8e7ab74a199d1f05b01dccfb75da7f2c4754ddc5;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 7442ce9..ea0be8f 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterWindow.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pPlotterWindow.cxx @@ -1,3 +1,28 @@ +/*# --------------------------------------------------------------------- +# +# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image +# pour la Sant�) +# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton +# Previous Authors : Laurent Guigues, Jean-Pierre Roux +# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil +# +# This software is governed by the CeCILL-B license under French law and +# abiding by the rules of distribution of free software. You can use, +# modify and/ or redistribute the software under the terms of the CeCILL-B +# license as circulated by CEA, CNRS and INRIA at the following URL +# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +# or in the file LICENSE.txt. +# +# As a counterpart to the access to the source code and rights to copy, +# modify and redistribute granted by the license, users are provided only +# with a limited warranty and the software's author, the holder of the +# economic rights, and the successive licensors have only limited +# liability. +# +# The fact that you are presently reading this means that you have had +# knowledge of the CeCILL-B license and that you accept its terms. +# ------------------------------------------------------------------------ */ + //---------------------------------------------------------------------------- // Class definition include //---------------------------------------------------------------------------- @@ -50,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() //---------------------------------------------------------------------------- @@ -200,6 +225,7 @@ wxPoint pPlotterWindow:: getRealPoint(wxPoint pixelPoint) void pPlotterWindow::setActualScales() { // int maxX,maxY,minX,minY; // JPRx + int maxX,maxY;//,minX,minY; // JPRx //EED /* if the function is drawed interactively the maxX and the maxY in actual are sets by the user @@ -1387,10 +1413,15 @@ int pPlotterWindow:: addFunction(pGraphicalFunction * function) function->initializeSplineVectors(); UpdateAll(); } - // bool added1= functions.Append(function)!=NULL; // JPRx + +// bool added1= functions.Append(function)!=NULL; // JPRx + functions.Append(function); //EED int id=functions.IndexOf(function); - /* bool added2= */ AddLayer(function);// JPRx + + // bool added2= AddLayer(function);// JPRx + AddLayer(function); //EED + UpdateAll(); return id;//added1 && added2; } @@ -1533,7 +1564,7 @@ void pPlotterWindow::InitFunctionForVectors( pGraphicalFunction *ff ) m_popmenu.Enable(mpID_LINE_GUIDES,true); m_popmenu.Enable(pwID_TRASLATEACTUALFUNCTION,true); //------------------------------------------ - //Sending the paarticular event of changed actual function + //Sending the particular event of changed actual function //------------------------------------------- wxCommandEvent cevent( wxEVT_PPLOTTER_CHANGED_FUNCTION, GetId() ); cevent.SetEventObject(this); @@ -1674,7 +1705,7 @@ void pPlotterWindow :: actualizeViewRange(int newMinX, int newMaxX) UpdateAll(); } /* -* Guide lines menu handler method that reacts to the mpID_LINE_GUIDES cimmand event +* Guide lines menu handler method that reacts to the mpID_LINE_GUIDES command event * event The corresponding event to handle */ void pPlotterWindow :: OnGuideLines (wxCommandEvent &event) @@ -1709,21 +1740,30 @@ void pPlotterWindow :: OnGuideLines (wxCommandEvent &event) */ pGraphicalFunction* pPlotterWindow::getFunction(int index) { - wxNode* node=functions.Item(index); + 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 setted in functionsToMove - @param porcentageMinX:the porcentage that the minShowed - of the funcntions have to be move + and that were set in functionsToMove + @param porcentageMinX:the percentage that the minShowed + of the functions have to be move 0<=porcentageMinX<=1 - @param porcentageMaxX:the porcentage that the maxShowed - of the funcntions have to be move + @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 @@ -1796,7 +1836,9 @@ void pPlotterWindow::moveFunctions( float porcentageMinX,float porcentageMaxX) */ int pPlotterWindow::addFunctionToMove(pGraphicalFunction *function) { - // bool added1= functionsToMove.Append(function)!=NULL; // JPRx + //bool added1= functionsToMove.Append(function)!=NULL; // JPRx + functionsToMove.Append(function); // EED + int id=functionsToMove.IndexOf(function); UpdateAll(); return id;