]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/manualContour.cpp
BUG MacOs
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / manualContour.cpp
index 7b424d2ad1660517757fc1e1661c14432f2db2f1..af53c28d5423b09f7d35251b4315d741e82f71e7 100644 (file)
@@ -610,6 +610,10 @@ manualContourModel::~manualContourModel()
        }
        _lstPoints.clear();
 
+       _cntSplineX->RemoveAllPoints();
+       _cntSplineY->RemoveAllPoints();
+       _cntSplineZ->RemoveAllPoints();
+       
        _cntSplineX->Delete();
        _cntSplineY->Delete();
        _cntSplineZ->Delete();
@@ -1315,15 +1319,16 @@ vtkActor* manualViewPoint::CreateVtkPointActor()
 
        _pts = vtkPoints::New();
        _pts->SetNumberOfPoints(8);
+
        _pts->SetPoint(0, -1000 , -1000 , 0 );
-       _pts->SetPoint(1,  1000 , -1000 , 0     );
+       _pts->SetPoint(1,  1000 , -1000 , 0 );
        _pts->SetPoint(2,  1000 ,  1000 , 0 );
        _pts->SetPoint(3, -1000 ,  1000 , 0 );
        _pts->SetPoint(4, -1000 ,  1000 , 0 );
        _pts->SetPoint(5, -1000 ,  1000 , 0 );
        _pts->SetPoint(6, -1000 ,  1000 , 0 );
        _pts->SetPoint(7, -1000 ,  1000 , 0 );
-
+       
        vtkCellArray *lines = vtkCellArray::New();
        lines->InsertNextCell(17);
        lines->InsertCellPoint(0);
@@ -1347,17 +1352,17 @@ vtkActor* manualViewPoint::CreateVtkPointActor()
        _pd = vtkPolyData::New();
        _pd->SetPoints( _pts );
        _pd->SetLines( lines );
-       lines->Delete();  //do not delete lines ??
+//     lines->Delete();  //do not delete lines ??
 
        _pointVtkActor  =       vtkActor::New();
     _bboxMapper                =       vtkPolyDataMapper::New();
 
        _bboxMapper->SetInput(_pd);
-       _bboxMapper->ImmediateModeRenderingOn();
+//     _bboxMapper->ImmediateModeRenderingOn();
        _pointVtkActor->SetMapper(_bboxMapper);
-       _pointVtkActor->GetProperty()->BackfaceCullingOn();
+//     _pointVtkActor->GetProperty()->BackfaceCullingOn();
        UpdateColorActor();
-       _pd->ComputeBounds();
+//     _pd->ComputeBounds();
 
        return _pointVtkActor;
 }
@@ -1524,7 +1529,6 @@ void manualViewContour::RefreshContour() // virtual
 // ----------------------------------------------------------------------------
 void manualViewContour::RefreshText()  // virtual
 {
-
        if ((_textActor!=NULL) && ( _textActor->GetProperty()->GetOpacity()!=0 )){
                int size = GetNumberOfPoints();
                char text[50];
@@ -1553,8 +1557,8 @@ void manualViewContour::RefreshText()  // virtual
                        }
                }
 
-               _textActor -> SetInput(resultText);
-
+               _textActor->SetInput(resultText);
+               
                if (size>=1){
 
                        int i;
@@ -2895,7 +2899,7 @@ void manualViewBaseContour::ConstructVTKObjects()
        //      Text
        _textActor = vtkTextActor::New();
 //     _textActor->SetDisplayPosition(200, 200);
-       _textActor->SetInput("");
+       _textActor->SetInput("00");
        // Set coordinates to match the old vtkScaledTextActor default value
 //     _textActor->GetPosition2Coordinate()->SetCoordinateSystemToNormalizedViewport();
 //     _textActor->GetPosition2Coordinate()->SetValue( 0.2 , 0.2 );
@@ -2954,7 +2958,7 @@ void manualViewBaseContour::AddPoint( manualViewPoint * manualViewPoint )
        manualViewPoint->SetSpacing(_spc);
 
        vtkActor *actor = manualViewPoint->CreateVtkPointActor();
-       _wxvtkbaseview->GetRenderer()->AddActor( actor );
+       _wxvtkbaseview->GetRenderer()->AddActor( actor );       
 }
 
 // ----------------------------------------------------------------------------
@@ -3239,7 +3243,7 @@ void manualViewBaseContour::Refresh() // virtual
 void manualViewBaseContour::RefreshText()  // virtual
 {
        if( _textActor!=NULL)
-               _textActor -> SetInput(" ");
+               _textActor -> SetInput("00");
 }
 // ----------------------------------------------------------------------------
 void manualViewBaseContour::SetColorNormalContour(double r, double g, double b)
@@ -3481,9 +3485,8 @@ void manualViewBaseContour::SetVisible(bool ok)
        {
                opacity=1;
        } else {
-               opacity=0;
+               opacity=0.5;
        }
-
        vtkActor *actor;
        int i,size=_lstViewPoints.size();
        for (i=0;i<size;i++){
@@ -3492,7 +3495,7 @@ void manualViewBaseContour::SetVisible(bool ok)
        }
        _contourVtkActor->GetProperty()->SetOpacity( opacity );
        _textActor->GetProperty()->SetOpacity( opacity );
-       _textActor->SetInput(" ");
+       _textActor->SetInput("00");
 
 }
 // ----------------------------------------------------------------------------
@@ -3501,7 +3504,7 @@ void manualViewBaseContour::SetShowText(bool ok)
        _show_text = ok;
        if (_show_text==false)
        {
-               _textActor->SetInput(" ");
+               _textActor->SetInput("00");
        }
 }
 // ----------------------------------------------------------------------------
@@ -4195,7 +4198,7 @@ void manualContourControler::MouseMove(int x, int y) // virtual
        if (!IsEditable())
        {
                GetManualViewBaseContour()->RemoveControlPoints();
-               GetManualViewBaseContour()->RemoveTextActor();
+//             GetManualViewBaseContour()->RemoveTextActor();
                GetManualViewBaseContour()->Refresh();
                this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
        }
@@ -4457,7 +4460,7 @@ void manualRoiControler::MouseClickLeft(int x, int y){
                        AddPoint(x,y,z);
                        AddPoint(x,y,z);
                        bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
-                       SetState(5);
+                       SetState(1);
                }
        }
        
@@ -4493,7 +4496,8 @@ void manualRoiControler::MouseMove(int x, int y) // virtual
        GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
        GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
 
-       if (GetState()==5){
+
+       if ( (GetState()==5) || (GetState()==1) ){
                SetPoint( bakIdPoint , x , y ,z);
                if (bakIdPoint==0)
                {
@@ -4660,7 +4664,7 @@ void manualCircleControler::MouseClickLeft(int x, int y){
                        AddPoint(x,y,z);
                        AddPoint(x,y,z);
                        bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
-                       SetState(5);
+                       SetState(1);
                }
        }       
        
@@ -4690,9 +4694,9 @@ void manualCircleControler::MouseMove(int x, int y) // virtual
        GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
        GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
 
-       if (GetState()==5){
-               SetPoint( bakIdPoint , x , y ,z);
-       }
+       if (GetState()==1){     SetPoint( bakIdPoint , x , y ,z); }
+       if (GetState()==5){     SetPoint( bakIdPoint , x , y ,z); }
+       
        if (GetState()==6){
                GetManualViewBaseContour()->MoveContour(x,y,z);
        }
@@ -4837,7 +4841,7 @@ void manualLineControler::MouseClickLeft(int x, int y){
                        AddPoint(x,y,z); 
                        AddPoint(x,y,z); 
                        bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);     
-                       SetState(5);
+                       SetState(1);
                }
        }
        
@@ -4867,10 +4871,9 @@ void manualLineControler::MouseMove(int x, int y) // virtual
        GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
        GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
 
-       if (GetState()==5)
-       {       
-               SetPoint( bakIdPoint , x , y ,z); 
-       }
+       if (GetState()==1) { SetPoint( bakIdPoint , x , y ,z); }
+       if (GetState()==5) { SetPoint( bakIdPoint , x , y ,z); }
+       
        if (GetState()==6)
        {       
                GetManualViewBaseContour()->MoveContour(x,y,z);
@@ -5052,6 +5055,7 @@ bool manualContourBaseControler::OnChar()
 // ----------------------------------------------------------------------------
 bool manualContourBaseControler::OnMouseMove()
 {
+       
        if ( _vtkInteractorStyleBaseView!=NULL)
        {
                int X,Y;
@@ -5173,14 +5177,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)