44 #include "DecimateThread.hh" 57 DecimateThread::DecimateThread(
const Params& _param, QString _jobId,
int _objId):
59 abort_(
false), maxCollapses_(0),
60 param_(_param), baseDec_(0), objId_(_objId)
62 connect(
this ,SIGNAL(
function()),
this,SLOT(decimate()), Qt::DirectConnection) ;
64 baseDec_ = param_.dec;
65 else if (param_.mcDec)
66 baseDec_ = param_.mcDec;
67 else if (param_.mixedDec)
68 baseDec_ = param_.mixedDec;
70 baseDec_->set_observer(
this);
71 if (param_.verticesCount != -1)
72 maxCollapses_ = baseDec_->mesh().n_vertices() - param_.verticesCount;
73 else if (param_.facesCount != -1)
74 maxCollapses_ = baseDec_->mesh().n_faces() - param_.facesCount;
76 maxCollapses_ = 0.8*baseDec_->mesh().n_vertices();
79 DecimateThread::~DecimateThread()
88 DecimateThread::BaseDecimaterType* DecimateThread::baseDecimater()
93 int DecimateThread::objectId()
const 98 void DecimateThread::decimate()
103 if ( param_.verticesCount != -1 )
104 param_.dec->decimate_to(param_.verticesCount,param_.selectionOnly);
105 else if (param_.facesCount != -1)
106 param_.dec->decimate_to_faces(0, param_.facesCount,param_.selectionOnly);
108 param_.dec->decimate_to_faces(0, 1,param_.selectionOnly);
110 else if (param_.mcDec)
112 param_.mcDec->set_samples(param_.samples);
113 if ( param_.verticesCount != -1 )
114 param_.mcDec->decimate_to(param_.verticesCount,param_.selectionOnly);
115 else if (param_.facesCount != -1 )
116 param_.mcDec->decimate_to_faces(0, param_.facesCount,param_.selectionOnly);
118 param_.mcDec->decimate_to_faces(0, 1,param_.selectionOnly);
120 else if (param_.mixedDec)
122 param_.mixedDec->set_samples(param_.samples);
123 if ( param_.verticesCount != -1 )
124 param_.mixedDec->decimate_to(param_.verticesCount,param_.mc_factor,param_.selectionOnly);
125 else if (param_.facesCount != -1 )
126 param_.mixedDec->decimate_to_faces(0, param_.facesCount,param_.mc_factor,param_.selectionOnly);
128 param_.mixedDec->decimate_to_faces(0, 1,param_.mc_factor,param_.selectionOnly);
virtual bool abort() const
Abort callback.
void state(QString _jobId, int _state)
Tell core about job state.
Thread handling class for OpenFlipper.
virtual void notify(size_t _step)
callback
void cancel()
Cancel the job.
QString jobId()
get JobId get the Id of the current Job
Observer(size_t _notificationInterval)