]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/manualContour.cpp
BUG interaction click right
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / manualContour.cpp
index 1e211963c23697acf53f6bcb3ce1864e2a152d7f..9dc5f2b65c2786591d0cf8d683e1f603fba73dc6 100644 (file)
@@ -1494,7 +1494,6 @@ void manualViewContour::RefreshContour() // virtual
     nps = _manContModel->GetNumberOfPointsSpline();
        //delta=( double ) ( np  ) / ( double ) ( nps-1  );             //JSTG 25-02-08
 
-//printf ("EED manualViewContour::RefreshContour>> %d %d \n", np,nps);
 
        if ( _pts!=NULL )
        {
@@ -1510,10 +1509,6 @@ void manualViewContour::RefreshContour() // virtual
        // EED 27 sep 2006
        //                      _pts->SetPoint(i, x,y,z );
                                _pts->SetPoint(i , x*_spc[0] , y*_spc[1] , z*_spc[2] );
-//if (i%15==0)
-//{
-//     printf ("EED manualViewContour::RefreshContour>> %d : %f %f %f \n", i,x,y,z);
-//}
 
 
                        }// for
@@ -1558,7 +1553,7 @@ void manualViewContour::RefreshText()  // virtual
                        }
                }
 
-               _textActor -> SetInput(resultText);
+               _textActor->SetInput(resultText);
 
                if (size>=1){
 
@@ -2258,7 +2253,7 @@ bool manualViewRoi::ifTouchContour(int x,int y, int z) // virtual
        {
                result=true;
        }
-
+               
        return result;
 }
 
@@ -2790,7 +2785,7 @@ void manualViewBaseContour :: RemoveControlPoints()
        SetIfViewControlPoints( false );
 }
 // ----------------------------------------------------------------------------
-void manualViewBaseContour :: AddControlPoints()
+void manualViewBaseContour::AddControlPoints()
 {
        vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
        SetIfViewControlPoints( true );
@@ -2935,7 +2930,7 @@ void manualViewBaseContour::UpdateViewPoint(int id) // virtual
 }
 
 // ----------------------------------------------------------------------------
-void manualViewBaseContour :: UpdateViewPoints()
+void manualViewBaseContour::UpdateViewPoints()
 {
        int id, size = _lstViewPoints.size();
        for( id=0; id<size; id++)
@@ -4164,12 +4159,11 @@ void manualContourControler::MouseClickLeft(int x, int y){
                        _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
                        SetState(7);
                }
-       }
-       else
-       {
+       }else{
                SetPosibleToMove( true );
                GetManualViewBaseContour()->SetSelected( GetManualViewBaseContour()->GetPosibleSelected() );
-       }
+       } // IsEditable
+       
        if ( GetState() == 0 && GetManualViewBaseContour()->GetPosibleSelected() )
        {
                SetMoving( true );
@@ -4439,16 +4433,22 @@ void manualRoiControler::Configure() //virtual
 
 void manualRoiControler::MouseClickLeft(int x, int y){
        int z = GetZ();
-       if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
-               bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
-               SetState(5);
-       }
+       
+       if( IsEditable() )
+       {       // move control point
+         if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
+                 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
+                 SetState(5);
+         }
+       } // IsEditable
+       
+       // Move contour
        if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true))        {
                GetManualViewBaseContour()->InitMove(x,y,z);
                SetState(6);
        }
        
-       
+       // if the firs time create 4 control points and move one point
        int size=GetManualViewBaseContour()->GetNumberOfPoints();
        if (GetState()==0) {
                if (size==0){
@@ -4489,6 +4489,7 @@ void manualRoiControler::MouseMove(int x, int y) // virtual
 
 //     this->_vtkInteractorStyleBaseView->
 
+                  
        GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
        GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
 
@@ -4637,14 +4638,22 @@ void manualCircleControler::Configure() //virtual
 // ----------------------------------------------------------------------------
 void manualCircleControler::MouseClickLeft(int x, int y){
        int z = GetZ();
-       if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
-               bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
-               SetState(5);
-       }
+       
+       if( IsEditable() )
+       {       // move control point
+         if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
+                 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
+                 SetState(5);
+         }
+       }// IsEditable
+       
+       // move contour
        if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true))        {
                GetManualViewBaseContour()->InitMove(x,y,z);
                SetState(6);
        }
+       
+       // firstime create 2 control points and move one control point
        int size=GetManualViewBaseContour()->GetNumberOfPoints();
        if (GetState()==0) {
                if (size==0){
@@ -4676,7 +4685,6 @@ void manualCircleControler::MouseClickLeft(int x, int y){
 void manualCircleControler::MouseMove(int x, int y) // virtual
 {
        int z=GetZ();
-
 //     this->_vtkInteractorStyleBaseView->
 
        GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
@@ -4684,29 +4692,6 @@ void manualCircleControler::MouseMove(int x, int y) // virtual
 
        if (GetState()==5){
                SetPoint( bakIdPoint , x , y ,z);
-/*
-               if (bakIdPoint==0)
-               {
-                       SetPointX( 1 , x );
-                       SetPointY( 3 , y );
-               }
-               if (bakIdPoint==1)
-               {
-                       SetPointX( 0 , x );
-                       SetPointY( 2 , y );
-               }
-
-               if (bakIdPoint==2)
-               {
-                       SetPointX( 3 , x );
-                       SetPointY( 1 , y );
-               }
-               if (bakIdPoint==3)
-               {
-                       SetPointX( 2 , x );
-                       SetPointY( 0 , y );
-               }
-*/
        }
        if (GetState()==6){
                GetManualViewBaseContour()->MoveContour(x,y,z);
@@ -4830,15 +4815,22 @@ void manualLineControler::CopyAttributesTo( manualLineControler * cloneObject)
 // ----------------------------------------------------------------------------
 void manualLineControler::MouseClickLeft(int x, int y){
        int z = GetZ();
-       if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
-               bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);     
-               SetState(5);
-       }
+       
+       if( IsEditable() )
+       {       // move control point
+         if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
+                 bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);   
+                 SetState(5);
+         }
+       } //IsEditable
+       
+       // move contour
        if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true))        { 
                GetManualViewBaseContour()->InitMove(x,y,z);
                SetState(6);
        }
        
+       // fist time create 2 control points and move a control point
        int size=GetManualViewBaseContour()->GetNumberOfPoints();
        if (GetState()==0) { 
                if (size==0){
@@ -5060,6 +5052,7 @@ bool manualContourBaseControler::OnChar()
 // ----------------------------------------------------------------------------
 bool manualContourBaseControler::OnMouseMove()
 {
+       
        if ( _vtkInteractorStyleBaseView!=NULL)
        {
                int X,Y;
@@ -5181,14 +5174,15 @@ void manualContourBaseControler::MouseClickLeft(int x, int y) // virtual
 // ----------------------------------------------------------------------------
 void manualContourBaseControler::MouseClickRight(int x, int y)
 {
-       if (_state==1)
-       {
-               _state=0;
-       }
+//     if (_state==1)
+//     {
+//             _state=0;
+//     }
        SetEditable( false );
        SetPosibleToMove( false );
-       //_state = 0;
-       _state=7;
+       _state = 0;
+
+//EED 24Avril2009      _state=7;
 }
 // ----------------------------------------------------------------------------
 void manualContourBaseControler::MouseReleaseLeft(int x, int y)