]> Creatis software - creaMaracasVisu.git/commitdiff
BUG
authorEduardo Davila <Eduardo.Davila@creatis.insa-lyon.fr>
Tue, 3 Jul 2012 11:48:08 +0000 (11:48 +0000)
committerEduardo Davila <Eduardo.Davila@creatis.insa-lyon.fr>
Tue, 3 Jul 2012 11:48:08 +0000 (11:48 +0000)
 - 1399  Optimisation of ifTouchContour in manualViewContour (Boundaring)
 - 1449  ManaulPaint incorrect default parameters

lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualView3VContour.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBullEyeSector.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewContour.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewContour.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/wxManualPaintPanel.cpp

index c7a1d75526058b14f4dc0b965eb8537354f961e2..f8fadfff0d94b7b258a286b7b5466c6c39507e23 100644 (file)
@@ -62,6 +62,17 @@ void manualView3VContour::RefreshContour()  // virtula
 {
        manualViewContour::RefreshContour();
        int i;
+       
+       //EED 27 Juin 2012
+    //Boundaring box   
+       _minX=99999;
+       _minY=99999;
+       _minZ=99999;
+       _maxX=-99999;
+       _maxY=-99999;
+       _maxZ=-99999;
+       
+       
        double pp[3];
 // JSTG 25-02-08 ----------------------------------------
        //int nps = GetNumberOfPointsSpline();
@@ -74,7 +85,18 @@ void manualView3VContour::RefreshContour()  // virtula
 
 //EED 27 sep 2006
                _pts->SetPoint( i, pp[0] , pp[1] ,pp[2] );
-       }
+               
+               
+               //EED 27 Juin 2012
+               //Boundaring box
+               if (pp[0] < _minX) { _minX = pp[0]; }
+               if (pp[1] < _minY) { _minY = pp[1]; }
+               if (pp[2] < _minZ) { _minZ = pp[2]; }
+               if (pp[0] > _maxX) { _maxX = pp[0]; }
+               if (pp[1] > _maxY) { _maxY = pp[1]; }           
+               if (pp[2] > _maxZ) { _maxY = pp[2]; }           
+               
+       }// for
 
 }
 
@@ -122,28 +144,30 @@ bool manualView3VContour::ifTouchContour(int x,int y,int z){ // virtual
        yy = yy * _spc[1];
        zz = zz * _spc[2];
 
-    unsigned int i, nps,nps_t;
-    nps          = _sizePointsContour;
-       if (this->_manContModel->IfCloseContour()==true)
-       {
-               nps_t = nps;
-       } else {
-               nps_t = nps-1;
-       }
-       FilterCordinateXYZ(xx,yy,zz);
-
-    for( i = 0; i < nps_t; i++ ) {
-               _pts->GetPoint(i%nps, ppA);
-               _pts->GetPoint((i+1)%nps, ppB);
-               FilterCordinateXYZ(ppA[0],ppA[1],ppA[2]);
-               FilterCordinateXYZ(ppB[0],ppB[1],ppB[2]);
-               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) ) {
-                       result=true;
-                       i=nps;
+       if ( (xx>=_minX) &&  (yy>=_minY) && (xx<=_maxX) && (yy<=_maxY)) {  //  boundaring box   
+               unsigned int i, nps,nps_t;
+               nps       = _sizePointsContour;
+               if (this->_manContModel->IfCloseContour()==true)
+               {
+                       nps_t = nps;
+               } else {
+                       nps_t = nps-1;
                }
-       }
+               FilterCordinateXYZ(xx,yy,zz);
+
+               for( i = 0; i < nps_t; i++ ) {
+                       _pts->GetPoint(i%nps, ppA);
+                       _pts->GetPoint((i+1)%nps, ppB);
+                       FilterCordinateXYZ(ppA[0],ppA[1],ppA[2]);
+                       FilterCordinateXYZ(ppB[0],ppB[1],ppB[2]);
+                       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) ) {
+                               result=true;
+                               i=nps;
+                       } // if d1 d2 d3
+               }// for i
+       } // boundaring box
        return result;
 }
index 7f666dee245735308b48de597fe36aa413944091..e3800a16dd2535a92c17e7fc745ae465ed6f818f 100644 (file)
@@ -13,8 +13,18 @@ void manualViewBullEyeSector::RefreshContour()
 //EED004
        int i,nps;
        double x,y,z;
+       double xx,yy,zz;
 //----------------------------------
 
+       //EED 27 Juin 2012
+    //Boundaring box   
+       _minX=99999;
+       _minY=99999;
+       _minZ=99999;
+       _maxX=-99999;
+       _maxY=-99999;
+       _maxZ=-99999;
+       
        _manContModel->UpdateSpline();
     nps = _manContModel->GetNumberOfPointsSpline();
 
@@ -23,8 +33,23 @@ void manualViewBullEyeSector::RefreshContour()
                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] );
+                       xx = x*_spc[0];
+                       yy = y*_spc[1];
+                       zz = z*_spc[2];
+                       _pts->SetPoint(i , xx , yy , zz );
+                       
+                       //EED 27 Juin 2012
+                       //Boundaring box
+                       if (xx < _minX) { _minX = xx; }
+                       if (yy < _minY) { _minY = yy; }
+                       if (zz < _minZ) { _minZ = zz; }
+                       if (xx > _maxX) { _maxX = xx; }
+                       if (yy > _maxY) { _maxY = yy; }         
+                       if (zz > _maxZ) { _maxY = zz; }         
+                       
+                       
                }// for
-       }
+               
+       } // if _pts
 
 }
index 3a42953780d0d587a8bc5700e20fd53914b3fc60..bff37c326502bbce96024a57cccc56ee604f37ab 100644 (file)
@@ -78,6 +78,8 @@ void manualViewContour::RefreshContour() // virtual
     nps = _manContModel->GetNumberOfPointsSpline();
        //delta=( double ) ( np  ) / ( double ) ( nps-1  );             //JSTG 25-02-08
 
+       //EED 27 Juin 2012
+    //Boundaring box   
        _minX=99999;
        _minY=99999;
        _maxX=-99999;
@@ -101,7 +103,8 @@ void manualViewContour::RefreshContour() // virtual
                                zz=z*_spc[2];
                                _pts->SetPoint(i,xx,yy,zz );
 
-//EED 27 Juin 2012
+                //EED 27 Juin 2012
+                               //Boundaring box
                                if (xx < _minX) { _minX = xx; }
                                if (yy < _minY) { _minY = yy; }
                                if (xx > _maxX) { _maxX = xx; }
@@ -210,7 +213,7 @@ bool manualViewContour::ifTouchContour(int x,int y,int z)
        yy = yy * _spc[1];
        zz = zz * _spc[2];
 
-       if ( (xx>=_minX) &&  (yy>=_minY) && (xx<=_maxX) && (yy<=_maxY)) {
+       if ( (xx>=_minX) &&  (yy>=_minY) && (xx<=_maxX) && (yy<=_maxY)) {  // inside the boundaring box
        
                unsigned int i, nps,nps_t;
                nps       = _sizePointsContour;
index 3acc8fa3b705b537cac25ca5d40e9c9f5c283ac3..6f3b75296c844bee333cb4fa9b61d86cd6b84fc3 100644 (file)
@@ -38,8 +38,10 @@ private:
 protected:
        double _minX;
        double _minY;
+       double _minZ;
        double _maxX;
        double _maxY;
+       double _maxZ;
        
 };
 
index 2ae9cf5dd2066fb282be810b96105e70d159224e..58054eaf30b9a3776e0d865dc05d8508c5bcb669 100644 (file)
@@ -173,22 +173,22 @@ void wxManualPaintPanel::ConfigureGrayLevelSld( )
 {
        _txtGrayLevel = new wxStaticText( this, -1,
                wxString( _T("  Gray Level  ") ) );
-       _sldGrayLevel = new wxSlider( this, -1, 0, 0, 50, wxDefaultPosition,
+       _sldGrayLevel = new wxSlider( this, -1, 0, 0, 255, wxDefaultPosition,
                wxDefaultSize, wxSL_LABELS );
        _sldGrayLevel->SetMinSize( wxSize( 200, -1 ) );
        _sldGrayLevel->SetMaxSize( wxSize( 200, -1 ) );
        _graylevelCtrl = new wxSpinCtrl( this, wxID_ANY, wxEmptyString,
-               wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 50, 0 );
+               wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 65535, 0 );
 }
 //--------------------------------------------------------------------------
 void wxManualPaintPanel::ConfigureBrushSizeSld( )
 {
        _txtBrushSize = new wxStaticText( this, -1,
                wxString( _T("  Brush size  ") ) );
-       _sldBrushSize = new wxSlider( this, -1, 1, 1, 20, wxDefaultPosition,
+       _sldBrushSize = new wxSlider( this, -1, 1, 1, 50, wxDefaultPosition,
                wxDefaultSize, wxSL_LABELS );
        _BrushSizeCtrl = new wxSpinCtrl( this, wxID_ANY, wxEmptyString,
-               wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 20, 0 );
+               wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 65535, 0 );
        _sldBrushSize->SetMinSize( wxSize( 200, -1 ) );
        _sldBrushSize->SetMaxSize( wxSize( 200, -1 ) );
 }
@@ -197,12 +197,12 @@ void wxManualPaintPanel::ConfigureDistanceFillSld( )
 {
        _txtDistanceFill = new wxStaticText( this, -1,
                wxString( _T("  Distance fill  ") ) );
-       _sldDistanceFill = new wxSlider( this, -1, 500, 1, 500, wxDefaultPosition,
+       _sldDistanceFill = new wxSlider( this, -1, 50, 1, 500, wxDefaultPosition,
                wxDefaultSize, wxSL_LABELS );
        _sldDistanceFill->SetMinSize( wxSize( 200, -1 ) );
        _sldDistanceFill->SetMaxSize( wxSize( 200, -1 ) );
        _distancefillCtrl = new wxSpinCtrl( this, wxID_ANY, wxEmptyString,
-               wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 500, 500 );
+               wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 500, 50 );
        _txtDistanceFill->Disable( );
        _sldDistanceFill->Disable( );
        _distancefillCtrl->Disable( );
@@ -212,12 +212,12 @@ void wxManualPaintPanel::ConfigureTolFillSld( )
 {
        _txtToleranceFill = new wxStaticText( this, -1,
                wxString( _T("  Tolerance fill  ") ) );
-       _sldToleranceFill = new wxSlider( this, -1, 50, 0, 50, wxDefaultPosition,
+       _sldToleranceFill = new wxSlider( this, -1, 125, 0, 255, wxDefaultPosition,
                wxDefaultSize, wxSL_LABELS );
        _sldToleranceFill->SetMinSize( wxSize( 200, -1 ) );
        _sldToleranceFill->SetMaxSize( wxSize( 200, -1 ) );
        _tolerancefillCtrl = new wxSpinCtrl( this, wxID_ANY, wxEmptyString,
-               wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 50, 50 );
+               wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 65535, 50 );
        _txtToleranceFill->Disable( );
        _sldToleranceFill->Disable( );
        _tolerancefillCtrl->Disable( );