X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FpPlotter%2FpLogicalFunction.cxx;h=5822083a1691f8b059fab7622e3d7c9a299c2764;hb=24937478048aca664712bb708240bff79879e0d9;hp=0c3f03b1861d39903c6914c6d8ab393a331c0069;hpb=c5feadbb145eecf6d73f793535b7e23eb18db2cb;p=creaMaracasVisu.git diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pLogicalFunction.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pLogicalFunction.cxx index 0c3f03b..5822083 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pLogicalFunction.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pLogicalFunction.cxx @@ -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;