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-vue.qt.hh"
00025 #include "window.qt.hh"
00026 #include "options-frame.qt.hh"
00027 #include "HtmlEntities.hh"
00028
00029 #include <QtGui/QHBoxLayout>
00030 #include <QtGui/QGridLayout>
00031 #include <QtGui/QLabel>
00032 #include <QtGui/QVBoxLayout>
00033
00034 #define SCALE_MAX (1.0)
00035
00036 static QString elementLabs [ 2 ] =
00037 {
00038 "Par barycentre",
00039 *HTML::decode("Par décalage"),
00040 };
00041
00042
00043
00044 OptionsVue :: OptionsVue ( Window * parent , OptionsFrame * parentTab )
00045 :
00046 QWidget ( parentTab ) ,
00047 FParentTab ( parentTab ) ,
00048 FParent ( parent ) ,
00049 FUpdate ( false )
00050 {
00051 QVBoxLayout * placement = new QVBoxLayout ( this ) ;
00052
00053 QWidget * WidgetHaut = new QWidget (this ) ;
00054 QGridLayout * haut = new QGridLayout ( WidgetHaut ) ;
00055
00056
00057 FTypeEclatement=new QGroupBox ( *HTML::decode("Vue éclatée" ) );
00058 QVBoxLayout* tet_vbl = new QVBoxLayout(FTypeEclatement);
00059
00060 for (int i=0;i<2;i++)
00061 {
00062 FBurstView[i] = new IdRadioButton(i,elementLabs[i]);
00063 tet_vbl -> addWidget ( FBurstView[i] );
00064
00065 connect ( FBurstView[i] , SIGNAL ( clicked ( int ) ) ,
00066 this , SLOT ( callbackBurstView( int ) ) ) ;
00067 }
00068
00069 haut -> addWidget ( FTypeEclatement, 0, 0 ) ;
00070
00071
00072 FInteractivite = new QGroupBox ( "Modifications interactives" ) ;
00073 FInteractivite -> setCheckable (true);
00074 FInteractivite -> setChecked (true) ;
00075
00076 QVBoxLayout* int_vbl = new QVBoxLayout(FInteractivite);
00077 FIAppliquer = new QPushButton ( "Appliquer Modifications" ) ;
00078 FIAppliquer -> setEnabled ( false ) ;
00079 FIRecuperer = new QPushButton ( *HTML::decode(
00080 "Récupérer Valeurs") ) ;
00081 FIRecuperer -> setEnabled ( false ) ;
00082
00083 int_vbl -> addWidget(FIAppliquer);
00084 int_vbl -> addWidget(FIRecuperer);
00085
00086 connect ( FInteractivite , SIGNAL ( clicked ( ) ) ,
00087 this , SLOT ( callbackToggleInteractive ( ) ) ) ;
00088
00089 connect ( FIAppliquer , SIGNAL ( clicked ( ) ) ,
00090 this , SLOT ( callbackApply ( ) ) ) ;
00091
00092 connect ( FIRecuperer , SIGNAL ( clicked () ) ,
00093 this , SLOT ( callbackRecover ( ) ) ) ;
00094
00095 haut -> addWidget ( FInteractivite, 1, 0 ) ;
00096
00097
00098 FPrereglages = new QGroupBox ( *HTML::decode("Préréglages") ) ;
00099 QGridLayout * prereglage = new QGridLayout ( FPrereglages ) ;
00100
00101 FPCompacte = new QPushButton ( "Vue Compacte (Shift-F8)") ;
00102 FPSemiEclatee =
00103 new QPushButton ( *HTML::decode("Vue Semi-Eclatée (Shift-F9)")) ;
00104 FPMoka=new QPushButton(*HTML::decode(
00105 "Vue Eclatée, style \"moKa\" (Shift-F10)")) ;
00106 FPTopofil=new QPushButton(*HTML::decode("Vue Eclatée, style "
00107 "\"Topofil\" (Shift-F11)")) ;
00108 FPSommets = new QPushButton ( "Sommets" ) ;
00109 FPAretes = new QPushButton ( *HTML::decode("Arêtes") ) ;
00110 FPFaces = new QPushButton ( "Faces" ) ;
00111 FPVolumes = new QPushButton ( "Volumes" ) ;
00112
00113 prereglage -> addWidget ( FPCompacte , 1 , 0 ) ;
00114 prereglage -> addWidget ( FPSemiEclatee , 2 , 0 ) ;
00115 prereglage -> addWidget ( FPMoka , 3 , 0 ) ;
00116 prereglage -> addWidget ( FPTopofil , 4 , 0 ) ;
00117 prereglage -> addWidget ( FPSommets , 1 , 1 ) ;
00118 prereglage -> addWidget ( FPAretes , 2 , 1 ) ;
00119 prereglage -> addWidget ( FPFaces , 3 , 1 ) ;
00120 prereglage -> addWidget ( FPVolumes , 4 , 1 ) ;
00121
00122 haut -> addWidget ( FPrereglages, 0, 1, 2, 1 ) ;
00123
00124
00125 FParametres = new QGroupBox ( *HTML::decode("Paramètres") ) ;
00126 QGridLayout * parametre = new QGridLayout ( FParametres ) ;
00127
00128 FAffEclatement = new QLabel ( "Eclatement" ) ;
00129 FAffPosition = new QLabel ( "Position" ) ;
00130 FAffEpaisseur = new QLabel ( "Epaisseur" ) ;
00131
00132 parametre -> addWidget ( FAffEclatement , 1 , 1 ) ;
00133 parametre -> addWidget ( FAffPosition , 1 , 4 ) ;
00134 parametre -> addWidget ( FAffEpaisseur , 1 , 6 ) ;
00135
00136 const char * alpha [] = { "Alpha0 :", "Alpha1 :", "Alpha2 :", "Alpha3 :" };
00137 const char * couture [] = { "0-Coutures" , "1-Coutures" , "2-Coutures" ,
00138 "3-Coutures" } ;
00139
00140 for (int i = 0 ; i < 4 ; i++ )
00141 {
00142
00143 FParAlpha [i] = new QLabel ( alpha [i] , FParametres ) ;
00144 FParEclatement [i] = new QSlider ( FParametres ) ;
00145 FParEclatement [i] -> setMinimum ( 0 ) ;
00146 FParEclatement [i] -> setMaximum ( 100 ) ;
00147 FParEclatement [i] -> setSingleStep ( 3 ) ;
00148 FParEclatement [i] -> setValue ( 0 ) ;
00149 FParEclatement [i] -> setOrientation ( Qt::Horizontal );
00150
00151 FParAffEclatement [i] = new QLabel ( 0 , FParametres ) ;
00152 FParCouture [i] = new QCheckBox ( couture [i] , FParametres ) ;
00153
00154 FParPosition [i] = new QSlider ( FParametres ) ;
00155 FParPosition [i] -> setMinimum ( 0 ) ;
00156 FParPosition [i] -> setMaximum ( 100 ) ;
00157 FParPosition [i] -> setSingleStep ( 3 ) ;
00158 FParPosition [i] -> setValue ( 0 ) ;
00159 FParPosition [i] -> setOrientation ( Qt::Horizontal );
00160
00161 FParAffPosition [i] = new QLabel ( 0 , FParametres ) ;
00162 FParEpaisseur [i] = new QSpinBox ( FParametres ) ;
00163 FParEpaisseur [i] -> setMinimum ( 1 ) ;
00164 FParEpaisseur [i] -> setMaximum ( 10 ) ;
00165 FParEpaisseur [i] -> setAccelerated(true);
00166
00167 parametre -> addWidget ( FParAlpha [i] , i+2 , 0 ) ;
00168 parametre -> addWidget ( FParEclatement [i] , i+2 , 1 ) ;
00169 parametre -> addWidget ( FParAffEclatement [i] , i+2 , 2 ) ;
00170 parametre -> addWidget ( FParCouture [i] , i+2 , 3 ) ;
00171 parametre -> addWidget ( FParPosition [i] , i+2 , 4 ) ;
00172 parametre -> addWidget ( FParAffPosition [i] , i+2 , 5 ) ;
00173 parametre -> addWidget ( FParEpaisseur [i] , i+2 , 6 ) ;
00174 }
00175
00176 placement -> addWidget ( WidgetHaut ) ;
00177 placement -> addWidget ( FParametres ) ;
00178
00179 connect ( FPCompacte , SIGNAL ( clicked () ) ,
00180 this , SLOT ( callbackPresetting0 ( ) ) ) ;
00181
00182 connect ( FPSemiEclatee , SIGNAL ( clicked () ) ,
00183 this , SLOT ( callbackPresetting1 ( ) ) ) ;
00184
00185 connect ( FPMoka , SIGNAL ( clicked () ) ,
00186 this , SLOT ( callbackPresetting2 ( ) ) ) ;
00187
00188 connect ( FPTopofil , SIGNAL ( clicked () ) ,
00189 this , SLOT ( callbackPresetting3 ( ) ) ) ;
00190
00191 connect ( FPSommets , SIGNAL ( clicked () ) ,
00192 this , SLOT ( callbackPresetting4 ( ) ) ) ;
00193
00194 connect ( FPAretes , SIGNAL ( clicked () ) ,
00195 this , SLOT ( callbackPresetting5 ( ) ) ) ;
00196
00197 connect ( FPFaces , SIGNAL ( clicked () ) ,
00198 this , SLOT ( callbackPresetting6 ( ) ) ) ;
00199
00200 connect ( FPVolumes , SIGNAL ( clicked () ) ,
00201 this , SLOT ( callbackPresetting7 ( ) ) ) ;
00202
00203
00204 QObject :: connect ( FParEclatement [0] ,
00205 SIGNAL ( valueChanged ( int ) ) ,
00206 this ,
00207 SLOT ( callbackBurstAlpha0 ( ) ) ) ;
00208 QObject :: connect ( FParEclatement [1] ,
00209 SIGNAL ( valueChanged ( int ) ) ,
00210 this ,
00211 SLOT ( callbackBurstAlpha1 ( ) ) ) ;
00212 QObject :: connect ( FParEclatement [2] ,
00213 SIGNAL ( valueChanged ( int ) ) ,
00214 this ,
00215 SLOT ( callbackBurstAlpha2 ( ) ) ) ;
00216 QObject :: connect ( FParEclatement [3] ,
00217 SIGNAL ( valueChanged ( int ) ) ,
00218 this ,
00219 SLOT ( callbackBurstAlpha3 ( ) ) ) ;
00220
00221
00222 QObject :: connect ( FParCouture [0] ,
00223 SIGNAL ( clicked ( ) ) ,
00224 this ,
00225 SLOT ( callbackSew0 ( ) ) ) ;
00226 QObject :: connect ( FParCouture [1] ,
00227 SIGNAL ( clicked ( ) ) ,
00228 this ,
00229 SLOT ( callbackSew1 ( ) ) ) ;
00230 QObject :: connect ( FParCouture [2] ,
00231 SIGNAL ( clicked ( ) ) ,
00232 this ,
00233 SLOT ( callbackSew2 ( ) ) ) ;
00234 QObject :: connect ( FParCouture [3] ,
00235 SIGNAL ( clicked ( ) ) ,
00236 this ,
00237 SLOT ( callbackSew3 ( ) ) ) ;
00238
00239
00240 QObject :: connect ( FParPosition [0] ,
00241 SIGNAL ( valueChanged ( int ) ) ,
00242 this ,
00243 SLOT ( callbackSewposAlpha0 ( ) ) ) ;
00244 QObject :: connect ( FParPosition [1] ,
00245 SIGNAL ( valueChanged ( int ) ) ,
00246 this ,
00247 SLOT ( callbackSewposAlpha1 ( ) ) ) ;
00248 QObject :: connect ( FParPosition [2] ,
00249 SIGNAL ( valueChanged ( int ) ) ,
00250 this ,
00251 SLOT ( callbackSewposAlpha2 ( ) ) ) ;
00252 QObject :: connect ( FParPosition [3] ,
00253 SIGNAL ( valueChanged ( int ) ) ,
00254 this ,
00255 SLOT ( callbackSewposAlpha3 ( ) ) ) ;
00256
00257
00258 QObject :: connect ( FParEpaisseur [0] ,
00259 SIGNAL ( valueChanged ( int ) ) ,
00260 this ,
00261 SLOT ( callbackSew0Width ( ) ) ) ;
00262 QObject :: connect ( FParEpaisseur [1] ,
00263 SIGNAL ( valueChanged ( int ) ) ,
00264 this ,
00265 SLOT ( callbackSew1Width ( ) ) ) ;
00266 QObject :: connect ( FParEpaisseur [2] ,
00267 SIGNAL ( valueChanged ( int ) ) ,
00268 this ,
00269 SLOT ( callbackSew2Width ( ) ) ) ;
00270 QObject :: connect ( FParEpaisseur [3] ,
00271 SIGNAL ( valueChanged ( int ) ) ,
00272 this ,
00273 SLOT ( callbackSew3Width ( ) ) ) ;
00274 }
00275
00276
00277
00278 OptionsVue :: ~OptionsVue ( )
00279 {
00280 }
00281
00282
00283
00284 void OptionsVue :: update ( )
00285 {
00286 if (FUpdate) return;
00287
00288 FUpdate = true ;
00289
00290 CParameterSew * p = FParent -> getParameterSew ( ) ;
00291
00292 for ( int i = 0 ; i < 4 ; ++i )
00293 {
00294
00295 setValueEclatement ( FParent -> getControler ( ) ->
00296 getMapBurstCoef ( i ) , i ) ;
00297
00298 setValuePosition ( p -> getSewPosCoef ( i ) , i ) ;
00299
00300 FParCouture [ i ] -> setChecked ( p -> getDisplayAlpha ( i ) ) ;
00301 FParEpaisseur [ i ] -> setValue( p -> getLWSew ( i ) ) ;
00302
00303
00304 FParCouture [ i ] -> setEnabled ( FParent -> getSewsDisplay ( ) );
00305
00306 FParEpaisseur [ i ] -> setEnabled ( FParent -> getSewsDisplay ( )
00307 && p -> getDisplayAlpha ( i ) ) ;
00308
00309 FParPosition [ i ] -> setEnabled( FParent -> getSewsDisplay ( )
00310 && p -> getDisplayAlpha ( i ) ) ;
00311 FParAffPosition [ i ] -> setEnabled ( FParent -> getSewsDisplay ( )
00312 && p -> getDisplayAlpha ( i ) ) ;
00313
00314 FBurstView[FParent -> getControler() -> getBurstMethod()]
00315 -> setChecked( true ) ;
00316 }
00317
00318 if ( getInteractive ( ) )
00319 {
00320 FParent -> repaint ( ) ;
00321 }
00322
00323 FUpdate = false ;
00324 }
00325
00326
00327
00328
00329
00330
00331
00332
00333 void OptionsVue :: callbackToggleInteractive ( )
00334 {
00335 if ( ! FUpdate )
00336 setInteractive ( getInteractive ( ) ) ;
00337 }
00338
00339 void OptionsVue :: callbackApply ( )
00340 {
00341 if ( ! FUpdate ) applyValues ( );
00342 }
00343
00344 void OptionsVue :: callbackRecover ( )
00345 {
00346 if ( ! FUpdate ) update ( ) ;
00347 }
00348
00349 void OptionsVue ::callbackBurstView ( int id )
00350 {
00351 if ( ! FUpdate )
00352 {
00353 FParent->getControler()->setBurstMethod( id );
00354 FParent->repaint ( ) ;
00355 }
00356 }
00357
00358
00359 void OptionsVue :: callbackBurstAlpha0 ( )
00360 {
00361 if ( !FUpdate && getInteractive ( ) ) {
00362
00363 char ValEclatement [8] ;
00364 sprintf ( ValEclatement , "%5.2f", getAlphaCoef ( 0 ) ) ;
00365 FParAffEclatement [ 0 ] -> setText ( ValEclatement ) ;
00366
00367 FParent -> getControler ( ) -> setMapBurstCoef ( 0 , getAlphaCoef ( 0 ) ) ;
00368 FParent -> repaint ( ) ;
00369 }
00370 }
00371
00372 void OptionsVue :: callbackBurstAlpha1 ( )
00373 {
00374 if ( !FUpdate && getInteractive ( ) ) {
00375
00376 char ValEclatement [8] ;
00377 sprintf ( ValEclatement , "%5.2f",
00378 ( float ( FParEclatement [ 1 ] -> value ( ) ) ) / 100.0 ) ;
00379 FParAffEclatement [ 1 ] -> setText ( ValEclatement ) ;
00380
00381 FParent -> getControler ( ) -> setMapBurstCoef ( 1 , getAlphaCoef ( 1 ) ) ;
00382 FParent -> repaint ( ) ;
00383 }
00384 }
00385
00386 void OptionsVue :: callbackBurstAlpha2 ( )
00387 {
00388 if ( !FUpdate && getInteractive ( ) ) {
00389
00390 char ValEclatement [8] ;
00391 sprintf ( ValEclatement , "%5.2f" ,
00392 ( float ( FParEclatement [ 2 ] -> value ( ) ) ) / 100.0 ) ;
00393 FParAffEclatement [ 2 ] -> setText ( ValEclatement ) ;
00394
00395 FParent -> getControler ( ) -> setMapBurstCoef ( 2 , getAlphaCoef ( 2 ) ) ;
00396 FParent -> repaint ( ) ;
00397 }
00398 }
00399
00400 void OptionsVue :: callbackBurstAlpha3 ( )
00401 {
00402 if ( !FUpdate && getInteractive ( ) ) {
00403
00404 char ValEclatement [8] ;
00405 sprintf ( ValEclatement , "%5.2f",
00406 ( float ( FParEclatement [ 3 ] -> value ( ) ) ) / 100.0 ) ;
00407 FParAffEclatement [ 3 ] -> setText ( ValEclatement ) ;
00408
00409 FParent -> getControler ( ) -> setMapBurstCoef ( 3 , getAlphaCoef ( 3 ) ) ;
00410 FParent -> repaint ( ) ;
00411 }
00412 }
00413
00414 void OptionsVue :: callbackSewposAlpha0 ( )
00415 {
00416 if ( !FUpdate && getInteractive ( ) ) {
00417 setSewposCoef ( 0 , getSewposCoef ( 0 ) ) ;
00418
00419 char ValPosition [8] ;
00420 sprintf ( ValPosition , "%5.2f",
00421 ( float ( FParPosition [ 0 ] -> value ( ) ) ) / 100.0 ) ;
00422 FParAffPosition[0] -> setText ( ValPosition ) ;
00423 FParent -> repaint ( ) ;
00424 }
00425 }
00426
00427 void OptionsVue :: callbackSewposAlpha1 ( )
00428 {
00429 if ( !FUpdate && getInteractive ( ) ) {
00430 setSewposCoef ( 1 , getSewposCoef ( 1 ) ) ;
00431 char ValPosition [8] ;
00432 sprintf ( ValPosition , "%5.2f",
00433 ( float ( FParPosition [ 1 ] -> value ( ) ) ) / 100.0 ) ;
00434 FParAffPosition [ 1 ] -> setText ( ValPosition ) ;
00435 FParent -> repaint ( ) ;
00436 }
00437 }
00438
00439 void OptionsVue :: callbackSewposAlpha2 ( )
00440 {
00441 if ( !FUpdate && getInteractive ( ) ) {
00442 setSewposCoef ( 2 , getSewposCoef ( 2 ) ) ;
00443 char ValPosition [8] ;
00444 sprintf ( ValPosition , "%5.2f",
00445 ( float ( FParPosition [ 2 ] -> value ( ) ) ) / 100.0 ) ;
00446 FParAffPosition [ 2 ] -> setText ( ValPosition ) ;
00447 FParent -> repaint ( ) ;
00448 }
00449 }
00450
00451 void OptionsVue :: callbackSewposAlpha3 ( )
00452 {
00453 if ( !FUpdate && getInteractive ( ) ) {
00454 setSewposCoef ( 3 , getSewposCoef ( 3 ) ) ;
00455 char ValPosition [8] ;
00456 sprintf ( ValPosition , "%5.2f",
00457 ( float ( FParPosition [ 3 ] -> value ( ) ) ) / 100.0 ) ;
00458 FParAffPosition [ 3 ] -> setText ( ValPosition ) ;
00459 FParent -> repaint ( ) ;
00460 }
00461 }
00462
00463 void OptionsVue :: callbackSew0 ( )
00464 {
00465 if ( !FUpdate && getInteractive ( ) ) {
00466 setSewDisplay ( 0 , getSewDisplay ( 0 ) ) ;
00467 FParent -> repaint ( ) ;
00468 }
00469 }
00470
00471 void OptionsVue :: callbackSew1 ( )
00472 {
00473 if ( !FUpdate && getInteractive ( ) ) {
00474 setSewDisplay ( 1 , getSewDisplay ( 1 ) ) ;
00475 FParent -> repaint ( ) ;
00476 }
00477 }
00478
00479 void OptionsVue :: callbackSew2 ( )
00480 {
00481 if ( !FUpdate && getInteractive ( ) ) {
00482 setSewDisplay ( 2 , getSewDisplay ( 2 ) ) ;
00483 FParent -> repaint ( ) ;
00484 }
00485 }
00486
00487 void OptionsVue :: callbackSew3 ( )
00488 {
00489 if ( !FUpdate && getInteractive ( ) ) {
00490 setSewDisplay ( 3 , getSewDisplay ( 3 ) ) ;
00491 FParent -> repaint ( ) ;
00492 }
00493 }
00494
00495 void OptionsVue :: callbackSew0Width ( )
00496 {
00497 if ( !FUpdate && getInteractive ( ) ) {
00498 setSewWidth ( 0 , getSewWidth ( 0 ) ) ;
00499 FParent -> repaint ( ) ;
00500 }
00501 }
00502
00503 void OptionsVue :: callbackSew1Width ( )
00504 {
00505 if ( !FUpdate && getInteractive ( ) ) {
00506 setSewWidth ( 1 , getSewWidth ( 1 ) ) ;
00507 FParent -> repaint ( ) ;
00508 }
00509 }
00510
00511 void OptionsVue :: callbackSew2Width ( )
00512 {
00513 if ( !FUpdate && getInteractive ( ) ) {
00514 setSewWidth ( 2 , getSewWidth ( 2 ) ) ;
00515 FParent -> repaint ( ) ;
00516 }
00517 }
00518
00519 void OptionsVue :: callbackSew3Width ( )
00520 {
00521 if ( !FUpdate && getInteractive ( ) ) {
00522 setSewWidth ( 3 , getSewWidth ( 3 ) ) ;
00523 FParent -> repaint ( ) ;
00524 }
00525 }
00526
00527
00528 void OptionsVue :: callbackPresetting0 ( )
00529 {
00530 if ( ! FUpdate )
00531 setPresetting ( 0 ) ;
00532 }
00533
00534 void OptionsVue :: callbackPresetting1 ( )
00535 {
00536 if ( ! FUpdate )
00537 setPresetting ( 1 ) ;
00538 }
00539
00540 void OptionsVue :: callbackPresetting2 ( )
00541 {
00542 if ( ! FUpdate )
00543 setPresetting ( 2 ) ;
00544 }
00545
00546 void OptionsVue :: callbackPresetting3 ( )
00547 {
00548 if ( ! FUpdate ) setPresetting ( 3 ) ;
00549 }
00550
00551 void OptionsVue :: callbackPresetting4 ( )
00552 {
00553 if ( ! FUpdate ) setPresetting ( 4 ) ;
00554 }
00555
00556 void OptionsVue :: callbackPresetting5 ( )
00557 {
00558 if ( ! FUpdate ) setPresetting ( 5 ) ;
00559 }
00560
00561 void OptionsVue :: callbackPresetting6 ( )
00562 {
00563 if ( ! FUpdate ) setPresetting ( 6 ) ;
00564 }
00565
00566 void OptionsVue :: callbackPresetting7 ( )
00567 {
00568 if ( ! FUpdate ) setPresetting ( 7 ) ;
00569 }
00570
00571
00572
00573 float OptionsVue :: getAlphaCoef ( int i ) const
00574 {
00575 assert(i>=0 && i<4);
00576 return ( ( (float) FParEclatement [i] -> value ( ) ) / 100.0 ) ;
00577 }
00578
00579 float OptionsVue :: getSewposCoef ( int i ) const
00580 {
00581 assert(i>=0 && i<4);
00582 return ( ( ( float ) FParPosition [i] -> value ( ) ) / 100.0 ) ;
00583 }
00584
00585 bool OptionsVue :: getSewDisplay ( int i ) const
00586 {
00587 assert(i>=0 && i<4);
00588 return FParCouture [i] -> isChecked ( ) ;
00589 }
00590
00591 int OptionsVue :: getSewWidth ( int i ) const
00592 {
00593 assert(i>=0 && i<4);
00594 return FParEpaisseur [i] -> value ( ) ;
00595 }
00596
00597
00598 bool OptionsVue :: getInteractive ( ) const
00599 {
00600 return FInteractivite -> isChecked ( ) ;
00601 }
00602
00603
00604
00605 void OptionsVue :: setAlphaCoefs ( float v0 , float v1 , float v2 , float v3 )
00606 {
00607 bool update = FUpdate ;
00608 FUpdate = true ;
00609 setAlphaCoef ( 0 ,v0 ) ;
00610 setAlphaCoef ( 1 ,v1 ) ;
00611 setAlphaCoef ( 2 ,v2 ) ;
00612 setAlphaCoef ( 3 ,v3 ) ;
00613 FUpdate = update ;
00614
00615 if ( getInteractive ( ) && !FUpdate ) {
00616 FParent -> repaint ( ) ;
00617 }
00618 }
00619
00620 void OptionsVue :: setSewposCoefs ( float v0 , float v1 , float v2 , float v3 )
00621 {
00622 bool update = FUpdate ;
00623 FUpdate = true ;
00624 setSewposCoef ( 0 , v0 ) ;
00625 setSewposCoef ( 1 , v1 ) ;
00626 setSewposCoef ( 2 , v2 ) ;
00627 setSewposCoef ( 3 , v3 ) ;
00628 FUpdate = update ;
00629
00630 if ( getInteractive () && !FUpdate )
00631 FParent -> repaint ( ) ;
00632 }
00633
00634 void OptionsVue :: setSewsDisplay ( bool b0 , bool b1 , bool b2 , bool b3 )
00635 {
00636 bool update = FUpdate ;
00637 FUpdate = true ;
00638 setSewDisplay ( 0 , b0 ) ;
00639 setSewDisplay ( 1 , b1 ) ;
00640 setSewDisplay ( 2 , b2 ) ;
00641 setSewDisplay ( 3 , b3 ) ;
00642 FUpdate = update ;
00643
00644 if ( getInteractive () && !FUpdate )
00645 FParent -> repaint ( ) ;
00646 }
00647
00648 void OptionsVue :: setAlphaCoef ( int i , float v )
00649 {
00650 assert ( i >= 0 ) ;
00651 assert ( i < 4 ) ;
00652 assert ( v >= 0 ) ;
00653 assert ( v <= SCALE_MAX ) ;
00654
00655 setValueEclatement ( v , i ) ;
00656
00657 if ( getInteractive ( ) )
00658 FParent -> getControler ( ) -> setMapBurstCoef ( i , v) ;
00659 }
00660
00661 void OptionsVue :: setSewposCoef ( int i , float v )
00662 {
00663 assert ( i >= 0 ) ;
00664 assert ( i < 4 ) ;
00665 assert ( v >= 0 ) ;
00666 assert ( v <= 1 ) ;
00667
00668 setValuePosition ( v , i ) ;
00669 if ( getInteractive ( ) )
00670 FParent -> getParameterSew ( ) -> setSewPosCoef ( i , v ) ;
00671 }
00672
00673 void OptionsVue :: setSewDisplay ( int i , bool b )
00674 {
00675 assert ( i >= 0 ) ;
00676 assert ( i < 4 ) ;
00677
00678 FParCouture [ i ] -> setChecked ( b ) ;
00679
00680 FParPosition [ i ] -> setEnabled ( b &&
00681 FParent -> getSewsDisplay ( ) ) ;
00682 FParAffPosition [ i ] -> setEnabled ( b &&
00683 FParent -> getSewsDisplay ( ) ) ;
00684 FParEpaisseur [ i ] -> setEnabled( b &&
00685 FParent -> getSewsDisplay ( ) ) ;
00686
00687 if ( getInteractive ( ) )
00688 FParent -> getParameterSew ( ) -> setDisplayAlpha ( i , b ) ;
00689
00690 }
00691
00692 void OptionsVue :: setSewWidth ( int i , int w )
00693 {
00694 assert ( i >= 0 ) ;
00695 assert ( i <= 3 ) ;
00696 assert ( w > 0 ) ;
00697
00698 FParEpaisseur [ i ] -> setValue ( w ) ;
00699
00700 if ( getInteractive ( ) )
00701 FParent -> getParameterSew ( ) -> setLWSew ( i , w ) ;
00702 }
00703
00704
00705 void OptionsVue :: setInteractive ( bool b )
00706 {
00707 FInteractivite -> setChecked ( b ) ;
00708 FIAppliquer -> setEnabled ( !b ) ;
00709 FIRecuperer -> setEnabled ( !b ) ;
00710
00711 if ( b )
00712 update ( ) ;
00713 }
00714
00715 void OptionsVue :: applyValues ( )
00716 {
00717 for ( int i = 0 ; i < 4 ; ++i )
00718 {
00719 FParent-> getControler ( ) ->setMapBurstCoef ( i , getAlphaCoef ( i ) );
00720 FParent-> getParameterSew()->setSewPosCoef ( i , getSewposCoef ( i ) );
00721 FParent-> getParameterSew()->setDisplayAlpha ( i , getSewDisplay ( i ) );
00722 FParent-> getParameterSew()->setLWSew ( i , getSewWidth ( i ) );
00723 }
00724
00725 FParentTab -> applyValues ( ) ;
00726 FParent -> repaint ( ) ;
00727 }
00728
00729 void OptionsVue :: setPresetting ( int P )
00730 {
00731 switch ( P )
00732 {
00733 case Compact:
00734 setAlphaCoefs( 1.00 , 1.00 , 1.00 , 1.00 ) ;
00735 setSewposCoefs ( 1.0 , 0.0 , 1.0 , 1.0 ) ;
00736 setSewsDisplay ( false , false , false , false ) ;
00737 break ;
00738 case SemiBurst:
00739 setAlphaCoefs( 1.00 , 1.00 , 0.85 , 0.96 ) ;
00740 setSewposCoefs ( 1.0 , 0.2 , 0.9 , 0.0 ) ;
00741 setSewsDisplay ( false , true , true , true ) ;
00742 break ;
00743 case Burst:
00744 setAlphaCoefs ( 1.00 , 1.00 , 0.80 , 0.50 );
00745 setSewposCoefs ( 0.8 , 0.0 , 0.5 , 0.0 ) ;
00746 setSewsDisplay ( false , true , true , true ) ;
00747 break ;
00748 case AltBurst:
00749 setAlphaCoefs ( 0.90 , 0.90 , 0.90 , 0.90 );
00750 setSewposCoefs ( 1.0 , 0.2 , 0.5 , 0.6 ) ;
00751 setSewsDisplay ( true , true , true , true );
00752 break ;
00753 case VertexEmphase:
00754 setAlphaCoefs ( 0.50 , 1.00 , 0.97 , 0.98 );
00755 setSewposCoefs ( 1.0 , 0.1 , 0.9 , 0.5 ) ;
00756 setSewsDisplay ( false, true , true , true );
00757 break ;
00758 case EdgeEmphase:
00759 setAlphaCoefs ( 1.00 , 0.50 , 0.97 , 0.98 ) ;
00760 setSewposCoefs ( 1.0 , 0.1 , 0.9 , 0.5 ) ;
00761 setSewsDisplay ( true , false , true , true ) ;
00762 break ;
00763 case FaceEmphase:
00764 setAlphaCoefs ( 1.00 , 1.00 , 0.50 , 0.96 ) ;
00765 setSewposCoefs ( 1.0 , 0.1 , 0.9 , 0.5 ) ;
00766 setSewsDisplay ( true , true , false, true ) ;
00767 break ;
00768 case VolumeEmphase:
00769 setAlphaCoefs( 1.00 , 1.00 , 0.97 , 0.65 ) ;
00770 setSewposCoefs ( 1.0 , 0.1 , 0.9 , 0.5) ;
00771 setSewsDisplay ( true , true , true , false) ;
00772 break ;
00773 default: assert ( false ) ; break ;
00774 }
00775
00776 }
00777
00778 void OptionsVue :: setValueEclatement ( TCoordinate c , int i )
00779 {
00780 FParEclatement [ i ] -> setValue ( int ( c * 100.0 ) ) ;
00781 char ValEclatement [8] ;
00782 sprintf ( ValEclatement , "%5.2f",
00783 ( float ( FParEclatement [ i ] -> value ( ) ) ) / 100.0 ) ;
00784 FParAffEclatement[i] -> setText ( ValEclatement ) ;
00785 }
00786
00787 void OptionsVue :: setValuePosition ( float f , int i )
00788 {
00789 FParPosition [ i ] -> setValue ( int ( f *100.0) ) ;
00790 char ValPosition [8] ;
00791 sprintf ( ValPosition , "%5.2f",
00792 ( float ( FParPosition [ i ] -> value ( ) ) ) / 100.0 ) ;
00793 FParAffPosition[i] -> setText ( ValPosition ) ;
00794 }
00795
00796