Moka Ihm Qt
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
creation-sphere.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-sphere.qt.hh"
25 #include "window.qt.hh"
26 #include "HtmlEntities.hh"
27 #include "SpaceWidget.qt.hh"
28 
29 #include <QtGui/QLabel>
30 
31 /*******************************************************************/
32 /* CLASSE creationSphere */
33 /*******************************************************************/
34 // Constructeur
35 //-------------
36 
38  GMap3d :: CControlerGMap * controler) :
39  CreationObjet(parent , HTML::decode("Create sphere") ,
40  controler)
41 {
42  // Creation des widgets
43  FAffCar = new QLabel(*new QString(" Subdivisions: ") , this) ;
44  FAffPar = new QLabel(*HTML::decode("Parallels: ") , this) ;
45 
46  FSaisiePar = new QSpinBox(this) ;
47  FSaisiePar -> setMinimum(1);
48  FSaisiePar -> setMaximum(1000);
49  FSaisiePar -> setAccelerated(true);
50 
51  FAffMer = new QLabel("Meridians : " , this) ;
52 
53  FSaisieMer = new QSpinBox(this) ;
54  FSaisieMer -> setMinimum(3);
55  FSaisieMer -> setMaximum(1000);
56  FSaisieMer -> setAccelerated(true);
57 
58  addWidget(FAffCar);
59  addWidget(FAffPar);
60  addWidget(FSaisiePar);
61  addWidget(new SpaceWidget(SPACE_PIX_SIZE, 1));
62  addWidget(FAffMer);
63  addWidget(FSaisieMer);
64  addWidget(new SpaceWidget(SPACE_PIX_SIZE, 1));
65 
66  // Creation des boutons
67  FChoix = new BoutonsCreation(this) ;
68 
69  //*** Creation de la boite de positonnement ******
70  FPosit = new BoitePositionnement(this , parent , OBJECT_SPHERE) ;
71 
72  update() ;
73 
74  // Mise en place des ecoutes
75  QObject::connect(FSaisiePar , SIGNAL(valueChanged(int)) , this,
76  SLOT(callbackParallels())) ;
77  QObject::connect(FSaisieMer , SIGNAL(valueChanged(int)) , this,
78  SLOT(callbackMeridians())) ;
79 }
80 
81 // Destructeur
82 //------------
84 
85 // Methode de mise a jour
86 //-----------------------
88 {
90 
91  FSaisieMer -> setValue(FControler -> getParameterCreation()
92  -> getSphereNbMeridians()) ;
93  FSaisiePar -> setValue(FControler -> getParameterCreation()
94  -> getSphereNbParallels()) ;
95 }
96 
97 // Slots
98 //------
99 void CreationSphere :: callbackMeridians()
100 {
101  setMeridians(FSaisieMer -> value()) ;
102 }
103 
104 void CreationSphere :: callbackParallels()
105 {
106  setParallels(FSaisiePar -> value()) ;
107 }
108 
109 // Accesseurs
110 //-----------
111 void CreationSphere :: setMeridians(int nb)
112 {
113  FControler -> getParameterCreation() -> setSphereNbMeridians(nb) ;
114  update() ;
115  repaint() ;
116 }
117 
118 void CreationSphere :: setParallels(int nb)
119 {
120  FControler -> getParameterCreation() -> setSphereNbParallels(nb) ;
121  update() ;
122  repaint() ;
123 }