50 #include "DecimateThread.hh" 63 DecimateThread::DecimateThread(
Params _param, QString _jobId,
int _objId):
65 abort_(
false), maxCollapses_(0),
66 param_(_param), baseDec_(0), objId_(_objId)
68 connect(
this ,SIGNAL(
function()),
this,SLOT(decimate()), Qt::DirectConnection) ;
70 baseDec_ = param_.dec;
71 else if (param_.mcDec)
72 baseDec_ = param_.mcDec;
73 else if (param_.mixedDec)
74 baseDec_ = param_.mixedDec;
76 baseDec_->set_observer(
this);
77 if (param_.verticesCount != -1)
78 maxCollapses_ = baseDec_->mesh().n_vertices() - param_.verticesCount;
79 else if (param_.facesCount != -1)
80 maxCollapses_ = baseDec_->mesh().n_faces() - param_.facesCount;
82 maxCollapses_ = 0.8*baseDec_->mesh().n_vertices();
85 DecimateThread::~DecimateThread()
94 DecimateThread::BaseDecimaterType* DecimateThread::baseDecimater()
99 int DecimateThread::objectId()
const 104 void DecimateThread::decimate()
109 if ( param_.verticesCount != -1 )
110 param_.dec->decimate_to(param_.verticesCount);
111 else if (param_.facesCount != -1)
112 param_.dec->decimate_to_faces(0, param_.facesCount);
114 param_.dec->decimate_to_faces(0, 1);
116 else if (param_.mcDec)
118 param_.mcDec->set_samples(param_.samples);
119 if ( param_.verticesCount != -1 )
120 param_.mcDec->decimate_to(param_.verticesCount);
121 else if (param_.facesCount != -1 )
122 param_.mcDec->decimate_to_faces(0, param_.facesCount);
124 param_.mcDec->decimate_to_faces(0, 1);
126 else if (param_.mixedDec)
128 param_.mixedDec->set_samples(param_.samples);
129 if ( param_.verticesCount != -1 )
130 param_.mixedDec->decimate_to(param_.verticesCount,param_.mc_factor);
131 else if (param_.facesCount != -1 )
132 param_.mixedDec->decimate_to_faces(0, param_.facesCount,param_.mc_factor);
134 param_.mixedDec->decimate_to_faces(0, 1,param_.mc_factor);
Thread handling class for OpenFlipper.
virtual bool abort() const
Abort callback.
void state(QString _jobId, int _state)
Tell core about job state.
QString jobId()
get JobId get the Id of the current Job
void cancel()
Cancel the job.
virtual void notify(size_t _step)
callback
Observer(size_t _notificationInterval)