From 03ec17bce7e82e4c219ce76f1acd709b6f93aa6b Mon Sep 17 00:00:00 2001
From: Eduardo Davila <Eduardo.Davila@creatis.insa-lyon.fr>
Date: Tue, 21 Apr 2009 18:06:03 +0000
Subject: [PATCH] Fix BUG  interaction Line, Rectangle, Circle

---
 .../src/interface/wxWindows/manualContour.cpp | 49 +++++++++++++++++--
 1 file changed, 45 insertions(+), 4 deletions(-)

diff --git a/lib/maracasVisuLib/src/interface/wxWindows/manualContour.cpp b/lib/maracasVisuLib/src/interface/wxWindows/manualContour.cpp
index 8f314e4..1e21196 100644
--- a/lib/maracasVisuLib/src/interface/wxWindows/manualContour.cpp
+++ b/lib/maracasVisuLib/src/interface/wxWindows/manualContour.cpp
@@ -4436,6 +4436,7 @@ void manualRoiControler::Configure() //virtual
 }
 
 // ----------------------------------------------------------------------------
+
 void manualRoiControler::MouseClickLeft(int x, int y){
 	int z = GetZ();
 	if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
@@ -4446,7 +4447,21 @@ void manualRoiControler::MouseClickLeft(int x, int y){
 		GetManualViewBaseContour()->InitMove(x,y,z);
 		SetState(6);
 	}
+	
+	
 	int size=GetManualViewBaseContour()->GetNumberOfPoints();
+	if (GetState()==0) {
+		if (size==0){
+			AddPoint(x,y,z);
+			AddPoint(x,y,z);
+			AddPoint(x,y,z);
+			AddPoint(x,y,z);
+			bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
+			SetState(5);
+		}
+	}
+	
+/*EED 21 Avril 2009
 	if (GetState()==0) {
 		if (size==0){
 			AddPoint(x,y,z);
@@ -4462,8 +4477,11 @@ void manualRoiControler::MouseClickLeft(int x, int y){
 		bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
 		SetState(5);
 	}
+*/
+	
 	GetManualViewBaseContour()->Refresh();
 }
+
 // ----------------------------------------------------------------------------
 void manualRoiControler::MouseMove(int x, int y) // virtual
 {
@@ -4632,17 +4650,25 @@ void manualCircleControler::MouseClickLeft(int x, int y){
 		if (size==0){
 			AddPoint(x,y,z);
 			AddPoint(x,y,z);
-//			AddPoint(x,y,z);
-//			AddPoint(x,y,z);
+			bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
+			SetState(5);
+		}
+	}	
+	
+/*EED 21 Avril 2009	
+	if (GetState()==0) {
+		if (size==0){
+			AddPoint(x,y,z);
+			AddPoint(x,y,z);
 		} else {
 			SetPoint(0,x,y,z);
 			SetPoint(1,x,y,z);
-//			SetPoint(2,x,y,z);
-//			SetPoint(3,x,y,z);
 		}
 		bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
 		SetState(5);
 	}
+*/
+	
 	GetManualViewBaseContour()->Refresh();
 }
 // ----------------------------------------------------------------------------
@@ -4800,6 +4826,7 @@ void manualLineControler::CopyAttributesTo( manualLineControler * cloneObject)
 	manualContourBaseControler::CopyAttributesTo(cloneObject);
 }
 
+
 // ----------------------------------------------------------------------------
 void manualLineControler::MouseClickLeft(int x, int y){
 	int z = GetZ();
@@ -4811,7 +4838,19 @@ void manualLineControler::MouseClickLeft(int x, int y){
 		GetManualViewBaseContour()->InitMove(x,y,z);
 		SetState(6);
 	}
+	
 	int size=GetManualViewBaseContour()->GetNumberOfPoints();
+	if (GetState()==0) { 
+		if (size==0){
+			AddPoint(x,y,z); 
+			AddPoint(x,y,z); 
+			bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);	
+			SetState(5);
+		}
+	}
+	
+	
+/*EED 21 Avril 2009		
 	if (GetState()==0) { 
 		if (size==0){
 			AddPoint(x,y,z); 
@@ -4823,6 +4862,8 @@ void manualLineControler::MouseClickLeft(int x, int y){
 		bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);	
 		SetState(5);
 	}
+*/
+	
 	GetManualViewBaseContour()->Refresh();
 }
 // ----------------------------------------------------------------------------
-- 
2.49.0