00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "options-interpolation.qt.hh"
00025 #include "window.qt.hh"
00026 #include "HtmlEntities.hh"
00027
00028 #include <QtGui/QLabel>
00029 #include <QtGui/QBoxLayout>
00030
00031
00032
00033 OptionsInterpolation :: OptionsInterpolation ( Window * parent , QTabWidget * parentTab )
00034 :
00035 QWidget ( parentTab ) ,
00036 FParent ( parent ) ,
00037 FUpdate ( false )
00038 {
00039 QBoxLayout * placement = new QBoxLayout ( QBoxLayout::TopToBottom, this ) ;
00040
00041 FNbSubdivision = new QGroupBox("Nombre de subdivisions");
00042 QVBoxLayout* nsd_vbl = new QVBoxLayout(FNbSubdivision);
00043
00045 QWidget * WidgetSub0 = new QWidget ( this ) ;
00046 QBoxLayout * sub0 = new QBoxLayout ( QBoxLayout::LeftToRight, WidgetSub0 ) ;
00047
00048 FNbDiv [0] =
00049 new QLabel ( *HTML::decode("Selon la première dimension : ") ) ;
00050 FSaisieNbDiv [0] = new QSpinBox ;
00051 FSaisieNbDiv [0] -> setMinimum ( 1 );
00052 FSaisieNbDiv [0] -> setMaximum ( 1000 );
00053 FSaisieNbDiv [0] -> setAccelerated(true);
00054
00055 sub0 -> addWidget ( FNbDiv [0], 0, Qt::AlignLeft ) ;
00056 sub0 -> addWidget ( FSaisieNbDiv [0], 1, Qt::AlignLeft ) ;
00057
00059 QWidget * WidgetSub1 = new QWidget ( this ) ;
00060 QBoxLayout * sub1 = new QBoxLayout ( QBoxLayout::LeftToRight, WidgetSub1 ) ;
00061 FNbDiv [1] =
00062 new QLabel ( *HTML::decode("Selon la deuxième dimension :") ) ;
00063 FSaisieNbDiv [1] = new QSpinBox ;
00064 FSaisieNbDiv [1] -> setMinimum ( 1 );
00065 FSaisieNbDiv [1] -> setMaximum ( 1000 );
00066 FSaisieNbDiv [1] -> setAccelerated(true);
00067
00068 sub1 -> addWidget ( FNbDiv [1], 0, Qt::AlignLeft ) ;
00069 sub1 -> addWidget ( FSaisieNbDiv [1], 1, Qt::AlignLeft ) ;
00070
00072 QWidget * WidgetSub2 = new QWidget ( this ) ;
00073 QBoxLayout * sub2 = new QBoxLayout ( QBoxLayout::LeftToRight, WidgetSub2 ) ;
00074 FNbDiv [2] =
00075 new QLabel ( *HTML::decode("Selon la troisième dimension : ")) ;
00076 FSaisieNbDiv [2] = new QSpinBox ;
00077 FSaisieNbDiv [2] -> setMinimum ( 1 );
00078 FSaisieNbDiv [2] -> setMaximum ( 1000 );
00079 FSaisieNbDiv [2] -> setAccelerated(true);
00080
00081 sub2 -> addWidget ( FNbDiv [2], 0, Qt::AlignLeft ) ;
00082 sub2 -> addWidget ( FSaisieNbDiv [2], 1, Qt::AlignLeft ) ;
00083
00084 nsd_vbl -> addWidget ( WidgetSub0 ) ;
00085 nsd_vbl -> addWidget ( WidgetSub1 ) ;
00086 nsd_vbl -> addWidget ( WidgetSub2 ) ;
00087
00088
00090 FAffInterpolation = new QGroupBox ( "Interpolation" ) ;
00091 QVBoxLayout* aip_vbl = new QVBoxLayout(FAffInterpolation);
00092
00093 FFusionInterpolation = new QCheckBox ( *HTML::decode("Fusionner le maillage créé avec l'objet initial") ) ;
00094 FCoudreInterpolation = new QCheckBox ( *HTML::decode("Coudre les maillages créés qui correspondent à des cellules adjacentes") ) ;
00095
00096 aip_vbl -> addWidget(FFusionInterpolation);
00097 aip_vbl -> addWidget(FCoudreInterpolation);
00098
00100 FAffLissage = new QGroupBox ("Lissage") ;
00101 QVBoxLayout* als_vbl = new QVBoxLayout(FAffLissage);
00102
00103 QWidget * WidgetMethode = new QWidget ;
00104 QBoxLayout * methode = new QBoxLayout ( QBoxLayout::LeftToRight, WidgetMethode ) ;
00105
00106 FAffMethode = new QLabel ( *HTML::decode("Méthode : ") ) ;
00107 FSaisieMethode = new QComboBox ;
00108 FSaisieMethode -> addItem ( "Hermite" ) ;
00109 FSaisieMethode -> addItem ( "Bezier" ) ;
00110 FSaisieMethode -> addItem ( "Overhauser" ) ;
00111 FSaisieMethode -> addItem ( "Spline") ;
00112
00113 methode -> addWidget ( FAffMethode , 0, Qt::AlignLeft) ;
00114 methode -> addWidget ( FSaisieMethode , 1, Qt::AlignLeft) ;
00115
00116 FFusionLissage = new QCheckBox ( *HTML::decode("Fusionner le maillage créé avec l'objet initial") ) ;
00117 FCoudreLissage = new QCheckBox ( *HTML::decode("Coudre les maillages créés qui correspondent à des cellules adjacentes") ) ;
00118
00119 als_vbl -> addWidget ( WidgetMethode );
00120 als_vbl -> addWidget ( FFusionLissage ) ;
00121 als_vbl -> addWidget ( FCoudreLissage ) ;
00122
00123
00126 placement -> addWidget ( FNbSubdivision );
00127 placement -> addWidget ( FAffInterpolation ) ;
00128 placement -> addWidget ( FAffLissage ) ;
00129
00130 QObject :: connect ( FSaisieNbDiv [0] ,
00131 SIGNAL ( valueChanged ( int ) ) ,
00132 this ,
00133 SLOT ( callbackSizeX ( ) ) ) ;
00134 QObject :: connect ( FSaisieNbDiv [1] ,
00135 SIGNAL ( valueChanged ( int ) ) ,
00136 this ,
00137 SLOT ( callbackSizeY ( ) ) ) ;
00138 QObject :: connect ( FSaisieNbDiv [2] ,
00139 SIGNAL ( valueChanged ( int ) ) ,
00140 this ,
00141 SLOT ( callbackSizeZ ( ) ) ) ;
00142
00143 QObject :: connect ( FFusionInterpolation ,
00144 SIGNAL ( clicked ( ) ) ,
00145 this ,
00146 SLOT (callbackInterpolationMerges ( ) ) ) ;
00147 QObject :: connect ( FCoudreInterpolation ,
00148 SIGNAL ( clicked ( ) ) ,
00149 this ,
00150 SLOT (callbackInterpolationSews ( ) ) ) ;
00151
00152 QObject :: connect ( FFusionLissage ,
00153 SIGNAL ( clicked ( ) ) ,
00154 this ,
00155 SLOT ( callbackSmoothMerges ( ) ) ) ;
00156 QObject :: connect ( FCoudreLissage ,
00157 SIGNAL ( clicked ( ) ) ,
00158 this ,
00159 SLOT ( callbackSmoothSews ( ) ) ) ;
00160 QObject :: connect ( FSaisieMethode ,
00161 SIGNAL ( activated ( int ) ) ,
00162 this ,
00163 SLOT ( callbackSmoothMethod ( ) ) ) ;
00164
00165 }
00166
00167
00168
00169
00170 OptionsInterpolation :: ~OptionsInterpolation ( )
00171 {
00172 }
00173
00174
00175
00176
00177 void OptionsInterpolation :: update ( )
00178 {
00179 FUpdate = true ;
00180 CParameterOperations* p = FParent -> getControler ( ) -> getParameterOperations ( ) ;
00181
00182 FSaisieNbDiv [ 0 ] -> setValue ( p -> getMeshNbSubdivisionsX ( ) ) ;
00183 FSaisieNbDiv [ 1 ] -> setValue ( p -> getMeshNbSubdivisionsY ( ) ) ;
00184 FSaisieNbDiv [ 2 ] -> setValue ( p -> getMeshNbSubdivisionsZ ( ) ) ;
00185
00186 FFusionInterpolation -> setChecked ( p -> getInterpolationMerges ( ) ) ;
00187 FCoudreInterpolation -> setChecked ( p -> getInterpolationSews ( ) ) ;
00188
00189 FCoudreInterpolation -> setEnabled ( p -> isActiveInterpolationSews ( ) ) ;
00190
00191 FFusionLissage -> setChecked ( p -> getSmoothMerges ( ) ) ;
00192 FCoudreLissage -> setChecked ( p -> getSmoothSews ( ) ) ;
00193
00194 FFusionLissage -> setEnabled ( p -> isActiveSmoothMerges ( ) ) ;
00195 FCoudreLissage -> setEnabled ( p -> isActiveSmoothSews ( ) ) ;
00196
00197 FSaisieMethode -> setCurrentIndex ( p -> getSmoothMethod ( ) ) ;
00198
00199 FUpdate = false ;
00200 }
00201
00202
00203 void OptionsInterpolation :: callbackSizeX ( )
00204 {
00205 if ( ! FUpdate )
00206 setSizeX ( FSaisieNbDiv [ 0 ] -> value ( ) ) ;
00207 }
00208
00209 void OptionsInterpolation :: callbackSizeY ( )
00210 {
00211 if ( ! FUpdate )
00212 setSizeY ( FSaisieNbDiv [ 1 ] -> value ( ) ) ;
00213 }
00214
00215 void OptionsInterpolation :: callbackSizeZ ( )
00216 {
00217 if ( ! FUpdate )
00218 setSizeZ ( FSaisieNbDiv [ 2 ] -> value ( ) ) ;
00219 }
00220
00221 void OptionsInterpolation :: callbackInterpolationMerges ( )
00222 {
00223 if ( ! FUpdate )
00224 setInterpolationMerges ( FFusionInterpolation -> isChecked ( ) ) ;
00225 }
00226
00227 void OptionsInterpolation :: callbackInterpolationSews ( )
00228 {
00229 if ( ! FUpdate )
00230 setInterpolationSews ( FCoudreInterpolation -> isChecked ( ) ) ;
00231 }
00232
00233 void OptionsInterpolation :: callbackSmoothMethod ( )
00234 {
00235 if ( ! FUpdate )
00236 setSmoothMethod ( FSaisieMethode -> currentIndex ( ) ) ;
00237 }
00238
00239 void OptionsInterpolation :: callbackSmoothMerges ( )
00240 {
00241 if ( ! FUpdate )
00242 setSmoothMerges ( FFusionLissage -> isChecked ( ) ) ;
00243 }
00244
00245 void OptionsInterpolation :: callbackSmoothSews ( )
00246 {
00247 if ( ! FUpdate )
00248 setSmoothSews ( FCoudreLissage -> isChecked ( ) ) ;
00249 }
00250
00251
00252
00253 int OptionsInterpolation :: getSmoothMethod ( ) const
00254 {
00255 return FParent -> getControler ( ) ->
00256 getParameterOperations ( ) -> getSmoothMethod ( ) ;
00257 }
00258
00259 bool OptionsInterpolation :: getInterpolationMerges ( ) const
00260 {
00261 return FParent -> getControler ( ) ->
00262 getParameterOperations ( ) -> getInterpolationMerges ( ) ;
00263 }
00264
00265 bool OptionsInterpolation :: getInterpolationSews ( ) const
00266 {
00267 return FParent -> getControler ( ) ->
00268 getParameterOperations ( ) -> getInterpolationSews ( ) ;
00269 }
00270
00271 bool OptionsInterpolation :: getSmoothMerges ( ) const
00272 {
00273 return FParent -> getControler ( ) ->
00274 getParameterOperations ( ) -> getSmoothMerges ( ) ;
00275 }
00276
00277 bool OptionsInterpolation :: getSmoothSews ( ) const
00278 { return FParent -> getControler ( ) ->
00279 getParameterOperations ( ) -> getSmoothSews ( ) ;
00280 }
00281
00282
00283
00284 void OptionsInterpolation :: setSizeX ( int s )
00285 {
00286 assert ( s >= 0 ) ;
00287 FParent -> getControler ( ) ->
00288 getParameterOperations ( ) -> setMeshNbSubdivisionsX ( s ) ;
00289 update ( ) ;
00290 }
00291
00292 void OptionsInterpolation :: setSizeY ( int s )
00293 {
00294 assert ( s >= 0 ) ;
00295 FParent -> getControler ( ) -> getParameterOperations ( )
00296 ->setMeshNbSubdivisionsY ( s ) ;
00297 update ( ) ;
00298 }
00299
00300 void OptionsInterpolation :: setSizeZ ( int s )
00301 {
00302 assert ( s >= 0 ) ;
00303 FParent -> getControler ( ) ->
00304 getParameterOperations ( ) -> setMeshNbSubdivisionsZ ( s ) ;
00305 update ( ) ;
00306 }
00307
00308 void OptionsInterpolation :: setInterpolationMerges ( bool b )
00309 {
00310 FParent -> getControler ( ) -> getParameterOperations ( )
00311 -> setInterpolationMerges ( b ) ;
00312 update ( ) ;
00313 }
00314
00315 void OptionsInterpolation :: setInterpolationSews ( bool b )
00316 {
00317 FParent -> getControler ( ) -> getParameterOperations ( )
00318 -> setInterpolationSews ( b ) ;
00319 update ( ) ;
00320 }
00321
00322 void OptionsInterpolation :: setSmoothMethod ( int m )
00323 {
00324 FParent -> getControler ( ) -> getParameterOperations ( )
00325 -> setSmoothMethod ( m ) ;
00326 update ( ) ;
00327 }
00328
00329 void OptionsInterpolation :: setSmoothMerges ( bool b )
00330 {
00331 FParent -> getControler ( ) -> getParameterOperations ( )
00332 -> setSmoothMerges ( b ) ;
00333 update ( ) ;
00334 }
00335
00336 void OptionsInterpolation :: setSmoothSews ( bool b )
00337 {
00338 FParent -> getControler ( ) -> getParameterOperations ( )
00339 -> setSmoothSews ( b ) ;
00340 update ( ) ;
00341 }