IsotropicRemesherPlugin.hh 6.6 KB
Newer Older
Jan Möbius's avatar
Jan Möbius committed
1 2 3
/*===========================================================================*\
*                                                                            *
*                              OpenFlipper                                   *
Martin Schultz's avatar
Martin Schultz committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
 *           Copyright (c) 2001-2015, RWTH-Aachen University                 *
 *           Department of Computer Graphics and Multimedia                  *
 *                          All rights reserved.                             *
 *                            www.openflipper.org                            *
 *                                                                           *
 *---------------------------------------------------------------------------*
 * This file is part of OpenFlipper.                                         *
 *---------------------------------------------------------------------------*
 *                                                                           *
 * Redistribution and use in source and binary forms, with or without        *
 * modification, are permitted provided that the following conditions        *
 * are met:                                                                  *
 *                                                                           *
 * 1. Redistributions of source code must retain the above copyright notice, *
 *    this list of conditions and the following disclaimer.                  *
 *                                                                           *
 * 2. Redistributions in binary form must reproduce the above copyright      *
 *    notice, this list of conditions and the following disclaimer in the    *
 *    documentation and/or other materials provided with the distribution.   *
 *                                                                           *
 * 3. Neither the name of the copyright holder nor the names of its          *
 *    contributors may be used to endorse or promote products derived from   *
 *    this software without specific prior written permission.               *
 *                                                                           *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS       *
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A           *
 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,  *
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,       *
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR        *
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF    *
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING      *
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS        *
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.              *
Jan Möbius's avatar
Jan Möbius committed
39 40 41 42 43 44 45 46 47 48 49
*                                                                            *
\*===========================================================================*/

/*===========================================================================*\
*                                                                            *
*   $Revision$                                                       *
*   $LastChangedBy$                                                *
*   $Date$                     *
*                                                                            *
\*===========================================================================*/

Jan Möbius's avatar
 
Jan Möbius committed
50 51 52
#ifndef ISOTROPICREMESHERPLUGIN_HH
#define ISOTROPICREMESHERPLUGIN_HH

Matthias Möller's avatar
Matthias Möller committed
53

Jan Möbius's avatar
 
Jan Möbius committed
54 55 56 57
#include <OpenFlipper/BasePlugin/BaseInterface.hh>
#include <OpenFlipper/BasePlugin/ToolboxInterface.hh>
#include <OpenFlipper/BasePlugin/LoggingInterface.hh>
#include <OpenFlipper/BasePlugin/RPCInterface.hh>
58
#include <OpenFlipper/BasePlugin/ProcessInterface.hh>
59
#include <OpenFlipper/BasePlugin/ScriptInterface.hh>
Jan Möbius's avatar
Jan Möbius committed
60
#include <OpenFlipper/BasePlugin/BackupInterface.hh>
Jan Möbius's avatar
 
Jan Möbius committed
61 62 63 64
#include <OpenFlipper/common/Types.hh>
#include <ObjectTypes/TriangleMesh/TriangleMesh.hh>

#include "IsotropicRemesherToolbox.hh"
65
#include "ProgressEmitter.hh"
Jan Möbius's avatar
 
Jan Möbius committed
66

67 68
#include <QtWidgets>

Jan Möbius's avatar
 
Jan Möbius committed
69

70 71
class IsotropicRemesherPlugin : public QObject, BaseInterface, BackupInterface , ToolboxInterface, LoggingInterface,
    RPCInterface, ProcessInterface, ScriptInterface
Jan Möbius's avatar
 
Jan Möbius committed
72 73 74 75 76 77
{
Q_OBJECT
Q_INTERFACES(BaseInterface)
Q_INTERFACES(ToolboxInterface)
Q_INTERFACES(LoggingInterface)
Q_INTERFACES(RPCInterface)
78
Q_INTERFACES(ProcessInterface)
79
Q_INTERFACES(ScriptInterface)
Jan Möbius's avatar
Jan Möbius committed
80
Q_INTERFACES(BackupInterface)
Jan Möbius's avatar
 
Jan Möbius committed
81

Matthias Möller's avatar
Matthias Möller committed
82 83
  Q_PLUGIN_METADATA(IID "org.OpenFlipper.Plugins.Plugin-IsotropicRemesher")

Jan Möbius's avatar
Jan Möbius committed
84

Jan Möbius's avatar
 
Jan Möbius committed
85
signals:
Jan Möbius's avatar
Jan Möbius committed
86 87
  
  //BaseInterface
Jan Möbius's avatar
 
Jan Möbius committed
88
  void updateView();
89
  void updatedObject(int _id, const UpdateType& _type);
Jan Möbius's avatar
 
Jan Möbius committed
90 91 92 93

  void setSlotDescription(QString     _slotName,   QString     _slotDescription,
                          QStringList _parameters, QStringList _descriptions);

Jan Möbius's avatar
Jan Möbius committed
94
  //LoggingInterface:
Jan Möbius's avatar
 
Jan Möbius committed
95 96 97
  void log( Logtype _type, QString _message );
  void log( QString _message );

Jan Möbius's avatar
Jan Möbius committed
98
  // RPC Interface
Jan Möbius's avatar
 
Jan Möbius committed
99 100
  void pluginExists( QString _pluginName , bool& _exists  ) ;
  void functionExists( QString _pluginName , QString _functionName , bool& _exists  );
Jan Möbius's avatar
Jan Möbius committed
101 102
  
  // ToolboxInterface
Dirk Wilden's avatar
Dirk Wilden committed
103
  void addToolbox( QString _name  , QWidget* _widget, QIcon* _icon );   
104 105 106 107 108 109 110
    
  // ProcessInterface 
  void startJob( QString _jobId, QString _description, int _min, int _max, bool _blocking = false);
  void setJobState(QString _jobId, int _value);
  void setJobName(QString _jobId, QString _name);
  void finishJob(QString _jobId);
  void setJobDescription(QString _jobId, QString _description);
Jan Möbius's avatar
Jan Möbius committed
111 112
  
  // BackupInterface
113
  void createBackup( int _id , QString _name, UpdateType /*_type*/ = UPDATE_ALL );
114 115 116
  
  // ScriptInterface
  void scriptInfo(QString _functionName);
Jan Möbius's avatar
 
Jan Möbius committed
117 118 119

private slots:

Jan Möbius's avatar
Jan Möbius committed
120 121
  // BaseInterface
  void initializePlugin();  
Jan Möbius's avatar
 
Jan Möbius committed
122 123 124
  void pluginsInitialized(); // BaseInterface

public :
125
  IsotropicRemesherPlugin();
Jan Möbius's avatar
 
Jan Möbius committed
126 127 128 129 130 131 132 133
  ~IsotropicRemesherPlugin() {};

  QString name() { return (QString("IsotropicRemesher")); };
  QString description( ) { return (QString("an isotropic remesher")); };

//GUI
private :
  IsotropicRemesherToolBox* tool_;
Dirk Wilden's avatar
Dirk Wilden committed
134
  QIcon* toolIcon_;
135
  double edgeLength_;
Jan Möbius's avatar
 
Jan Möbius committed
136

137 138
  OpenFlipperThread* thread_;

Jan Möbius's avatar
 
Jan Möbius committed
139 140 141
private slots:
  void slotRemesh();

142
  void slotRemeshButtonClicked();
Jan Möbius's avatar
 
Jan Möbius committed
143 144 145
  void slotSetMinLength();
  void slotSetMaxLength();
  void slotSetMeanLength();
146 147
  
  void threadFinished(QString _jobId);
Jan Möbius's avatar
 
Jan Möbius committed
148 149 150 151 152 153 154 155

//scripting functions
public slots:
  void isotropicRemesh(int _objectID, double _targetEdgeLength );


public slots:
  QString version() { return QString("1.0"); };
Matthias Möller's avatar
Matthias Möller committed
156
  void noguiSupported( ) {} ;
Jan Möbius's avatar
 
Jan Möbius committed
157 158 159
};

#endif //ISOTROPICREMESHERPLUGIN_HH