]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/LogicalColorBar.cxx
#2864 creaMaracasVisu Feature New Normal - Manual Paint , modify external image
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / pPlotter / LogicalColorBar.cxx
index 642f0d6305e616ecbf43fac3ba009e426ae16724..bdb8ad3f28bc4d0f9a56e5218b06608ecf883d57 100644 (file)
@@ -1,4 +1,29 @@
 //------------------------------------------------------------------------------------------------------------
+/*# ---------------------------------------------------------------------
+#
+# 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
 //------------------------------------------------------------------------------------------------------------
 #include "LogicalColorBar.h"
                
                if(xRealValue>=minValue && xRealValue<=maxValue)
                {
-                       bool ifContinue = true;
+                       // bool ifContinue = true; // JPRx
                        //pColorPoint * colorPoint, nextColorPoint;
                        int maxIndex= logicColorPoints.size()-1;
-                       int nextIndex = 0;
-                       int nextX = 0;
+                       // int nextIndex = 0; // JPRx
+                       //int nextX = 0; // JPRx
                        int i = 0;
                                        
                        std::vector <pColorPoint*>::iterator iter;
                        {
                                logicColorPoints.push_back(newColorPoint);
                                addedPoint = true;
-                       }
-                       for ( iter = logicColorPoints.begin(); i<=maxIndex && !addedPoint; iter++ )
-                       {
-                               nextIter = iter;
-                               int before = (*iter)->getRealX() ;
-                               if(before>xRealValue && i==0)
+                       }else{                          
+                               iter = logicColorPoints.begin();
+                               for (i=0; i<=maxIndex && !addedPoint; i++)
                                {
-                                       //Is the first point
-                                       logicColorPoints.insert( iter, newColorPoint );
-                                       addedPoint =true;
-                                       lastAddedPoint = newColorPoint;
-                               }
-                               else if(before<xRealValue && i==maxIndex)
-                               {
-                                       //Is the last point 
-                                       logicColorPoints.insert( iter+1, newColorPoint );       
-                                       addedPoint =true;
-                                       lastAddedPoint = newColorPoint;
-                               }
-                               else if(i<maxIndex)
-                               {
-                                       //
-                                       nextIter++;                     
-                                       int after = (*nextIter)->getRealX();                            
-                                       if( before < xRealValue && after> xRealValue)
+                                       nextIter = iter;
+                                       int before = (*iter)->getRealX() ;
+                                       if(before>xRealValue && i==0)
                                        {
-                                               logicColorPoints.insert( nextIter, newColorPoint );     
+                                               //Is the first point
+                                               logicColorPoints.insert( iter, newColorPoint );
                                                addedPoint =true;
                                                lastAddedPoint = newColorPoint;
                                        }
-                               }                               
-                               i++;
-                       }               
+                                       else if(before<xRealValue && i==maxIndex)
+                                       {
+                                               //Is the last point 
+                                               logicColorPoints.push_back(newColorPoint );     
+                                               addedPoint =true;
+                                               lastAddedPoint = newColorPoint;
+                                       }
+                                       else if(i<maxIndex)
+                                       {
+                                               //
+                                               nextIter++;                     
+                                               int after = (*nextIter)->getRealX();                            
+                                               if( before < xRealValue && after> xRealValue)
+                                               {
+                                                       logicColorPoints.insert( nextIter, newColorPoint );     
+                                                       addedPoint =true;
+                                                       lastAddedPoint = newColorPoint;
+                                               }
+                                       }               
+                                       //std::cout<<"JCPaddColorPoint iterator "<<*iter<<std::endl;
+                                       if(!addedPoint)
+                                               ++iter;
+                               }               
+                       }                       
                }
                return addedPoint;              
        }