mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-20 03:16:10 +00:00
Updated to remove PluginInfo, to use new MeshEditInterface, and to use new factory way of creating edit tools
This commit is contained in:
parent
62e8c75fb2
commit
6d3a8eaa68
@ -1,6 +1,7 @@
|
||||
include (../../shared.pri)
|
||||
|
||||
HEADERS = common/const_types.h \
|
||||
edit_quality_factory.h \
|
||||
qualitymapper.h \
|
||||
qualitymapperdialog.h \
|
||||
common/transferfunction.h \
|
||||
@ -10,7 +11,8 @@ HEADERS = common/const_types.h \
|
||||
eqhandle.h \
|
||||
tfhandle.h
|
||||
|
||||
SOURCES = qualitymapper.cpp\
|
||||
SOURCES = edit_quality_factory.cpp \
|
||||
qualitymapper.cpp\
|
||||
qualitymapperdialog.cpp\
|
||||
common/transferfunction.cpp\
|
||||
common/util.cpp \
|
||||
|
||||
58
src/fgt/edit_quality/edit_quality_factory.cpp
Normal file
58
src/fgt/edit_quality/edit_quality_factory.cpp
Normal file
@ -0,0 +1,58 @@
|
||||
/****************************************************************************
|
||||
* MeshLab o o *
|
||||
* A versatile mesh processing toolbox o o *
|
||||
* _ O _ *
|
||||
* Copyright(C) 2005-2008 \/)\/ *
|
||||
* Visual Computing Lab /\/| *
|
||||
* ISTI - Italian National Research Council | *
|
||||
* \ *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
|
||||
* for more details. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#include "edit_quality_factory.h"
|
||||
#include "qualitymapper.h"
|
||||
|
||||
QualityMapperFactory::QualityMapperFactory()
|
||||
{
|
||||
//setting-up plugin
|
||||
editQuality = new QAction(QIcon(":/images/qualitymapper.png"),"Quality Mapper", this);
|
||||
|
||||
actionList << editQuality;
|
||||
|
||||
foreach(QAction *editAction, actionList)
|
||||
editAction->setCheckable(true);
|
||||
}
|
||||
|
||||
//gets a list of actions available from this plugin
|
||||
QList<QAction *> QualityMapperFactory::actions() const
|
||||
{
|
||||
return actionList;
|
||||
}
|
||||
|
||||
//get the edit tool for the given action
|
||||
MeshEditInterface* QualityMapperFactory::getMeshEditInterface(QAction *action)
|
||||
{
|
||||
if(action == editQuality)
|
||||
{
|
||||
return new QualityMapperPlugin();
|
||||
} else assert(0); //should never be asked for an action that isnt here
|
||||
}
|
||||
|
||||
const QString QualityMapperFactory::getEditToolDescription(QAction *)
|
||||
{
|
||||
return QualityMapperPlugin::Info();
|
||||
}
|
||||
|
||||
Q_EXPORT_PLUGIN(QualityMapperFactory)
|
||||
59
src/fgt/edit_quality/edit_quality_factory.h
Normal file
59
src/fgt/edit_quality/edit_quality_factory.h
Normal file
@ -0,0 +1,59 @@
|
||||
/****************************************************************************
|
||||
* MeshLab o o *
|
||||
* A versatile mesh processing toolbox o o *
|
||||
* _ O _ *
|
||||
* Copyright(C) 2005-2008 \/)\/ *
|
||||
* Visual Computing Lab /\/| *
|
||||
* ISTI - Italian National Research Council | *
|
||||
* \ *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
|
||||
* for more details. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#ifndef QualityMapperFactoryPLUGIN_H
|
||||
#define QualityMapperFactoryPLUGIN_H
|
||||
|
||||
#include <meshlab/interfaces.h>
|
||||
#include <QObject>
|
||||
#include <QList>
|
||||
|
||||
class QualityMapperFactory : public QObject, public MeshEditInterfaceFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(MeshEditInterfaceFactory)
|
||||
|
||||
public:
|
||||
QualityMapperFactory();
|
||||
virtual ~QualityMapperFactory() { delete editQuality; }
|
||||
|
||||
//gets a list of actions available from this plugin
|
||||
virtual QList<QAction *> actions() const;
|
||||
|
||||
//get the edit tool for the given action
|
||||
virtual MeshEditInterface* getMeshEditInterface(QAction *);
|
||||
|
||||
//get the description for the given action
|
||||
virtual const QString getEditToolDescription(QAction *);
|
||||
|
||||
private:
|
||||
QList <QAction *> actionList;
|
||||
|
||||
QAction *editQuality;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -37,37 +37,16 @@ using namespace vcg;
|
||||
|
||||
QualityMapperPlugin::QualityMapperPlugin()
|
||||
{
|
||||
//setting-up plugin
|
||||
actionList << new QAction(QIcon(":/images/qualitymapper.png"),"Quality Mapper", this);
|
||||
QAction *editAction;
|
||||
foreach(editAction, actionList)
|
||||
editAction->setCheckable(true);
|
||||
|
||||
//initializing dialog pointer
|
||||
_qualityMapperDialog = 0;
|
||||
}
|
||||
|
||||
QList<QAction *> QualityMapperPlugin::actions() const
|
||||
{ return actionList; }
|
||||
|
||||
|
||||
const QString QualityMapperPlugin::Info(QAction *action)
|
||||
const QString QualityMapperPlugin::Info()
|
||||
{
|
||||
if( action->text() != tr("Get Info") ) assert (0);
|
||||
|
||||
return tr("Colorize mesh vertexes by Quality");
|
||||
}
|
||||
|
||||
const PluginInfo &QualityMapperPlugin::Info()
|
||||
{
|
||||
static PluginInfo ai;
|
||||
ai.Date=tr("Jan 2008");
|
||||
ai.Version = tr("1.0");
|
||||
ai.Author = ("Alessandro Maione, Federico Bellucci");
|
||||
return ai;
|
||||
}
|
||||
|
||||
void QualityMapperPlugin::StartEdit(QAction *mode, MeshModel& m, GLArea *gla )
|
||||
void QualityMapperPlugin::StartEdit(MeshModel& m, GLArea *gla )
|
||||
{
|
||||
if(_qualityMapperDialog==0)
|
||||
_qualityMapperDialog = new QualityMapperDialog(gla->window(), m, gla);
|
||||
@ -76,7 +55,7 @@ void QualityMapperPlugin::StartEdit(QAction *mode, MeshModel& m, GLArea *gla )
|
||||
//bool ret = _qualityMapperDialog->initEqualizerHistogram();
|
||||
if ( !_qualityMapperDialog->initEqualizerHistogram() )
|
||||
{
|
||||
EndEdit(mode, m, gla);
|
||||
EndEdit(m, gla);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -89,7 +68,7 @@ void QualityMapperPlugin::StartEdit(QAction *mode, MeshModel& m, GLArea *gla )
|
||||
connect(_qualityMapperDialog, SIGNAL(closingDialog()),gla,SLOT(endEdit()) );
|
||||
}
|
||||
|
||||
void QualityMapperPlugin::EndEdit(QAction * , MeshModel &, GLArea * )
|
||||
void QualityMapperPlugin::EndEdit(MeshModel &, GLArea * )
|
||||
{
|
||||
//if a dialog exists, it's time to destroy it
|
||||
if ( _qualityMapperDialog )
|
||||
@ -102,7 +81,7 @@ void QualityMapperPlugin::EndEdit(QAction * , MeshModel &, GLArea * )
|
||||
}
|
||||
}
|
||||
|
||||
void QualityMapperPlugin::Decorate(QAction*, MeshModel&, GLArea*)
|
||||
void QualityMapperPlugin::Decorate(MeshModel&, GLArea*)
|
||||
{
|
||||
// Draw a vertical bar
|
||||
// Enter in 2D screen Mode again
|
||||
@ -157,6 +136,3 @@ void QualityMapperPlugin::Decorate(QAction*, MeshModel&, GLArea*)
|
||||
glPopMatrix();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
Q_EXPORT_PLUGIN(QualityMapperPlugin)
|
||||
|
||||
|
||||
@ -47,21 +47,18 @@ class QualityMapperPlugin : public QObject, public MeshEditInterface
|
||||
|
||||
private:
|
||||
QualityMapperDialog *_qualityMapperDialog;
|
||||
QList <QAction *> actionList;
|
||||
|
||||
public:
|
||||
QualityMapperPlugin(void);
|
||||
~QualityMapperPlugin(void){};
|
||||
|
||||
virtual const QString Info(QAction *);
|
||||
virtual const PluginInfo &Info();
|
||||
virtual QList<QAction *> actions() const ;
|
||||
virtual void StartEdit(QAction*, MeshModel&, GLArea*);
|
||||
virtual void EndEdit(QAction*, MeshModel&, GLArea*);
|
||||
virtual void Decorate(QAction*, MeshModel&, GLArea*);
|
||||
virtual void mousePressEvent(QAction*, QMouseEvent*, MeshModel&, GLArea*) {};
|
||||
virtual void mouseMoveEvent(QAction*, QMouseEvent*, MeshModel&, GLArea*) {};
|
||||
virtual void mouseReleaseEvent(QAction*, QMouseEvent *event, MeshModel&, GLArea*){};
|
||||
static const QString Info();
|
||||
virtual void StartEdit(MeshModel&, GLArea*);
|
||||
virtual void EndEdit(MeshModel&, GLArea*);
|
||||
virtual void Decorate(MeshModel&, GLArea*);
|
||||
virtual void mousePressEvent(QMouseEvent*, MeshModel&, GLArea*) {};
|
||||
virtual void mouseMoveEvent(QMouseEvent*, MeshModel&, GLArea*) {};
|
||||
virtual void mouseReleaseEvent(QMouseEvent *event, MeshModel&, GLArea*){};
|
||||
|
||||
QPoint cur;
|
||||
bool haveToPick;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user