Commit 6f18a155 authored by Jan Möbius's avatar Jan Möbius

Convert to original plugin style

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@12856 383ad7c9-94d9-4d36-a494-682f7c89f535
parent f55dcc69
This diff is collapsed.
...@@ -40,18 +40,28 @@ ...@@ -40,18 +40,28 @@
* * * *
\*===========================================================================*/ \*===========================================================================*/
#ifndef DECIMATER_PLUGIN_HH_INCLUDED #ifndef DECIMATERPLUGIN_HH
#define DECIMATER_PLUGIN_HH_INCLUDED #define DECIMATERPLUGIN_HH
//== INCLUDES =================================================================
#include <QObject>
#include <QMenuBar>
#include <QTimer>
#include <OpenFlipper/BasePlugin/BaseInterface.hh> #include <OpenFlipper/BasePlugin/BaseInterface.hh>
#include <OpenFlipper/BasePlugin/ToolboxInterface.hh> #include <OpenFlipper/BasePlugin/ToolboxInterface.hh>
#include <OpenFlipper/BasePlugin/LoggingInterface.hh>
#include <OpenFlipper/BasePlugin/BackupInterface.hh> #include <OpenFlipper/BasePlugin/BackupInterface.hh>
#include <OpenFlipper/BasePlugin/LoggingInterface.hh>
#include <OpenFlipper/BasePlugin/ScriptInterface.hh>
#include <OpenFlipper/BasePlugin/RPCInterface.hh>
#include <OpenFlipper/common/Types.hh> #include <OpenFlipper/common/Types.hh>
#include <ObjectTypes/TriangleMesh/TriangleMesh.hh> #include <ObjectTypes/TriangleMesh/TriangleMesh.hh>
#include "DecimaterInfo.hh"
#include "DecimaterToolbarWidget.hh" #include "DecimaterToolbarWidget.hh"
#include <OpenMesh/Tools/Decimater/DecimaterT.hh> #include <OpenMesh/Tools/Decimater/DecimaterT.hh>
...@@ -64,48 +74,78 @@ ...@@ -64,48 +74,78 @@
#include <OpenMesh/Tools/Decimater/ModRoundnessT.hh> #include <OpenMesh/Tools/Decimater/ModRoundnessT.hh>
#include <OpenMesh/Tools/Decimater/ModIndependentSetsT.hh> #include <OpenMesh/Tools/Decimater/ModIndependentSetsT.hh>
#include <ObjectTypes/TriangleMesh/TriangleMesh.hh>
//== CLASS DEFINITION ========================================================= //== CLASS DEFINITION =========================================================
class DecimaterPlugin : public QObject, BaseInterface, ToolboxInterface, LoggingInterface, BackupInterface { /** Plugin for Decimater Support
Q_OBJECT */
Q_INTERFACES(BaseInterface) class DecimaterPlugin : public QObject, BaseInterface, ToolboxInterface, LoggingInterface, ScriptInterface, BackupInterface, RPCInterface
Q_INTERFACES(ToolboxInterface) {
Q_INTERFACES(LoggingInterface) Q_OBJECT
Q_INTERFACES(BackupInterface) Q_INTERFACES(BaseInterface)
Q_INTERFACES(ToolboxInterface)
Q_INTERFACES(BackupInterface)
Q_INTERFACES(LoggingInterface)
Q_INTERFACES(ScriptInterface)
Q_INTERFACES(RPCInterface)
signals: signals:
// BaseInterface // BaseInterface
void updateView(); void updateView();
void updatedObject(int _id, const UpdateType _type); void updatedObject(int _id, const UpdateType _type);
void setSlotDescription(QString _slotName, QString _slotDescription,
QStringList _parameters, QStringList _descriptions);
// LoggingInterface // LoggingInterface
void log(Logtype _type, QString _message); void log(Logtype _type, QString _message);
void log(QString _message); void log(QString _message);
// RPC Interface
void pluginExists( QString _pluginName , bool& _exists ) ;
void functionExists( QString _pluginName , QString _functionName , bool& _exists );
// ToolboxInterface // ToolboxInterface
void addToolbox( QString _name , QWidget* _widget, QIcon* _icon ); void addToolbox( QString _name , QWidget* _widget, QIcon* _icon );
// ScriptInterface
void scriptInfo( QString _functionName );
// BackupInterface // BackupInterface
void createBackup(int _id, QString _name, UpdateType _type = UPDATE_ALL); void createBackup( int _id , QString _name, UpdateType _type = UPDATE_ALL );
public: private slots:
// BaseInterface
void initializePlugin();
void pluginsInitialized();
void slotObjectUpdated( int _identifier , const UpdateType _type ); // BaseInterface
void slotObjectSelectionChanged( int _identifier ); // BaseInterface
public :
/// Default constructor
DecimaterPlugin() : tool_(0) {}; DecimaterPlugin() : tool_(0) {};
/// Default destructor
~DecimaterPlugin() {}; ~DecimaterPlugin() {};
QString name() { return QString("DecimaterPlugin"); }; /// Name of the Plugin
QString description() { return QString("Mesh Decimater Plugin"); }; QString name(){ return (QString("Decimater")); };
private: /// Description of the Plugin
QString description() { return (QString(tr("Mesh Decimation ..."))); };
private :
/// Widget for Toolbox /// Widget for Toolbox
DecimaterToolbarWidget* tool_; DecimaterToolbarWidget* tool_;
QIcon* toolIcon_; QIcon* toolIcon_;
typedef OpenMesh::Decimater::DecimaterT< TriMesh > DecimaterType; typedef OpenMesh::Decimater::DecimaterT< TriMesh > DecimaterType;
typedef OpenMesh::Decimater::ModAspectRatioT< DecimaterType >::Handle ModAspectRatioH; typedef OpenMesh::Decimater::ModAspectRatioT< DecimaterType >::Handle ModAspectRatioH;
typedef OpenMesh::Decimater::ModEdgeLengthT< DecimaterType >::Handle ModEdgeLengthH; typedef OpenMesh::Decimater::ModEdgeLengthT< DecimaterType >::Handle ModEdgeLengthH;
typedef OpenMesh::Decimater::ModHausdorffT< DecimaterType >::Handle ModHausdorffH; typedef OpenMesh::Decimater::ModHausdorffT< DecimaterType >::Handle ModHausdorffH;
...@@ -114,39 +154,38 @@ private: ...@@ -114,39 +154,38 @@ private:
typedef OpenMesh::Decimater::ModNormalFlippingT< DecimaterType >::Handle ModNormalFlippingH; typedef OpenMesh::Decimater::ModNormalFlippingT< DecimaterType >::Handle ModNormalFlippingH;
typedef OpenMesh::Decimater::ModQuadricT< DecimaterType >::Handle ModQuadricH; typedef OpenMesh::Decimater::ModQuadricT< DecimaterType >::Handle ModQuadricH;
typedef OpenMesh::Decimater::ModRoundnessT< DecimaterType >::Handle ModRoundnessH; typedef OpenMesh::Decimater::ModRoundnessT< DecimaterType >::Handle ModRoundnessH;
private slots: private slots:
// BaseInterface
void initializePlugin();
void slotObjectUpdated(int _identifier , const UpdateType _type);
void slotObjectSelectionChanged(int _identifier);
/// initialization called from button in toolbox
void slot_init();
/// decimating called from button in toolbox /// decimating called from button in toolbox
void slot_decimate(); void slot_decimate();
// slider / spinbox updates /// roundness slider - spinbox sync
void slotUpdateNumTriangles(); void updateRoundness(int _value);
void updateRoundness(double _value);
/// slider / spinbox updates
void updateDistance ();
void updateNormalDev ();
void updateVertices ();
void updateNormalDev(int _value); /// update number of vertices information
void updateAspectRatio(int _value); void slotUpdateNumVertices();
void updateAspectRatio(double _value);
void updateNumTriangles(int _value);
// checkbox updates //===========================================================================
void cbUpdateDistance(int _state); /** @name Scripting Functions
void cbUpdateNormalDev(int _state); * @{ */
void cbUpdateAspectRatio(int _state); //===========================================================================
void cbUpdateEdgeLength(int _state);
void cbUpdateNumTriangles(int _state);
public slots:
void decimate(int _objID, QVariantMap _constraints);
public slots: public slots:
QString version() { return QString("1.0"); };
/** @} */
QString version() { return QString("0.1"); };
}; };
#endif #endif //DECIMATERPLUGIN_HH
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
* * * *
* $Revision: 10745 $ * * $Revision: 10745 $ *
* $LastChangedBy: moebius $ * * $LastChangedBy: moebius $ *
* $Date: 2011-01-26 10:23:50 +0100 (Wed, 26 Jan 2011) $ * * $Date: 2011-01-26 10:23:50 +0100 (Mi, 26 Jan 2011) $ *
* * * *
\*===========================================================================*/ \*===========================================================================*/
......
...@@ -34,14 +34,12 @@ ...@@ -34,14 +34,12 @@
/*===========================================================================*\ /*===========================================================================*\
* * * *
* $Revision: 11270 $ * * $Revision: 10745 $ *
* $LastChangedBy: wilden $ * * $LastChangedBy: moebius $ *
* $Date: 2011-04-11 15:13:21 +0200 (Mo, 11 Apr 2011) $ * * $Date: 2011-01-26 10:23:50 +0100 (Mi, 26 Jan 2011) $ *
* * * *
\*===========================================================================*/ \*===========================================================================*/
#ifndef DECIMATERTOOLBARWIDGET_HH #ifndef DECIMATERTOOLBARWIDGET_HH
#define DECIMATERTOOLBARWIDGET_HH #define DECIMATERTOOLBARWIDGET_HH
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment