00001 /*===========================================================================*\ 00002 * * 00003 * OpenMesh * 00004 * Copyright (C) 2001-2010 by Computer Graphics Group, RWTH Aachen * 00005 * www.openmesh.org * 00006 * * 00007 *---------------------------------------------------------------------------* 00008 * This file is part of OpenMesh. * 00009 * * 00010 * OpenMesh is free software: you can redistribute it and/or modify * 00011 * it under the terms of the GNU Lesser General Public License as * 00012 * published by the Free Software Foundation, either version 3 of * 00013 * the License, or (at your option) any later version with the * 00014 * following exceptions: * 00015 * * 00016 * If other files instantiate templates or use macros * 00017 * or inline functions from this file, or you compile this file and * 00018 * link it with other files to produce an executable, this file does * 00019 * not by itself cause the resulting executable to be covered by the * 00020 * GNU Lesser General Public License. This exception does not however * 00021 * invalidate any other reasons why the executable file might be * 00022 * covered by the GNU Lesser General Public License. * 00023 * * 00024 * OpenMesh is distributed in the hope that it will be useful, * 00025 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00026 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00027 * GNU Lesser General Public License for more details. * 00028 * * 00029 * You should have received a copy of the GNU LesserGeneral Public * 00030 * License along with OpenMesh. If not, * 00031 * see <http://www.gnu.org/licenses/>. * 00032 * * 00033 \*===========================================================================*/ 00034 00035 /*===========================================================================*\ 00036 * * 00037 * $Revision: 325 $ * 00038 * $Date: 2010-06-17 12:45:58 +0200 (Do, 17 Jun 2010) $ * 00039 * * 00040 \*===========================================================================*/ 00041 00042 //============================================================================= 00043 // 00044 // CLASS SubdivideWidget 00045 // 00046 //============================================================================= 00047 00048 #ifndef SUBDIVIDEWIDGET_HH 00049 #define SUBDIVIDEWIDGET_HH 00050 00051 00052 //== INCLUDES ================================================================= 00053 00054 #include <QTimer> 00055 #include <QMainWindow> 00056 #include <QStatusBar> 00057 #include <OpenMesh/Apps/Subdivider/MeshViewerWidget.hh> 00058 #include <OpenMesh/Tools/Subdivider/Uniform/SubdividerT.hh> 00059 00060 00061 00062 00063 //== CLASS DEFINITION ========================================================= 00064 00065 class SubdivideWidget : public QWidget 00066 { 00067 Q_OBJECT 00068 00069 public: 00070 00071 typedef OpenMesh::Subdivider::Uniform::SubdividerT< Mesh > Subdivider; 00072 00073 enum SOPType { 00074 SOP_UniformCompositeLoop, 00075 SOP_UniformCompositeSqrt3, 00076 SOP_UniformLoop, 00077 SOP_UniformSqrt3, 00078 SOP_Undefined 00079 }; 00080 00081 typedef std::map< SOPType, Subdivider* > SubdividerPool; 00082 00083 public: 00084 00086 SubdivideWidget(QWidget* _parent=0, const char* _name=0); 00087 00089 ~SubdivideWidget() {}; 00090 00091 00093 bool open_mesh(const char* _filename); 00094 00095 void keyPressEvent( QKeyEvent *k ); 00096 00098 QStatusBar *status_bar; 00099 void update(); 00100 00101 00102 private slots: 00103 00104 void animate_slot(void); 00105 void slot_select_sop(int i); 00106 void subdiv_slot(); 00107 void reset_slot(); 00108 void save_slot(); 00109 void load_slot(); 00110 00111 private: 00112 00113 // widgets 00114 MeshViewerWidget* viewer_widget_; 00115 00116 QTimer *timer_; 00117 00118 int animate_step_; 00119 int max_animate_steps_; 00120 int msecs_; 00121 00122 // Selected and current subdivision operator 00123 SOPType sel_topo_type; // selected operator 00124 SOPType cur_topo_type; // active operator 00125 00126 // 00127 SubdividerPool subdivider_; 00128 00129 }; 00130 00131 00132 //============================================================================= 00133 #endif // SUBDIVIDEWIDGET_HH defined 00134 //============================================================================= 00135