From 56db4d328ab5bc86baa6ae7cfd6334dd3cdce9d9 Mon Sep 17 00:00:00 2001 From: Guido Ranzuglia granzuglia Date: Thu, 9 Dec 2010 11:24:17 +0000 Subject: [PATCH] more rational use of some common include --- src/meshlab/mainwindow.h | 2 + src/meshlab/mainwindow_RunTime.cpp | 99 ++++++++++++++++++++++++++++++ src/meshlab/xmlstdpardialog.cpp | 11 ++-- src/meshlab/xmlstdpardialog.h | 3 + 4 files changed, 110 insertions(+), 5 deletions(-) diff --git a/src/meshlab/mainwindow.h b/src/meshlab/mainwindow.h index 228838205..338f63a90 100644 --- a/src/meshlab/mainwindow.h +++ b/src/meshlab/mainwindow.h @@ -35,6 +35,7 @@ #include #include #include "../common/pluginmanager.h" +#include "../common/interfaces.h" #include "glarea.h" #include "layerDialog.h" #include "stdpardialog.h" @@ -58,6 +59,7 @@ class MainWindow : public QMainWindow, MainWindowInterface public: // callback function to execute a filter void executeFilter(QAction *action, RichParameterSet &srcpar, bool isPreview); + void executeFilter(MeshLabXMLFilterContainer* mfc, XMLFilterInfo::XMLMapList & mplist, bool isPreview); MainWindow(); static bool QCallBack(const int pos, const char * str); diff --git a/src/meshlab/mainwindow_RunTime.cpp b/src/meshlab/mainwindow_RunTime.cpp index 2ea3a1e64..8c2377f8c 100644 --- a/src/meshlab/mainwindow_RunTime.cpp +++ b/src/meshlab/mainwindow_RunTime.cpp @@ -1007,6 +1007,105 @@ void MainWindow::executeFilter(QAction *action, RichParameterSet ¶ms, bool i } +void MainWindow::executeFilter(MeshLabXMLFilterContainer* mfc, XMLFilterInfo::XMLMapList& mplist, bool isPreview) +{ + + //MeshFilterInterface *iFilter = qobject_cast< MeshFilterInterface *>(action->parent()); + + //qb->show(); + //iFilter->setLog(&meshDoc()->Log); + + //// Ask for filter requirements (eg a filter can need topology, border flags etc) + //// and statisfy them + //qApp->setOverrideCursor(QCursor(Qt::WaitCursor)); + //MainWindow::globalStatusBar()->showMessage("Starting Filter...",5000); + //int req=iFilter->getRequirements(action); + //meshDoc()->mm()->updateDataMask(req); + //qApp->restoreOverrideCursor(); + + //// (3) save the current filter and its parameters in the history + //if(!isPreview) + //{ + // meshDoc()->filterHistory.actionList.append(qMakePair(action->text(),params)); + // meshDoc()->Log.ClearBookmark(); + //} + //else + // meshDoc()->Log.BackToBookmark(); + //// (4) Apply the Filter + //bool ret; + //qApp->setOverrideCursor(QCursor(Qt::WaitCursor)); + //QTime tt; tt.start(); + //meshDoc()->setBusy(true); + //RichParameterSet MergedEnvironment(params); + //MergedEnvironment.join(currentGlobalParams); + + ////GLA() is only the parent + //QGLWidget* filterWidget = new QGLWidget(GLA()); + //QGLFormat defForm = QGLFormat::defaultFormat(); + //iFilter->glContext = new QGLContext(defForm,filterWidget->context()->device()); + //bool retres = iFilter->glContext->create(filterWidget->context()); + //ret=iFilter->applyFilter(action, *(meshDoc()), MergedEnvironment, QCallBack); + + //meshDoc()->setBusy(false); + + //qApp->restoreOverrideCursor(); + + //// (5) Apply post filter actions (e.g. recompute non updated stuff if needed) + + //if(ret) + //{ + // meshDoc()->Log.Logf(GLLogStream::SYSTEM,"Applied filter %s in %i msec",qPrintable(action->text()),tt.elapsed()); + // MainWindow::globalStatusBar()->showMessage("Filter successfully completed...",2000); + // if(GLA()) + // { + // GLA()->setWindowModified(true); + // GLA()->setLastAppliedFilter(action); + // } + // lastFilterAct->setText(QString("Apply filter ") + action->text()); + // lastFilterAct->setEnabled(true); + //} + //else // filter has failed. show the message error. + //{ + // QMessageBox::warning(this, tr("Filter Failure"), QString("Failure of filter: '%1'\n\n").arg(action->text())+iFilter->errorMsg()); // text + // MainWindow::globalStatusBar()->showMessage("Filter failed...",2000); + //} + //// at the end for filters that change the color, or selection set the appropriate rendering mode + //if(iFilter->getClass(action) & MeshFilterInterface::FaceColoring ) { + // GLA()->setColorMode(vcg::GLW::CMPerFace); + // meshDoc()->mm()->updateDataMask(MeshModel::MM_FACECOLOR); + //} + //if(iFilter->getClass(action) & MeshFilterInterface::VertexColoring ){ + // GLA()->setColorMode(vcg::GLW::CMPerVert); + // meshDoc()->mm()->updateDataMask(MeshModel::MM_VERTCOLOR); + //} + //if(iFilter->postCondition(action) & MeshModel::MM_COLOR) + //{ + // GLA()->setColorMode(vcg::GLW::CMPerMesh); + // meshDoc()->mm()->updateDataMask(MeshModel::MM_COLOR); + //} + //if(iFilter->getClass(action) & MeshFilterInterface::Selection ) + //{ + // GLA()->setSelectVertRendering(true); + // GLA()->setSelectFaceRendering(true); + //} + //if(iFilter->getClass(action) & MeshFilterInterface::MeshCreation ) + // GLA()->resetTrackBall(); + + //if(iFilter->getClass(action) & MeshFilterInterface::Texture ) + // GLA()->updateTexture(); + + //qb->reset(); + + //updateMenus(); + //GLA()->update(); //now there is the container + //MultiViewer_Container* mvc = currentViewContainer(); + //if(mvc) + // mvc->updateAllViewer(); + +} + + + // Edit Mode Managment // At any point there can be a single editing plugin active. // When a plugin is active it intercept the mouse actions. diff --git a/src/meshlab/xmlstdpardialog.cpp b/src/meshlab/xmlstdpardialog.cpp index 3e8cc07da..ef4cf7bc1 100644 --- a/src/meshlab/xmlstdpardialog.cpp +++ b/src/meshlab/xmlstdpardialog.cpp @@ -174,11 +174,12 @@ void MeshLabXMLStdDialog::applyClick() //PreView Caching: if the apply parameters are the same to those used in the preview mode //we don't need to reapply the filter to the mesh - /*bool isEqual = (curParSet == prevParSet); - if ((isEqual) && (validcache)) - meshCacheState.apply(curModel); - else - curmwi->executeFilter(q, curParSet, false);*/ + //bool isEqual = (curParSet == prevParSet); + //if ((isEqual) && (validcache)) + // meshCacheState.apply(curModel); + //else + //curmwi->executeFilter(curmfc, curParSet, false); + if(curmask) meshState.create(curmask, curModel); diff --git a/src/meshlab/xmlstdpardialog.h b/src/meshlab/xmlstdpardialog.h index da3354612..e468f1ee4 100644 --- a/src/meshlab/xmlstdpardialog.h +++ b/src/meshlab/xmlstdpardialog.h @@ -2,6 +2,8 @@ #define MESHLAB_XMLSTDPARDIALOG #include "../common/xmlfilterinfo.h" +#include "../common/mlparameter.h" +#include "../common/interfaces.h" #include #include #include @@ -12,6 +14,7 @@ #include #include #include +#include // class XMLMeshLabWidget : public QWidget