00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "dialog-translation.qt.hh"
00028 #include "window.qt.hh"
00029 #include "HtmlEntities.hh"
00030 #include "SpaceWidget.qt.hh"
00031
00032 #include <QtGui/QPixmap>
00033
00034
00035
00036 dialogTranslation :: dialogTranslation(Window * parent ,
00037 GMap3d :: CControlerGMap * controler)
00038 :
00039 dialogOperations(parent , new QString("Translation") ,
00040 controler , Qt::BottomToolBarArea)
00041
00042 {
00043 QIcon p1(":/boutonReinit.png") ;
00044 FReinit = new QPushButton(p1 , *HTML::decode("Réinitialiser")) ;
00045 FSaisieTranslate =
00046 new QCheckBox(*HTML::decode("Translation pondérée")) ;
00047
00048 QIcon p2(":/boutonAnnuler.png") ;
00049 FClose = new QPushButton(p2 , "Fermer") ;
00050 FClose -> setShortcut(Qt :: Key_Space) ;
00051
00052 FSaisie = new champsOperations(this) ;
00053
00054 addWidget(FReinit);
00055 addWidget(new SpaceWidget(SPACE_PIX_SIZE, 1));
00056 addWidget(FSaisieTranslate);
00057 addWidget(new SpaceWidget(SPACE_PIX_SIZE, 1));
00058 addWidget(FClose);
00059
00060 update() ;
00061
00062 connect(FSaisie -> getSaisieX() , SIGNAL(valueChanged(double)) ,
00063 this , SLOT(callbackVx())) ;
00064
00065 connect(FSaisie -> getSaisieY() , SIGNAL(valueChanged(double)) ,
00066 this , SLOT(callbackVy())) ;
00067
00068 connect(FSaisie -> getSaisieZ() , SIGNAL(valueChanged(double)) ,
00069 this , SLOT(callbackVz())) ;
00070
00071 connect(FSaisie -> getButtonRecuperer() , SIGNAL(clicked()) ,
00072 this, SLOT(callbackTakeVector())) ;
00073
00074 connect(FReinit , SIGNAL(clicked()) ,
00075 this , SLOT(callbackReinitVector())) ;
00076
00077 connect(FSaisieTranslate , SIGNAL(clicked()) ,
00078 this , SLOT(callbackTogglePonderation())) ;
00079
00080 connect(FClose , SIGNAL(clicked()) ,
00081 this , SLOT(callbackClose())) ;
00082 }
00083
00084
00085
00086 dialogTranslation :: ~dialogTranslation()
00087 {
00088 }
00089
00090
00091 void dialogTranslation :: update()
00092 {
00093 FUpdate = true ;
00094 dialogOperations :: update() ;
00095
00096 FSaisie->setValueX(getVx());
00097 FSaisie->setValueY(getVy());
00098 FSaisie->setValueZ(getVz());
00099
00100 FSaisieTranslate->setChecked(getControler()
00101 -> getObjectTranslationPonderation()) ;
00102
00103 FParent -> repaint() ;
00104 FUpdate = false ;
00105 }
00106
00107
00108
00109 void dialogTranslation :: callbackVx()
00110 {
00111 if (!FUpdate)
00112 setVx(FSaisie -> getValueX()) ;
00113 }
00114
00115 void dialogTranslation :: callbackVy()
00116 {
00117 if (!FUpdate)
00118 setVy(FSaisie -> getValueY()) ;
00119 }
00120
00121 void dialogTranslation :: callbackVz()
00122 {
00123 if (!FUpdate)
00124 setVz(FSaisie -> getValueZ()) ;
00125 }
00126
00127 void dialogTranslation :: callbackTakeVector()
00128 {
00129 assert(FParent != NULL);
00130 CVertex vector;
00131
00132 if (getControler() -> takeVector(vector))
00133 {
00134 setV(getV() + vector) ;
00135 FParent -> repaint() ;
00136 }
00137 }
00138
00139 void dialogTranslation :: callbackReinitVector()
00140 {
00141 setV(ORIGIN) ;
00142 }
00143
00144 void dialogTranslation :: callbackTogglePonderation()
00145 {
00146 getControler() -> toggleObjectTranslationPonderation() ;
00147 FParent -> repaint() ;
00148 }
00149
00150
00151
00152 TCoordinate dialogTranslation :: getVx() const
00153 {
00154 assert(FParent != NULL) ;
00155 return getControler() -> getObjectTranslationVector() . getX() ;
00156 }
00157
00158 TCoordinate dialogTranslation :: getVy() const
00159 {
00160 assert(FParent != NULL) ;
00161 return getControler() -> getObjectTranslationVector() . getY() ;
00162 }
00163
00164 TCoordinate dialogTranslation :: getVz() const
00165 {
00166 assert(FParent != NULL) ;
00167 return getControler() -> getObjectTranslationVector() . getZ() ;
00168 }
00169
00170 CVertex dialogTranslation :: getV()
00171 {
00172 assert(FParent != NULL) ;
00173 return getControler() -> getObjectTranslationVector() ;
00174 }
00175
00176
00177
00178 void dialogTranslation :: setVx(TCoordinate k)
00179 {
00180 setV(CVertex(k , getVy() , getVz())) ;
00181 }
00182
00183 void dialogTranslation :: setVy(TCoordinate k)
00184 {
00185 setV(CVertex(getVx() , k , getVz())) ;
00186 }
00187 void dialogTranslation :: setVz(TCoordinate k)
00188 {
00189 setV(CVertex(getVx() , getVy() , k)) ;
00190 }
00191
00192 void dialogTranslation :: setV(const CVertex & V)
00193 {
00194 assert(FParent != NULL) ;
00195 if (V == getV())
00196 return;
00197
00198 getControler() -> setObjectTranslationVector(V) ;
00199 update() ;
00200 }