Moka Ihm Qt
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
creation-cylindre.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 "creation-cylindre.qt.hh"
25 #include "window.qt.hh"
26 #include "HtmlEntities.hh"
27 #include "SpaceWidget.qt.hh"
28 
29 #include <QtGui/QLabel>
30 
31 
32 /*******************************************************************/
33 /* CLASSE creationCylindre */
34 /*******************************************************************/
35 
36 // Constructeur
37 //-------------
39  GMap3d :: CControlerGMap * controler) :
40  CreationObjet(parent , HTML::decode("Create cylinder") ,
41  controler)
42 {
43  // creation des widget
44  FAffSub = new QLabel(" Subdivisions: " , this) ;
45  FAffPar = new QLabel(*HTML::decode("Parallels: ") , this) ;
46 
47  FSaisiePar = new QSpinBox(this) ;
48  FSaisiePar -> setMinimum(1);
49  FSaisiePar -> setMaximum(1000);
50  FSaisiePar -> setAccelerated(true);
51 
52  FAffMer = new QLabel(*HTML::decode("Meridians : ") , this) ;
53  FSaisieMer = new QSpinBox(this) ;
54  FSaisieMer -> setMinimum(3);
55  FSaisieMer -> setMaximum(1000);
56  FSaisieMer -> setAccelerated(true);
57 
58  FAffFaces = new QLabel(*HTML::decode("Faces created: ") ,
59  this) ;
60  FFace1 = new QCheckBox("Face 1" , this) ;
61  FFace2 = new QCheckBox("Face 2" , this) ;
62 
63  addWidget(FAffSub);
64  addWidget(FAffPar);
65  addWidget(FSaisiePar);
66  addWidget(new SpaceWidget(SPACE_PIX_SIZE, 1));
67  addWidget(FAffMer);
68  addWidget(FSaisieMer);
69  addWidget(new SpaceWidget(SPACE_PIX_SIZE, 1));
70  addWidget(FAffFaces);
71  addWidget(FFace1);
72  addWidget(FFace2);
73  addWidget(new SpaceWidget(SPACE_PIX_SIZE, 1));
74 
75  // Creation des boutons
76  FChoix = new BoutonsCreation(this) ;
77 
78  //*** Creation de la boite de positonnement ******
79  FPosit = new BoitePositionnement(this , parent , OBJECT_CYLINDER) ;
80 
81  update() ;
82  repaint() ;
83 
84 // Mise en place des ecouteurs
85  QObject::connect(FSaisiePar , SIGNAL(valueChanged(int)) , this,
86  SLOT(callbackParallels())) ;
87  QObject::connect(FSaisieMer , SIGNAL(valueChanged(int)) , this,
88  SLOT(callbackMeridians())) ;
89  QObject::connect(FFace1 , SIGNAL(clicked()) , this ,
90  SLOT(callbackCheckedButton1())) ;
91  QObject::connect(FFace2 , SIGNAL(clicked()) , this ,
92  SLOT(callbackCheckedButton2())) ;
93 }
94 
95 // Destructeur
96 //------------
98 
99 // Methode de mise a jour
100 //-----------------------
102 {
104 
105  FSaisieMer -> setValue(FControler -> getParameterCreation()
106  -> getCylinderNbMeridians());
107  FSaisiePar -> setValue(FControler->getParameterCreation()
108  ->getCylinderNbParallels());
109 
110  FFace1 -> setChecked(FControler->getParameterCreation()
111  ->getCylinderClosedUp());
112  FFace2 -> setChecked(FControler->getParameterCreation()
113  ->getCylinderClosedDown());
114 }
115 
116 // Accesseurs de modification
117 //----------------------------
118 void CreationCylindre :: setMeridians(int m)
119 {
120  FControler ->getParameterCreation()->setCylinderNbMeridians(m);
121  update();
122  repaint() ;
123 }
124 
125 void CreationCylindre :: setParallels(int p)
126 {
127  FControler ->getParameterCreation()->setCylinderNbParallels(p);
128  update();
129  repaint() ;
130 }
131 
132 void CreationCylindre :: setClosedBorder1(bool b)
133 {
134  FControler->getParameterCreation()->setCylinderClosedUp(b);
135  update() ;
136  repaint() ;
137 }
138 
139 void CreationCylindre :: setClosedBorder2(bool b)
140 {
141  FControler->getParameterCreation()->setCylinderClosedDown(b);
142  update() ;
143  repaint() ;
144 
145 }
146 
147 // Slots
148 //------
149 void CreationCylindre :: callbackMeridians()
150 {
151  setMeridians(FSaisieMer -> value());
152 }
153 
154 void CreationCylindre :: callbackParallels()
155 {
156  setParallels(FSaisiePar->value());
157 }
158 
159 void CreationCylindre :: callbackCheckedButton1()
160 {
161  setClosedBorder1(FFace1->isChecked());
162 }
163 
164 void CreationCylindre :: callbackCheckedButton2()
165 {
166  setClosedBorder2(FFace2->isChecked());
167 }