TopologyPlugin.hh 2.48 KB
Newer Older
Jan Möbius's avatar
 
Jan Möbius committed
1 2 3 4 5 6 7 8 9
#ifndef TOPOLOGYPLUGIN_HH
#define TOPOLOGYPLUGIN_HH

#include <OpenFlipper/BasePlugin/BaseInterface.hh>
#include <OpenFlipper/BasePlugin/MouseInterface.hh>
#include <OpenFlipper/BasePlugin/KeyInterface.hh>
#include <OpenFlipper/BasePlugin/LoggingInterface.hh>
#include <OpenFlipper/BasePlugin/PickingInterface.hh>
#include <OpenFlipper/BasePlugin/BackupInterface.hh>
Dirk Wilden's avatar
Dirk Wilden committed
10
#include <OpenFlipper/BasePlugin/ToolbarInterface.hh>
Jan Möbius's avatar
 
Jan Möbius committed
11 12 13 14
#include <OpenFlipper/common/Types.hh>
#include <ObjectTypes/PolyMesh/PolyMesh.hh>
#include <ObjectTypes/TriangleMesh/TriangleMesh.hh>

Dirk Wilden's avatar
Dirk Wilden committed
15
class TopologyPlugin : public QObject, BaseInterface , MouseInterface, KeyInterface, PickingInterface, BackupInterface, LoggingInterface, ToolbarInterface
Jan Möbius's avatar
 
Jan Möbius committed
16 17 18 19 20 21 22 23
{
  Q_OBJECT
  Q_INTERFACES(BaseInterface)
  Q_INTERFACES(MouseInterface)
  Q_INTERFACES(KeyInterface)
  Q_INTERFACES(PickingInterface)
  Q_INTERFACES(BackupInterface)
  Q_INTERFACES(LoggingInterface)
Dirk Wilden's avatar
Dirk Wilden committed
24
  Q_INTERFACES(ToolbarInterface)
Jan Möbius's avatar
 
Jan Möbius committed
25 26

  signals:
Dirk Wilden's avatar
Dirk Wilden committed
27
    // BaseInterface
Jan Möbius's avatar
 
Jan Möbius committed
28 29 30
    void updateView();
    void updatedObject(int);

Dirk Wilden's avatar
Dirk Wilden committed
31
    // PickingInterface
Jan Möbius's avatar
 
Jan Möbius committed
32 33
    void addHiddenPickMode( const std::string _mode );

Dirk Wilden's avatar
Dirk Wilden committed
34
    // BackupInterface
Jan Möbius's avatar
 
Jan Möbius committed
35 36
    void createBackup( int _id , QString _name );

Dirk Wilden's avatar
Dirk Wilden committed
37
    // LoggingInterface
Jan Möbius's avatar
 
Jan Möbius committed
38 39 40
    void log(Logtype _type, QString _message);
    void log(QString _message);

Dirk Wilden's avatar
Dirk Wilden committed
41 42
    // ToolbarInterface
    void addToolbar(QToolBar* _toolbar);
Jan Möbius's avatar
 
Jan Möbius committed
43 44 45

  private slots:

Dirk Wilden's avatar
Dirk Wilden committed
46
    // BaseInterface
Jan Möbius's avatar
 
Jan Möbius committed
47 48
    void pluginsInitialized();

Dirk Wilden's avatar
Dirk Wilden committed
49 50 51 52
    // MouseInterface
    void slotMouseEvent( QMouseEvent* _event );

  private slots:
Jan Möbius's avatar
 
Jan Möbius committed
53

Dirk Wilden's avatar
Dirk Wilden committed
54 55
    /// called when an action on the toolbar was triggered
    void toolBarTriggered(QAction* _action);
Jan Möbius's avatar
 
Jan Möbius committed
56 57 58

  public :

Dirk Wilden's avatar
Dirk Wilden committed
59
    /// Destructor
Jan Möbius's avatar
 
Jan Möbius committed
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
    ~TopologyPlugin() {};


    QString name() { return (QString("Topology")); };
    QString description( ) { return (QString("Allows to control Mesh topology (Edge Flips,...)")); };

  private :

    /// clear the add face vector
    void clearAddFaceVertices();

    /// Add a face
    void add_face(QMouseEvent* _event);

    /// Split a face at the current hit point
    void split_face(QMouseEvent* _event);

    /// Delete a face at the current hit point
    void delete_face(QMouseEvent* _event);

    /// Flip edge
    void flip_edge(QMouseEvent* _event);

    /// Collapse edge
    void collapse_edge(QMouseEvent* _event);

    /// Split Edge
    void split_edge(QMouseEvent* _event);

  private:
Dirk Wilden's avatar
Dirk Wilden committed
90

Jan Möbius's avatar
 
Jan Möbius committed
91
    std::vector< std::pair<int,int> > addFaceVertices_;
Dirk Wilden's avatar
Dirk Wilden committed
92 93

    QToolBar* toolbar_;
Jan Möbius's avatar
 
Jan Möbius committed
94 95 96 97 98 99 100


   public slots:
      QString version() { return QString("1.0"); };
};

#endif //TOPOLOGYPLUGIN_HH