mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-14 16:44:37 +00:00
FilterIsoParametrization uses new applyFilter call
This commit is contained in:
parent
a9724159db
commit
3c69dbafe9
@ -144,7 +144,7 @@ else()
|
||||
meshlabplugins/filter_fractal
|
||||
meshlabplugins/filter_func
|
||||
meshlabplugins/filter_img_patch_param
|
||||
# meshlabplugins/filter_isoparametrization
|
||||
meshlabplugins/filter_isoparametrization
|
||||
# meshlabplugins/filter_layer
|
||||
# meshlabplugins/filter_measure
|
||||
# meshlabplugins/filter_meshing
|
||||
|
||||
@ -67,7 +67,7 @@ SUBDIRS += \ #sub projects names
|
||||
filter_fractal \
|
||||
filter_func \
|
||||
filter_img_patch_param \
|
||||
#filter_isoparametrization \
|
||||
filter_isoparametrization \
|
||||
#filter_layer \
|
||||
#filter_mls \
|
||||
#filter_mutualglobal \
|
||||
|
||||
@ -179,7 +179,12 @@ void FilterIsoParametrization::PrintStats(CMeshO *mesh)
|
||||
log("stdDev Edge: %5.2f",stdE/avE);
|
||||
}
|
||||
|
||||
bool FilterIsoParametrization::applyFilter(const QAction *filter, MeshDocument& md, std::map<std::string, QVariant>&, unsigned int& /*postConditionMask*/, const RichParameterList & par, vcg::CallBackPos *cb)
|
||||
std::map<std::string, QVariant> FilterIsoParametrization::applyFilter(
|
||||
const QAction *filter,
|
||||
const RichParameterList & par,
|
||||
MeshDocument& md,
|
||||
unsigned int& /*postConditionMask*/,
|
||||
vcg::CallBackPos *cb)
|
||||
{
|
||||
MeshModel* m = md.mm(); //get current mesh from document
|
||||
CMeshO *mesh=&m->cm;
|
||||
@ -244,19 +249,19 @@ bool FilterIsoParametrization::applyFilter(const QAction *filter, MeshDocument&
|
||||
switch(ret)
|
||||
{
|
||||
case IsoParametrizator::MultiComponent:
|
||||
this->errorMessage="non possible parameterization because of multi component mesh"; return false;
|
||||
throw MLException("non possible parameterization because of multi component mesh");
|
||||
case IsoParametrizator::NonSizeCons:
|
||||
this->errorMessage="non possible parameterization because of non size consistent mesh"; return false;
|
||||
throw MLException("non possible parameterization because of non size consistent mesh");
|
||||
case IsoParametrizator::NonManifoldE:
|
||||
this->errorMessage="non possible parameterization because of non manifold edges"; return false;
|
||||
throw MLException("non possible parameterization because of non manifold edges");
|
||||
case IsoParametrizator::NonManifoldV:
|
||||
this->errorMessage="non possible parameterization because of non manifold vertices";return false;
|
||||
throw MLException("non possible parameterization because of non manifold vertices");
|
||||
case IsoParametrizator::NonWatertigh:
|
||||
this->errorMessage="non possible parameterization because of non watertight mesh"; return false;
|
||||
throw MLException("non possible parameterization because of non watertight mesh");
|
||||
case IsoParametrizator::FailParam:
|
||||
this->errorMessage="non possible parameterization cause one of the following reasons:\n Topologycal noise \n Too Low resolution mesh \n Too Bad triangulation \n"; return false;
|
||||
throw MLException("non possible parameterization cause one of the following reasons:\n Topologycal noise \n Too Low resolution mesh \n Too Bad triangulation \n");
|
||||
default:
|
||||
this->errorMessage="unknown error"; return false;
|
||||
throw MLException("unknown error");
|
||||
}
|
||||
}
|
||||
|
||||
@ -267,8 +272,7 @@ bool FilterIsoParametrization::applyFilter(const QAction *filter, MeshDocument&
|
||||
|
||||
bool isOK=isoPHandle().Init(abs_mesh,para_mesh);
|
||||
if (!isOK) {
|
||||
this->errorMessage="Problems gathering parameterization \n";
|
||||
return false;
|
||||
throw MLException("Problems gathering parameterization \n");
|
||||
}
|
||||
|
||||
isoPHandle().CopyParametrization<CMeshO>(mesh); ///copy back to original mesh
|
||||
@ -280,19 +284,17 @@ bool FilterIsoParametrization::applyFilter(const QAction *filter, MeshDocument&
|
||||
bool Done=isoPHandle().LoadBaseDomain<CMeshO>(qUtf8Printable(AbsLoadName),mesh,para_mesh,abs_mesh,true);
|
||||
if (!Done)
|
||||
{
|
||||
this->errorMessage="Abstract domain doesn't fit well with the parametrized mesh";
|
||||
delete para_mesh;
|
||||
delete abs_mesh;
|
||||
return false;
|
||||
throw MLException("Abstract domain doesn't fit well with the parametrized mesh");
|
||||
}
|
||||
}
|
||||
|
||||
QString AbsSaveName = par.getString("AbsSaveName");
|
||||
if(!AbsSaveName.isEmpty())
|
||||
{
|
||||
if(!AbsSaveName.isEmpty()) {
|
||||
isoPHandle().SaveBaseDomain(qUtf8Printable(AbsSaveName));
|
||||
}
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
case ISOP_REMESHING :
|
||||
{
|
||||
@ -302,16 +304,14 @@ bool FilterIsoParametrization::applyFilter(const QAction *filter, MeshDocument&
|
||||
bool b=tri::Allocator<CMeshO>::IsValidHandle<IsoParametrization>(*mesh,isoPHandle);
|
||||
if (!b)
|
||||
{
|
||||
this->errorMessage="You must compute the abstract mesh before remeshing. Use the Isoparametrization main filter.";
|
||||
return false;
|
||||
throw MLException("You must compute the abstract mesh before remeshing. Use the Isoparametrization main filter.");
|
||||
}
|
||||
|
||||
|
||||
int SamplingRate=par.getInt("SamplingRate");
|
||||
if (SamplingRate<2)
|
||||
{
|
||||
this->errorMessage="Sampling rate must be >1";
|
||||
return false;
|
||||
throw MLException("Sampling rate must be >1");
|
||||
}
|
||||
MeshModel* mm=md.addNewMesh("","Re-meshed");
|
||||
|
||||
@ -320,7 +320,7 @@ bool FilterIsoParametrization::applyFilter(const QAction *filter, MeshDocument&
|
||||
DiamSampl.Init(&isoPHandle());
|
||||
bool done = DiamSampl.SamplePos(SamplingRate);
|
||||
if (!done)
|
||||
return false;
|
||||
throw MLException(filter->text() + " filter failed.");
|
||||
DiamSampl.GetMesh<CMeshO>(*rem);
|
||||
|
||||
int n_diamonds,inFace,inEdge,inStar,n_merged;
|
||||
@ -335,7 +335,7 @@ bool FilterIsoParametrization::applyFilter(const QAction *filter, MeshDocument&
|
||||
mm->updateDataMask(MeshModel::MM_VERTFACETOPO);
|
||||
PrintStats(rem);
|
||||
mm->UpdateBoxAndNormals();
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
case ISOP_DIAMPARAM :
|
||||
{
|
||||
@ -344,8 +344,7 @@ bool FilterIsoParametrization::applyFilter(const QAction *filter, MeshDocument&
|
||||
bool b=tri::Allocator<CMeshO>::IsValidHandle<IsoParametrization>(*mesh,isoPHandle);
|
||||
if (!b)
|
||||
{
|
||||
this->errorMessage="You must compute the abstract mesh before remeshing. Use the Isoparametrization main filter.";
|
||||
return false;
|
||||
throw MLException("You must compute the abstract mesh before remeshing. Use the Isoparametrization main filter.");
|
||||
}
|
||||
|
||||
Scalarm border_size=par.getDynamicFloat("BorderSize");
|
||||
@ -357,7 +356,7 @@ bool FilterIsoParametrization::applyFilter(const QAction *filter, MeshDocument&
|
||||
DiaPara.Init(&isoPHandle());
|
||||
DiaPara.SetCoordinates<CMeshO>(*rem,border_size);
|
||||
tri::UpdateNormal<CMeshO>::PerFace(*rem);
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
// case ISOP_LOAD :
|
||||
// {
|
||||
@ -427,8 +426,7 @@ bool FilterIsoParametrization::applyFilter(const QAction *filter, MeshDocument&
|
||||
bool b=tri::Allocator<CMeshO>::IsValidHandle<IsoParametrization>(*srcMesh,isoPHandle);
|
||||
if (!b)
|
||||
{
|
||||
this->errorMessage="Your source mesh must have the abstract isoparametrization. Use the Isoparametrization command.";
|
||||
return false;
|
||||
throw MLException("Your source mesh must have the abstract isoparametrization. Use the Isoparametrization command.");
|
||||
}
|
||||
IsoTransfer IsoTr;
|
||||
AbstractMesh *abs_mesh = isoPHandle().AbsMesh();
|
||||
@ -448,10 +446,12 @@ bool FilterIsoParametrization::applyFilter(const QAction *filter, MeshDocument&
|
||||
isoPHandle().AbsMesh()=abs_mesh;
|
||||
isoPHandle().SetParamMesh<CMeshO>(trgMesh,para_mesh);
|
||||
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
wrongActionCalled(filter);
|
||||
}
|
||||
return false;
|
||||
return std::map<std::string, QVariant>();
|
||||
}
|
||||
|
||||
FilterPlugin::FilterClass FilterIsoParametrization::getClass(const QAction *) const
|
||||
|
||||
@ -36,29 +36,34 @@ class FilterIsoParametrization : public QObject, public FilterPlugin
|
||||
Q_OBJECT
|
||||
MESHLAB_PLUGIN_IID_EXPORTER(FILTER_PLUGIN_IID)
|
||||
Q_INTERFACES(FilterPlugin)
|
||||
|
||||
public:
|
||||
enum {ISOP_PARAM,
|
||||
ISOP_REMESHING,
|
||||
ISOP_DIAMPARAM,
|
||||
ISOP_TRANSFER
|
||||
};
|
||||
|
||||
FilterIsoParametrization();
|
||||
~FilterIsoParametrization();
|
||||
|
||||
QString pluginName() const;
|
||||
virtual FilterClass getClass(const QAction*) const;
|
||||
virtual QString filterName(ActionIDType filter) const;
|
||||
virtual QString filterInfo(ActionIDType filter) const;
|
||||
|
||||
virtual int getRequirements(const QAction*);
|
||||
|
||||
virtual void initParameterList(const QAction*, MeshDocument&, RichParameterList & /*parent*/);
|
||||
virtual bool applyFilter(const QAction* filter, MeshDocument&, std::map<std::string, QVariant>& outputValues, unsigned int& postConditionMask, const RichParameterList & /*parent*/, vcg::CallBackPos * cb);
|
||||
int postCondition(const QAction* filter) const;
|
||||
void PrintStats(CMeshO *mesh);
|
||||
FILTER_ARITY filterArity(const QAction*) const;
|
||||
|
||||
|
||||
public:
|
||||
enum {ISOP_PARAM,
|
||||
ISOP_REMESHING,
|
||||
ISOP_DIAMPARAM,
|
||||
ISOP_TRANSFER
|
||||
};
|
||||
|
||||
FilterIsoParametrization();
|
||||
~FilterIsoParametrization();
|
||||
|
||||
QString pluginName() const;
|
||||
virtual FilterClass getClass(const QAction*) const;
|
||||
virtual QString filterName(ActionIDType filter) const;
|
||||
virtual QString filterInfo(ActionIDType filter) const;
|
||||
|
||||
virtual int getRequirements(const QAction*);
|
||||
|
||||
virtual void initParameterList(const QAction*, MeshDocument&, RichParameterList & /*parent*/);
|
||||
std::map<std::string, QVariant> applyFilter(
|
||||
const QAction* action,
|
||||
const RichParameterList & parameters,
|
||||
MeshDocument &md,
|
||||
unsigned int& postConditionMask,
|
||||
vcg::CallBackPos * cb);
|
||||
int postCondition(const QAction* filter) const;
|
||||
void PrintStats(CMeshO *mesh);
|
||||
FILTER_ARITY filterArity(const QAction*) const;
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user