]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewContour.cpp
#3347 creaMaracasVisu Bug New Normal - ViewerMPR2D Reset back position when set...
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / manualContour / manualViewContour.cpp
index 32ef7e736c9ba79a7d34e59b06b86d37e5162066..50754a1c391b1438be723570534c80ae8fc96843 100644 (file)
@@ -186,7 +186,6 @@ void manualViewContour::RefreshContour() // virtual
 // ----------------------------------------------------------------------------
 void manualViewContour::RefreshText()  // virtual
 {
-
        if ((_textActor!=NULL) && ( _textActor->GetProperty()->GetOpacity()!=0 )){
                int size = GetNumberOfPoints();
                char text[50];
@@ -195,13 +194,13 @@ void manualViewContour::RefreshText()  // virtual
                char resultText2[250];
                strcpy(resultText2, "000");
                double spcP[3];
-               spcP[0]=1;
-               spcP[1]=1;
-               spcP[2]=1;
+               spcP[0] = 1;
+               spcP[1] = 1;
+               spcP[2] = 1;
 
 //CMRU 19-08-09 ----------------------------------
-               std::string label;
-               label = _manContModel->GetLabel();
+               std::string label       = _manContModel->GetLabel();
+               std::string label2      = " (" + _manContModel->GetLabel2() + "z) ";
 // ------------------------------------
        
                if (size==2)
@@ -257,9 +256,9 @@ void manualViewContour::RefreshText()  // virtual
                                gcvt ( this->_manContModel->GetPathSize( _spc ), 5, text );
                                strcat(resultText2,text);
                                strcat(resultText2,"u");
-
                        }
 //CMRU 19-08-09 ----------------------------------
+                       strcat(resultText,label2.c_str());
                        strcat(resultText,label.c_str());
 //------------------------------------------------
                }
@@ -267,32 +266,28 @@ void manualViewContour::RefreshText()  // virtual
                _textActor->SetInput(resultText);
                _textActor2->SetInput(resultText2);
                
-               if (size>=1){
-
+               if (size>=1)
+               {
                        int i;
                        for (i=0; i<size; i++)
                        {
                                if (_lstViewPoints[i]->GetPosibleSelected()==true)
                                {
                                        _id_viewPoint_for_text = i;
-                               }
-                       }
-
+                               } // if
+                       } // for
                        if (_id_viewPoint_for_text>=size) 
                        {
-                               _id_viewPoint_for_text=0;
-                       }
-                       
+                               _id_viewPoint_for_text = 0;
+                       }// if
                        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];
-                       py=py*_spc[1];
-
+                       px = px*_spc[0];
+                       py = py*_spc[1];
                        _textActor->SetPosition(px+GetRange()+1,py);
                        _textActor2->SetPosition(px+GetRange()+1,py+2);
-               }
+               } // if size
        }
 }
 
@@ -315,20 +310,21 @@ bool manualViewContour::ifTouchContour(int x,int y,int z)
        {  // inside the boundaring box
                if ( ShowLineVersion()==true )
                {
-                       manualPoint *mpA = _manContModel->GetManualPoint(0);
-                       manualPoint *mpB = _manContModel->GetManualPoint(1);
                        _pts->GetPoint(0, ppA);
+                       _pts->GetPoint(1, ppB);
                        double dirVec[3];
                        // direction of the segment
-            dirVec[0] = mpB->GetX() - mpA->GetX();                     
-            dirVec[1] = mpB->GetY() - mpA->GetY();                     
-            dirVec[2] = mpB->GetZ() - mpA->GetZ();                     
+            dirVec[0] = ppB[0] - ppA[0];
+            dirVec[1] = ppB[1] - ppA[1];
+            dirVec[2] = ppB[2] - ppA[2];
                        // proj = mpA + k*dirVec
                        double num;
                        double den = 0.0 ;
-                       num     = dirVec[0]*( xx-mpA->GetX() );
-                       num     = num + dirVec[1]*( yy-mpA->GetY() );
-                       num     = num + dirVec[2]*( zz-mpA->GetZ() );
+
+                       num     = dirVec[0]*( xx-ppA[0] );
+                       num     = num + dirVec[1]*( yy-ppA[1] );
+                       num     = num + dirVec[2]*( zz-ppA[2] );
+
                        den=dirVec[0]*dirVec[0] + dirVec[1]*dirVec[1] + dirVec[2]*dirVec[2];
                        double k;
                        if (den!=0) 
@@ -338,9 +334,10 @@ bool manualViewContour::ifTouchContour(int x,int y,int z)
                                k = 99999999;
                        }
                        // projection of th point xx,yy,zz  in segment mpA,mpB
-                       double projX = mpA->GetX() + k*dirVec[0];
-                       double projY = mpA->GetY() + k*dirVec[1];
-                       double projZ = mpA->GetZ() + k*dirVec[2];
+                       double projX = ppA[0] + k*dirVec[0];
+                       double projY = ppA[1] + k*dirVec[1];
+                       double projZ = ppA[2] + k*dirVec[2];
+
 
                        // distance [projX,projY,projZ]   and   (xx,yy,zz]
                        double d1= sqrt(  (projX-xx)*(projX-xx) + (projY-yy)*(projY-yy) +(projZ-zz)*(projZ-zz) );