]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pLogicalFunction.cxx
size of upper panel
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / pPlotter / pLogicalFunction.cxx
index 0c3f03b1861d39903c6914c6d8ab393a331c0069..5822083a1691f8b059fab7622e3d7c9a299c2764 100644 (file)
@@ -118,7 +118,11 @@ bool pLogicalFunction:: AddNewPoint(int x,int y)
        bool includedPoint = realPoints.Append(newPoint)!=NULL;
        if(includedPoint)
        {
-           bool order=orderPoints();
+               bool order=true;
+               if(realPoints.size()>1){
+                       order=orderPoints();
+               }
+           
                return order; 
        }
        return includedPoint;
@@ -141,8 +145,14 @@ bool pLogicalFunction::orderPoints()
        int nextX;
 
        // Used for validating 'leftToRigthDef'
-       pFunctionPoint* ordFirstPoint = (pFunctionPoint*)realPoints.GetFirst()-> GetData();
-       pFunctionPoint* ordLastPoint = (pFunctionPoint*)(lastNodeIncluded->GetPrevious())-> GetData();
+       pFunctionPoint* ordFirstPoint = NULL;
+       pFunctionPoint* ordLastPoint =  NULL;
+       if(node!=NULL){
+               ordFirstPoint = (pFunctionPoint*)realPoints.GetFirst()-> GetData();
+       }
+       if(lastNodeIncluded->GetPrevious()!=NULL){
+               ordLastPoint = (pFunctionPoint*)(lastNodeIncluded->GetPrevious())-> GetData();
+       }
 
 
        // Normal drawing
@@ -439,7 +449,7 @@ bool pLogicalFunction::deletePointAt(int index)
                
                if(node)//point!=NULL)
                {
-                       pFunctionPoint* point=(pFunctionPoint*)node->GetData();
+                       //pFunctionPoint* point=(pFunctionPoint*)node->GetData(); // JPRx
                        bool deleted=realPoints.DeleteNode(node);
                        //delete point;
                        //delete node;