Moka Ihm Qt
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
options-vue.qt.cc
Go to the documentation of this file.
1 /*
2  * Moka : Un modeleur de 3-G-cartes.
3  * Copyright (C) 2004, Moka Team, Université de Poitiers, Laboratoire SIC
4  * http://www.sic.sp2mi.univ-poitiers.fr/
5  * Copyright (C) 2009, Guillaume Damiand, CNRS, LIRIS,
6  * guillaume.damiand@liris.cnrs.fr, http://liris.cnrs.fr/
7  *
8  * This file is part of Moka
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 #include "options-vue.qt.hh"
25 #include "window.qt.hh"
26 #include "options-frame.qt.hh"
27 #include "HtmlEntities.hh"
28 
29 #include <QtGui/QHBoxLayout>
30 #include <QtGui/QGridLayout>
31 #include <QtGui/QLabel>
32 #include <QtGui/QVBoxLayout>
33 
34 #define SCALE_MAX (1.0)
35 
36 static QString elementLabs [ 2 ] =
37 {
38  "By barycenter",
39  *HTML::decode("By offset"),
40 };
41 
42 // Constructeur
43 //-------------
44 OptionsVue :: OptionsVue ( Window * parent , OptionsFrame * parentTab )
45  :
46  QWidget ( parentTab ) ,
47  FParentTab ( parentTab ) ,
48  FParent ( parent ) ,
49  FUpdate ( false )
50 {
51  QVBoxLayout * placement = new QVBoxLayout ( this ) ;
52 
53  QWidget * WidgetHaut = new QWidget (this ) ;
54  QGridLayout * haut = new QGridLayout ( WidgetHaut ) ;
55 
56  //-------------------------
57  FTypeEclatement=new QGroupBox ( *HTML::decode("Splitted view" ) );
58  QVBoxLayout* tet_vbl = new QVBoxLayout(FTypeEclatement);
59 
60  for (int i=0;i<2;i++)
61  {
62  FBurstView[i] = new IdRadioButton(i,elementLabs[i]);
63  tet_vbl -> addWidget ( FBurstView[i] );
64 
65  connect ( FBurstView[i] , SIGNAL ( clicked ( int ) ) ,
66  this , SLOT ( callbackBurstView( int ) ) ) ;
67  }
68 
69  haut -> addWidget ( FTypeEclatement, 0, 0 ) ;
70 
71  //-------- Interactivite -----------------
72  FInteractivite = new QGroupBox ( "Interactives modifications" ) ;
73  FInteractivite -> setCheckable (true);
74  FInteractivite -> setChecked (true) ;
75 
76  QVBoxLayout* int_vbl = new QVBoxLayout(FInteractivite);
77  FIAppliquer = new QPushButton ( "Apply Modifications" ) ;
78  FIAppliquer -> setEnabled ( false ) ;
79  FIRecuperer = new QPushButton ( *HTML::decode(
80  "Recover Values") ) ;
81  FIRecuperer -> setEnabled ( false ) ;
82 
83  int_vbl -> addWidget(FIAppliquer);
84  int_vbl -> addWidget(FIRecuperer);
85 
86  connect ( FInteractivite , SIGNAL ( clicked ( ) ) ,
87  this , SLOT ( callbackToggleInteractive ( ) ) ) ;
88 
89  connect ( FIAppliquer , SIGNAL ( clicked ( ) ) ,
90  this , SLOT ( callbackApply ( ) ) ) ;
91 
92  connect ( FIRecuperer , SIGNAL ( clicked () ) ,
93  this , SLOT ( callbackRecover ( ) ) ) ;
94 
95  haut -> addWidget ( FInteractivite, 1, 0 ) ;
96 
97  //-------------------------
98  FPrereglages = new QGroupBox ( *HTML::decode("Presets") ) ;
99  QGridLayout * prereglage = new QGridLayout ( FPrereglages ) ;
100 
101  FPCompacte = new QPushButton ( "Compacted view (Shift-F8)") ;
102  FPSemiEclatee =
103  new QPushButton ( *HTML::decode("Semi-splitted view (Shift-F9)")) ;
104  FPMoka=new QPushButton(*HTML::decode(
105  "Splitted view, style \"moKa\" (Shift-F10)")) ;
106  FPTopofil=new QPushButton(*HTML::decode("Splitted View, style "
107  "\"Topofil\" (Shift-F11)")) ;
108  FPSommets = new QPushButton ( "Vertices" ) ;
109  FPAretes = new QPushButton ( *HTML::decode("Edges") ) ;
110  FPFaces = new QPushButton ( "Faces" ) ;
111  FPVolumes = new QPushButton ( "Volumes" ) ;
112 
113  prereglage -> addWidget ( FPCompacte , 1 , 0 ) ;
114  prereglage -> addWidget ( FPSemiEclatee , 2 , 0 ) ;
115  prereglage -> addWidget ( FPMoka , 3 , 0 ) ;
116  prereglage -> addWidget ( FPTopofil , 4 , 0 ) ;
117  prereglage -> addWidget ( FPSommets , 1 , 1 ) ;
118  prereglage -> addWidget ( FPAretes , 2 , 1 ) ;
119  prereglage -> addWidget ( FPFaces , 3 , 1 ) ;
120  prereglage -> addWidget ( FPVolumes , 4 , 1 ) ;
121 
122  haut -> addWidget ( FPrereglages, 0, 1, 2, 1 ) ;
123 
124  //-------------------------
125  FParametres = new QGroupBox ( *HTML::decode("Parameters") ) ;
126  QGridLayout * parametre = new QGridLayout ( FParametres ) ;
127 
128  FAffEclatement = new QLabel ( "Splitting" ) ;
129  FAffPosition = new QLabel ( "Position" ) ;
130  FAffEpaisseur = new QLabel ( "Thickening" ) ;
131 
132  parametre -> addWidget ( FAffEclatement , 1 , 1 ) ;
133  parametre -> addWidget ( FAffPosition , 1 , 4 ) ;
134  parametre -> addWidget ( FAffEpaisseur , 1 , 6 ) ;
135 
136  const char * alpha [] = { "Alpha0 :", "Alpha1 :", "Alpha2 :", "Alpha3 :" };
137  const char * couture [] = { "0-Sews" , "1-Sews" , "2-Sews" ,
138  "3-Sews" } ;
139 
140  for (int i = 0 ; i < 4 ; i++ )
141  {
142  // Les alpha
143  FParAlpha [i] = new QLabel ( alpha [i] , FParametres ) ;
144  FParEclatement [i] = new QSlider ( FParametres ) ;
145  FParEclatement [i] -> setMinimum ( 0 ) ;
146  FParEclatement [i] -> setMaximum ( 100 ) ;
147  FParEclatement [i] -> setSingleStep ( 3 ) ;
148  FParEclatement [i] -> setValue ( 0 ) ;
149  FParEclatement [i] -> setOrientation ( Qt::Horizontal );
150 
151  FParAffEclatement [i] = new QLabel ( 0 , FParametres ) ;
152  FParCouture [i] = new QCheckBox ( couture [i] , FParametres ) ;
153 
154  FParPosition [i] = new QSlider ( FParametres ) ;
155  FParPosition [i] -> setMinimum ( 0 ) ;
156  FParPosition [i] -> setMaximum ( 100 ) ;
157  FParPosition [i] -> setSingleStep ( 3 ) ;
158  FParPosition [i] -> setValue ( 0 ) ;
159  FParPosition [i] -> setOrientation ( Qt::Horizontal );
160 
161  FParAffPosition [i] = new QLabel ( 0 , FParametres ) ;
162  FParEpaisseur [i] = new QSpinBox ( FParametres ) ;
163  FParEpaisseur [i] -> setMinimum ( 1 ) ;
164  FParEpaisseur [i] -> setMaximum ( 10 ) ;
165  FParEpaisseur [i] -> setAccelerated(true);
166 
167  parametre -> addWidget ( FParAlpha [i] , i+2 , 0 ) ;
168  parametre -> addWidget ( FParEclatement [i] , i+2 , 1 ) ;
169  parametre -> addWidget ( FParAffEclatement [i] , i+2 , 2 ) ;
170  parametre -> addWidget ( FParCouture [i] , i+2 , 3 ) ;
171  parametre -> addWidget ( FParPosition [i] , i+2 , 4 ) ;
172  parametre -> addWidget ( FParAffPosition [i] , i+2 , 5 ) ;
173  parametre -> addWidget ( FParEpaisseur [i] , i+2 , 6 ) ;
174  }
175 
176  placement -> addWidget ( WidgetHaut ) ;
177  placement -> addWidget ( FParametres ) ;
178 
179  connect ( FPCompacte , SIGNAL ( clicked () ) ,
180  this , SLOT ( callbackPresetting0 ( ) ) ) ;
181 
182  connect ( FPSemiEclatee , SIGNAL ( clicked () ) ,
183  this , SLOT ( callbackPresetting1 ( ) ) ) ;
184 
185  connect ( FPMoka , SIGNAL ( clicked () ) ,
186  this , SLOT ( callbackPresetting2 ( ) ) ) ;
187 
188  connect ( FPTopofil , SIGNAL ( clicked () ) ,
189  this , SLOT ( callbackPresetting3 ( ) ) ) ;
190 
191  connect ( FPSommets , SIGNAL ( clicked () ) ,
192  this , SLOT ( callbackPresetting4 ( ) ) ) ;
193 
194  connect ( FPAretes , SIGNAL ( clicked () ) ,
195  this , SLOT ( callbackPresetting5 ( ) ) ) ;
196 
197  connect ( FPFaces , SIGNAL ( clicked () ) ,
198  this , SLOT ( callbackPresetting6 ( ) ) ) ;
199 
200  connect ( FPVolumes , SIGNAL ( clicked () ) ,
201  this , SLOT ( callbackPresetting7 ( ) ) ) ;
202 
203  // -- connection les slider pour les alpha
204  QObject :: connect ( FParEclatement [0] ,
205  SIGNAL ( valueChanged ( int ) ) ,
206  this ,
207  SLOT ( callbackBurstAlpha0 ( ) ) ) ;
208  QObject :: connect ( FParEclatement [1] ,
209  SIGNAL ( valueChanged ( int ) ) ,
210  this ,
211  SLOT ( callbackBurstAlpha1 ( ) ) ) ;
212  QObject :: connect ( FParEclatement [2] ,
213  SIGNAL ( valueChanged ( int ) ) ,
214  this ,
215  SLOT ( callbackBurstAlpha2 ( ) ) ) ;
216  QObject :: connect ( FParEclatement [3] ,
217  SIGNAL ( valueChanged ( int ) ) ,
218  this ,
219  SLOT ( callbackBurstAlpha3 ( ) ) ) ;
220 
221  // -- connection pour les checkbox des coutures
222  QObject :: connect ( FParCouture [0] ,
223  SIGNAL ( clicked ( ) ) ,
224  this ,
225  SLOT ( callbackSew0 ( ) ) ) ;
226  QObject :: connect ( FParCouture [1] ,
227  SIGNAL ( clicked ( ) ) ,
228  this ,
229  SLOT ( callbackSew1 ( ) ) ) ;
230  QObject :: connect ( FParCouture [2] ,
231  SIGNAL ( clicked ( ) ) ,
232  this ,
233  SLOT ( callbackSew2 ( ) ) ) ;
234  QObject :: connect ( FParCouture [3] ,
235  SIGNAL ( clicked ( ) ) ,
236  this ,
237  SLOT ( callbackSew3 ( ) ) ) ;
238 
239  // -- connection pour les slider pour les positions
240  QObject :: connect ( FParPosition [0] ,
241  SIGNAL ( valueChanged ( int ) ) ,
242  this ,
243  SLOT ( callbackSewposAlpha0 ( ) ) ) ;
244  QObject :: connect ( FParPosition [1] ,
245  SIGNAL ( valueChanged ( int ) ) ,
246  this ,
247  SLOT ( callbackSewposAlpha1 ( ) ) ) ;
248  QObject :: connect ( FParPosition [2] ,
249  SIGNAL ( valueChanged ( int ) ) ,
250  this ,
251  SLOT ( callbackSewposAlpha2 ( ) ) ) ;
252  QObject :: connect ( FParPosition [3] ,
253  SIGNAL ( valueChanged ( int ) ) ,
254  this ,
255  SLOT ( callbackSewposAlpha3 ( ) ) ) ;
256 
257  // -- connection pour les spinbox des epaisseur
258  QObject :: connect ( FParEpaisseur [0] ,
259  SIGNAL ( valueChanged ( int ) ) ,
260  this ,
261  SLOT ( callbackSew0Width ( ) ) ) ;
262  QObject :: connect ( FParEpaisseur [1] ,
263  SIGNAL ( valueChanged ( int ) ) ,
264  this ,
265  SLOT ( callbackSew1Width ( ) ) ) ;
266  QObject :: connect ( FParEpaisseur [2] ,
267  SIGNAL ( valueChanged ( int ) ) ,
268  this ,
269  SLOT ( callbackSew2Width ( ) ) ) ;
270  QObject :: connect ( FParEpaisseur [3] ,
271  SIGNAL ( valueChanged ( int ) ) ,
272  this ,
273  SLOT ( callbackSew3Width ( ) ) ) ;
274 }
275 
276 // Destructeur
277 //------------
279 {
280 }
281 
282 // Mise a jour de l'affichage
283 //---------------------------
285 {
286  if (FUpdate) return;
287 
288  FUpdate = true ;
289 
290  CParameterSew * p = FParent -> getParameterSew ( ) ;
291 
292  for ( int i = 0 ; i < 4 ; ++i )
293  {
294  // QSlider
295  setValueEclatement ( FParent -> getControler ( ) ->
296  getMapBurstCoef ( i ) , i ) ;
297  // QSlider
298  setValuePosition ( p -> getSewPosCoef ( i ) , i ) ;
299 
300  FParCouture [ i ] -> setChecked ( p -> getDisplayAlpha ( i ) ) ;
301  FParEpaisseur [ i ] -> setValue( p -> getLWSew ( i ) ) ;
302 
303 
304  FParCouture [ i ] -> setEnabled ( FParent -> getSewsDisplay ( ) );
305 
306  FParEpaisseur [ i ] -> setEnabled ( FParent -> getSewsDisplay ( )
307  && p -> getDisplayAlpha ( i ) ) ;
308 
309  FParPosition [ i ] -> setEnabled( FParent -> getSewsDisplay ( )
310  && p -> getDisplayAlpha ( i ) ) ;
311  FParAffPosition [ i ] -> setEnabled ( FParent -> getSewsDisplay ( )
312  && p -> getDisplayAlpha ( i ) ) ;
313 
314  FBurstView[FParent -> getControler() -> getBurstMethod()]
315  -> setChecked( true ) ;
316  }
317 
318  if ( getInteractive ( ) )
319  {
320  FParent -> repaint ( ) ;
321  }
322 
323  FUpdate = false ;
324 }
325 
326 // SLOTS
327 //------
328 
329 //--- Interactivite ---
330 
331 //Action a effectuer lorsque l'on coche ou decoche la case
332 // "Modifications interactive"
334 {
335  if ( ! FUpdate )
336  setInteractive ( getInteractive ( ) ) ;
337 }
338 
340 {
341  if ( ! FUpdate ) applyValues ( );
342 }
343 
345 {
346  if ( ! FUpdate ) update ( ) ;
347 }
348 
350 {
351  if ( ! FUpdate )
352  {
353  FParent->getControler()->setBurstMethod( id );
354  FParent->repaint ( ) ;
355  }
356 }
357 
358 // --- Parametres ---
360 {
361  if ( !FUpdate && getInteractive ( ) ) {
362  // Mise a jour de l'affichage txt
363  char ValEclatement [8] ;
364  sprintf ( ValEclatement , "%5.2f", getAlphaCoef ( 0 ) ) ;
365  FParAffEclatement [ 0 ] -> setText ( ValEclatement ) ;
366 
367  FParent -> getControler ( ) -> setMapBurstCoef ( 0 , getAlphaCoef ( 0 ) ) ;
368  FParent -> repaint ( ) ;
369  }
370 }
371 
373 {
374  if ( !FUpdate && getInteractive ( ) ) {
375  // Mise a jour de l'affichage txt
376  char ValEclatement [8] ;
377  sprintf ( ValEclatement , "%5.2f",
378  ( float ( FParEclatement [ 1 ] -> value ( ) ) ) / 100.0 ) ;
379  FParAffEclatement [ 1 ] -> setText ( ValEclatement ) ;
380 
381  FParent -> getControler ( ) -> setMapBurstCoef ( 1 , getAlphaCoef ( 1 ) ) ;
382  FParent -> repaint ( ) ;
383  }
384 }
385 
387 {
388  if ( !FUpdate && getInteractive ( ) ) {
389  // Mise a jour de l'affichage txt
390  char ValEclatement [8] ;
391  sprintf ( ValEclatement , "%5.2f" ,
392  ( float ( FParEclatement [ 2 ] -> value ( ) ) ) / 100.0 ) ;
393  FParAffEclatement [ 2 ] -> setText ( ValEclatement ) ;
394 
395  FParent -> getControler ( ) -> setMapBurstCoef ( 2 , getAlphaCoef ( 2 ) ) ;
396  FParent -> repaint ( ) ;
397  }
398 }
399 
401 {
402  if ( !FUpdate && getInteractive ( ) ) {
403  // Mise a jour de l'affichage txt
404  char ValEclatement [8] ;
405  sprintf ( ValEclatement , "%5.2f",
406  ( float ( FParEclatement [ 3 ] -> value ( ) ) ) / 100.0 ) ;
407  FParAffEclatement [ 3 ] -> setText ( ValEclatement ) ;
408 
409  FParent -> getControler ( ) -> setMapBurstCoef ( 3 , getAlphaCoef ( 3 ) ) ;
410  FParent -> repaint ( ) ;
411  }
412 }
413 
415 {
416  if ( !FUpdate && getInteractive ( ) ) {
417  setSewposCoef ( 0 , getSewposCoef ( 0 ) ) ;
418 
419  char ValPosition [8] ;
420  sprintf ( ValPosition , "%5.2f",
421  ( float ( FParPosition [ 0 ] -> value ( ) ) ) / 100.0 ) ;
422  FParAffPosition[0] -> setText ( ValPosition ) ;
423  FParent -> repaint ( ) ;
424  }
425 }
426 
428 {
429  if ( !FUpdate && getInteractive ( ) ) {
430  setSewposCoef ( 1 , getSewposCoef ( 1 ) ) ;
431  char ValPosition [8] ;
432  sprintf ( ValPosition , "%5.2f",
433  ( float ( FParPosition [ 1 ] -> value ( ) ) ) / 100.0 ) ;
434  FParAffPosition [ 1 ] -> setText ( ValPosition ) ;
435  FParent -> repaint ( ) ;
436  }
437 }
438 
440 {
441  if ( !FUpdate && getInteractive ( ) ) {
442  setSewposCoef ( 2 , getSewposCoef ( 2 ) ) ;
443  char ValPosition [8] ;
444  sprintf ( ValPosition , "%5.2f",
445  ( float ( FParPosition [ 2 ] -> value ( ) ) ) / 100.0 ) ;
446  FParAffPosition [ 2 ] -> setText ( ValPosition ) ;
447  FParent -> repaint ( ) ;
448  }
449 }
450 
452 {
453  if ( !FUpdate && getInteractive ( ) ) {
454  setSewposCoef ( 3 , getSewposCoef ( 3 ) ) ;
455  char ValPosition [8] ;
456  sprintf ( ValPosition , "%5.2f",
457  ( float ( FParPosition [ 3 ] -> value ( ) ) ) / 100.0 ) ;
458  FParAffPosition [ 3 ] -> setText ( ValPosition ) ;
459  FParent -> repaint ( ) ;
460  }
461 }
462 
464 {
465  if ( !FUpdate && getInteractive ( ) ) {
466  setSewDisplay ( 0 , getSewDisplay ( 0 ) ) ;
467  FParent -> repaint ( ) ;
468  }
469 }
470 
472 {
473  if ( !FUpdate && getInteractive ( ) ) {
474  setSewDisplay ( 1 , getSewDisplay ( 1 ) ) ;
475  FParent -> repaint ( ) ;
476  }
477 }
478 
480 {
481  if ( !FUpdate && getInteractive ( ) ) {
482  setSewDisplay ( 2 , getSewDisplay ( 2 ) ) ;
483  FParent -> repaint ( ) ;
484  }
485 }
486 
488 {
489  if ( !FUpdate && getInteractive ( ) ) {
490  setSewDisplay ( 3 , getSewDisplay ( 3 ) ) ;
491  FParent -> repaint ( ) ;
492  }
493 }
494 
496 {
497  if ( !FUpdate && getInteractive ( ) ) {
498  setSewWidth ( 0 , getSewWidth ( 0 ) ) ;
499  FParent -> repaint ( ) ;
500  }
501 }
502 
504 {
505  if ( !FUpdate && getInteractive ( ) ) {
506  setSewWidth ( 1 , getSewWidth ( 1 ) ) ;
507  FParent -> repaint ( ) ;
508  }
509 }
510 
512 {
513  if ( !FUpdate && getInteractive ( ) ) {
514  setSewWidth ( 2 , getSewWidth ( 2 ) ) ;
515  FParent -> repaint ( ) ;
516  }
517 }
518 
520 {
521  if ( !FUpdate && getInteractive ( ) ) {
522  setSewWidth ( 3 , getSewWidth ( 3 ) ) ;
523  FParent -> repaint ( ) ;
524  }
525 }
526 
527 // -- Prereglages --
529 {
530  if ( ! FUpdate )
531  setPresetting ( 0 ) ;
532 }
533 
535 {
536  if ( ! FUpdate )
537  setPresetting ( 1 ) ;
538 }
539 
541 {
542  if ( ! FUpdate )
543  setPresetting ( 2 ) ;
544 }
545 
547 {
548  if ( ! FUpdate ) setPresetting ( 3 ) ;
549 }
550 
552 {
553  if ( ! FUpdate ) setPresetting ( 4 ) ;
554 }
555 
557 {
558  if ( ! FUpdate ) setPresetting ( 5 ) ;
559 }
560 
562 {
563  if ( ! FUpdate ) setPresetting ( 6 ) ;
564 }
565 
567 {
568  if ( ! FUpdate ) setPresetting ( 7 ) ;
569 }
570 
571 // Accesseurs en lecture
572 //----------------------
573 float OptionsVue :: getAlphaCoef ( int i ) const
574 {
575  assert(i>=0 && i<4);
576  return ( ( (float) FParEclatement [i] -> value ( ) ) / 100.0 ) ;
577 }
578 
579 float OptionsVue :: getSewposCoef ( int i ) const
580 {
581  assert(i>=0 && i<4);
582  return ( ( ( float ) FParPosition [i] -> value ( ) ) / 100.0 ) ;
583 }
584 
585 bool OptionsVue :: getSewDisplay ( int i ) const
586 {
587  assert(i>=0 && i<4);
588  return FParCouture [i] -> isChecked ( ) ;
589 }
590 
591 int OptionsVue :: getSewWidth ( int i ) const
592 {
593  assert(i>=0 && i<4);
594  return FParEpaisseur [i] -> value ( ) ;
595 }
596 
597 
599 {
600  return FInteractivite -> isChecked ( ) ;
601 }
602 
603 // Accesseurs en ecriture
604 //-----------------------
605 void OptionsVue :: setAlphaCoefs ( float v0 , float v1 , float v2 , float v3 )
606 {
607  bool update = FUpdate ;
608  FUpdate = true ;
609  setAlphaCoef ( 0 ,v0 ) ;
610  setAlphaCoef ( 1 ,v1 ) ;
611  setAlphaCoef ( 2 ,v2 ) ;
612  setAlphaCoef ( 3 ,v3 ) ;
613  FUpdate = update ;
614 
615  if ( getInteractive ( ) && !FUpdate ) {
616  FParent -> repaint ( ) ;
617  }
618 }
619 
620 void OptionsVue :: setSewposCoefs ( float v0 , float v1 , float v2 , float v3 )
621 {
622  bool update = FUpdate ;
623  FUpdate = true ;
624  setSewposCoef ( 0 , v0 ) ;
625  setSewposCoef ( 1 , v1 ) ;
626  setSewposCoef ( 2 , v2 ) ;
627  setSewposCoef ( 3 , v3 ) ;
628  FUpdate = update ;
629 
630  if ( getInteractive () && !FUpdate )
631  FParent -> repaint ( ) ;
632 }
633 
634 void OptionsVue :: setSewsDisplay ( bool b0 , bool b1 , bool b2 , bool b3 )
635 {
636  bool update = FUpdate ;
637  FUpdate = true ;
638  setSewDisplay ( 0 , b0 ) ;
639  setSewDisplay ( 1 , b1 ) ;
640  setSewDisplay ( 2 , b2 ) ;
641  setSewDisplay ( 3 , b3 ) ;
642  FUpdate = update ;
643 
644  if ( getInteractive () && !FUpdate )
645  FParent -> repaint ( ) ;
646 }
647 
648 void OptionsVue :: setAlphaCoef ( int i , float v )
649 {
650  assert ( i >= 0 ) ;
651  assert ( i < 4 ) ;
652  assert ( v >= 0 ) ;
653  assert ( v <= SCALE_MAX ) ;
654 
655  setValueEclatement ( v , i ) ;
656 
657  if ( getInteractive ( ) )
658  FParent -> getControler ( ) -> setMapBurstCoef ( i , v) ;
659 }
660 
661 void OptionsVue :: setSewposCoef ( int i , float v )
662 {
663  assert ( i >= 0 ) ;
664  assert ( i < 4 ) ;
665  assert ( v >= 0 ) ;
666  assert ( v <= 1 ) ;
667 
668  setValuePosition ( v , i ) ;
669  if ( getInteractive ( ) )
670  FParent -> getParameterSew ( ) -> setSewPosCoef ( i , v ) ;
671 }
672 
673 void OptionsVue :: setSewDisplay ( int i , bool b )
674 {
675  assert ( i >= 0 ) ;
676  assert ( i < 4 ) ;
677 
678  FParCouture [ i ] -> setChecked ( b ) ;
679 
680  FParPosition [ i ] -> setEnabled ( b &&
681  FParent -> getSewsDisplay ( ) ) ;
682  FParAffPosition [ i ] -> setEnabled ( b &&
683  FParent -> getSewsDisplay ( ) ) ;
684  FParEpaisseur [ i ] -> setEnabled( b &&
685  FParent -> getSewsDisplay ( ) ) ;
686 
687  if ( getInteractive ( ) )
688  FParent -> getParameterSew ( ) -> setDisplayAlpha ( i , b ) ;
689 
690 }
691 
692 void OptionsVue :: setSewWidth ( int i , int w )
693 {
694  assert ( i >= 0 ) ;
695  assert ( i <= 3 ) ;
696  assert ( w > 0 ) ;
697 
698  FParEpaisseur [ i ] -> setValue ( w ) ;
699 
700  if ( getInteractive ( ) )
701  FParent -> getParameterSew ( ) -> setLWSew ( i , w ) ;
702 }
703 
704 
706 {
707  FInteractivite -> setChecked ( b ) ;
708  FIAppliquer -> setEnabled ( !b ) ;
709  FIRecuperer -> setEnabled ( !b ) ;
710 
711  if ( b )
712  update ( ) ;
713 }
714 
716 {
717  for ( int i = 0 ; i < 4 ; ++i )
718  {
719  FParent-> getControler ( ) ->setMapBurstCoef ( i , getAlphaCoef ( i ) );
720  FParent-> getParameterSew()->setSewPosCoef ( i , getSewposCoef ( i ) );
721  FParent-> getParameterSew()->setDisplayAlpha ( i , getSewDisplay ( i ) );
722  FParent-> getParameterSew()->setLWSew ( i , getSewWidth ( i ) );
723  }
724 
725  FParentTab -> applyValues ( ) ;
726  FParent -> repaint ( ) ;
727 }
728 
730 {
731  switch ( P )
732  {
733  case Compact:
734  setAlphaCoefs( 1.00 , 1.00 , 1.00 , 1.00 ) ;
735  setSewposCoefs ( 1.0 , 0.0 , 1.0 , 1.0 ) ;
736  setSewsDisplay ( false , false , false , false ) ;
737  break ;
738  case SemiBurst:
739  setAlphaCoefs( 1.00 , 1.00 , 0.85 , 0.96 ) ;
740  setSewposCoefs ( 1.0 , 0.2 , 0.9 , 0.0 ) ;
741  setSewsDisplay ( false , true , true , true ) ;
742  break ;
743  case Burst:
744  setAlphaCoefs ( 1.00 , 1.00 , 0.80 , 0.50 );
745  setSewposCoefs ( 0.8 , 0.0 , 0.5 , 0.0 ) ;
746  setSewsDisplay ( false , true , true , true ) ;
747  break ;
748  case AltBurst:
749  setAlphaCoefs ( 0.90 , 0.90 , 0.90 , 0.90 );
750  setSewposCoefs ( 1.0 , 0.2 , 0.5 , 0.6 ) ;
751  setSewsDisplay ( true , true , true , true );
752  break ;
753  case VertexEmphase:
754  setAlphaCoefs ( 0.50 , 1.00 , 0.97 , 0.98 );
755  setSewposCoefs ( 1.0 , 0.1 , 0.9 , 0.5 ) ;
756  setSewsDisplay ( false, true , true , true );
757  break ;
758  case EdgeEmphase:
759  setAlphaCoefs ( 1.00 , 0.50 , 0.97 , 0.98 ) ;
760  setSewposCoefs ( 1.0 , 0.1 , 0.9 , 0.5 ) ;
761  setSewsDisplay ( true , false , true , true ) ;
762  break ;
763  case FaceEmphase:
764  setAlphaCoefs ( 1.00 , 1.00 , 0.50 , 0.96 ) ;
765  setSewposCoefs ( 1.0 , 0.1 , 0.9 , 0.5 ) ;
766  setSewsDisplay ( true , true , false, true ) ;
767  break ;
768  case VolumeEmphase:
769  setAlphaCoefs( 1.00 , 1.00 , 0.97 , 0.65 ) ;
770  setSewposCoefs ( 1.0 , 0.1 , 0.9 , 0.5) ;
771  setSewsDisplay ( true , true , true , false) ;
772  break ;
773  default: assert ( false ) ; break ;
774  }
775 
776 }
777 
778 void OptionsVue :: setValueEclatement ( TCoordinate c , int i )
779 {
780  FParEclatement [ i ] -> setValue ( int ( c * 100.0 ) ) ;
781  char ValEclatement [8] ;
782  sprintf ( ValEclatement , "%5.2f",
783  ( float ( FParEclatement [ i ] -> value ( ) ) ) / 100.0 ) ;
784  FParAffEclatement[i] -> setText ( ValEclatement ) ;
785 }
786 
787 void OptionsVue :: setValuePosition ( float f , int i )
788 {
789  FParPosition [ i ] -> setValue ( int ( f *100.0) ) ;
790  char ValPosition [8] ;
791  sprintf ( ValPosition , "%5.2f",
792  ( float ( FParPosition [ i ] -> value ( ) ) ) / 100.0 ) ;
793  FParAffPosition[i] -> setText ( ValPosition ) ;
794 }
795 
796