AnimaL |
Tutorial |
Documentation |
00001 /*************************************************************************** 00002 monwidgetbidon.cpp - description 00003 ------------------- 00004 begin : Thu Jan 8 2004 00005 copyright : (C) 2004 by Mathieu Coquerelle 00006 email : coquerel@inrialpes.fr 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #include "DeformableOctreeQt.h" 00019 #include <qpushbutton.h> 00020 #include <qcheckbox.h> 00021 #include <qspinbox.h> 00022 #include <qcombobox.h> 00023 #include <qslider.h> 00024 #include <qlabel.h> 00025 #include <animal/X3DTK/Qt/mainControllerGUI/MainController.h> 00026 00027 #include <animal/X3DTK/Qt/engineGUI/engineGUI.h> 00028 00029 00030 namespace X3DTK 00031 { 00032 namespace Qt 00033 { 00034 00035 DeformableOctreeQt::DeformableOctreeQt(X3D::DeformableOctreeNode * DON ) : 00036 DeformableOctreeDesigner(0,"main q object" ), 00037 _node(DON) 00038 { 00039 initButtons(); 00040 //initConnections(); 00041 setMinimumWidth( 800 ); 00042 } 00043 00044 DeformableOctreeQt::~DeformableOctreeQt() 00045 { 00046 } 00047 00048 00049 void DeformableOctreeQt::initButtons() 00050 { 00051 _node->slotSetDrawEmptyCells(checkBoxDrawEmptyCells->isChecked()); 00052 _node->slotSetDrawOctree(checkBoxDrawOctree->isChecked()); 00053 _node->slotSetDrawSelection(checkBoxDrawSelection->isChecked()); 00054 _node->slotSetDrawSelectedCellsPoints(checkBoxDrawSelectedCellsPoints->isChecked()); 00055 _node->slotSetDrawFrames(checkBoxDrawFrames->isChecked()); 00056 _node->slotSetDrawNeighbours(checkBoxDrawNeighbours->isChecked()); 00057 00058 _node->slotSetInterpolationMethod( comboBoxMethod->currentItem() ); 00059 00060 _node->slotChangeToolsSize( sliderToolsSize->maxValue() - sliderToolsSize->value() ); 00061 00062 textToolsSize->setText( QString("Tool's Size : %1").arg(_node->getToolsSize()) ); 00063 } 00064 00065 00066 void DeformableOctreeQt::slotSubdivide() 00067 {_node->slotSubdivide(); emit changed();} 00068 void DeformableOctreeQt::slotSimplify() 00069 {_node->slotSimplify();emit changed();} 00070 00071 00072 00073 00074 void DeformableOctreeQt::slotMoveXPlus() 00075 { 00076 _node->slotMoveXPlus(); 00077 emit changed(); 00078 } 00079 void DeformableOctreeQt::slotMoveXMinus() 00080 { 00081 _node->slotMoveXMinus(); 00082 emit changed(); 00083 } 00084 void DeformableOctreeQt::slotMoveYPlus() 00085 { 00086 _node->slotMoveYPlus(); 00087 emit changed(); 00088 } 00089 void DeformableOctreeQt::slotMoveYMinus() 00090 { 00091 _node->slotMoveYMinus(); 00092 emit changed(); 00093 } 00094 void DeformableOctreeQt::slotMoveZPlus() 00095 { 00096 _node->slotMoveZPlus(); 00097 emit changed(); 00098 } 00099 void DeformableOctreeQt::slotMoveZMinus() 00100 { 00101 _node->slotMoveZMinus(); 00102 emit changed(); 00103 } 00104 00105 00106 void DeformableOctreeQt::slotCycleCell() 00107 { 00108 _node->slotCycleCell(); 00109 emit changed(); 00110 } 00111 00112 void DeformableOctreeQt::slotCyclePoint() 00113 { 00114 _node->slotCyclePoint(); 00115 emit changed(); 00116 } 00117 00118 void DeformableOctreeQt::slotGoFather() 00119 { 00120 _node->slotGoFather(); 00121 emit changed(); 00122 } 00123 00124 void DeformableOctreeQt::slotGoChild() 00125 { 00126 _node->slotGoChild(); 00127 emit changed(); 00128 } 00129 00130 // Options 00131 void DeformableOctreeQt::slotSetDrawEmptyCells(bool b) 00132 { _node->slotSetDrawEmptyCells(b); emit changed(); } 00133 void DeformableOctreeQt::slotSetDrawOctree(bool b) 00134 { _node->slotSetDrawOctree(b); emit changed();} 00135 void DeformableOctreeQt::slotSetDrawSelection(bool b) 00136 { _node->slotSetDrawSelection(b); emit changed();} 00137 void DeformableOctreeQt::slotSetDrawFrames(bool b) 00138 { _node->slotSetDrawFrames(b); emit changed(); } 00139 void DeformableOctreeQt::slotSetDrawNeighbours(bool b) 00140 { _node->slotSetDrawNeighbours(b); emit changed(); } 00141 00142 void DeformableOctreeQt::slotSetNMaxPointsPerCell( int n ) 00143 { _node->slotSetNMaxPointsPerCell(n); emit changed(); } 00144 00145 unsigned int DeformableOctreeQt::getOptionNMaxPointsPerCell( ) 00146 { return _node->getOptionNMaxPointsPerCell(); } 00147 00148 void DeformableOctreeQt::slotSetDrawSelectedCellsPoints(bool b) 00149 { 00150 _node->slotSetDrawSelectedCellsPoints(b); 00151 emit changed(); 00152 } 00153 00154 void DeformableOctreeQt::slotSetInterpolationMethod( int index ) 00155 { 00156 _node->slotSetInterpolationMethod(index); 00157 emit changed(); 00158 } 00159 00160 void DeformableOctreeQt::slotChangeToolsSize( int size ) 00161 { 00162 _node->slotChangeToolsSize(sliderToolsSize->maxValue()-size); 00163 textToolsSize->setText( QString("Tool's Size : %1").arg(_node->getToolsSize()) ); 00164 emit changed(); 00165 00166 } 00167 00168 void DeformableOctreeQt::slotButtonTest() 00169 { 00170 _node->slotButtonTest(); 00171 emit changed(); 00172 } 00173 00174 void DeformableOctreeQt::slotDirectManipulation() 00175 { 00176 _node->slotButtonDirectManipulation(); 00177 emit changed(); 00178 } 00179 00180 00181 00182 //QWidget * createDeformableOctreeQWidget(X3D::DeformableOctreeNode * node, QWidget * parent) 00183 QWidget * createDeformableOctreeQWidget(X3D::DeformableOctreeNode * node, QWidget * parent) 00184 { 00185 if (node) 00186 { 00187 DeformableOctreeQt * DOQt = new DeformableOctreeQt(node); 00188 00189 EngineGUI * engineGUI = static_cast<EngineGUI *>(X3DTK::Qt::createEngineNodeQWidget(node, parent)); 00190 engineGUI->insertTab(DOQt, "DeformableOctreeNode",0); 00191 engineGUI->setCurrentPage(0); 00192 QWidget::connect( DOQt, SIGNAL( changed() ), engineGUI, SLOT(ok())); 00193 00194 return engineGUI; 00195 }else 00196 std::cerr<<"Warning: impossible to create a DeformableOctreeQt because the associated DeformableOctreeNode is NULL."<<std::endl; 00197 00198 return NULL; 00199 } 00200 00201 00202 } 00203 00204 } 00205