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=910aad6b5adef5024f896cc5a0daa79f1cda0661;hp=3c8d9250a88bfbf1fb76ad1e801a37032131cf3f;hpb=8e7ab74a199d1f05b01dccfb75da7f2c4754ddc5;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 3c8d925..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