From 199ffbc27d7e6869d853b494bb5302174eb2fa6c Mon Sep 17 00:00:00 2001 From: Paolo Cignoni cignoni Date: Fri, 7 Dec 2012 15:35:23 +0000 Subject: [PATCH] Cleaned Histogram decorator parameters --- src/meshlabplugins/decorate_base/decorate_base.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/meshlabplugins/decorate_base/decorate_base.cpp b/src/meshlabplugins/decorate_base/decorate_base.cpp index 813212664..fe0504fbe 100644 --- a/src/meshlabplugins/decorate_base/decorate_base.cpp +++ b/src/meshlabplugins/decorate_base/decorate_base.cpp @@ -304,10 +304,7 @@ void ExtraMeshDecoratePlugin::decorateMesh(QAction *a, MeshModel &m, RichParamet case DP_SHOW_QUALITY_HISTOGRAM : { CMeshO::PerMeshAttributeHandle qH; - if(rm->getEnum(this->HistTypeParam()) == 0) - qH = vcg::tri::Allocator::GetPerMeshAttribute(m.cm,"VertQualityHist"); - else - qH = vcg::tri::Allocator::GetPerMeshAttribute(m.cm,"FaceQualityHist"); + qH = vcg::tri::Allocator::GetPerMeshAttribute(m.cm,"QualityHist"); if(vcg::tri::Allocator::IsValidHandle (m.cm, qH)) { CHist &ch=qH(); @@ -1043,12 +1040,15 @@ bool ExtraMeshDecoratePlugin::startDecorate(QAction * action, MeshModel &m, Rich } } break; - case DP_SHOW_QUALITY_HISTOGRAM : + case DP_SHOW_QUALITY_HISTOGRAM : { bool perVertFlag = rm->getEnum(HistTypeParam()) == 0; + if( perVertFlag && !(tri::HasPerVertexQuality(m.cm) && tri::HasPerVertexColor(m.cm)) ) return false; + if(!perVertFlag && !(tri::HasPerFaceQuality(m.cm) && tri::HasPerFaceColor(m.cm)) ) return false; CMeshO::PerMeshAttributeHandle qH = vcg::tri::Allocator::GetPerMeshAttribute(m.cm,"QualityHist"); if(!vcg::tri::Allocator::IsValidHandle(m.cm,qH)) qH=vcg::tri::Allocator::AddPerMeshAttribute (m.cm,std::string("QualityHist")); + CHist *H = &qH(); std::pair minmax; if(perVertFlag) minmax = tri::Stat::ComputePerVertexQualityMinMax(m.cm); @@ -1451,10 +1451,11 @@ void ExtraMeshDecoratePlugin::initGlobalParameterSet(QAction *action, RichParame } break; case DP_SHOW_QUALITY_HISTOGRAM : { + parset.addParam(new RichEnum(HistTypeParam(),0,QStringList()<<"Per Vertex"<<"Per Face","Quality Src","Set the source of the quality, it can be either per vertex or per face.")); parset.addParam(new RichInt(HistBinNumParam(), 256,"Histogram Bins","If true the parametrization is drawn in a textured wireframe style")); parset.addParam(new RichBool(HistAreaParam(), false,"Area Weighted","If true the histogram is computed according to the surface of the involved elements.
" "e.g. each face contribute to the histogram proportionally to its area and each vertex with 1/3 of sum of the areas of the incident triangles.")); - parset.addParam(new RichBool(HistFixedParam(), false,"Fixed Histogram width","if true the parametrization is drawn in a textured wireframe style")); + parset.addParam(new RichBool(HistFixedParam(), false,"Fixed Width","if true the parametrization is drawn in a textured wireframe style")); parset.addParam(new RichFloat(HistFixedMinParam(), 0,"Min Hist Value","Used only if the Fixed Histogram Width Parameter is checked")); parset.addParam(new RichFloat(HistFixedMaxParam(), 0,"Max Hist Value","Used only if the Fixed Histogram Width Parameter is checked")); parset.addParam(new RichFloat(HistFixedWidthParam(), 0,"Hist Width","If not zero, this value is used to scale histogram width so that it is the indicated value.
"