X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FmanualContour%2FmanualViewContour.cpp;h=4fee4987fa2750e887e9c64ec022169e0a53f931;hb=1b9af7b2c71aa44e2e5adebd2826f26b55d4b209;hp=4fcd7228798e90ea5acf0a56a9ba7205e52fb63f;hpb=6e68b5935bb50bf855de11614fd3b49c06b84294;p=creaMaracasVisu.git diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewContour.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewContour.cpp index 4fcd722..4fee498 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewContour.cpp +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewContour.cpp @@ -7,7 +7,7 @@ manualViewContour::manualViewContour() { _id_viewPoint_for_text = 0; - _mesureScale = 1; + _mesureScale = 1; _initialConoturModel = new manualContourModel(); } // ---------------------------------------------------------------------------- @@ -55,12 +55,9 @@ void manualViewContour::Open(FILE *pFile) { } - - // ---------------------------------------------------------------------------- void manualViewContour::RefreshContour() // virtual { - int i,np,nps; //JSTG 25-02-08 -------------------- @@ -88,8 +85,7 @@ void manualViewContour::RefreshContour() // virtual //-------------------------------------------------------------- // EED 27 sep 2006 // _pts->SetPoint(i, x,y,z ); - _pts->SetPoint(i , x*_spc[0] , y*_spc[1] , z*_spc[2] ); - + _pts->SetPoint(i, x*_spc[0], y*_spc[1], z*_spc[2] ); }// for } @@ -108,28 +104,43 @@ void manualViewContour::RefreshText() // virtual int size = GetNumberOfPoints(); char text[50]; char resultText[50]; - strcpy(resultText," "); + strcpy(resultText, "000"); + +//CMRU 19-08-09 ---------------------------------- + std::string label; + label = _manContModel->GetLabel(); +// ------------------------------------ + if (size==2) { strcpy(resultText,"L= "); - gcvt ( _mesureScale * this->_manContModel->GetPathSize() , 5, text ); + gcvt ( _mesureScale * this->_manContModel->GetPathSize(), 5, text ); strcat(resultText,text); + +//CMRU 19-08-09 ---------------------------------- + strcat(resultText," "); + strcat(resultText,label.c_str()); +//------------------------------------------------ } if (size>2) { if (_manContModel->IfCloseContour()==true) { strcpy(resultText,"P= "); - gcvt ( _mesureScale * this->_manContModel->GetPathSize() , 5, text ); + gcvt ( _mesureScale * this->_manContModel->GetPathSize(), 5, text ); strcat(resultText,text); - gcvt ( _mesureScale * _mesureScale * this->_manContModel->GetPathArea() , 5, text ); + gcvt ( _mesureScale * _mesureScale * this->_manContModel->GetPathArea(), 5, text ); strcat(resultText," A= "); strcat(resultText,text); + strcat(resultText," "); } else { strcpy(resultText,"L= "); - gcvt ( _mesureScale * this->_manContModel->GetPathSize() , 5, text ); + gcvt ( _mesureScale * this->_manContModel->GetPathSize(), 5, text ); strcat(resultText,text); } +//CMRU 19-08-09 ---------------------------------- + strcat(resultText,label.c_str()); +//------------------------------------------------ } _textActor->SetInput(resultText); @@ -145,9 +156,13 @@ void manualViewContour::RefreshText() // virtual } } - int id = _id_viewPoint_for_text; - double px = _manContModel->GetManualPoint(id)->GetX(); - double py = _manContModel->GetManualPoint(id)->GetY(); + if (_id_viewPoint_for_text>=size) + { + _id_viewPoint_for_text=0; + } + + double px = _manContModel->GetManualPoint(_id_viewPoint_for_text)->GetX(); + double py = _manContModel->GetManualPoint(_id_viewPoint_for_text)->GetY(); //EED 27 sep 2006 px=px*_spc[0]; @@ -155,13 +170,11 @@ void manualViewContour::RefreshText() // virtual _textActor->SetPosition(px+GetRange()+1,py); } - } } // ---------------------------------------------------------------------------- bool manualViewContour::ifTouchContour(int x,int y,int z){ - bool result=false; double xx=x; double yy=y; @@ -186,7 +199,6 @@ bool manualViewContour::ifTouchContour(int x,int y,int z){ nps_t = nps-1; } - for( i = 0; i < nps_t; i++ ) { _pts->GetPoint(i%nps, ppA); @@ -195,21 +207,13 @@ bool manualViewContour::ifTouchContour(int x,int y,int z){ 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; - } - - //EED 25 Sep 2009 - if ((d1<=1) || (d2<=1)) { result=true; i=nps; } - } - return result; }