From c42df01fab3ee14e02ff62f294d526ec5d2ab431 Mon Sep 17 00:00:00 2001 From: Paolo Cignoni cignoni Date: Thu, 21 Sep 2006 10:19:43 +0000 Subject: [PATCH] Update the meshlab's web page --- web/filter.html | 332 +++++++++++++++++++++--------------------------- 1 file changed, 144 insertions(+), 188 deletions(-) diff --git a/web/filter.html b/web/filter.html index f1904fe83..e73e74a9c 100644 --- a/web/filter.html +++ b/web/filter.html @@ -1,191 +1,147 @@ - - - - - - - - - - - Meshlab Development - - - - - - - - - - - - - - - - - - - - - - - -
-

MeshLab: -Development page : Create a Filter-plugin

- - -
- - -

How to

- -

-To create a new filter plug-in the first step is to considerate that you -must implement the "MeshFilterInterface" interface; you can find it in "meshlab/interfaces.h".

- - -

Then you create a new class -filter which must inherit from the interface and from Object. This -involves you specifying the two keywords "Q_OBJECT" and "Q_INTERFACES(MeshFilterInterface)" before the method declaration to permit the moc'ing phases.

-

It is essential to import of the mesh definition found in "meshlab/meshmodel.h".
-
-The new filter plug-in class must have an action container like "QList <QAction *>", where you can store all the actions you implement in your class; QList <QAction*> must be populated in the constructor.
-
-Then you implement the following four pure virtual methods:
-
-QList<QAction *> actions() // return the list of actions to create the menu on the toolbar
-virtual const ActionInfo &Info(QAction *)//?
-virtual const PluginInfo &Info()//?
-virtual bool applyFilter(QAction * /*filter*/, MeshModel & /*m*/, QWidget * /*parent*/, vcg::CallBackPos* /*cb*/)
-// Discriminate on the filter to apply by the action name. Its parameters are:
-||    * The filter action
-||    * The Mesh
-||    * The QWidget parent to possibly create the dialog to set some variables
-||    * The call-back function to update the progress-bar
-
-Important:
-Before performing a filter function call it is good practice to check -that the characteristics of the mesh (topology, normal, texture and so -on) are up to date; otherwise you should call the specific method.

- -

Example

- -

Example.h

-

#ifndef EXAMPLEPLUGIN_H
-#define EXAMPLEPLUGIN_H
-
-#include <QObject>
-#include <QStringList>
-#include <QList>
-
-class ExampleMeshFilterPlugin : public QObject, public MeshFilterInterface
-{
-    Q_OBJECT
-    Q_INTERFACES(MeshFilterInterface)
-       
-public:
-    ExampleMeshFilterPlugin();
-    virtual const ActionInfo &Info(QAction *);
-    virtual const PluginInfo &Info();
-    virtual QList<QAction *> actions() const;
-    bool applyFilter(QAction *filter, MeshModel &m, QWidget *parent, vcg::CallBackPos * cb) ;
-
-protected:
-    QList <QAction *> actionList;
-};
-
-#endif
-

-


-
-Example.cpp
-
-#include <QtGui>
-#include <stdlib.h>
-#include "meshfilter.h"
-#include <vcg/complex/trimesh/clean.h>
-#include <vcg/complex/trimesh/smooth.h>
-
-ExampleMeshFilterPlugin::ExampleMeshFilterPlugin() 
-{

-    actionList << new QAction("ExampleFilter", this);
-}
-
-QList<QAction *> ExampleMeshFilterPlugin::actions() const 
-{

-    return actionList;
-}
-
-const ActionInfo &ExampleMeshFilterPlugin::Info(QAction *action)
-{
-   ActionInfo ai;
-     if( action->text() == tr("ExampleFilter") )
-        {
-            ai.Help = tr("explain yuor method");
-            ai.ShortHelp = tr("For tooltip");
-        }
-   return ai;
- }
-
-const PluginInfo &ExampleMeshFilterPlugin::Info()
-{
-   static PluginInfo ai;
-   ai.Date=tr("__DATE__");
-     ai.Version = tr("Current version");
-     ai.Author = ("Yuor name");
-   return ai;
- }
- 
-bool ExampleMeshFilterPlugin::applyFilter(QAction *filter, MeshModel &m, QWidget *parent, vcg::CallBackPos *cb)
-{
-    if(filter->text() == tr("ExampleFilter") )
-        {
-            //call my filter method
-        }
-    return true;
-}
-Q_EXPORT_PLUGIN(ExampleMeshFilterPlugin)
-
-

-
- -
- - -
- - -
- - -
-
- -SourceForge.net Logo - - - - - - - - - - - - - - - -
- - - + + Meshlab Development + + + + + + + + +
+

MeshLab: Development page : Create a Filter-plugin

+
+

How to

+

+ To create a new filter plug-in the first step is to considerate that you must + implement the "MeshFilterInterface", you can find it in "meshlab/interfaces.h".

+

Then you create a new class filter which + must inherit from the interface and from QObject. This involves you specifying + the two keywords "Q_OBJECT" + and "Q_INTERFACES(MeshFilterInterface)" + before the method declaration to permit the moc'ing phases.

+

It is essential to import of the mesh definition found in "meshlab/meshmodel.h".
+
+ Then you implement the following four pure virtual methods:
+
+ virtual const QString ST(FilterType filter); + // Return a string that explane the filter's behaviour
+ virtual const ActionInfo &Info(QAction *);
+ virtual const PluginInfo &Info();
+ virtual bool applyFilter(QAction * /*filter*/, MeshModel & /*m*/, FilterParameter & /*par*/, vcg::CallBackPos* /*cb*/); + // Discriminate on the filter to apply by the action name. Its parameters are:
+ ||    * The Filter Action
+ ||    * The Mesh +
+ ||    * The Filter Parameters +
+ ||    * The Call-Back function to update the progress-bar
+
+ Important:
+ Before performing a filter function call it is good practice to check that the + characteristics of the mesh (topology, normal, texture and so on) are up to + date, otherwise you should call the specific method.

+

Example

+

Example.h

+

#ifndef EXAMPLEPLUGIN_H
+ #define EXAMPLEPLUGIN_H
+
+ #include <QObject>
+ #include <QStringList>
+ #include <QList>
+
+ class ExampleMeshFilterPlugin : public QObject, public MeshFilterInterface
+ {
+
+     Q_OBJECT
+     Q_INTERFACES(MeshFilterInterface)
+        
+ public:
+
+     ExampleMeshFilterPlugin();
+     virtual const ActionInfo &Info(QAction *);
+     virtual const PluginInfo &Info();
+     virtual QString ST(FilterType filter);
+     virtual bool applyFilter(QAction *filter, MeshModel &m, FilterParameter &par, vcg::CallBackPos * cb);
+
+ };
+
+ #endif
+

+


+
+ Example.cpp
+
+ #include <QtGui>
+ #include <stdlib.h>
+ #include "meshfilter.h"
+ #include <vcg/complex/trimesh/clean.h>
+ #include <vcg/complex/trimesh/smooth.h>
+
+ ExampleMeshFilterPlugin::ExampleMeshFilterPlugin() 
+{

+     actionList << new QAction("ExampleFilter", this);
+ }
+
+ QString ExampleMeshFilterPlugin::ST(FilterType filter) 
+{

+     switch(filter){
+
+       case "TYPE":      return QString("...");
+       ...
+    }
+    return QString("error");
+ }
+
+ const ActionInfo &ExampleMeshFilterPlugin::Info(QAction *action)
+ {
+    ActionInfo ai;
+     if( action->text() == tr("ExampleFilter") )
+         {
+             ai.Help = tr("explain yuor method");
+             ai.ShortHelp = tr("For tooltip");
+         }
+    return ai;
+  }
+
+ const PluginInfo &ExampleMeshFilterPlugin::Info()
+ {
+    static PluginInfo ai;
+    ai.Date=tr("__DATE__");
+      ai.Version = tr("Current version");
+      ai.Author = ("Yuor name");
+    return ai;
+  }
+  
+ bool ExampleMeshFilterPlugin::applyFilter(QAction *filter, MeshModel &m, FilterParameter &par, vcg::CallBackPos *cb)
+ {
+     if(filter->text() == tr("ExampleFilter") )
+         {
+             //call my filter method
+         }
+     return true;
+ }
+
+ Q_EXPORT_PLUGIN(ExampleMeshFilterPlugin)
+
+

+
+ +
+
+
+
+
+ + SourceForge.net Logo + + + + + +
+