more rational use of some common include

This commit is contained in:
Guido Ranzuglia granzuglia 2010-12-09 11:24:17 +00:00
parent 03f70ebed0
commit 56db4d328a
4 changed files with 110 additions and 5 deletions

View File

@ -35,6 +35,7 @@
#include <QStringList>
#include <QColorDialog>
#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);

View File

@ -1007,6 +1007,105 @@ void MainWindow::executeFilter(QAction *action, RichParameterSet &params, 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.

View File

@ -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);

View File

@ -2,6 +2,8 @@
#define MESHLAB_XMLSTDPARDIALOG
#include "../common/xmlfilterinfo.h"
#include "../common/mlparameter.h"
#include "../common/interfaces.h"
#include<QCheckBox>
#include<QPushButton>
#include<QRadioButton>
@ -12,6 +14,7 @@
#include<QGridLayout>
#include<QDockWidget>
#include<QTextEdit>
#include<QLabel>
//
class XMLMeshLabWidget : public QWidget