diff --git a/src/meshlabplugins/edit_align/AlignPairDialog.cpp b/src/meshlabplugins/edit_align/AlignPairDialog.cpp index 9d6539096..ec0ea9673 100644 --- a/src/meshlabplugins/edit_align/AlignPairDialog.cpp +++ b/src/meshlabplugins/edit_align/AlignPairDialog.cpp @@ -28,7 +28,7 @@ #include #include -AlignPairDialog::AlignPairDialog (GLArea* gla,QWidget * parent) : QDialog(parent) +AlignPairDialog::AlignPairDialog (GLArea* gla, QWidget * parent) : QDialog(parent) { QVBoxLayout *layout = new QVBoxLayout(); diff --git a/src/meshlabplugins/edit_align/AlignPairDialog.h b/src/meshlabplugins/edit_align/AlignPairDialog.h index 79a41475f..cc4111c31 100644 --- a/src/meshlabplugins/edit_align/AlignPairDialog.h +++ b/src/meshlabplugins/edit_align/AlignPairDialog.h @@ -35,7 +35,7 @@ class AlignPairDialog: public QDialog public: AlignPairWidget *aa; - AlignPairDialog (GLArea* gla, QWidget * parent = 0); + AlignPairDialog (GLArea* gla, QWidget * parent = nullptr); private slots: diff --git a/src/meshlabplugins/edit_align/alignDialog.cpp b/src/meshlabplugins/edit_align/alignDialog.cpp index b37ab83e3..cf4a7c095 100644 --- a/src/meshlabplugins/edit_align/alignDialog.cpp +++ b/src/meshlabplugins/edit_align/alignDialog.cpp @@ -71,8 +71,8 @@ AlignDialog::AlignDialog(QWidget *parent, EditAlignPlugin *_edit) : QDockWidget( // The following connection is used to associate the click with the change of the current mesh. connect(ui.alignTreeWidget, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this, SLOT(onClickItem(QTreeWidgetItem *, int))); globalLogTextEdit = ui.logTextEdit; - currentArc = 0; - meshTree = 0; + currentArc = nullptr; + meshTree = nullptr; } @@ -92,7 +92,7 @@ void AlignDialog::setCurrentArc(vcg::AlignPair::Result *_currentArc) // if we clicked twice on the same arc deselect it if (_currentArc == currentArc) { - currentArc = 0; + currentArc = nullptr; return; } @@ -113,7 +113,7 @@ void AlignDialog::setCurrentArc(vcg::AlignPair::Result *_currentArc) void AlignDialog::updateCurrentNodeBackground() { - static MeshTreem::MeshNode *lastCurrentNode = 0; + static MeshTreem::MeshNode *lastCurrentNode = nullptr; assert(meshTree); if (lastCurrentNode && M2T[lastCurrentNode]) @@ -129,7 +129,7 @@ void AlignDialog::updateCurrentNodeBackground() void AlignDialog::setTree(MeshTreem *_meshTree) { - assert(meshTree == 0); + assert(meshTree == nullptr); meshTree = _meshTree; meshTree->cb = AlignCallBackPos; rebuildTree(); @@ -137,14 +137,14 @@ void AlignDialog::setTree(MeshTreem *_meshTree) void AlignDialog::updateDialog() { - assert(meshTree != 0); + assert(meshTree != nullptr); assert(currentNode() == meshTree->find(currentNode()->m)); updateButtons(); } void AlignDialog::updateButtons() { - if (currentNode() == NULL) + if (currentNode() == nullptr) return; if (currentNode()->glued) ui.glueHereButton->setText("Unglue Mesh "); @@ -152,8 +152,8 @@ void AlignDialog::updateButtons() ui.pointBasedAlignButton->setDisabled(currentNode()->glued); ui.manualAlignButton->setDisabled(currentNode()->glued); - ui.recalcButton->setDisabled(currentArc == 0); - ui.icpParamCurrentButton->setDisabled(currentArc == 0); + ui.recalcButton->setDisabled(currentArc == nullptr); + ui.icpParamCurrentButton->setDisabled(currentArc == nullptr); ui.baseMeshButton->setDisabled(!currentNode()->glued); } @@ -171,13 +171,13 @@ MeshTreeWidgetItem::MeshTreeWidgetItem(MeshTreem::MeshNode *meshNode) setText(3, labelText); n = meshNode; - a = 0; + a = nullptr; } MeshTreeWidgetItem::MeshTreeWidgetItem(MeshTreem* /*meshTree*/, vcg::AlignPair::Result *A, MeshTreeWidgetItem *parent) { - n = 0; + n = nullptr; a = A; parent->addChild(this); QString buf = QString("Arc: %1 -> %2 Area: %3 Err: %4 Sample# %5 (%6)") @@ -210,7 +210,7 @@ MeshTreeWidgetItem::MeshTreeWidgetItem(MeshTreem* /*meshTree*/, vcg::AlignPair:: void AlignDialog::rebuildTree() { - currentArc = 0; + currentArc = nullptr; gla = edit->_gla; ui.alignTreeWidget->clear(); M2T.clear(); diff --git a/src/meshlabplugins/edit_align/edit_align.cpp b/src/meshlabplugins/edit_align/edit_align.cpp index ec6c95227..a740d9c40 100644 --- a/src/meshlabplugins/edit_align/edit_align.cpp +++ b/src/meshlabplugins/edit_align/edit_align.cpp @@ -28,7 +28,6 @@ $Log: meshedit.cpp,v $ #include "edit_align.h" #include #include -#include #include #include #include "AlignPairWidget.h" @@ -49,7 +48,7 @@ vcg::Box3d vcg::PointMatchingScale::b; EditAlignPlugin::EditAlignPlugin() { - alignDialog=0; + alignDialog = nullptr; qFont.setFamily("Helvetica"); qFont.setPixelSize(10); @@ -57,7 +56,7 @@ EditAlignPlugin::EditAlignPlugin() trackball.radius= 1; } -const QString EditAlignPlugin::info() +QString EditAlignPlugin::info() { return tr("Allows one to align different layers together."); } @@ -66,7 +65,7 @@ void EditAlignPlugin::suggestedRenderingData(MeshModel & /*m*/, MLRenderingData& { MLPerViewGLOptions opts; dt.get(opts); - for (MLRenderingData::PRIMITIVE_MODALITY pr = MLRenderingData::PRIMITIVE_MODALITY(0); pr < MLRenderingData::PR_ARITY; pr = MLRenderingData::next(pr)) + for (auto pr = MLRenderingData::PRIMITIVE_MODALITY(0); pr < MLRenderingData::PR_ARITY; pr = MLRenderingData::next(pr)) { MLRenderingData::RendAtts atts; dt.get(pr, atts); @@ -142,8 +141,7 @@ bool EditAlignPlugin::startEdit(MeshDocument& md, GLArea * gla, MLSceneGLSharedD // it.value().colorMode=GLW::CMPerMesh; _gla->setCursor(QCursor(QPixmap(":/images/cur_align.png"),1,1)); - if(alignDialog==0) - { + if (alignDialog == nullptr) { if (!GLExtensionsManager::initializeGLextensions_notThrowing()) return false; @@ -190,7 +188,7 @@ void EditAlignPlugin::decorate(MeshModel & mm, GLArea * gla) opts._perbbox_enabled = true; tmp.set(opts); _shared->drawAllocatedAttributesSubset(mm.id(), _gla->context(), tmp); - if ((alignDialog != NULL) && (alignDialog->currentArc != 0)) + if ((alignDialog != nullptr) && (alignDialog->currentArc != nullptr)) DrawArc(alignDialog->currentArc); } @@ -214,12 +212,9 @@ void EditAlignPlugin::decorate(MeshModel & mm, GLArea * gla) void EditAlignPlugin::endEdit(MeshModel &/*m*/, GLArea * /*parent*/, MLSceneGLSharedDataContext* /*cont*/) { - // some cleaning at the end. qDebug("EndEdit: cleaning everything"); meshTree.clear(); - delete alignDialog; - alignDialog=0; } void EditAlignPlugin::hideRevealGluedMesh() @@ -263,12 +258,11 @@ void EditAlignPlugin::glueByPicking() } //Matrix44f oldTr = md->mm()->cm.Tr; - AlignPairDialog *dd=new AlignPairDialog(_gla,this->alignDialog); + AlignPairDialog *dd = new AlignPairDialog(_gla,this->alignDialog); dd->aa->initMesh(currentNode(), &meshTree); dd->exec(); - if(dd->result()==QDialog::Rejected) - return; + if (dd->result()==QDialog::Rejected) return; // i picked points sono in due sistemi di riferimento. @@ -281,7 +275,7 @@ void EditAlignPlugin::glueByPicking() } Matrix44m res; - if ((dd != NULL) && (dd->aa != NULL) && (dd->aa->allowscaling)) + if ((dd != nullptr) && (dd->aa != nullptr) && (dd->aa->allowscaling)) ComputeSimilarityMatchMatrix(gluedPnt,freePnt,res); else ComputeRigidMatchMatrix(gluedPnt,freePnt,res); @@ -304,7 +298,7 @@ void EditAlignPlugin::glueManual() { assert(currentNode()->glued==false); - if ((_md == NULL) || (_md->mm() == NULL) || (_gla == NULL) || (_gla->mvc() == NULL)) + if ((_md == nullptr) || (_md->mm() == nullptr) || (_gla == nullptr) || (_gla->mvc() == nullptr)) return; MeshModel *mm=_md->mm(); @@ -343,7 +337,7 @@ void EditAlignPlugin::glueManual() alignDialog->rebuildTree(); break; } - default : assert("entered in the GlueManual slot in the wrong state"==0); + default : assert("entered in the GlueManual slot in the wrong state"==nullptr); } _gla->update(); @@ -415,7 +409,7 @@ void EditAlignPlugin::setAlignParamM() defaultAP.ReduceFactorPerc = 0.8; defaultAP.PassHiFilter = 0.75; defaultAP.MatchMode = AlignPair::Param::MMRigid; - QMessageBox::warning(0, "Align tool", "ICP Default Parameters set for METERS"); + QMessageBox::warning(nullptr, "Align tool", "ICP Default Parameters set for METERS"); } void EditAlignPlugin::glueHere() @@ -458,7 +452,7 @@ void EditAlignPlugin::process() { if(meshTree.gluedNum()<2) { - QMessageBox::warning(0,"Align tool", "ICP Process can only work when at least two layers have been glued"); + QMessageBox::warning(nullptr,"Align tool", "ICP Process can only work when at least two layers have been glued"); return; } alignDialog->setEnabled(false); diff --git a/src/meshlabplugins/edit_align/edit_align.h b/src/meshlabplugins/edit_align/edit_align.h index be18b9aeb..0e15fe3df 100644 --- a/src/meshlabplugins/edit_align/edit_align.h +++ b/src/meshlabplugins/edit_align/edit_align.h @@ -49,10 +49,10 @@ class EditAlignPlugin : public QObject, public EditTool public: EditAlignPlugin(); - virtual ~EditAlignPlugin() { - } + virtual ~EditAlignPlugin() { + } - static const QString info(); + static QString info(); bool isSingleMeshEdit() const { return false; } void suggestedRenderingData(MeshModel &m, MLRenderingData& dt); @@ -74,8 +74,9 @@ public: GLArea* _gla; MeshDocument* _md; MeshTreem::MeshNode *currentNode() { return meshTree.find(_md->mm()); } - vcg::AlignPair::Result *currentArc() { return alignDialog->currentArc; } + vcg::AlignPair::Result *currentArc() const { return alignDialog->currentArc; } MeshTreem meshTree; + public: vcg::AlignPair::Param defaultAP; // default alignment parameters MeshTreem::Param defaultMTP; // default MeshTree parameters