Moka Ihm Qt
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
creation-polygone.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-polygone.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 CreationPolygone */
33 /*******************************************************************/
34 
35 //***********************************************
36 // Constructeur
37 //***********************************************
39  GMap3d :: CControlerGMap * controler )
40  :
41  CreationObjet ( parent ,
42  HTML::decode("Create Regular Polygon" ),
43  controler ),
44  FModifie ( true )
45 {
46 
47  // Creation des widgets
48  FAffNom = new QLabel ( *HTML::decode(" Edge number: ") , this ) ;
49 
50  FSaisieNom = new QSpinBox ( this ) ;
51  FSaisieNom -> setMinimum ( 3 );
52  FSaisieNom -> setMaximum ( 999 );
53  FSaisieNom -> setValue ( 6 ) ;
54  FSaisieNom -> setAccelerated(true);
55 
56  FAffLon =
57  new QLabel ( *HTML::decode("Edge length: ") , this ) ;
58  FSaisieLon = new FloatSpinBox ( 0.2 , 0 , 1000 , 3 , 0.5 ) ;
59 
60  addWidget(FAffNom);
61  addWidget(FSaisieNom);
62  addWidget(new SpaceWidget(SPACE_PIX_SIZE,1));
63  addWidget(FAffLon);
64  addWidget(FSaisieLon);
65  addWidget(new SpaceWidget(SPACE_PIX_SIZE,1));
66 
67  // Creation des boutons
68 
69  FChoix = new BoutonsCreation ( this ) ;
70 
71  //*** Creation de la boite de positonnement ******
72  FPosit = new BoitePositionnement ( this , parent , OBJECT_POLYGON ) ;
73 
74  update ( ) ;
75  repaint ( ) ;
76 
77  QObject::connect ( FSaisieNom , SIGNAL ( valueChanged ( int ) ) , this,
78  SLOT ( callbackEdgesNumber() ) ) ;
79 
80  QObject::connect ( FSaisieLon , SIGNAL ( valueChanged ( double ) ) , this,
81  SLOT ( callbackEdgesLength() ) ) ;
82 }
83 
84 //****************************************************
85 // Destructeur
86 //****************************************************
88 
90 {
91  FModifie = false ;
93  FSaisieLon -> setValuef ( FControler -> getPolygonEdgesLength ( ) ) ;
94  FPosit -> update ( ) ;
95  FModifie = true ;
96 }
97 
98 //*****************************************************
99 // SLOTS
100 //*****************************************************
101 void CreationPolygone :: callbackEdgesNumber()
102 {
103  if ( FModifie )
105 }
106 
107 void CreationPolygone:: callbackEdgesLength()
108 {
109  if ( FModifie )
111 }
112 
113 // Accessseurs en lecture
114 //-----------------------
116 {
117  return FSaisieNom -> value ();
118 }
119 
121 {
122  return FSaisieLon -> valuef ();
123 }
124 
125 // Accesseurs en ecriture
126 // ----------------------
128 {
129  FControler -> setPolygonEdgesNumber ( n ) ;
130  update ( ) ;
131  repaint ( ) ;
132 }
133 
135 {
136  FControler -> setPolygonEdgesLength ( l ) ;
137 // FPosit -> update ( ) ;
138  update ( ) ;
139  repaint ( ) ;
140 }