]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/manualContour.cpp
BUG MacOs
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / manualContour.cpp
index 1d9f3ad2321e5cf8d30fc14738102f5c792f7850..af53c28d5423b09f7d35251b4315d741e82f71e7 100644 (file)
@@ -1,5 +1,5 @@
 
-#include <vtkActor.h> 
+#include <vtkActor.h>
 #include <vtkProperty.h>
 
 #include <vtkCellArray.h>
@@ -78,7 +78,7 @@ manualContourModelCircle::~manualContourModelCircle()
 
 
 // ----------------------------------------------------------------------------
-manualContourModelCircle * manualContourModelCircle :: Clone()  // virtual 
+manualContourModelCircle * manualContourModelCircle :: Clone()  // virtual
 {
        manualContourModelCircle * clone = new manualContourModelCircle();
        CopyAttributesTo(clone);
@@ -94,7 +94,7 @@ void manualContourModelCircle::CopyAttributesTo( manualContourModelCircle * clon
 }
 
 //----------------------------------------------------------------
-int manualContourModelCircle::GetTypeModel() //virtual 
+int manualContourModelCircle::GetTypeModel() //virtual
 {
        return 3;
 }
@@ -135,6 +135,86 @@ void manualContourModelCircle::UpdateSpline() // virtal
        }
 }
 
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+//AD: 02-09
+
+manualContourModelLine::manualContourModelLine()
+: manualContourModel()
+{
+       SetNumberOfPointsSpline(20);
+       this->SetCloseContour(false);
+}
+
+manualContourModelLine::~manualContourModelLine()
+{
+}
+
+
+// ----------------------------------------------------------------------------
+manualContourModelLine * manualContourModelLine :: Clone()  // virtual 
+{
+       manualContourModelLine * clone = new manualContourModelLine();
+       CopyAttributesTo(clone);
+       return clone;
+}
+
+// ---------------------------------------------------------------------------
+
+void manualContourModelLine::CopyAttributesTo( manualContourModelLine * cloneObject)
+{
+       manualContourModel::CopyAttributesTo(cloneObject);
+}
+
+//----------------------------------------------------------------
+int manualContourModelLine::GetTypeModel() //virtual 
+{
+       return 6;
+}
+
+
+//----------------------------------------------------------------
+/*
+void manualContourModelLine::GetSpline_i_Point(int i, double *x, double *y, double *z) // virtual
+{
+       int np  = GetSizeLstPoints();
+       if (np==0)
+       {
+               *x      = 0;
+               *y      = 0;
+               *z      = 0;
+       }
+       if (np==1)
+       {
+               manualPoint     *mp;
+               mp      = GetManualPoint(0);
+               *x      = mp->GetX();
+               *y      = mp->GetY();
+               *z      = mp->GetZ();
+       }
+       if (np==2)
+       {
+               manualPoint     *mp;
+
+               if (i==0)
+               {
+                       mp = GetManualPoint(0);
+               } 
+               else if (i==1)
+               {
+                       mp = GetManualPoint(1);
+               }
+
+               *x      = mp->GetX();
+               *y      = mp->GetY();
+               *z      = mp->GetZ();
+       }
+
+}
+*/
+
 
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
@@ -151,7 +231,7 @@ manualContourModelBullEye::~manualContourModelBullEye()
 
 
 // ----------------------------------------------------------------------------
-manualContourModelBullEye * manualContourModelBullEye :: Clone()  // virtual 
+manualContourModelBullEye * manualContourModelBullEye :: Clone()  // virtual
 {
        manualContourModelBullEye * clone = new manualContourModelBullEye();
        CopyAttributesTo(clone);
@@ -167,7 +247,7 @@ void manualContourModelBullEye::CopyAttributesTo( manualContourModelBullEye * cl
 }
 
 //----------------------------------------------------------------
-int manualContourModelBullEye::GetTypeModel() //virtual 
+int manualContourModelBullEye::GetTypeModel() //virtual
 {
        return 4;
 }
@@ -203,7 +283,7 @@ manualContourModelBullEyeSector * manualContourModelBullEye::GetModelSector(int
 }
 
 //----------------------------------------------------------------
-void manualContourModelBullEye::GetSector(int id,      
+void manualContourModelBullEye::GetSector(int id,
                                                double *radioA,
                                                double *radioB,
                                                double *ang,
@@ -255,7 +335,7 @@ int manualContourModelBullEye::GetSizeOfSectorLst()
 //----------------------------------------------------------------
 void manualContourModelBullEye::Save(FILE *ff) // virtual
 {
-       manualContourModel::Save(ff); 
+       manualContourModel::Save(ff);
        int i,size = GetSizeOfSectorLst();
        fprintf(ff,"numberOfSections %d \n",size);
        for ( i=0 ; i<size ; i++ )
@@ -267,7 +347,7 @@ void manualContourModelBullEye::Save(FILE *ff) // virtual
 //----------------------------------------------------------------
 void manualContourModelBullEye::Open(FILE *ff) // virtual
 {
-       manualContourModel::Open(ff); 
+       manualContourModel::Open(ff);
 
        ResetSectors();
 
@@ -278,7 +358,7 @@ void manualContourModelBullEye::Open(FILE *ff) // virtual
 
        fscanf(ff,"%s",tmp); // NumberOfSections
        fscanf(ff,"%s",tmp); // ##
-       numberOfSections = atoi(tmp);  
+       numberOfSections = atoi(tmp);
        for (i=0;i<numberOfSections;i++)
        {
                AddSector(0,1,90,0);
@@ -315,7 +395,7 @@ manualContourModelBullEyeSector::~manualContourModelBullEyeSector()
 
 
 // ----------------------------------------------------------------------------
-manualContourModelBullEyeSector * manualContourModelBullEyeSector :: Clone()  // virtual 
+manualContourModelBullEyeSector * manualContourModelBullEyeSector :: Clone()  // virtual
 {
        manualContourModelBullEyeSector * clone = new manualContourModelBullEyeSector();
        CopyAttributesTo(clone);
@@ -331,7 +411,7 @@ void manualContourModelBullEyeSector::CopyAttributesTo( manualContourModelBullEy
 }
 
 //----------------------------------------------------------------
-int manualContourModelBullEyeSector::GetTypeModel() //virtual 
+int manualContourModelBullEyeSector::GetTypeModel() //virtual
 {
        return 5;
 }
@@ -350,7 +430,7 @@ void manualContourModelBullEyeSector::SetSector(    double radioA,
 }
 
 //----------------------------------------------------------------
-void manualContourModelBullEyeSector::GetSector(       
+void manualContourModelBullEyeSector::GetSector(
                                                double *radioA,
                                                double *radioB,
                                                double *ang,
@@ -407,13 +487,13 @@ void manualContourModelBullEyeSector::GetSpline_i_Point(int i, double *x, double
 
        *x = _ww*radio*angcos + _cx;
        *y = _hh*radio*angsin + _cy;
-       *z= -900;
+       *z= 900;
 }
 
 //----------------------------------------------------------------
 void manualContourModelBullEyeSector::Save(FILE *ff) // virtual
 {
-       manualContourModel::Save(ff); 
+       manualContourModel::Save(ff);
        fprintf(ff,"rA= %f rB= %f ang= %f deltaAng= %f\n", _radioA,_radioB, _ang , _angDelta);
 }
 
@@ -424,24 +504,24 @@ void manualContourModelBullEyeSector::Open(FILE *ff) // virtual
        fscanf(ff,"%s",tmp); // TypeModel
        fscanf(ff,"%s",tmp); // ##
 
-       manualContourModel::Open(ff); 
+       manualContourModel::Open(ff);
 
 
        fscanf(ff,"%s",tmp); // radioA=
        fscanf(ff,"%s",tmp); // radioA
-       _radioA = atof(tmp);  
+       _radioA = atof(tmp);
 
        fscanf(ff,"%s",tmp); // radioB=
        fscanf(ff,"%s",tmp); // radioB
-       _radioB = atof(tmp);  
+       _radioB = atof(tmp);
 
        fscanf(ff,"%s",tmp); // ang=
        fscanf(ff,"%s",tmp); // ang
-       _ang = atof(tmp);  
+       _ang = atof(tmp);
 
        fscanf(ff,"%s",tmp); // deltaAng=
        fscanf(ff,"%s",tmp); // deltaAng
-       _angDelta = atof(tmp);  
+       _angDelta = atof(tmp);
 }
 
 
@@ -464,7 +544,7 @@ manualContourModelRoi::~manualContourModelRoi()
 
 
 // ----------------------------------------------------------------------------
-manualContourModelRoi * manualContourModelRoi :: Clone()  // virtual 
+manualContourModelRoi * manualContourModelRoi :: Clone()  // virtual
 {
        manualContourModelRoi * clone = new manualContourModelRoi();
        CopyAttributesTo(clone);
@@ -480,7 +560,7 @@ void manualContourModelRoi::CopyAttributesTo( manualContourModelRoi * cloneObjec
 }
 
 //----------------------------------------------------------------
-int manualContourModelRoi::GetTypeModel() //virtual 
+int manualContourModelRoi::GetTypeModel() //virtual
 {
        return 2;
 }
@@ -500,16 +580,16 @@ manualContourModel::manualContourModel()
 
        this->SetCloseContour(true);
 
-    _cntSplineX->SetDefaultTension( 0 ); 
-       _cntSplineX->SetDefaultBias( 0 ); 
-       _cntSplineX->SetDefaultContinuity( 0 ); 
+    _cntSplineX->SetDefaultTension( 0 );
+       _cntSplineX->SetDefaultBias( 0 );
+       _cntSplineX->SetDefaultContinuity( 0 );
 
-    _cntSplineY->SetDefaultTension( 0 ); 
-       _cntSplineY->SetDefaultBias( 0 ); 
+    _cntSplineY->SetDefaultTension( 0 );
+       _cntSplineY->SetDefaultBias( 0 );
        _cntSplineY->SetDefaultContinuity( 0 );
 
-    _cntSplineZ->SetDefaultTension( 0 ); 
-       _cntSplineZ->SetDefaultBias( 0 ); 
+    _cntSplineZ->SetDefaultTension( 0 );
+       _cntSplineZ->SetDefaultBias( 0 );
        _cntSplineZ->SetDefaultContinuity( 0 );
 
 //JSTG 25-02-08 -------------------------------------------------------------------------------------------------
@@ -530,6 +610,10 @@ manualContourModel::~manualContourModel()
        }
        _lstPoints.clear();
 
+       _cntSplineX->RemoveAllPoints();
+       _cntSplineY->RemoveAllPoints();
+       _cntSplineZ->RemoveAllPoints();
+       
        _cntSplineX->Delete();
        _cntSplineY->Delete();
        _cntSplineZ->Delete();
@@ -606,7 +690,7 @@ int manualContourModel::InsertPoint(double x,double y,double z)
        //manualPoint *mp = new manualPoint();
        //mp->SetPoint(x,y,z);
        //std::vector<manualPoint*>::iterator itNum = _lstPoints.begin() + ibak;
-       //_lstPoints.insert(itNum,mp);  
+       //_lstPoints.insert(itNum,mp);
        InsertPoint_id(ibak,x,y,z);
 //----------------------------------------------------------------------------
 
@@ -667,7 +751,7 @@ void manualContourModel::MoveAllPoints(double dx,double dy,double dz)
 // type=0      x,y
 // type=1      y,z
 // type=2      x,z
-int     manualContourModel::GetIdPoint(double x, double y, double z, int i_range,int type)  
+int     manualContourModel::GetIdPoint(double x, double y, double z, int i_range,int type)
 {
        double range = i_range+1;
 
@@ -683,7 +767,7 @@ int  manualContourModel::GetIdPoint(double x, double y, double z, int i_range,in
                if (type==-1)
                {
                        if ((fabs(xx-x)<range) && (fabs(yy-y)<range) && (fabs(zz-z)<range)) {
-                          dd=sqrt(   (xx-x)*(xx-x) + (yy-y)*(yy-y) + (zz-z)*(zz-z) ); 
+                          dd=sqrt(   (xx-x)*(xx-x) + (yy-y)*(yy-y) + (zz-z)*(zz-z) );
                           if (dd<ddmin){
                                   ddmin=dd;
                                   ibak=i;
@@ -693,7 +777,7 @@ int  manualContourModel::GetIdPoint(double x, double y, double z, int i_range,in
                if (type==0)
                {
                        if ((fabs(yy-y)<range) && (fabs(zz-z)<range)) {
-                          dd=sqrt(   (yy-y)*(yy-y) + (zz-z)*(zz-z) ); 
+                          dd=sqrt(   (yy-y)*(yy-y) + (zz-z)*(zz-z) );
                           if (dd<ddmin){
                                   ddmin=dd;
                                   ibak=i;
@@ -703,7 +787,7 @@ int  manualContourModel::GetIdPoint(double x, double y, double z, int i_range,in
                if (type==1)
                {
                        if ((fabs(xx-x)<range) && (fabs(zz-z)<range)) {
-                          dd=sqrt(   (xx-x)*(xx-x)  + (zz-z)*(zz-z) ); 
+                          dd=sqrt(   (xx-x)*(xx-x)  + (zz-z)*(zz-z) );
                           if (dd<ddmin){
                                   ddmin=dd;
                                   ibak=i;
@@ -713,7 +797,7 @@ int  manualContourModel::GetIdPoint(double x, double y, double z, int i_range,in
                if (type==2)
                {
                        if ((fabs(xx-x)<range) && (fabs(yy-y)<range) ) {
-                          dd=sqrt(   (xx-x)*(xx-x) + (yy-y)*(yy-y)  ); 
+                          dd=sqrt(   (xx-x)*(xx-x) + (yy-y)*(yy-y)  );
                           if (dd<ddmin){
                                   ddmin=dd;
                                   ibak=i;
@@ -752,11 +836,11 @@ void manualContourModel::SetCloseContour(bool closeContour)
        _closeContour = closeContour;
        if (_closeContour==true)
        {
-               _cntSplineX->ClosedOn(); 
+               _cntSplineX->ClosedOn();
                _cntSplineY->ClosedOn();
                _cntSplineZ->ClosedOn();
        } else {
-               _cntSplineX->ClosedOff(); 
+               _cntSplineX->ClosedOff();
                _cntSplineY->ClosedOff();
                _cntSplineZ->ClosedOff();
        }
@@ -790,7 +874,8 @@ void manualContourModel::UpdateSpline() // virtual
        {
                _delta_JSTG = (double) (np) / double (_sizePointsContour - 1);  //Without the -1 the curve is not close
        } else {
-               _delta_JSTG = (double) (np-1) / double (_sizePointsContour );  //Without the -1 the curve is not close
+//             _delta_JSTG = (double) (np-1) / double (_sizePointsContour );  //Without the -1 the curve is not close
+               _delta_JSTG = (double) (np) / double (_sizePointsContour-1 );  //Without the -1 the curve is not close
        }
 //-----------------------------------------------------------------------------------------------------------
 }
@@ -799,7 +884,7 @@ void manualContourModel::UpdateSpline() // virtual
 
 /*void manualContourModel::GetSplineiPoint(int i, double &x, double &y, double &z)
 {
-       double delta=(double)(_lstPoints.size()) / (double)(_sizePointsContour);        
+       double delta=(double)(_lstPoints.size()) / (double)(_sizePointsContour);
        double t = delta*(double)i;
        GetSplinePoint(t, x, y, z);
 }*/
@@ -833,9 +918,9 @@ void manualContourModel::GetSpline_t_Point(double t, double *x, double *y, doubl
        }
        if (_lstPoints.size()>=2)
        {
-               *x      = _cntSplineX->Evaluate(t); 
-               *y      = _cntSplineY->Evaluate(t); 
-               *z      = _cntSplineZ->Evaluate(t); 
+               *x      = _cntSplineX->Evaluate(t);
+               *y      = _cntSplineY->Evaluate(t);
+               *z      = _cntSplineZ->Evaluate(t);
        }
 }
 
@@ -860,9 +945,9 @@ void manualContourModel::GetSpline_t_Point(double t, double *x, double *y, doubl
        }
        if (_lstPoints.size()>=2)
        {
-               x       = _cntSplineX->Evaluate(t); 
-               y       = _cntSplineY->Evaluate(t); 
-               z       = _cntSplineZ->Evaluate(t); 
+               x       = _cntSplineX->Evaluate(t);
+               y       = _cntSplineY->Evaluate(t);
+               z       = _cntSplineZ->Evaluate(t);
        }
 }*/
 // ----------------------------------------------------------------------------
@@ -891,9 +976,9 @@ double manualContourModel::GetPathSize()
        if (_lstPoints.size()>2)
        {
 
-// JSTG 25-02-08 ------------------------------------------            
+// JSTG 25-02-08 ------------------------------------------
                //np  = _lstPoints.size( );
-               //nps = 200; 
+               //nps = 200;
                //delta=( double ) ( np  ) / ( double ) ( nps  );
                UpdateSpline();
                //GetSplinePoint(0,x1,y1,z1);
@@ -910,7 +995,7 @@ double manualContourModel::GetPathSize()
                        x1=x2;
                        y1=y2;
                        z1=z2;
-               }// for 
+               }// for
        }
 
        return result;
@@ -929,7 +1014,7 @@ double manualContourModel::GetPathArea()
                double x2,y2,z2;
                bool okArea=true;
                int i, j;
-         
+
                // This uses Green's theorem:
                // A = 1/2 * sum( xiyi+1 - xi+1yi); pO == pN
                // A < 0 -> A = |A| (a negative value could raise because points are
@@ -941,7 +1026,7 @@ double manualContourModel::GetPathArea()
                int nps = GetNumberOfPointsSpline();
                //double delta=( double ) ( np  ) / ( double ) ( nps  );
                UpdateSpline();
-               for( i = 0, area = 0.0; i < nps; i++ ) 
+               for( i = 0, area = 0.0; i < nps; i++ )
                {
                        j = ( i + 1 ) % nps;
                        //ti = delta * (double)i;
@@ -958,12 +1043,12 @@ double manualContourModel::GetPathArea()
                        {
                                okArea=false;
                        }
-               }// for 
+               }// for
                area /= 2.0;
                area = fabs( area );
 
 /*
-               for( i = 0, area = 0.0; i < _lstPoints.size(); i++ ) 
+               for( i = 0, area = 0.0; i < _lstPoints.size(); i++ )
                {
                        j = ( i + 1 ) % _lstPoints.size();
                        //  Area
@@ -993,8 +1078,8 @@ double manualContourModel::GetPathArea()
 }
 
 // ----------------------------------------------------------------------------
-// p[x,y,z]   :  data in 
-// rp[x,y,z]  :  data out  result point 
+// p[x,y,z]   :  data in
+// rp[x,y,z]  :  data out  result point
 // rn[x,y,z]  :  data out   result normal
 
 void manualContourModel::GetNearestPointAndNormal(double *p, double *rp,  double *rn)
@@ -1015,13 +1100,13 @@ void manualContourModel::GetNearestPointAndNormal(double *p, double *rp,  double
        if (np>=2)
        {
 // JSTG 25-02-08 ------------------------------------------
-               //nps           = 200; 
+               //nps           = 200;
                nps = GetNumberOfPointsSpline();
                //delta = ( double ) ( np  ) / ( double ) ( nps  );
                UpdateSpline();
                //GetSplinePoint(0,x1,y1,z1);
                GetSpline_i_Point(0,&x1,&y1,&z1);
-               for( i = 0; i < nps; i++ ) 
+               for( i = 0; i < nps; i++ )
                {
                        //t = delta * (double)i;
                        //GetSplinePoint(t,x1,y1,z1);
@@ -1031,7 +1116,7 @@ void manualContourModel::GetNearestPointAndNormal(double *p, double *rp,  double
                        dy= y1-p[1];
                        dz= z1-p[2];
                        dist = sqrt( dx*dx + dy*dy + dz*dz );
-                       if (dist<distMin) 
+                       if (dist<distMin)
                        {
                                distMin  = dist;
 //JSTG                 tback = t;
@@ -1046,7 +1131,7 @@ void manualContourModel::GetNearestPointAndNormal(double *p, double *rp,  double
                        x2=x1;
                        y2=y1;
                        z2=z1;
-               }// for 
+               }// for
 
 // JSTG 25-02-08 ------------------------------------------
                //if (tback==0)
@@ -1060,8 +1145,8 @@ void manualContourModel::GetNearestPointAndNormal(double *p, double *rp,  double
                        rn[1]=rp[1]-y1;
                        rn[2]=rp[2]-z1;
                }
-       } 
-       else 
+       }
+       else
        {
                rp[0] = 0;
                rp[1] = 0;
@@ -1090,22 +1175,22 @@ void manualContourModel::Open(FILE *ff) // virtual
 
        fscanf(ff,"%s",tmp); // NumberOfControlPoints
        fscanf(ff,"%s",tmp); // ##
-       numberOfControlPoints = atoi(tmp);  
+       numberOfControlPoints = atoi(tmp);
        for (i=0;i<numberOfControlPoints;i++)
        {
                fscanf(ff,"%s",tmp); // X
-               x = atof(tmp);  
+               x = atof(tmp);
                fscanf(ff,"%s",tmp); // Y
-               y = atof(tmp);  
+               y = atof(tmp);
                fscanf(ff,"%s",tmp); // Z
-               z = atof(tmp);  
+               z = atof(tmp);
                AddPoint(x,y,z);
        }
 }
 
 
 // ----------------------------------------------------------------------------
-int manualContourModel::GetTypeModel() //virtual 
+int manualContourModel::GetTypeModel() //virtual
 {
        // 0 spline
        // 1 spline
@@ -1113,6 +1198,7 @@ int manualContourModel::GetTypeModel() //virtual
        // 3 circle
        // 4 BullEye
        // 5 BullEyeSector
+       // 6 Line
        return 1;
 }
 
@@ -1143,7 +1229,7 @@ void manualContourModel::CopyAttributesTo( manualContourModel * cloneObject)
        {
                cloneObject->AddManualPoint( GetManualPoint( i )->Clone() );
        }
-       cloneObject->SetNumberOfPointsSpline( GetNumberOfPointsSpline () ); 
+       cloneObject->SetNumberOfPointsSpline( GetNumberOfPointsSpline () );
        cloneObject->SetCloseContour( _closeContour );
        cloneObject->UpdateSpline();
 }
@@ -1202,7 +1288,7 @@ void manualViewPoint::SetSelected(bool selected){
 }
 // ----------------------------------------------------------------------------
 void manualViewPoint::SetPosibleSelected(bool posibleSelected){
-       _posibleSelected=posibleSelected;       
+       _posibleSelected=posibleSelected;
 }
 // ----------------------------------------------------------------------------
 bool manualViewPoint::GetSelected(){
@@ -1233,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);
@@ -1265,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;
 }
@@ -1369,7 +1456,7 @@ void manualViewContour::CopyAttributesTo( manualViewContour * cloneObject)
 {
        // Call to Fathers object
        manualViewBaseContour::CopyAttributesTo(cloneObject);
-       
+
        cloneObject->SetMesureScale(_mesureScale);
 }
 
@@ -1408,38 +1495,33 @@ void manualViewContour::RefreshContour() // virtual
 
        _manContModel->UpdateSpline();
     np = GetNumberOfPoints( );
-       //nps = GetNumberOfPointsSpline(); 
-    nps = _manContModel->GetNumberOfPointsSpline();            
+       //nps = GetNumberOfPointsSpline();
+    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 )
        {
                if (np>=2  )
                {
-                       for( i = 0; i < nps; i++ ) 
+                       for( i = 0; i < nps; i++ )
                        {
-//JSTG 25-02-08 ------------------------------------------------                               
+//JSTG 25-02-08 ------------------------------------------------
                                //t = delta * (double)i;
                                //_manContModel->GetSplinePoint(t,x,y,z);
                                _manContModel->GetSpline_i_Point(i,&x,&y,&z);
 //--------------------------------------------------------------
        // 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);
-//}
+       //                      _pts->SetPoint(i, x,y,z );
+                               _pts->SetPoint(i , x*_spc[0] , y*_spc[1] , z*_spc[2] );
 
 
-                       }// for 
-               } 
-               else 
+                       }// for
+               }
+               else
                {
-                               _pts->SetPoint(0, 0 , 0 , 0);   
-                               _pts->SetPoint(1, 0 , 0 , 0);   
+                               _pts->SetPoint(0, 0 , 0 , 0);
+                               _pts->SetPoint(1, 0 , 0 , 0);
                } // if
        }
 }
@@ -1447,7 +1529,6 @@ void manualViewContour::RefreshContour() // virtual
 // ----------------------------------------------------------------------------
 void manualViewContour::RefreshText()  // virtual
 {
-
        if ((_textActor!=NULL) && ( _textActor->GetProperty()->GetOpacity()!=0 )){
                int size = GetNumberOfPoints();
                char text[50];
@@ -1476,8 +1557,8 @@ void manualViewContour::RefreshText()  // virtual
                        }
                }
 
-               _textActor -> SetInput(resultText);
-
+               _textActor->SetInput(resultText);
+               
                if (size>=1){
 
                        int i;
@@ -1519,32 +1600,38 @@ bool manualViewContour::ifTouchContour(int x,int y,int z){
        yy = yy * _spc[1];
        zz = zz * _spc[2];
 
-
     unsigned int i, nps,nps_t;
-    nps          = _sizePointsContour; 
-       if (this->_manContModel->IfCloseContour()==true) 
+    nps          = _sizePointsContour;
+       
+       if (this->_manContModel->IfCloseContour()==true)
        {
-               nps_t = nps; 
+               nps_t = nps;
        } else {
-               nps_t = nps-1; 
+               nps_t = nps-1;
        }
 
-    for( i = 0; i < nps_t; i++ ) {
+       
+       for( i = 0; i < nps_t; i++ ) 
+       {
                _pts->GetPoint(i%nps, ppA);
                _pts->GetPoint((i+1)%nps, ppB);
                d1= sqrt( (ppA[0]-xx)*(ppA[0]-xx) + (ppA[1]-yy)*(ppA[1]-yy) + (ppA[2]-zz)*(ppA[2]-zz));
                d2= sqrt( (ppB[0]-xx)*(ppB[0]-xx) + (ppB[1]-yy)*(ppB[1]-yy) + (ppB[2]-zz)*(ppB[2]-zz));
                d3= sqrt( (ppB[0]-ppA[0])*(ppB[0]-ppA[0]) + (ppB[1]-ppA[1])*(ppB[1]-ppA[1]) + (ppB[2]-ppA[2])*(ppB[2]-ppA[2]));
-               if (  ((d1+d2)>=d3) &&  ((d1+d2)<=d3*1.3) ) {
+
+
+               if (  ((d1+d2)>=d3) &&  ((d1+d2)<=d3*1.3) ) 
+               {
                        result=true;
                        i=nps;
                }
-       } 
+       }
+       
        return result;
 }
 
 // ----------------------------------------------------------------------------
-void manualViewContour::DeletePoint(int id) // virtual 
+void manualViewContour::DeletePoint(int id) // virtual
 {
        if (_lstViewPoints.size()>2)
        {
@@ -1567,19 +1654,19 @@ void manualViewContour::SetMesureScale(double mesureScale)
 void manualViewContour::InitMove(int x, int y, int z)
 {
        _initialConoturModel->DeleteAllPoints();
-       
+
        manualPoint *mp = NULL;
        double XX=x;
        double YY=y;
        double ZZ=z;
        TransfromeCoordViewWorld(XX,YY,ZZ);
-               
+
        int i, manualPointsSZ = _manContModel->GetSizeLstPoints();
        for ( i=0; i<manualPointsSZ; i++ )
        {
                mp = _manContModel->GetManualPoint( i );
                this->_initialConoturModel->AddPoint( mp->GetX() - XX, mp->GetY() - YY, mp->GetZ() );
-       }               
+       }
 }
 //-------------------------------------------------------------------
 void manualViewContour::MoveContour(int x, int y, int z)
@@ -1589,7 +1676,7 @@ void manualViewContour::MoveContour(int x, int y, int z)
        double XX=x;
        double YY=y;
        double ZZ=z;
-       
+
        TransfromeCoordViewWorld(XX,YY,ZZ);
 
        int i, manualPointsSZ = _manContModel->GetSizeLstPoints();
@@ -1598,8 +1685,8 @@ void manualViewContour::MoveContour(int x, int y, int z)
                mpOrigin = _manContModel->GetManualPoint( i );
                mpMoving = _initialConoturModel->GetManualPoint(i);
                mpOrigin->SetPoint( mpMoving->GetX()+XX, mpMoving->GetY() + YY, mpMoving->GetZ() );
-       }       
-       UpdateViewPoints();     
+       }
+       UpdateViewPoints();
 }
 void manualViewContour::MoveContour(int horizontalUnits, int verticalUnits )
 {
@@ -1610,8 +1697,8 @@ void manualViewContour::MoveContour(int horizontalUnits, int verticalUnits )
        {
                mpOrigin = _manContModel->GetManualPoint( i );
                mpOrigin->SetPoint( mpOrigin->GetX()+horizontalUnits, mpOrigin->GetY()+verticalUnits, mpOrigin->GetZ() );
-       }       
-       UpdateViewPoints();             
+       }
+       UpdateViewPoints();
 }
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
@@ -1680,13 +1767,13 @@ void manualView3VContour::RefreshContour()  // virtula
        //int nps = GetNumberOfPointsSpline();
        int nps = _manContModel->GetNumberOfPointsSpline();
 //-------------------------------------------------------
-       for( i = 0; i < nps; i++ ) 
+       for( i = 0; i < nps; i++ )
        {
                _pts->GetPoint( i, pp );
                FilterCordinateXYZ(pp[0],pp[1],pp[2]);
 
 //EED 27 sep 2006
-               _pts->SetPoint( i, pp[0] , pp[1] ,pp[2] );      
+               _pts->SetPoint( i, pp[0] , pp[1] ,pp[2] );
        }
 
 }
@@ -1736,12 +1823,12 @@ bool manualView3VContour::ifTouchContour(int x,int y,int z){ // virtual
        zz = zz * _spc[2];
 
     unsigned int i, nps,nps_t;
-    nps          = _sizePointsContour; 
-       if (this->_manContModel->IfCloseContour()==true) 
+    nps          = _sizePointsContour;
+       if (this->_manContModel->IfCloseContour()==true)
        {
-               nps_t = nps; 
+               nps_t = nps;
        } else {
-               nps_t = nps-1; 
+               nps_t = nps-1;
        }
        FilterCordinateXYZ(xx,yy,zz);
 
@@ -1757,7 +1844,7 @@ bool manualView3VContour::ifTouchContour(int x,int y,int z){ // virtual
                        result=true;
                        i=nps;
                }
-       } 
+       }
        return result;
 }
 // ----------------------------------------------------------------------------
@@ -1813,7 +1900,7 @@ int manualView3DContour::GetIdPoint2(int x, int y)
        double p[3],pA[3],pB[3];
 
        double pickPoint[ 3 ], cameraPos[ 3 ];
-       vtkPointPicker* picker = vtkPointPicker::New( );        
+       vtkPointPicker* picker = vtkPointPicker::New( );
        vtkRenderer *pRenderer = this->GetWxVtkBaseView()->GetRenderer();
        picker->Pick( x, y, 0.0, pRenderer );
        pRenderer->GetActiveCamera( )->GetPosition( cameraPos );
@@ -1823,7 +1910,7 @@ int manualView3DContour::GetIdPoint2(int x, int y)
        UtilVtk3DGeometriSelection utilVtk3Dgeometriselection;
        utilVtk3Dgeometriselection.SetDimentions(_w,_h,_d);
 
-       if( utilVtk3Dgeometriselection.FindCubePointsFromPoints( pA, pB, pickPoint, cameraPos )  ) 
+       if( utilVtk3Dgeometriselection.FindCubePointsFromPoints( pA, pB, pickPoint, cameraPos )  )
        {
                double dist,distMin=999999999;
                int i,size=this->_manContModel->GetSizeLstPoints();
@@ -1881,15 +1968,15 @@ void manualViewBullEyeSector::RefreshContour()
 //----------------------------------
 
        _manContModel->UpdateSpline();
-    nps = _manContModel->GetNumberOfPointsSpline();            
+    nps = _manContModel->GetNumberOfPointsSpline();
 
        if ( _pts!=NULL )
        {
-               for( i = 0; i < nps; i++ ) 
+               for( i = 0; i < nps; i++ )
                {
                        _manContModel->GetSpline_i_Point(i,&x,&y,&z);
-                       _pts->SetPoint(i , x*_spc[0] , y*_spc[1] , z*_spc[2] );  
-               }// for 
+                       _pts->SetPoint(i , x*_spc[0] , y*_spc[1] , z*_spc[2] );
+               }// for
        }
 
 }
@@ -1942,7 +2029,7 @@ int manualViewBullEye::GetType() // virtual
 
 // ----------------------------------------------------------------------------
 void manualViewBullEye::RefreshContour() // virtual
-{ 
+{
        // External Rectangle
        manualViewRoi::RefreshContour();
 
@@ -2050,6 +2137,7 @@ void manualViewRoi::RefreshContour() // virtual
 {
     unsigned int i,ii, np;
     np = GetNumberOfPoints( );
+//EED01        
        if ( np > 0)
        {
                if (np>=2)
@@ -2065,13 +2153,13 @@ void manualViewRoi::RefreshContour() // virtual
        //                      wxvtk2Dbasevie->TransformCoordinate_spacing_ModelToView(XX,YY,ZZ);
 
        //EED 27 sep 2007
-       //                      _pts->SetPoint(i, XX,YY,ZZ );   
-                               _pts->SetPoint(i, XX*_spc[0] , YY*_spc[1] , ZZ*_spc[2] );       
+       //                      _pts->SetPoint(i, XX,YY,ZZ );
+                               _pts->SetPoint(i, XX*_spc[0] , YY*_spc[1] , ZZ*_spc[2] );
                        } //  rof
 
                } else {
-                               _pts->SetPoint(0, 0 , 0 , 0);   
-                               _pts->SetPoint(1, 0 , 0 , 0);   
+                               _pts->SetPoint(0, 0 , 0 , 0);
+                               _pts->SetPoint(1, 0 , 0 , 0);
                } // if
        }
 }
@@ -2087,9 +2175,9 @@ int manualViewRoi::GetType() // virtual
 void manualViewRoi::GetMinMax(double &minX,double &minY, double &maxX, double &maxY)
 {
        double  pp[3];
-       manualPoint *mp;  
+       manualPoint *mp;
     unsigned int i;
-       
+
        minX=99999;
        minY=99999;
        maxX=-99999;
@@ -2097,30 +2185,30 @@ void manualViewRoi::GetMinMax(double &minX,double &minY, double &maxX, double &m
 
        unsigned int size=(unsigned int) _manContModel->GetSizeLstPoints();
 
-       for( i = 0; i < size; i++ ) 
+       for( i = 0; i < size; i++ )
        {
 
                mp=_manContModel->GetManualPoint(i);
                pp[0]=mp->GetX();
                pp[1]=mp->GetY();
+
                // min X
-               if (pp[0]<minX) 
+               if (pp[0]<minX)
                {
                        minX=pp[0];
                }
                //min Y
-               if (pp[1]<minY) 
+               if (pp[1]<minY)
                {
                        minY=pp[1];
                }
                //max X
-               if (pp[0]>maxX) 
+               if (pp[0]>maxX)
                {
                        maxX=pp[0];
                }
                // max Y
-               if (pp[1]>maxY) 
+               if (pp[1]>maxY)
                {
                        maxY=pp[1];
                }
@@ -2133,14 +2221,15 @@ void manualViewRoi::GetMinMax(double &minX,double &minY, double &maxX, double &m
                minY=0;
                maxY=0;
        }
-} 
+}
 
 // ----------------------------------------------------------------------------
 
-bool manualViewRoi::ifTouchContour(int x,int y, int z) // virtual 
+
+bool manualViewRoi::ifTouchContour(int x,int y, int z) // virtual
 {
        bool    result=false;
-       double  px1=99999,py1=99999,px2=-9999,py2=-99999;
+       double  px1=99999,py1=99999,px2=-99999,py2=-99999;
 
        GetMinMax(px1,py1, px2, py2);
 
@@ -2168,11 +2257,10 @@ bool manualViewRoi::ifTouchContour(int x,int y, int z) // virtual
        {
                result=true;
        }
-
+               
        return result;
 }
 
-
 // ----------------------------------------------------------------------------
 
 void manualViewRoi::InitMove(int x, int y, int z)  // virtual
@@ -2208,7 +2296,7 @@ void manualViewRoi::InitMove(int x, int y, int z)  // virtual
 
 // ----------------------------------------------------------------------------
 
-void manualViewRoi::MoveContour(int x, int y, int z) // virtual 
+void manualViewRoi::MoveContour(int x, int y, int z) // virtual
 {
        manualPoint *mp;
        double XX=x;
@@ -2231,7 +2319,7 @@ void manualViewRoi::MoveContour(int x, int y, int z) // virtual
        UpdateViewPoint(0);
        UpdateViewPoint(1);
        UpdateViewPoint(2);
-       UpdateViewPoint(3);     
+       UpdateViewPoint(3);
 
 }
 
@@ -2300,11 +2388,11 @@ void manualViewCircle::RefreshContour(){ // virtual
 //                             XX = cos(angle)*radio+mpA->GetX();
 //                             YY = sin(angle)*radio+mpA->GetY();
                                ZZ = mpA->GetZ();
-                               _pts->SetPoint(i, XX*_spc[0] , YY*_spc[1] , ZZ*_spc[2] );       
+                               _pts->SetPoint(i, XX*_spc[0] , YY*_spc[1] , ZZ*_spc[2] );
                        } //  rof
                } else {
-                               _pts->SetPoint(0, 0 , 0 , 0);   
-                               _pts->SetPoint(1, 0 , 0 , 0);   
+                               _pts->SetPoint(0, 0 , 0 , 0);
+                               _pts->SetPoint(1, 0 , 0 , 0);
                } // if
        }
 }
@@ -2342,11 +2430,11 @@ void manualViewCircle::GetMinMax(double &minX,double &minY, double &maxX, double
                minY=0;
                maxY=0;
        }
-} 
+}
 
 /*
 // ----------------------------------------------------------------------------
-bool manualViewCircle::ifTouchContour(int x,int y, int z) // virtual 
+bool manualViewCircle::ifTouchContour(int x,int y, int z) // virtual
 {
        bool    result=false;
        double  px1=99999,py1=99999,px2=-9999,py2=-99999;
@@ -2418,7 +2506,7 @@ void manualViewCircle::InitMove(int x, int y, int z)  // virtual
 
 
 // ----------------------------------------------------------------------------
-void manualViewCircle::MoveContour(int x, int y, int z) // virtual 
+void manualViewCircle::MoveContour(int x, int y, int z) // virtual
 {
        manualPoint *mp;
        double XX=x;
@@ -2441,13 +2529,96 @@ void manualViewCircle::MoveContour(int x, int y, int z) // virtual
        UpdateViewPoint(0);
        UpdateViewPoint(1);
 //     UpdateViewPoint(2);
-//     UpdateViewPoint(3);     
+//     UpdateViewPoint(3);
 
 }
 
 
 
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+// AD:02-09
+
+manualViewLine::manualViewLine()
+{
+       _sizePointsContour=20;
+}
+// ----------------------------------------------------------------------------
+manualViewLine::~manualViewLine()
+{
+}
+
+
+// ----------------------------------------------------------------------------
+manualViewLine * manualViewLine :: Clone()
+{
+       manualViewLine * clone = new manualViewLine();
+       CopyAttributesTo(clone);
+       return clone;
+}
+
+// ---------------------------------------------------------------------------
+
+void manualViewLine::CopyAttributesTo( manualViewLine * cloneObject)
+{
+       // Fathers object
+       manualViewBaseContour::CopyAttributesTo(cloneObject);
+}
+
+// ----------------------------------------------------------------------------
+int manualViewLine::GetType() // virtual
+{
+       return 6;
+}
+
+
+// ----------------------------------------------------------------------------
+
+void manualViewLine::InitMove(int x, int y, int z)  // virtual
+{
+       manualPoint *mp;
+       double XX=x;
+       double YY=y;
+       double ZZ=z;
+       TransfromeCoordViewWorld(XX,YY,ZZ);
+
+       if (_manContModel->GetSizeLstPoints()==2)
+       {
+               mp = _manContModel->GetManualPoint(0);
+               _dp0[0]= mp->GetX() - XX;
+               _dp0[1]= mp->GetY() - YY;
+               _dp0[2]= mp->GetZ();
+
+               mp = _manContModel->GetManualPoint(1);
+               _dp1[0]= mp->GetX() - XX;
+               _dp1[1]= mp->GetY() - YY;
+               _dp1[2]= mp->GetZ();
+
+       }
+}
+
+
+// ----------------------------------------------------------------------------
+void manualViewLine::MoveContour(int x, int y, int z) // virtual 
+{
+       manualPoint *mp;
+       double XX=x;
+       double YY=y;
+       double ZZ=z;
+       TransfromeCoordViewWorld(XX,YY,ZZ);
 
+       mp = _manContModel->GetManualPoint(0);
+       mp->SetPoint(_dp0[0]+XX,_dp0[1]+YY,_dp0[2]);
+
+       mp = _manContModel->GetManualPoint(1);
+       mp->SetPoint(_dp1[0]+XX,_dp1[1]+YY,_dp0[2]);
+
+
+       UpdateViewPoint(0);
+       UpdateViewPoint(1);
+}
 
 
 // ----------------------------------------------------------------------------
@@ -2457,7 +2628,7 @@ void manualViewCircle::MoveContour(int x, int y, int z) // virtual
 
 manualViewBaseContour::manualViewBaseContour()
 {
-       _show_text                      = true; 
+       _show_text                      = true;
        _textActor                      = NULL;
        _manContModel           = NULL;
        _wxvtkbaseview          = NULL;
@@ -2478,7 +2649,7 @@ manualViewBaseContour::manualViewBaseContour()
        _coulorEdit_g           = 1;
        _coulorEdit_b           = 0;
 
-       _coulorNormal_r         = 1;    
+       _coulorNormal_r         = 1;
        _coulorNormal_g         = 0;
        _coulorNormal_b         = 1;
 
@@ -2509,6 +2680,7 @@ int manualViewBaseContour::GetType() // virtual
 //int manualViewRoi::GetType()                         2;
 //int manualViewCircle::GetType()                      3;
 //int manualViewStar::GetType()                                4;
+//int manualViewLine::GetType()                                6;
 
 
        return 0;
@@ -2529,7 +2701,7 @@ void manualViewBaseContour::Open(FILE *pFile)
 void manualViewBaseContour :: AddCompleteContourActor(  bool ifControlPoints )
 {
        _viewControlPoints = ifControlPoints;
-        vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
+        /*vtkRenderer * theRenderer = */  _wxvtkbaseview->GetRenderer();  // JPRx ??
         //Adding the spline
         AddSplineActor();
 
@@ -2543,12 +2715,12 @@ void manualViewBaseContour :: AddCompleteContourActor(  bool ifControlPoints )
 // ---------------------------------------------------------------------------
 
 void manualViewBaseContour :: RemoveCompleteContourActor()
-{      
-       vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
+{
+       /*vtkRenderer * theRenderer =*/  _wxvtkbaseview->GetRenderer(); // JPRx ??
         //Removing the spline
        RemoveSplineActor();
        RemoveTextActor();
-       
+
        //Removing each point
        RemoveControlPoints();
        RefreshContour();
@@ -2569,7 +2741,7 @@ void manualViewBaseContour::CopyAttributesTo( manualViewBaseContour * cloneObjec
 {
        // Fathers object
        //XXXX::CopyAttributesTo(cloneObject);
-       
+
        cloneObject-> SetWxVtkBaseView( this->_wxvtkbaseview );
        cloneObject-> SetSelected( this->GetSelected() );
        cloneObject-> SetPosibleSelected( this->GetPosibleSelected() );
@@ -2579,9 +2751,9 @@ void manualViewBaseContour::CopyAttributesTo( manualViewBaseContour * cloneObjec
        cloneObject-> SetSpacing( _spc );
        cloneObject-> SetColorNormalContour( _coulorNormal_r, _coulorNormal_g, _coulorNormal_b );
        cloneObject-> SetColorEditContour( _coulorEdit_r, _coulorEdit_g, _coulorEdit_b );
-       cloneObject-> SetColorSelectContour( _coulorSelection_r, _coulorSelection_g, _coulorSelection_b );      
+       cloneObject-> SetColorSelectContour( _coulorSelection_r, _coulorSelection_g, _coulorSelection_b );
 
-       int i, size = _lstViewPoints.size(); 
+       int i, size = _lstViewPoints.size();
        for ( i=0; i<size; i++ )
        {
                cloneObject->AddPoint(  );
@@ -2604,7 +2776,7 @@ void manualViewBaseContour :: RemoveSplineActor() // virtual
 }
 // ----------------------------------------------------------------------------
 void manualViewBaseContour :: RemoveControlPoints()
-{      
+{
        if (_wxvtkbaseview!=NULL){
                vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
                int i,size=_lstViewPoints.size();
@@ -2612,15 +2784,15 @@ void manualViewBaseContour :: RemoveControlPoints()
                {
                        vtkActor * pointActor = _lstViewPoints[i]->GetVtkActor();
                        theRenderer->RemoveActor( pointActor );
-               } // for        
+               } // for
        } // if
-       SetIfViewControlPoints( false );        
+       SetIfViewControlPoints( false );
 }
 // ----------------------------------------------------------------------------
-void manualViewBaseContour :: AddControlPoints()
+void manualViewBaseContour::AddControlPoints()
 {
        vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
-       SetIfViewControlPoints( true ); 
+       SetIfViewControlPoints( true );
         if( _viewControlPoints )
         {
                int i,size=_lstViewPoints.size();
@@ -2628,7 +2800,7 @@ void manualViewBaseContour :: AddControlPoints()
                {
                        vtkActor * pointActor = _lstViewPoints[i]->GetVtkActor();
                        theRenderer->AddActor( pointActor );
-               }        
+               }
         }
 }
 // ----------------------------------------------------------------------------
@@ -2681,7 +2853,7 @@ void manualViewBaseContour::ConstructVTKObjects()
 {
 //JSTG 29-02-08 -----------------------------------------------
        //int i , nps = _sizePointsContour;
-       int i; 
+       int i;
        int nps = _manContModel->GetNumberOfPointsSpline();
 //-------------------------------------------------------------
        DeleteVtkObjects();
@@ -2690,10 +2862,15 @@ void manualViewBaseContour::ConstructVTKObjects()
 
        for (i=0 ; i<nps ; i++){
                _pts->SetPoint(i,       0       , 0     , 0 );
-       } 
-       // This is for the boundaring inicialisation 
-       _pts->SetPoint(0,       -1000   , -1000 , -1000 );
-       _pts->SetPoint(1,       1000    , 1000  , 1000 );
+       }
+       // This is for the boundaring inicialisation
+
+//EED 29Mars2009       
+       _pts->SetPoint(0,       0       , 0     , -1000 );
+       _pts->SetPoint(1,       0       , 0     ,  1000 );
+//     _pts->SetPoint(0,       -1000   , -1000 , -1000 );
+//     _pts->SetPoint(1,       1000    , 1000  , 1000  );
+
 
        vtkCellArray *lines = vtkCellArray::New();
        lines->InsertNextCell( nps /* +1 */ );
@@ -2722,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 );
@@ -2732,7 +2909,7 @@ void manualViewBaseContour::ConstructVTKObjects()
        vtkTextProperty *tprop = _textActor->GetTextProperty();
        tprop->SetFontSize(14);
        tprop->SetFontFamilyToArial();
-       tprop->SetColor(0, 0, 1);       
+       tprop->SetColor(0, 0, 1);
 }
 // ----------------------------------------------------------------------------
 void manualViewBaseContour::CreateNewContour()
@@ -2745,7 +2922,7 @@ void manualViewBaseContour::CreateNewContour()
 }
 // ----------------------------------------------------------------------------
 void manualViewBaseContour::UpdateViewPoint(int id) // virtual
-{  
+{
        manualPoint             *mp             = _manContModel->GetManualPoint(id);
 
 //EEDx6
@@ -2757,7 +2934,7 @@ void manualViewBaseContour::UpdateViewPoint(int id) // virtual
 }
 
 // ----------------------------------------------------------------------------
-void manualViewBaseContour :: UpdateViewPoints()
+void manualViewBaseContour::UpdateViewPoints()
 {
        int id, size = _lstViewPoints.size();
        for( id=0; id<size; id++)
@@ -2781,7 +2958,7 @@ void manualViewBaseContour::AddPoint( manualViewPoint * manualViewPoint )
        manualViewPoint->SetSpacing(_spc);
 
        vtkActor *actor = manualViewPoint->CreateVtkPointActor();
-       _wxvtkbaseview->GetRenderer()->AddActor( actor );
+       _wxvtkbaseview->GetRenderer()->AddActor( actor );       
 }
 
 // ----------------------------------------------------------------------------
@@ -2811,8 +2988,8 @@ void manualViewBaseContour::DeleteContour()
        Refresh();
 }
 // ----------------------------------------------------------------------------
-void manualViewBaseContour::DeletePoint(int id) // virtual 
-{ 
+void manualViewBaseContour::DeletePoint(int id) // virtual
+{
        int size=_lstViewPoints.size();
        if ( (id>=0) && (id<size) ){
                manualViewPoint         *mvp    =_lstViewPoints[id];
@@ -2841,7 +3018,7 @@ void manualViewBaseContour::SetSelected(bool selected)
 // ----------------------------------------------------------------------------
 void manualViewBaseContour::SetPosibleSelected(bool posibleSelected)
 {
-       _posibleSelected=posibleSelected;       
+       _posibleSelected=posibleSelected;
 }
 // ----------------------------------------------------------------------------
 bool manualViewBaseContour::GetEditable()
@@ -2894,8 +3071,8 @@ void manualViewBaseContour::SelectAllPoints(bool select)
 }
 //-----------------------------------------------------------------------------
 void manualViewBaseContour:: SetIfViewControlPoints(bool ifShow)
-{      
-       _viewControlPoints = ifShow;    
+{
+       _viewControlPoints = ifShow;
 }
 // ----------------------------------------------------------------------------
 bool manualViewBaseContour:: GetIfViewControlPoints()
@@ -2963,7 +3140,7 @@ bool manualViewBaseContour::SelectPosibleContour(int x, int y, int z)
                                SetPosibleSelected(result);
                        }
                }
-       
+
 
        }
        return result;
@@ -3010,7 +3187,7 @@ double* manualViewBaseContour::GetVectorPointsXManualContour(){
        for (i=0;i<size;i++){
                _pts->GetPoint(i,pp);
                vx[i]=pp[0];
-       }       
+       }
        return vx;
 }
 // ----------------------------------------------------------------------------
@@ -3022,7 +3199,7 @@ double* manualViewBaseContour::GetVectorPointsYManualContour()
        for (i=0;i<size;i++){
                _pts->GetPoint(i,pp);
                vy[i]=pp[1];
-       }       
+       }
        return vy;
 }
 // ----------------------------------------------------------------------------
@@ -3034,7 +3211,7 @@ double* manualViewBaseContour::GetVectorPointsZManualContour()
        for (i=0;i<size;i++){
                _pts->GetPoint(i,pp);
                vz[i]=pp[2];
-       }       
+       }
        return vz;
 }
 // ----------------------------------------------------------------------------
@@ -3050,7 +3227,7 @@ void manualViewBaseContour::Refresh() // virtual
        }
        UpdateColorActor();
 
-       if (_show_text==true) 
+       if (_show_text==true)
        {
                RefreshText();
        }
@@ -3066,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)
@@ -3173,7 +3350,7 @@ void manualViewBaseContour::TransfromeCoordViewWorld(double &X, double &Y, doubl
 //EED 27 sep 2007
 //   //EEDx6
 //     wxVtk2DBaseView *wxvtk2Dbaseview = (wxVtk2DBaseView*)_wxvtkbaseview;
-//     wxvtk2Dbaseview->TransformCoordinate_spacing_ModelToView(X,Y,Z); 
+//     wxvtk2Dbaseview->TransformCoordinate_spacing_ModelToView(X,Y,Z);
 
 }
 // ----------------------------------------------------------------------------
@@ -3204,7 +3381,7 @@ void manualViewBaseContour::InitMove(int x, int y, int z) // virtual
 }
 // ----------------------------------------------------------------------------
 void manualViewBaseContour::MoveContour(int x, int y, int z) // virtual
-{      
+{
 }
 // ----------------------------------------------------------------------------
 void manualViewBaseContour::MoveContour(int horizontalUnits, int verticalUnits )// virtual
@@ -3215,7 +3392,7 @@ void manualViewBaseContour::MoveContour(int horizontalUnits, int verticalUnits )
 void manualViewBaseContour::GetMinMax( double &minX,double &minY, double &minZ, double &maxX, double &maxY, double &maxZ )// virtual
 {
        double  pp[3];
-       manualPoint *mp;  
+       manualPoint *mp;
        int i;
        int size=_manContModel->GetSizeLstPoints();
        minX=99999;
@@ -3228,47 +3405,47 @@ void manualViewBaseContour::GetMinMax( double &minX,double &minY, double &minZ,
                minZ=99999;
                maxZ=-99999;
        }
-       for( i = 0; i < size; i++ ) 
+       for( i = 0; i < size; i++ )
        {
                mp=_manContModel->GetManualPoint(i);
                pp[0]=mp->GetX();
                pp[1]=mp->GetY();
                if ( ifFindZ )
                        pp[2]=mp->GetZ();
+
                // min X
-               if (pp[0]<minX) 
+               if (pp[0]<minX)
                {
                        minX=pp[0];
                }
                //min Y
-               if (pp[1]<minY) 
+               if (pp[1]<minY)
                {
                        minY=pp[1];
                }
                //max X
-               if (pp[0]>maxX) 
+               if (pp[0]>maxX)
                {
                        maxX=pp[0];
                }
                // max Y
-               if (pp[1]>maxY) 
+               if (pp[1]>maxY)
                {
                        maxY=pp[1];
                }
                if ( ifFindZ )
                {
                        // min Z
-                       if (pp[2]<minZ) 
+                       if (pp[2]<minZ)
                        {
                                minZ=pp[2];
                        }
                        // max Z
-                       if (pp[2]>maxZ) 
+                       if (pp[2]>maxZ)
                        {
                                maxZ=pp[2];
                        }
-               }               
+               }
        }
        if ( size<1 )
        {
@@ -3308,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++){
@@ -3319,7 +3495,7 @@ void manualViewBaseContour::SetVisible(bool ok)
        }
        _contourVtkActor->GetProperty()->SetOpacity( opacity );
        _textActor->GetProperty()->SetOpacity( opacity );
-       _textActor->SetInput(" ");
+       _textActor->SetInput("00");
 
 }
 // ----------------------------------------------------------------------------
@@ -3328,7 +3504,7 @@ void manualViewBaseContour::SetShowText(bool ok)
        _show_text = ok;
        if (_show_text==false)
        {
-               _textActor->SetInput(" ");
+               _textActor->SetInput("00");
        }
 }
 // ----------------------------------------------------------------------------
@@ -3356,9 +3532,9 @@ void manualViewBaseContour::SetSpacing(double spc[3])
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 
-// _type = 0  Sagital  
-// _type = 1  Coronal 
-// _type = 2  Axial   
+// _type = 0  Sagital
+// _type = 1  Coronal
+// _type = 2  Axial
 // _type = -1 View 3D
 
 manualContour3VControler::manualContour3VControler(int type)
@@ -3376,7 +3552,7 @@ manualContour3VControler::~manualContour3VControler()
 }
 
 // ----------------------------------------------------------------------------
-manualContour3VControler * manualContour3VControler :: Clone()  // virtual 
+manualContour3VControler * manualContour3VControler :: Clone()  // virtual
 {
        manualContour3VControler * clone = new manualContour3VControler( this->GetType() );
        CopyAttributesTo(clone);
@@ -3407,14 +3583,14 @@ void manualContour3VControler::AddPoint_Others()
        int i,size=this->_lstManualViewBaseContour.size();
        for ( i = 0 ; i < size ; i++ )
        {
-               mvbc = _lstManualViewBaseContour[i]; 
+               mvbc = _lstManualViewBaseContour[i];
                mvbc->AddPoint();
        }
 
 // EEDhh
 //     if (_manViewBaseCont1!=NULL){
-//             _manViewBaseCont1->AddPoint(); 
-//             _manViewBaseCont2->AddPoint(); 
+//             _manViewBaseCont1->AddPoint();
+//             _manViewBaseCont2->AddPoint();
 //             _manViewBaseCont3->AddPoint();
 //             this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
 //     }
@@ -3443,8 +3619,8 @@ void manualContour3VControler::AddPoint( int x, int y, int z ) // virtual
                }
 
 
-               int     id              = GetManualContourModel()->AddPoint(xx,yy,zz);
-               GetManualViewBaseContour()->AddPoint(); 
+               /*int   id              = */ GetManualContourModel()->AddPoint(xx,yy,zz);  // JPRx
+               GetManualViewBaseContour()->AddPoint();
                AddPoint_Others();
 
        }
@@ -3458,15 +3634,15 @@ void manualContour3VControler::InsertPoint_Others(int id)
        int i,size=this->_lstManualViewBaseContour.size();
        for ( i = 0 ; i < size ; i++ )
        {
-               mvbc = _lstManualViewBaseContour[i]; 
+               mvbc = _lstManualViewBaseContour[i];
                mvbc->InsertPoint(id);
        }
 
 /*EEDhh
        if (_manViewBaseCont1!=NULL){
-               _manViewBaseCont1->InsertPoint(id);                             
-               _manViewBaseCont2->InsertPoint(id);                             
-               _manViewBaseCont3->InsertPoint(id);                             
+               _manViewBaseCont1->InsertPoint(id);
+               _manViewBaseCont2->InsertPoint(id);
+               _manViewBaseCont3->InsertPoint(id);
                this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
        }
 */
@@ -3488,7 +3664,7 @@ void manualContour3VControler::InsertPoint(int x, int y, int z)
                        if (_type==0)
                        {
                                xx=_vtkmprbasedata->GetX();
-                       }       
+                       }
 
                        if (_type==1)
                        {
@@ -3497,11 +3673,11 @@ void manualContour3VControler::InsertPoint(int x, int y, int z)
 
                        id      = GetManualContourModel()->InsertPoint(xx,yy,zz);
 
-                       GetManualViewBaseContour()->InsertPoint(id);    
-                       InsertPoint_Others(0);  
+                       GetManualViewBaseContour()->InsertPoint(id);
+                       InsertPoint_Others(0);
 
                } else {
-                       AddPoint(x,y,z);        
+                       AddPoint(x,y,z);
                }
        }
 }
@@ -3509,9 +3685,9 @@ void manualContour3VControler::InsertPoint(int x, int y, int z)
 
 // EEDhh
 /*
-void manualContour3VControler::SetModelView (  manualContourModel *manContModel, 
-                                                                                               manualViewBaseContour *manViewBaseCont0, 
-                                                                                               manualViewBaseContour *manViewBaseCont1, 
+void manualContour3VControler::SetModelView (  manualContourModel *manContModel,
+                                                                                               manualViewBaseContour *manViewBaseCont0,
+                                                                                               manualViewBaseContour *manViewBaseCont1,
                                                                                                manualViewBaseContour *manViewBaseCont2,
                                                                                                manualViewBaseContour *manViewBaseCont3)
 {
@@ -3569,21 +3745,21 @@ void manualContour3VControler::DeleteActualMousePoint_Others(int id)
        int i,size=this->_lstManualViewBaseContour.size();
        for ( i = 0 ; i < size ; i++ )
        {
-               mvbc = _lstManualViewBaseContour[i]; 
-               mvbc->DeletePoint(id);  
+               mvbc = _lstManualViewBaseContour[i];
+               mvbc->DeletePoint(id);
                mvbc->Refresh();
        }
 
 /*
        if (_manViewBaseCont1!=NULL){
-               _manViewBaseCont1->DeletePoint(id);  
-               _manViewBaseCont2->DeletePoint(id);  
+               _manViewBaseCont1->DeletePoint(id);
+               _manViewBaseCont2->DeletePoint(id);
                _manViewBaseCont3->DeletePoint(id);
-       
+
                _manViewBaseCont1->Refresh();
                _manViewBaseCont2->Refresh();
                _manViewBaseCont3->Refresh();
-               
+
                this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
        }
 */
@@ -3591,7 +3767,7 @@ void manualContour3VControler::DeleteActualMousePoint_Others(int id)
 }
 // ----------------------------------------------------------------------------
 void manualContour3VControler::DeleteActualMousePoint(int x, int y)// virtual
-{ 
+{
        int id=GetManualViewBaseContour()->GetIdPoint ( x , y , GetZ() );
        if (id!=-1){
                manualContourBaseControler::DeleteActualMousePoint( x , y );
@@ -3605,30 +3781,30 @@ void manualContour3VControler::MouseMove_Others(int id) // virtual
        int i,size=this->_lstManualViewBaseContour.size();
        for ( i = 0 ; i < size ; i++ )
        {
-               mvbc = _lstManualViewBaseContour[i]; 
+               mvbc = _lstManualViewBaseContour[i];
                mvbc->SelectAllPossibleSelected(false);
                if (id!=-1)
-               {       
+               {
                        mvbc->SetPointPosibleSelected(id,true);
                }
-               mvbc->SetPosibleSelected  (  GetManualViewBaseContour()->GetPosibleSelected()  );   
+               mvbc->SetPosibleSelected  (  GetManualViewBaseContour()->GetPosibleSelected()  );
                mvbc->Refresh();
        }
-       
+
 // EEDhh
-/*     
+/*
        if (_manViewBaseCont1!=NULL){
                _manViewBaseCont1->SelectAllPossibleSelected(false);
                _manViewBaseCont2->SelectAllPossibleSelected(false);
                _manViewBaseCont3->SelectAllPossibleSelected(false);
-               if (id!=-1){            
+               if (id!=-1){
                        _manViewBaseCont1->SetPointPosibleSelected(id,true);
                        _manViewBaseCont2->SetPointPosibleSelected(id,true);
                        _manViewBaseCont3->SetPointPosibleSelected(id,true);
-               } 
-               _manViewBaseCont1->SetPosibleSelected  (  GetManualViewBaseContour()->GetPosibleSelected()  );   
-               _manViewBaseCont2->SetPosibleSelected  (  GetManualViewBaseContour()->GetPosibleSelected()  );   
-               _manViewBaseCont3->SetPosibleSelected  (  GetManualViewBaseContour()->GetPosibleSelected()  );   
+               }
+               _manViewBaseCont1->SetPosibleSelected  (  GetManualViewBaseContour()->GetPosibleSelected()  );
+               _manViewBaseCont2->SetPosibleSelected  (  GetManualViewBaseContour()->GetPosibleSelected()  );
+               _manViewBaseCont3->SetPosibleSelected  (  GetManualViewBaseContour()->GetPosibleSelected()  );
 
                _manViewBaseCont1->Refresh();
                _manViewBaseCont2->Refresh();
@@ -3656,7 +3832,7 @@ void manualContour3VControler::OnChar_Others()
        int i,size=this->_lstManualViewBaseContour.size();
        for ( i = 0 ; i < size ; i++ )
        {
-               mvbc = _lstManualViewBaseContour[i]; 
+               mvbc = _lstManualViewBaseContour[i];
                mvbc->Refresh();
        }
 // EEDhh
@@ -3688,7 +3864,7 @@ void manualContour3VControler::ResetContour_Others()
        int i,size=this->_lstManualViewBaseContour.size();
        for ( i = 0 ; i < size ; i++ )
        {
-               mvbc = _lstManualViewBaseContour[i]; 
+               mvbc = _lstManualViewBaseContour[i];
                mvbc->DeleteContour();
                mvbc->CreateNewContour();
        }
@@ -3715,7 +3891,7 @@ manualContour3DControler::~manualContour3DControler()
 {
 }
 // ----------------------------------------------------------------------------
-manualContour3DControler * manualContour3DControler :: Clone()  // virtual 
+manualContour3DControler * manualContour3DControler :: Clone()  // virtual
 {
        manualContour3DControler * clone = new manualContour3DControler();
        CopyAttributesTo(clone);
@@ -3770,7 +3946,7 @@ void manualContour3DControler::MouseClickLeft(int x, int y) // virtual
 
        manualContourControler::MouseClickLeft(x,y);
 
-} 
+}
 // ----------------------------------------------------------------------------
 bool manualContour3DControler::OnChar()
 {
@@ -3818,7 +3994,7 @@ manualContour3V3DControler::~manualContour3V3DControler()
 }
 
 // ----------------------------------------------------------------------------
-manualContour3V3DControler * manualContour3V3DControler :: Clone()  // virtual 
+manualContour3V3DControler * manualContour3V3DControler :: Clone()  // virtual
 {
        manualContour3V3DControler * clone = new manualContour3V3DControler();
        CopyAttributesTo(clone);
@@ -3883,7 +4059,7 @@ bool manualContour3V3DControler::OnChar() // virtual
 }
 
 // ----------------------------------------------------------------------------
-void manualContour3V3DControler::ResetContour() // virtual 
+void manualContour3V3DControler::ResetContour() // virtual
 {
        manualContourControler::ResetContour();
        _manualcontour3Vcontroler->ResetContour_Others();
@@ -3896,21 +4072,21 @@ void manualContour3V3DControler::ResetContour() // virtual
 
 // _state = 0  // ..nothing..
 // _state = 1  // move with add point
-// _state = 5  // move 
+// _state = 5  // move
 // _state = 6  // move with insert point
 // _state = 7  // move with non selection
 
 manualContourControler::manualContourControler()
 {
        _easyCreation = true;
-       
+
 }
 // ----------------------------------------------------------------------------
 manualContourControler::~manualContourControler()
 {
 }
 // ----------------------------------------------------------------------------
-manualContourControler * manualContourControler :: Clone()  // virtual 
+manualContourControler * manualContourControler :: Clone()  // virtual
 {
        manualContourControler * clone = new manualContourControler();
        CopyAttributesTo(clone);
@@ -3933,40 +4109,40 @@ void manualContourControler::Configure() //virtual
 // ----------------------------------------------------------------------------
 void manualContourControler::MouseClickLeft(int x, int y){
 
-                       
+
        bool ok = false;
        int z   = GetZ();
        int size= GetManualViewBaseContour()->GetNumberOfPoints();
 
        // Insert a Control Point with shift+ClickLeft
-       int tt = GetState();
+       // int tt = GetState();  // JPRx
        vtkRenderWindowInteractor *vtkrenderwindowinteractor = _vtkInteractorStyleBaseView->GetInteractor();
 //EED3131
        if( IsEditable() )
        {
-               if ( (_vtkInteractorStyleBaseView!=NULL) && (GetState()==0) && ( (vtkrenderwindowinteractor!=NULL) && (vtkrenderwindowinteractor->GetShiftKey()==1) ) ) 
-               { 
+               if ( (_vtkInteractorStyleBaseView!=NULL) && (GetState()==0) && ( (vtkrenderwindowinteractor!=NULL) && (vtkrenderwindowinteractor->GetShiftKey()==1) ) )
+               {
                        ok=true;
                        InsertPoint(x,y,z);
                        size++;
                }
                // Start to Insert Control Points with ClickLeft (Empty contour)
                if ((GetState()==0) && (size==0) && (_easyCreation==true) )
-               { 
+               {
                        ok=true;
-                       SetState(1); 
+                       SetState(1);
                        AddPoint(x,y,z);
                }
                // Continuie to Insert Control Points with ClickLeft (After being empty the contour)
-               if ((GetState()==1) && (_easyCreation==true) )  
-               { 
+               if ((GetState()==1) && (_easyCreation==true) )
+               {
                        ok=true;
                        AddPoint(x,y,z);
                        _bakIdPoint=GetNumberOfPointsManualContour() - 1;
                }
                // Insert Control Points IF Contour si Selected
-               if ((GetState()==0) && GetManualViewBaseContour()->GetPosibleSelected() )       
-               {               
+               if ((GetState()==0) && GetManualViewBaseContour()->GetPosibleSelected() )
+               {
                        ok=true;
                        InsertPoint(x,y,z);
                        _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
@@ -3976,29 +4152,28 @@ void manualContourControler::MouseClickLeft(int x, int y){
                if ( (GetState()==0 || GetState()==6) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) )
                {
                        ok=true;
-                       _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);    
+                       _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
                        SetState(5);
                }
                // If nothing selected _state=7
                if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)==-1 ) )
                {
                        //ok=true;
-                       _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);    
+                       _bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
                        SetState(7);
                }
-       }
-       else
-       {
+       }else{
                SetPosibleToMove( true );
                GetManualViewBaseContour()->SetSelected( GetManualViewBaseContour()->GetPosibleSelected() );
-       }       
+       } // IsEditable
+       
        if ( GetState() == 0 && GetManualViewBaseContour()->GetPosibleSelected() )
-       {               
+       {
                SetMoving( true );
-               ok=true;                
+               ok=true;
                GetManualViewBaseContour()->InitMove(x,y,z);
                SetState(6);
-       }               
+       }
        if (ok==true)
        {
                GetManualViewBaseContour()->Refresh();
@@ -4009,11 +4184,11 @@ void manualContourControler::MouseMove(int x, int y) // virtual
 {
        int z=GetZ();
        GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
-       GetManualViewBaseContour()->SelectPosibleContour(x,y,z);        
+       GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
        if (GetState()==1){     SetPoint( _bakIdPoint , x , y ,z); }
        if (GetState()==5){     SetPoint( _bakIdPoint , x , y ,z); }
        if ( GetState()==6 && !IsEditable() && GetPosibleToMove() &&IsMoving() )
-       {               
+       {
                GetManualViewBaseContour()->MoveContour(x,y,z);
        }
        if (GetState()!=7 || GetManualViewBaseContour()->GetPosibleSelected() ){
@@ -4023,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();
        }
@@ -4031,16 +4206,16 @@ void manualContourControler::MouseMove(int x, int y) // virtual
 }
 
 // ----------------------------------------------------------------------------
-void manualContourControler::MouseDLeft( int x, int y)//virtual 
+void manualContourControler::MouseDLeft( int x, int y)//virtual
 {
-       manualContourBaseControler::MouseDLeft( x, y);  
+       manualContourBaseControler::MouseDLeft( x, y);
        if ( IsEditable() )
        {
                GetManualViewBaseContour()->AddControlPoints();
                GetManualViewBaseContour()->AddTextActor();
                GetManualViewBaseContour()->Refresh();
                this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
-       }       
+       }
 }
 // ----------------------------------------------------------------------------
 void manualContourControler::SetEasyCreation(bool easyCreation)
@@ -4066,7 +4241,7 @@ manualContourPerpPlaneControler::~manualContourPerpPlaneControler()
 {
 }
 // ----------------------------------------------------------------------------
-manualContourPerpPlaneControler * manualContourPerpPlaneControler :: Clone()  // virtual 
+manualContourPerpPlaneControler * manualContourPerpPlaneControler :: Clone()  // virtual
 {
        manualContourPerpPlaneControler * clone = new manualContourPerpPlaneControler();
        CopyAttributesTo(clone);
@@ -4151,26 +4326,26 @@ bool manualContourPerpPlaneControler::OnChar() // virtual
        return true;
 }
 // ----------------------------------------------------------------------------
-bool manualContourPerpPlaneControler::OnMouseMove() //         virtual 
+bool manualContourPerpPlaneControler::OnMouseMove() //         virtual
 {
        manualContourControler::OnMouseMove();
        return _flagMouseMove;
 }
 // ----------------------------------------------------------------------------
-bool manualContourPerpPlaneControler::OnLeftDClick() //        virtual 
+bool manualContourPerpPlaneControler::OnLeftDClick() //        virtual
 {
        manualContourControler::OnLeftDClick();
        return _flagMouseDClick;
 }
 // ----------------------------------------------------------------------------
-void manualContourPerpPlaneControler::ResetContour() // virtual 
+void manualContourPerpPlaneControler::ResetContour() // virtual
 {
        manualContourControler::ResetContour();
        _manualcontour3Vcontroler->ResetContour_Others();
 }
 
 // ----------------------------------------------------------------------------
-void manualContourPerpPlaneControler::MouseDLeft( int x, int y) // virtual 
+void manualContourPerpPlaneControler::MouseDLeft( int x, int y) // virtual
 {
        _flagMouseDClick=true;
        manualContourControler::MouseDLeft(x,y);
@@ -4192,7 +4367,7 @@ void manualContourPerpPlaneControler::MouseDLeft( int x, int y) // virtual
 //             _vtkmprbasedata->SetZ( mp->GetZ() );
 //             ResetOrientationPlane();
 //             this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
-//     } 
+//     }
 }
 
 
@@ -4237,7 +4412,7 @@ manualRoiControler::~manualRoiControler()
 {
 }
 // ----------------------------------------------------------------------------
-manualRoiControler * manualRoiControler :: Clone()  // virtual 
+manualRoiControler * manualRoiControler :: Clone()  // virtual
 {
        manualRoiControler * clone = new manualRoiControler();
        CopyAttributesTo(clone);
@@ -4258,34 +4433,58 @@ 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 ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true))        { 
+       
+       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 (GetState()==0) {
                if (size==0){
-                       AddPoint(x,y,z); 
-                       AddPoint(x,y,z); 
-                       AddPoint(x,y,z); 
-                       AddPoint(x,y,z); 
+                       AddPoint(x,y,z);
+                       AddPoint(x,y,z);
+                       AddPoint(x,y,z);
+                       AddPoint(x,y,z);
+                       bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
+                       SetState(1);
+               }
+       }
+       
+/*EED 21 Avril 2009
+       if (GetState()==0) {
+               if (size==0){
+                       AddPoint(x,y,z);
+                       AddPoint(x,y,z);
+                       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); 
+                       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);     
+               bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
                SetState(5);
        }
+*/
+       
        GetManualViewBaseContour()->Refresh();
 }
+
 // ----------------------------------------------------------------------------
 void manualRoiControler::MouseMove(int x, int y) // virtual
 {
@@ -4293,40 +4492,42 @@ void manualRoiControler::MouseMove(int x, int y) // virtual
 
 //     this->_vtkInteractorStyleBaseView->
 
+                  
        GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
        GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
 
-       if (GetState()==5){     
-               SetPoint( bakIdPoint , x , y ,z); 
+
+       if ( (GetState()==5) || (GetState()==1) ){
+               SetPoint( bakIdPoint , x , y ,z);
                if (bakIdPoint==0)
                {
-                       SetPointX( 1 , x ); 
-                       SetPointY( 3 , y ); 
+                       SetPointX( 1 , x );
+                       SetPointY( 3 , y );
                }
                if (bakIdPoint==1)
                {
-                       SetPointX( 0 , x ); 
-                       SetPointY( 2 , y ); 
+                       SetPointX( 0 , x );
+                       SetPointY( 2 , y );
                }
                if (bakIdPoint==2)
                {
-                       SetPointX( 3 , x ); 
-                       SetPointY( 1 , y ); 
+                       SetPointX( 3 , x );
+                       SetPointY( 1 , y );
                }
                if (bakIdPoint==3)
                {
-                       SetPointX( 2 , x ); 
-                       SetPointY( 0 , y ); 
+                       SetPointX( 2 , x );
+                       SetPointY( 0 , y );
                }
        }
-       if (GetState()==6){     
+       if (GetState()==6){
                GetManualViewBaseContour()->MoveContour(x,y,z);
        }
        GetManualViewBaseContour()->Refresh();
 }
 // ----------------------------------------------------------------------------
 void manualRoiControler::DeleteActualMousePoint(int x, int y)  // virtual
-{ 
+{
 }
 // ----------------------------------------------------------------------------
 void manualRoiControler::InitRoi(int ww, int hh, double porcentage)
@@ -4368,8 +4569,8 @@ void manualRoiControler::InitRoi(int ww, int hh, double porcentage)
        GetManualViewBaseContour() ->UpdateViewPoint(3);
 
        SetState(0);
-       GetManualViewBaseContour()->Refresh();  
-}      
+       GetManualViewBaseContour()->Refresh();
+}
 
 // ----------------------------------------------------------------------------
 void manualRoiControler::SetRoi(int x1, int y1,int x2, int y2)
@@ -4418,7 +4619,7 @@ manualCircleControler::~manualCircleControler()
 {
 }
 // ----------------------------------------------------------------------------
-manualCircleControler * manualCircleControler :: Clone()  // virtual 
+manualCircleControler * manualCircleControler :: Clone()  // virtual
 {
        manualCircleControler * clone = new manualCircleControler();
        CopyAttributesTo(clone);
@@ -4441,30 +4642,46 @@ 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 ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true))        { 
+       
+       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 (GetState()==0) {
                if (size==0){
-                       AddPoint(x,y,z); 
-                       AddPoint(x,y,z); 
-//                     AddPoint(x,y,z); 
-//                     AddPoint(x,y,z); 
+                       AddPoint(x,y,z);
+                       AddPoint(x,y,z);
+                       bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
+                       SetState(1);
+               }
+       }       
+       
+/*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); 
+                       SetPoint(0,x,y,z);
+                       SetPoint(1,x,y,z);
                }
-               bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);     
+               bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
                SetState(5);
        }
+*/
+       
        GetManualViewBaseContour()->Refresh();
 }
 // ----------------------------------------------------------------------------
@@ -4472,39 +4689,15 @@ 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);
        GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
 
-       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){     
+       if (GetState()==1){     SetPoint( bakIdPoint , x , y ,z); }
+       if (GetState()==5){     SetPoint( bakIdPoint , x , y ,z); }
+       
+       if (GetState()==6){
                GetManualViewBaseContour()->MoveContour(x,y,z);
        }
        GetManualViewBaseContour()->Refresh();
@@ -4513,7 +4706,7 @@ void manualCircleControler::MouseMove(int x, int y) // virtual
 
 // ----------------------------------------------------------------------------
 void manualCircleControler::DeleteActualMousePoint(int x, int y)  // virtual
-{ 
+{
 }
 // ----------------------------------------------------------------------------
 
@@ -4556,8 +4749,8 @@ void manualCircleControler::InitRoi(int ww, int hh, double porcentage)
 //     GetManualViewBaseContour() ->UpdateViewPoint(3);
 
        SetState(0);
-       GetManualViewBaseContour()->Refresh();  
-}      
+       GetManualViewBaseContour()->Refresh();
+}
 
 // ----------------------------------------------------------------------------
 /*
@@ -4589,6 +4782,141 @@ void manualCircleControler::SetRoi(int x1, int y1,int x2, int y2)
 */
 
 
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+// AD:02-09
+
+// _state = 0  // ..nothing..
+// _state = 5  // move point
+// _state = 6  // move all
+// _state = 7  // Empty mouse drag
+
+manualLineControler::manualLineControler()
+{
+}
+// ----------------------------------------------------------------------------
+manualLineControler::~manualLineControler()
+{
+}
+// ----------------------------------------------------------------------------
+manualLineControler * manualLineControler :: Clone()  // virtual 
+{
+       manualLineControler * clone = new manualLineControler();
+       CopyAttributesTo(clone);
+       return clone;
+}
+
+// ---------------------------------------------------------------------------
+void manualLineControler::CopyAttributesTo( manualLineControler * cloneObject)
+{
+       // Fathers object
+       manualContourBaseControler::CopyAttributesTo(cloneObject);
+}
+
+
+// ----------------------------------------------------------------------------
+void manualLineControler::MouseClickLeft(int x, int y){
+       int z = GetZ();
+       
+       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){
+                       AddPoint(x,y,z); 
+                       AddPoint(x,y,z); 
+                       bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);     
+                       SetState(1);
+               }
+       }
+       
+       
+/*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); 
+               }
+               bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);     
+               SetState(5);
+       }
+*/
+       
+       GetManualViewBaseContour()->Refresh();
+}
+// ----------------------------------------------------------------------------
+
+void manualLineControler::MouseMove(int x, int y) // virtual
+{
+       int z=GetZ();
+
+       GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
+       GetManualViewBaseContour()->SelectPosiblePoint(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);
+       }
+       GetManualViewBaseContour()->Refresh();
+}
+
+
+// ----------------------------------------------------------------------------
+void manualLineControler::DeleteActualMousePoint(int x, int y)  // virtual
+{ 
+}
+// ----------------------------------------------------------------------------
+
+void manualLineControler::InitRoi(int ww, int hh, double porcentage)
+{
+       int zz;
+       manualPoint *mp;
+
+       if (GetManualContourModel()->GetSizeLstPoints() ==0)
+       {
+               zz = GetZ();
+               AddPoint(0,0,zz);
+               AddPoint(0,0,zz);
+       }
+
+       double pp1=porcentage;
+       double pp2=1-porcentage;
+
+       mp = GetManualContourModel()->GetManualPoint(0);
+       zz=(int)mp->GetZ();
+       mp->SetPoint(ww*pp2,hh*pp2,zz);
+
+       mp = GetManualContourModel()->GetManualPoint(1);
+       zz=(int)mp->GetZ();
+       mp->SetPoint(ww*pp2,hh*pp1,zz);
+
+       GetManualViewBaseContour() ->UpdateViewPoint(0);
+       GetManualViewBaseContour() ->UpdateViewPoint(1);
+
+       SetState(0);
+       GetManualViewBaseContour()->Refresh();  
+}      
 
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
@@ -4600,9 +4928,9 @@ manualContourBaseControler::manualContourBaseControler()
        _manViewBaseCont        = NULL;
        _manContModel           = NULL;
        _state                          = 0;
-       _z                                      = -900;
+       _z                                      = 900;
        _editable                       = true;
-       _posibleToMove          = true; 
+       _posibleToMove          = true;
        _moving                         = false;
        _created                        = false;
        _keyBoardMoving         = false;
@@ -4613,7 +4941,7 @@ manualContourBaseControler::~manualContourBaseControler()
 }
 
 // ----------------------------------------------------------------------------
-manualContourBaseControler * manualContourBaseControler :: Clone()  // virtual 
+manualContourBaseControler * manualContourBaseControler :: Clone()  // virtual
 {
        manualContourBaseControler * clone = new manualContourBaseControler();
        CopyAttributesTo(clone);
@@ -4650,8 +4978,8 @@ bool manualContourBaseControler::OnChar()
                int X,Y;
                wxVTKRenderWindowInteractor *_wxVTKiren;
                _wxVTKiren= _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
-               _wxVTKiren->GetEventPosition(X, Y);     
-               int Z = GetZ();
+               _wxVTKiren->GetEventPosition(X, Y);
+               //int Z = GetZ(); // JPRx
                // Delete Point
                if ((keyCode==8) || (keyCode==127))
                {
@@ -4662,10 +4990,10 @@ bool manualContourBaseControler::OnChar()
                        }
                        GetManualViewBaseContour()->Refresh();
                        this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
-               }       
+               }
                else
                {
-                       // Magnet 
+                       // Magnet
                        if (keyCode==32)
                        {
                                Magnet(X,Y);
@@ -4673,60 +5001,61 @@ bool manualContourBaseControler::OnChar()
                                this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
                        }
                        else if( !IsEditable() )
-                       {               
+                       {
                                if ( keyCode == 'L' )
-                               {       
-                                       GetManualViewBaseContour()->MoveContour( -1, 0 );       
+                               {
+                                       GetManualViewBaseContour()->MoveContour( -1, 0 );
                                        SetKeyBoardMoving( true );
                                }
                                else if ( keyCode == 'R' )
-                               {                       
-                                       GetManualViewBaseContour()->MoveContour( 1, 0 );        
-                                       SetKeyBoardMoving( true );      
+                               {
+                                       GetManualViewBaseContour()->MoveContour( 1, 0 );
+                                       SetKeyBoardMoving( true );
                                }
                                else if ( keyCode == 'U' )
                                {
-                                       GetManualViewBaseContour()->MoveContour( 0, -1 );       
+                                       GetManualViewBaseContour()->MoveContour( 0, -1 );
                                        SetKeyBoardMoving( true );
                                }
                                else if ( keyCode == 'D' )
                                {
-                                       GetManualViewBaseContour()->MoveContour( 0, 1 );        
+                                       GetManualViewBaseContour()->MoveContour( 0, 1 );
                                        SetKeyBoardMoving( true );
                                }
                                else if ( keyCode == 'W' )//Diagonal left down
                                {
-                                       GetManualViewBaseContour()->MoveContour( -1, 1 );       
+                                       GetManualViewBaseContour()->MoveContour( -1, 1 );
                                        SetKeyBoardMoving( true );
                                }
                                else if ( keyCode == 'Q' )//Diagonal left up
                                {
-                                       GetManualViewBaseContour()->MoveContour( -1, -1 );      
+                                       GetManualViewBaseContour()->MoveContour( -1, -1 );
                                        SetKeyBoardMoving( true );
                                }
                                else if( keyCode == 'P' )//Diagonal right up
                                {
-                                       GetManualViewBaseContour()->MoveContour( 1, -1 );       
+                                       GetManualViewBaseContour()->MoveContour( 1, -1 );
                                        SetKeyBoardMoving( true );
                                }
                                else if( keyCode == 'M' )//Diagonal right down
                                {
-                                       GetManualViewBaseContour()->MoveContour( 1, 1 );        
+                                       GetManualViewBaseContour()->MoveContour( 1, 1 );
                                        SetKeyBoardMoving( true );
                                }
                                if( GetKeyBoardMoving() )
                                {
                                        GetManualViewBaseContour()->Refresh();
-                                       this->_vtkInteractorStyleBaseView->SetRefresh_waiting();        
+                                       this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
                                }
                        }
-               }               
+               }
        }
        return true;
 }
 // ----------------------------------------------------------------------------
 bool manualContourBaseControler::OnMouseMove()
 {
+       
        if ( _vtkInteractorStyleBaseView!=NULL)
        {
                int X,Y;
@@ -4752,7 +5081,7 @@ bool manualContourBaseControler::OnLeftButtonDown()
                wxVTKRenderWindowInteractor *wxVTKiren;
                wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
                wxVTKiren->GetEventPosition(X,Y);
-               
+
                MouseClickLeft(X,Y);
        }
        return true;
@@ -4785,7 +5114,7 @@ bool manualContourBaseControler::OnLeftDClick()
        return true;
 }
 // ----------------------------------------------------------------------------
-bool manualContourBaseControler::OnMiddleButtonDown() 
+bool manualContourBaseControler::OnMiddleButtonDown()
 {
 //     SetKeyBoardMoving( false );
        if ( _vtkInteractorStyleBaseView!=NULL )
@@ -4812,7 +5141,7 @@ bool manualContourBaseControler::OnRightButtonDown()
                wxVTKRenderWindowInteractor *wxVTKiren;
                wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
                wxVTKiren->GetEventPosition(X, Y);
-               
+
                SetCompleteCreation( true );
                SetKeyBoardMoving( false );
                MouseClickRight(X,Y);
@@ -4842,40 +5171,41 @@ manualViewBaseContour* manualContourBaseControler::GetManualViewBaseContour()
 }
 // ----------------------------------------------------------------------------
 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)
 {
        if (_state==5){ _state = 0; }
        if (_state==6){ _state = 0; }
-       if (_state==7){ _state = 0; }   
+       if (_state==7){ _state = 0; }
        SetMoving( false );
        GetManualViewBaseContour()->SelectPosibleContour(x,y,GetZ());
        if( GetIfCompleteCreation() && IsEditable() && !GetManualViewBaseContour()->GetPosibleSelected() && (GetManualViewBaseContour()->GetIdPoint(x,y,GetZ())==-1)  )
        {
                SetEditable( false );
-               SetPosibleToMove( false );              
+               SetPosibleToMove( false );
        }
 }
 // ----------------------------------------------------------------------------
 void manualContourBaseControler::MouseDLeft(int x, int y )
 {
-       if (_state==0)  
-       { 
+       if (_state==0)
+       {
                int z=GetZ();
                GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
                GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
@@ -4913,7 +5243,7 @@ void manualContourBaseControler::SetEditable(  bool condition  )
                        GetManualViewBaseContour()->RemoveControlPoints();
                }
                GetManualViewBaseContour()->SetSelected( condition );
-       }       
+       }
        _editable = condition;
 }
 
@@ -4984,17 +5314,17 @@ double* manualContourBaseControler::GetVectorPointsYManualContour(){
 // ----------------------------------------------------------------------------
 void manualContourBaseControler::DeleteContour(){
        _manViewBaseCont->DeleteContour();
-       _manContModel->DeleteAllPoints(); 
+       _manContModel->DeleteAllPoints();
 }
 // ----------------------------------------------------------------------------
 void manualContourBaseControler::DeleteActualMousePoint(int x, int y)// virtual
-{ 
+{
        if ((_manContModel!=NULL) && (_manViewBaseCont!=NULL) )
        {
                int id=_manViewBaseCont->GetIdPoint(x,y,GetZ());
                if ((id!=-1) && (_manContModel->GetSizeLstPoints()>2) ){
                        _manContModel->DeletePoint(id);
-                       _manViewBaseCont->DeletePoint(id);  
+                       _manViewBaseCont->DeletePoint(id);
                }
        }
        _state = 0;
@@ -5002,10 +5332,10 @@ void manualContourBaseControler::DeleteActualMousePoint(int x, int y)// virtual
 
 // ----------------------------------------------------------------------------
 void manualContourBaseControler::Magnet(int x, int y)
-{ 
+{
        if( IsEditable())
        {
-               int id=_manViewBaseCont->GetIdPoint(x,y,GetZ());
+               /*int id= */ _manViewBaseCont->GetIdPoint(x,y,GetZ()); // JPRx
                if (GetManualContourModel()!=NULL){
                        double  xx      = x;
                        double  yy      = y;
@@ -5041,8 +5371,8 @@ void manualContourBaseControler::AddPoint(int x, int y, int z) // virtual
                double  yy      = y;
                double  zz      = z;
                GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
-               int     id              = GetManualContourModel()->AddPoint(xx,yy,zz);
-               GetManualViewBaseContour()->AddPoint(); 
+               /*int   id              =*/  GetManualContourModel()->AddPoint(xx,yy,zz);  // JPRx
+               GetManualViewBaseContour()->AddPoint();
 //             GetManualViewBaseContour()->UpdateViewPoint(id);
        }
 }
@@ -5058,12 +5388,12 @@ void manualContourBaseControler::InsertPoint(int x,int y,int z)  // virtual
                GetManualViewBaseContour()->TransfromeCoordViewWorld(xx,yy,zz);
                if (GetManualContourModel()->GetSizeLstPoints()>1){
                        id = GetManualContourModel()->InsertPoint(xx,yy,zz);
-                       GetManualViewBaseContour()->InsertPoint(id);                            
+                       GetManualViewBaseContour()->InsertPoint(id);
 //                     GetManualViewBaseContour()->UpdateViewPoint(id);
                } else {
                        GetManualContourModel()->AddPoint(xx,yy,zz);
-                       GetManualViewBaseContour()->AddPoint(); 
-//                     AddPoint(x,y,z);        
+                       GetManualViewBaseContour()->AddPoint();
+//                     AddPoint(x,y,z);
 //                     GetManualViewBaseContour()->UpdateViewPoint(id);
                }
        }