From b613b5c774c04bcd993e3c249b43e2c43771847d Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA <davila@ei-ed-606.univ-lyon1.fr> Date: Tue, 10 Dec 2019 15:29:18 +0100 Subject: [PATCH] #3323 creaMaracasVisu Feature New Normal - label2 for manal contours --- .../wxWindows/Contour/AutoControlPoints.cxx | 43 ++++++++----------- .../Contour/ExtractControlPoints2D.cxx | 9 ++-- .../widgets/manualContour/manualBaseModel.cpp | 29 ++++++++++--- .../widgets/manualContour/manualBaseModel.h | 15 ++++--- .../manualContour/manualContourModel.cpp | 17 +++----- .../manualContour/manualContourModel.h | 18 +------- .../manualContour/manualViewBaseContour.cpp | 4 +- .../manualContour/manualViewContour.cpp | 35 +++++++-------- 8 files changed, 80 insertions(+), 90 deletions(-) diff --git a/lib/maracasVisuLib/src/interface/wxWindows/Contour/AutoControlPoints.cxx b/lib/maracasVisuLib/src/interface/wxWindows/Contour/AutoControlPoints.cxx index 95e0f68..ac61fed 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/Contour/AutoControlPoints.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/Contour/AutoControlPoints.cxx @@ -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(); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/Contour/ExtractControlPoints2D.cxx b/lib/maracasVisuLib/src/interface/wxWindows/Contour/ExtractControlPoints2D.cxx index a68e88b..ad52edc 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/Contour/ExtractControlPoints2D.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/Contour/ExtractControlPoints2D.cxx @@ -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"); } } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualBaseModel.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualBaseModel.cpp index 5399daf..3cfe1b1 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualBaseModel.cpp +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualBaseModel.cpp @@ -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; } + + + //---------------------------------------------------------------------------- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualBaseModel.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualBaseModel.h index 5815971..25057a2 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualBaseModel.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualBaseModel.h @@ -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; + }; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModel.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModel.cpp index 7f4d128..9744ed0 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModel.cpp +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModel.cpp @@ -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; -} //---------------------------------------------------------------------------- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModel.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModel.h index 2beb5ae..4493ed5 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModel.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourModel.h @@ -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; //-------------------------------------------------------------------------------- }; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.cpp index 47b19a0..88f1d4c 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.cpp +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.cpp @@ -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); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewContour.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewContour.cpp index 32ef7e7..e279664 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewContour.cpp +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewContour.cpp @@ -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 } } -- 2.49.0