]> Creatis software - creaMaracasVisu.git/commitdiff
#3323 creaMaracasVisu Feature New Normal - label2 for manal contours
authorEduardo DAVILA <davila@ei-ed-606.univ-lyon1.fr>
Tue, 10 Dec 2019 14:29:18 +0000 (15:29 +0100)
committerEduardo DAVILA <davila@ei-ed-606.univ-lyon1.fr>
Tue, 10 Dec 2019 14:29:18 +0000 (15:29 +0100)
lib/maracasVisuLib/src/interface/wxWindows/Contour/AutoControlPoints.cxx
lib/maracasVisuLib/src/interface/wxWindows/Contour/ExtractControlPoints2D.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualBaseModel.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualBaseModel.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModel.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModel.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewContour.cpp

index 95e0f68985b045a44bbcf21e503108fe6f493974..ac61fede6ba73b4459d796a2f58e8985f5a1ca66 100644 (file)
@@ -1309,13 +1309,11 @@ void AutoControlPoints::NearMaxError2Control()
                        nearp = distA;
                        _posn = _posA;
 
-               }
-               else
-               {
+               } else {
                        nearp = distB;
                        _posn = _posB;
-               }
-       }
+               } // if dist
+       } // if interpointsX
 }
 //-----------------------------------------------------------------------------------------------------------------------------------------
 void AutoControlPoints::MoveControlPointInContour(std::vector<double>*InX, std::vector<double>*InY, std::vector<double>*InZ)
@@ -1358,14 +1356,12 @@ for(i=0; i<_controlpointsX.size(); i++)
                        _controlpointsX.push_back( (*InX)[_contIncontpos[_posn]] );
                        _controlpointsY.push_back( (*InY)[_contIncontpos[_posn]] );
                        _controlpointsZ.push_back( (*InZ)[_contIncontpos[_posn]] );
-               }
-               else
-               {
+               } else {
                        _controlpointsX.push_back( tempX[i] );
                        _controlpointsY.push_back( tempY[i] );
                        _controlpointsZ.push_back( tempZ[i] );
-               }
-       }
+               } // if i
+       } // for
 
        fixBetweenPoints(5.0);
        PossibleIntersections(InX,InY,InZ);
@@ -1399,14 +1395,12 @@ for(i=0; i<_controlpointsX.size(); i++)
                                _controlpointsX.push_back( (*InX)[_contIncontpos[posact]] );
                                _controlpointsY.push_back( (*InY)[_contIncontpos[posact]] );
                                _controlpointsZ.push_back( (*InZ)[_contIncontpos[posact]] );
-                       }
-                       else
-                       {
+                       } else {
                                _controlpointsX.push_back( tempX[i] );
                                _controlpointsY.push_back( tempY[i] );
                                _controlpointsZ.push_back( tempZ[i] );
-                       }
-               }
+                       } // if i
+               } // for i
                if(direction == 1)
                {
                        posact = posact+1;
@@ -1502,8 +1496,8 @@ double AutoControlPoints::MoveAndAverage(int dir, std::vector<double>*InX, std::
                                ErrorBetweenContours();
                                promactual1 = vf->promVector(&_errorvector,false);
                                j--;
-                       }
-               }
+                       } // if j
+               }// for i
                delete vf;
        }
        return 99999;
@@ -1581,6 +1575,7 @@ printf("\n");
                int inicontrolpoints = cpX.size();
                double inipercentage = (inicontrolpoints*100)/InX->size();
                int h=0;
+
                if(inicontrolpoints<10)
                {
                        int points = (int)((inipercentage*3*InX->size())/100);
@@ -1592,9 +1587,10 @@ printf("\n");
                                        _controlpointsY.push_back( (*InY)[i] );
                                        _controlpointsZ.push_back( (*InZ)[i] );
                                        h = 0;
-                               }
-                       }
-               }
+                               } // if h
+                       } // for i
+               } // if initontrolpoints
+
                if(inicontrolpoints>=10)
                {
                        int points = (int)((inipercentage*2*InX->size())/100);
@@ -1606,9 +1602,9 @@ printf("\n");
                                        _controlpointsY.push_back( (*InY)[i] );
                                        _controlpointsZ.push_back( (*InZ)[i] );
                                        h = 0;
-                               }
-                       }
-               }
+                               } // if h
+                       } // for int i
+               } // if inicontrolpoints
        }
 /*
        fixBetweenPoints(5.0);
@@ -1715,7 +1711,6 @@ void AutoControlPoints::CalculeControlPoints(std::vector<double>*InX, std::vecto
 //-----------------------------------------------------------------------------------------------------------------------------------------
 void AutoControlPoints::CalculeInitialControlPoints(std::vector<double>*InX, std::vector<double>*InY, std::vector<double>*InZ)
 {
-
        _controlpointsX.clear();
        _controlpointsY.clear();
        _controlpointsZ.clear();
index a68e88b5057762f286d5b898716f4e4afe674e19..ad52edc9a80adb84a3791e4dc02ef7df72e1a8f8 100644 (file)
@@ -43,6 +43,7 @@ void ExtractControlPoints2D::ResetControlPoints()
 //-----------------------------------------------------------------------------------------
 void ExtractControlPoints2D::SetContour(std::vector<double>*InX, std::vector<double>*InY,std::vector<double>*InZ)
 {
+       int i;
        _InX.clear();
        _InY.clear();
        _InZ.clear();
@@ -51,15 +52,13 @@ void ExtractControlPoints2D::SetContour(std::vector<double>*InX, std::vector<dou
        int sizeZ = InZ->size();
        if( (sizeX == sizeY) && (sizeY==sizeZ) )
        {
-               for(int i=0; i<sizeX; i++)
+               for(i=0; i<sizeX; i++)
                {
                        _InX.push_back( (*InX)[i] );
                        _InY.push_back( (*InY)[i] );
                        _InZ.push_back( (*InZ)[i] );
-               }
-       }
-       else
-       {
+               } // for i
+       } else {
                printf("\n The lists Of vectors have diferents sizes");
        }
 }
index 5399daf62a3d71fa7f6c3baba06492e6ff3e6896..3cfe1b1aab41b3a237c5f81fa59b7a1673ccc483 100644 (file)
@@ -30,7 +30,8 @@ manualBaseModel::manualBaseModel()
 {
 //EED2017
        _sizePointsContour      = 100;                  //JSTG 25-02-08 The change in the inisialization of these variable is critical.
-
+       _label                          = "";
+       _label2                         = "UU";
 }
 
 // ----------------------------------------------------------------------------
@@ -367,9 +368,6 @@ bool manualBaseModel::IfCloseContour()
        return false;
 }
 //CMRU 17-08-09----------------------------------------------------------------------------
-void manualBaseModel::SetLabel(std::string newLabel)
-{
-}
 
 void manualBaseModel::SetRealSize(double newRealSize) 
 {
@@ -380,11 +378,30 @@ double manualBaseModel::GetRealSize()
        return -1;
 }
 
+void manualBaseModel::OpenData(FILE *ff)
+{
+}
+
+void manualBaseModel::SetLabel(std::string newLabel)
+{
+       _label = newLabel;
+}
+
 std::string manualBaseModel::GetLabel()
 {
-       return "";
+       return _label;
 }
-void manualBaseModel::OpenData(FILE *ff)
+
+void manualBaseModel::SetLabel2(std::string newLabel)
+{
+       _label2 = newLabel;
+}
+
+std::string manualBaseModel::GetLabel2()
 {
+       return _label2;
 }
+
+
+
 //----------------------------------------------------------------------------
index 5815971523b9cb04a3334465ef87b9722e6e3145..25057a2bf126302ecd3c59d44a0a3ed068c8dd02 100644 (file)
@@ -124,7 +124,10 @@ public:
        * Assigns the parameter value to the label
        * @param newLabel New label of the contour
        */
-       virtual void SetLabel(std::string newLabel);
+       void SetLabel(std::string newLabel);
+       std::string GetLabel();
+       void SetLabel2(std::string newLabel);
+       std::string GetLabel2();
        
        /*
        * Assigns the parameter value to the real size
@@ -132,10 +135,6 @@ public:
        */
        virtual void SetRealSize(double newRealSize);
        
-       /**
-       * Returns the label of the contour
-       */
-       virtual std::string GetLabel();
 
        /**
        * Returns the real size in milimeters of the contour
@@ -158,6 +157,12 @@ protected:
        int                                                     _sizePointsContour;
        std::vector<manualPoint*>       _lstPoints;
 
+       /**
+       * Represents the label associated with the contour
+       */
+       std::string                                     _label;
+       std::string                                     _label2;
+
 }; 
 
 
index 7f4d128eb4135f35993b2db96c426b0c3eef1de8..9744ed09929f34e83c7f4db8c4ad789d1f6a6822 100644 (file)
@@ -51,7 +51,6 @@ manualContourModel::manualContourModel()
 //---------------------------------------------------------------------------------------------------------------
 //CMRU 17-08-09 -------------------------------------------------------------------------------------------------
        _realSize                       = 0.0;
-       _label                          = "";
 //---------------------------------------------------------------------------------------------------------------
 }
 
@@ -671,9 +670,11 @@ void manualContourModel::SaveData(FILE *ff)
 {
        std::string etiqueta = GetLabel();
        if(etiqueta.empty())
+       {
                fprintf(ff,"Label: NO_LABEL\n");
-       else
+       } else {
                fprintf(ff,"Label: %s\n",etiqueta.c_str());
+       } // if etiqueta
        fprintf(ff,"Real_Size: %f\n",GetRealSize());
 }
 
@@ -686,8 +687,9 @@ void manualContourModel::OpenData(FILE *ff)
        std::cout<<tmp<<std::endl;
        //if(strcmp(tmp != "NO_LABEL") // JPR
        if(strcmp(tmp,"NO_LABEL") != 0)
+       {
                SetLabel(tmp);
-
+       }
        fscanf(ff,"%s",tmp); // Real_size
        fscanf(ff,"%s",tmp);// #
 
@@ -748,11 +750,6 @@ void manualContourModel::Transform_Ax_Plus_B (double Ax, double Bx, double Ay, d
 
 
 //CMRU 17-08-09----------------------------------------------------------------------------
-void manualContourModel::SetLabel(std::string newLabel)
-{
-       _label = newLabel;
-}
-
 void manualContourModel::SetRealSize(double newRealSize) 
 {
        _realSize = newRealSize;
@@ -763,8 +760,4 @@ double manualContourModel::GetRealSize()
        return _realSize;
 }
 
-std::string manualContourModel::GetLabel()
-{
-       return _label;
-}
 //----------------------------------------------------------------------------
index 2beb5ae2ce37ecbd1f91745321c977f51fab3340..4493ed5b38b09612af60f56d5f76b6b4eb8efc6b 100644 (file)
@@ -117,11 +117,6 @@ public:
 
 // CMRU 17-08-09 -----------------------------------------------------------------
        
-       /*
-       * Assigns the parameter value to the label
-       * @param newLabel New label of the contour
-       */
-       void SetLabel(std::string newLabel);
        
        /*
        * Assigns the parameter value to the real size
@@ -129,11 +124,6 @@ public:
        */
        void SetRealSize(double newRealSize);
        
-       /**
-       * Returns the label of the contour
-       */
-       std::string GetLabel();
-
        /**
        * Returns the real size in milimeters of the contour
        */
@@ -161,19 +151,15 @@ public:
     vtkKochanekSpline                  *_cntSplineZ;
 
 //JSTG 25-02-08 ----------------------------------------
-       double                  _delta_JSTG;
+       double                                          _delta_JSTG;
 //------------------------------------------------------
 
 //CMRU 17-08-09 -----------------------------------------------------------------
        /**
        * Represents the real size in milimeters of the contour
        */
-       double                  _realSize;
+       double                                          _realSize;
 
-       /**
-       * Represents the label associated with the contour
-       */
-       std::string             _label;
 //--------------------------------------------------------------------------------
 
 }; 
index 47b19a033d802a515087015598f727e703e940fd..88f1d4cf16a1e1188207c9cc11835559a14f4893 100644 (file)
@@ -355,7 +355,7 @@ void manualViewBaseContour::InitTextActor()
 //     _textActor->GetPositionCoordinate()->SetValue( 0.8 , 0.8 );
 
        vtkTextProperty *tprop = _textActor->GetTextProperty();
-       tprop->SetFontSize(14);
+       tprop->SetFontSize(12);
        tprop->SetFontFamilyToArial();
        tprop->SetColor(1, 1, 0);
 
@@ -371,7 +371,7 @@ void manualViewBaseContour::InitTextActor()
 //     _textActor2->GetPositionCoordinate()->SetValue( 0.8 , 0.8 );
 
        vtkTextProperty *tprop2 = _textActor2->GetTextProperty();
-       tprop2->SetFontSize(14);
+       tprop2->SetFontSize(12);
        tprop2->SetFontFamilyToArial();
        tprop2->SetColor(1, 1, 0);
 
index 32ef7e736c9ba79a7d34e59b06b86d37e5162066..e279664f794d5b9b7fe8e2b620069c30d9b0593a 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
        }
 }