From b613b5c774c04bcd993e3c249b43e2c43771847d Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA 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*InX, std::vector*InY, std::vector*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*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*InX, std::vecto //----------------------------------------------------------------------------------------------------------------------------------------- void AutoControlPoints::CalculeInitialControlPoints(std::vector*InX, std::vector*InY, std::vector*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*InX, std::vector*InY,std::vector*InZ) { + int i; _InX.clear(); _InY.clear(); _InZ.clear(); @@ -51,15 +52,13 @@ void ExtractControlPoints2D::SetContour(std::vector*InX, std::vectorsize(); if( (sizeX == sizeY) && (sizeY==sizeZ) ) { - for(int i=0; i _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<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; iGetPosibleSelected()==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.45.1