Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

MainWindow Class Reference

#include <mainWindow.h>

List of all members.

Public Member Functions

 MainWindow (QWidget *parent, const char *nom=0)
 ~MainWindow ()
QWorkspace * getWorkspace ()
Window2DgetProfileWindow ()
Window2DgetSectionWindown ()
Window2DgetAxisWindow ()
Window3DgetOpenGLWondow ()

Private Slots

void slotAbout ()
void slotHelp ()
void slotNew ()
void slotOpen ()
void slotSave ()
void slotSaveAs ()
void slotDrawCircle ()
void slotDrawSegment ()
void slotDrawBezier ()
void slotDrawBSpline ()
void slotTile ()
void slotCascade ()
void slotImportVRML ()
void slotExportVRML ()
void slotImportPGN ()
void slotExportPGN ()
void slotSimpleExtrusion ()
void slotProfileExtrusion ()
void slotRefreshSimpleExtrusion ()
void slotRefreshProfileExtrusion ()
void slotChangeSample ()
void updateStatusBar ()
void closeEvent (QCloseEvent *e)
void resizeEvent (QResizeEvent *)
void changeWindow ()
void clearActiveWindow ()

Private Member Functions

void createActions ()
void createMenus ()
void createToolsBar ()
void createStatusBar ()

Private Attributes

QPopupMenu * menuFile
QAction * actionOpen
QAction * actionNew
QAction * actionSave
QAction * actionSaveAs
QPopupMenu * subMenuImport
QAction * actionImportVRML
QAction * actionImportPGN
QPopupMenu * subMenuExport
QAction * actionExportVRML
QAction * actionExportPGN
QAction * actionQuit
QPopupMenu * menuPrimitives
QAction * actionSegment
QAction * actionCircle
QAction * actionBezier
QAction * actionBSpline
QPopupMenu * menuExtrusion
QAction * actionSimpleExtrusion
QAction * actionProfileExtrusion
QPopupMenu * menuDisplay
QAction * actionTile
QAction * actionCascade
QPopupMenu * menuHelp
QToolBar * barFile
QToolBar * barPrimitives
QToolBar * barDisplay
QToolBar * barTwist
QSpinBox * spinboxTwist
QToolBar * barSample
QComboBox * sampleComboBox
QAction * actionChangeSample
QWorkspace * workspace
Window2Dprofile
Window2Dsection
Window2Daxis
Window3Dopengl
QAction * changeWin
QAction * clearWindow
QLabel * infos
QString filename
QTimer * timerSimpleExtrusion
QTimer * timerProfileExtrusion


Detailed Description

La classe MainWindow regroupe l'ensemble des fonctionnalités nécéssaires à la génération de cylindres généralisés. Il s'agit de la fenetre principale contenant 3 fenetres 2D (axe, profil et section) et d'une fenetre 3D où est générée le cylindre.

Author:
Guitteny Fabrice

Idiart Baptiste

Le Goff Erwan


Constructor & Destructor Documentation

MainWindow::MainWindow QWidget *  parent,
const char *  nom = 0
 

00005 : QMainWindow(parent, name) 00006 { 00007 setCaption(name); 00008 00009 workspace = new QWorkspace(this,"espace de travail"); 00010 setCentralWidget(workspace); 00011 00012 createActions(); 00013 createMenus(); 00014 createToolsBar(); 00015 createStatusBar(); 00016 00017 axis = new Window2D(workspace,"axe"); 00018 section = new Window2D(workspace,"section"); 00019 profile = new Window2D(workspace,"profil"); 00020 opengl = new Window3D(workspace,"visualisation 3D"); 00021 00022 showMaximized(); 00023 workspace->tile(); 00024 00025 filename = "nouveau"; 00026 }

MainWindow::~MainWindow  ) 
 

00029 { 00030 delete axis; 00031 delete section; 00032 delete profile; 00033 delete opengl; 00034 00035 delete workspace; 00036 00037 delete actionSegment; 00038 delete actionCircle; 00039 delete actionBezier; 00040 delete actionBSpline; 00041 00042 delete actionOpen; 00043 delete actionNew; 00044 delete actionSave; 00045 delete actionSaveAs; 00046 delete actionImportVRML; 00047 delete actionImportPGN; 00048 delete actionExportVRML; 00049 delete actionExportPGN; 00050 delete actionQuit; 00051 00052 delete actionSimpleExtrusion; 00053 delete actionProfileExtrusion; 00054 00055 delete actionTile; 00056 delete actionCascade; 00057 delete changeWin; 00058 delete clearWindow; 00059 00060 delete actionChangeSample; 00061 00062 delete subMenuImport; 00063 delete subMenuExport; 00064 delete menuPrimitives; 00065 delete menuExtrusion; 00066 delete menuDisplay; 00067 delete menuHelp; 00068 00069 delete spinboxTwist; 00070 delete sampleComboBox; 00071 delete infos; 00072 00073 delete barFile; 00074 delete barPrimitives; 00075 delete barDisplay; 00076 delete barTwist; 00077 delete barSample; 00078 00079 delete timerSimpleExtrusion; 00080 delete timerProfileExtrusion; 00081 }


Member Function Documentation

void MainWindow::changeWindow  )  [private, slot]
 

00649 { 00650 00651 QString name = this->getWorkspace()->activeWindow()->name(); 00652 if (name == "axe") 00653 section->setFocus(); 00654 if (name == "section") 00655 profile->setFocus(); 00656 if (name == "profil") 00657 opengl->setFocus(); 00658 if (name == "visualisation 3D") 00659 axis->setFocus(); 00660 updateStatusBar(); 00661 }

void MainWindow::clearActiveWindow  )  [private, slot]
 

00664 { 00665 timerSimpleExtrusion->stop(); 00666 timerProfileExtrusion->stop(); 00667 QString name = this->getWorkspace()->activeWindow()->name(); 00668 if (name == "axe") 00669 axis->clear(); 00670 if (name == "section") 00671 section->clear(); 00672 if (name == "profil") 00673 profile->clear(); 00674 if (name == "visualisation 3D") 00675 opengl->clear(); 00676 }

void MainWindow::closeEvent QCloseEvent *  e  )  [private, slot]
 

00401 { 00402 QMainWindow::closeEvent( e ); 00403 }

void MainWindow::createActions  )  [private]
 

00084 { 00085 actionSegment = new QAction(tr("Segment"),Key_F1 ,this); 00086 actionSegment->setIconSet(QPixmap::fromMimeSource("src/interface/icones/segment.png")); 00087 actionSegment->setStatusTip(tr("Dessiner un segment")); 00088 connect(actionSegment,SIGNAL(activated()),this,SLOT(slotDrawSegment())); 00089 00090 actionCircle = new QAction(tr("Cercle"),Key_F2 ,this); 00091 actionCircle->setIconSet(QPixmap::fromMimeSource("src/interface/icones/cercle.png")); 00092 actionCircle->setStatusTip(tr("Dessiner un cercle")); 00093 connect(actionCircle,SIGNAL(activated()),this,SLOT(slotDrawCircle())); 00094 00095 actionBezier = new QAction(tr("Bézier"),Key_F3 ,this); 00096 actionBezier->setIconSet(QPixmap::fromMimeSource("src/interface/icones/bezier.png")); 00097 actionBezier->setStatusTip(tr("Dessiner une courbe de Bézier")); 00098 connect(actionBezier,SIGNAL(activated()),this,SLOT(slotDrawBezier())); 00099 00100 actionBSpline = new QAction(tr("BSpline"),Key_F4 ,this); 00101 actionBSpline->setIconSet(QPixmap::fromMimeSource("src/interface/icones/bspline.png")); 00102 actionBSpline->setStatusTip(tr("Dessiner une BSpline")); 00103 connect(actionBSpline,SIGNAL(activated()),this,SLOT(slotDrawBSpline())); 00104 00105 actionNew = new QAction(tr("Nouveau"),tr("Ctrl+N"),this); 00106 actionNew->setIconSet(QPixmap::fromMimeSource("src/interface/icones/nouveau.png")); 00107 actionNew->setStatusTip(tr("Creation d'un nouveau document")); 00108 connect(actionNew,SIGNAL(activated()),this,SLOT(slotNew())); 00109 00110 actionOpen = new QAction(tr("Ouvrir"),tr("Ctrl+O"),this); 00111 actionOpen->setIconSet(QPixmap::fromMimeSource("src/interface/icones/ouvrir.png")); 00112 actionOpen->setStatusTip(tr("Ouverture d'un document existant")); 00113 connect(actionOpen,SIGNAL(activated()),this,SLOT(slotOpen())); 00114 00115 actionSave = new QAction(tr("Enregistrer"),tr("Ctrl+S"),this); 00116 actionSave->setIconSet(QPixmap::fromMimeSource("src/interface/icones/sauver.png")); 00117 connect(actionSave,SIGNAL(activated()),this,SLOT(slotSave())); 00118 00119 actionSaveAs = new QAction(tr("Enregistrer sous..."),tr(""),this); 00120 actionSaveAs->setIconSet(QPixmap::fromMimeSource("src/interface/icones/sauver.png")); 00121 connect(actionSaveAs,SIGNAL(activated()),this,SLOT(slotSaveAs())); 00122 00123 actionQuit = new QAction(tr("Quitter"),tr("Ctrl+Q"),this); 00124 connect(actionQuit,SIGNAL(activated()),this,SLOT(close())); 00125 00126 actionImportVRML = new QAction("VRML",tr(""),this); 00127 connect(actionImportVRML,SIGNAL(activated()),this,SLOT(slotImportVRML())); 00128 00129 actionExportVRML = new QAction("VRML",tr(""),this); 00130 connect(actionExportVRML,SIGNAL(activated()),this,SLOT(slotExportVRML())); 00131 00132 actionImportPGN = new QAction("PGN",tr(""),this); 00133 connect(actionImportPGN,SIGNAL(activated()),this,SLOT(slotImportPGN())); 00134 00135 actionExportPGN = new QAction("PGN",tr(""),this); 00136 connect(actionExportPGN,SIGNAL(activated()),this,SLOT(slotExportPGN())); 00137 00138 actionSimpleExtrusion = new QAction("Extrusion simple",Key_F9,this); 00139 connect(actionSimpleExtrusion,SIGNAL(activated()),this,SLOT(slotSimpleExtrusion())); 00140 00141 actionProfileExtrusion = new QAction("Extrusion selon le profil",Key_F10,this); 00142 connect(actionProfileExtrusion,SIGNAL(activated()),this,SLOT(slotProfileExtrusion())); 00143 00144 actionTile = new QAction(tr("Tile"),tr("Ctrl+T"),this); 00145 actionTile->setIconSet(QPixmap::fromMimeSource("src/interface/icones/tile.png")); 00146 connect(actionTile,SIGNAL(activated()),this,SLOT(slotTile())); 00147 00148 actionCascade = new QAction(tr("Cascade"),tr("Ctrl+D"),this); 00149 actionCascade->setIconSet(QPixmap::fromMimeSource("src/interface/icones/cascade.png")); 00150 connect(actionCascade,SIGNAL(activated()),this,SLOT(slotCascade())); 00151 00152 changeWin = new QAction(tr("Changement de fenêtre"),Key_Tab,this); 00153 changeWin->setIconSet(QPixmap::fromMimeSource("src/interface/icones/change.png")); 00154 connect(changeWin,SIGNAL(activated()),this,SLOT(changeWindow())); 00155 connect(workspace,SIGNAL(windowActivated(QWidget*)),this,SLOT(updateStatusBar())); 00156 00157 clearWindow = new QAction(tr("Effacer la fenêtre active"),Key_F5,this); 00158 clearWindow->setIconSet(QPixmap::fromMimeSource("src/interface/icones/clear.png")); 00159 connect(clearWindow,SIGNAL(activated()),this,SLOT(clearActiveWindow())); 00160 00161 timerSimpleExtrusion = new QTimer( this, "RefreshSE" ); 00162 connect(timerSimpleExtrusion, SIGNAL(timeout()), this, SLOT(slotRefreshSimpleExtrusion())); 00163 00164 timerProfileExtrusion = new QTimer( this, "RefreshPE" ); 00165 connect(timerProfileExtrusion, SIGNAL(timeout()), this, SLOT(slotRefreshProfileExtrusion())); 00166 00167 actionChangeSample = new QAction(tr("Changement d'echantillonage"), tr(""), this); 00168 actionChangeSample->setIconSet(QPixmap::fromMimeSource("src/interface/icones/ok.png")); 00169 connect(actionChangeSample, SIGNAL(activated()), this, SLOT(slotChangeSample())) ; 00170 }

void MainWindow::createMenus  )  [private]
 

00175 { 00176 00177 00178 /**************************************************Menu Fichier*******************************************************/ 00179 menuFile = new QPopupMenu(this); 00180 00181 actionNew->addTo( menuFile); 00182 actionOpen->addTo( menuFile); 00183 actionSave->addTo( menuFile); 00184 actionSaveAs->addTo( menuFile); 00185 menuFile->insertSeparator(); 00186 00187 //sous-menu importer 00188 subMenuImport = new QPopupMenu(this); 00189 actionImportVRML->addTo(subMenuImport); 00190 actionImportPGN->addTo(subMenuImport); 00191 menuFile->insertItem("Importer",subMenuImport); 00192 00193 //sous-menu exporter 00194 subMenuExport = new QPopupMenu(this); 00195 actionExportVRML->addTo(subMenuExport); 00196 actionExportPGN->addTo(subMenuExport); 00197 menuFile->insertItem("Exporter",subMenuExport); 00198 00199 menuFile->insertSeparator(); 00200 00201 actionQuit->addTo(menuFile); 00202 00203 menuBar()->insertItem(tr("Fichier"),menuFile); 00204 00205 /**************************************************Menu Primitives*******************************************************/ 00206 00207 menuPrimitives = new QPopupMenu(this); 00208 00209 actionSegment->addTo( menuPrimitives); 00210 actionCircle->addTo( menuPrimitives); 00211 actionBezier->addTo( menuPrimitives); 00212 actionBSpline->addTo( menuPrimitives); 00213 00214 menuPrimitives->insertSeparator(); 00215 00216 menuBar()->insertItem(tr("Primitives"),menuPrimitives); 00217 00218 /**************************************************Menu Extrusion*******************************************************/ 00219 menuExtrusion = new QPopupMenu(this); 00220 00221 actionSimpleExtrusion->addTo(menuExtrusion); 00222 actionProfileExtrusion->addTo(menuExtrusion); 00223 00224 menuBar()->insertItem(tr("Extrusion"),menuExtrusion); 00225 00226 /**************************************************Menu Affichage*******************************************************/ 00227 menuDisplay = new QPopupMenu(this); 00228 00229 clearWindow->addTo(menuDisplay); 00230 changeWin->addTo(menuDisplay); 00231 menuDisplay->insertSeparator(); 00232 actionTile->addTo(menuDisplay); 00233 actionCascade->addTo(menuDisplay); 00234 00235 menuBar()->insertItem(tr("Affichage"),menuDisplay); 00236 00237 /**************************************************Menu Aide************************************************************/ 00238 menuHelp = new QPopupMenu(this); 00239 00240 menuHelp->insertItem("Aide",this,SLOT(slotHelp())); 00241 menuHelp->insertSeparator(); 00242 menuHelp->insertItem("A propos du GCG",this,SLOT(slotAbout())); 00243 menuHelp->insertItem("A propos de Qt",qApp,SLOT(aboutQt())); 00244 menuBar()->insertItem(tr("Aide"),menuHelp); 00245 }

void MainWindow::createStatusBar  )  [private]
 

00286 { 00287 infos = new QLabel(this); 00288 statusBar()->addWidget(infos); 00289 updateStatusBar(); 00290 }

void MainWindow::createToolsBar  )  [private]
 

00249 { 00250 barFile = new QToolBar( tr("Fichier"),this); 00251 actionNew->addTo( barFile ); 00252 actionOpen->addTo( barFile ); 00253 actionSave->addTo( barFile ); 00254 00255 barPrimitives = new QToolBar( tr("Primitives"),this); 00256 actionSegment->addTo(barPrimitives); 00257 actionCircle->addTo(barPrimitives); 00258 actionBezier->addTo(barPrimitives); 00259 actionBSpline->addTo(barPrimitives); 00260 00261 barDisplay = new QToolBar( tr("Affichage"),this); 00262 clearWindow->addTo(barDisplay); 00263 changeWin->addTo(barDisplay); 00264 actionTile->addTo(barDisplay); 00265 actionCascade->addTo(barDisplay); 00266 00267 barTwist = new QToolBar( tr("Torsion"),this); 00268 QLabel *labelTwist; 00269 labelTwist = new QLabel("Torsion (degrés)", barTwist); 00270 spinboxTwist = new QSpinBox(barTwist, "torsion"); 00271 spinboxTwist->setMaxValue( 360 * 5 ); 00272 spinboxTwist->setMinValue( - 360 * 5 ); 00273 00274 barSample = new QToolBar( tr("Echantillonage"), this); 00275 QLabel *labelSample; 00276 labelSample = new QLabel("Echantillonage", barSample); 00277 sampleComboBox = new QComboBox(barSample, "sampleComboBox"); 00278 sampleComboBox->insertItem("FAIBLE", 0); 00279 sampleComboBox->insertItem("NORMAL", 1); 00280 sampleComboBox->insertItem("FORT", 2); 00281 sampleComboBox->setCurrentItem(1); 00282 actionChangeSample->addTo(barSample); 00283 }

Window2D* MainWindow::getAxisWindow  )  [inline]
 

Returns:
pointeur sur la fenetre 2D repésentant l'axe.

00081 {return axis;}

Window3D* MainWindow::getOpenGLWondow  )  [inline]
 

Returns:
pointeur sur la fenetre 3D.

00084 {return opengl;}

Window2D* MainWindow::getProfileWindow  )  [inline]
 

Returns:
pointeur sur la fenetre 2D repésentant le profil.

00075 {return profile;}

Window2D* MainWindow::getSectionWindown  )  [inline]
 

Returns:
pointeur sur la fenetre 2D repésentant la section.

00078 {return section;}

QWorkspace* MainWindow::getWorkspace  )  [inline]
 

Returns:
pointeur sur l'espace de travail composé des 4 fenêtres.

00072 {return workspace;}

void MainWindow::resizeEvent QResizeEvent *   )  [private, slot]
 

00680 { 00681 workspace->tile(); 00682 }

void MainWindow::slotAbout  )  [private, slot]
 

00388 { 00389 QMessageBox::about(this, 00390 tr("A propos"), 00391 tr("Générateur de Cylindres Généralisés\tv1.0\n" 00392 "\nAuteurs :\n" 00393 "\tGUITTENY Fabrice\n" 00394 "\tIDIART Baptiste\n" 00395 "\tLE GOFF Erwan") 00396 ); 00397 }

void MainWindow::slotCascade  )  [private, slot]
 

00444 { 00445 this->getWorkspace()->cascade(); 00446 }

void MainWindow::slotChangeSample  )  [private, slot]
 

00707 { 00708 int newSample = sampleComboBox->currentItem(); 00709 int sample = NORMAL_SAMPLE; 00710 00711 switch (newSample) 00712 { 00713 case 0 : sample = LOW_SAMPLE; break; 00714 case 1 : sample = NORMAL_SAMPLE; break; 00715 case 2 : sample = ACCURATE_SAMPLE; break; 00716 default : sample = NORMAL_SAMPLE; break; 00717 } 00718 00719 axis->setSample(sample); 00720 section->setSample(sample); 00721 profile->setSample(sample); 00722 }

void MainWindow::slotDrawBezier  )  [private, slot]
 

00474 { 00475 profile->setTypePrimitive(BEZIER); 00476 axis->setTypePrimitive(BEZIER); 00477 section->setTypePrimitive(BEZIER); 00478 profile->update(); 00479 section->update(); 00480 axis->update(); 00481 updateStatusBar(); 00482 }

void MainWindow::slotDrawBSpline  )  [private, slot]
 

00486 { 00487 profile->setTypePrimitive(BSPLINE); 00488 axis->setTypePrimitive(BSPLINE); 00489 section->setTypePrimitive(BSPLINE); 00490 profile->update(); 00491 section->update(); 00492 axis->update(); 00493 updateStatusBar(); 00494 }

void MainWindow::slotDrawCircle  )  [private, slot]
 

00462 { 00463 profile->setTypePrimitive(CIRCLE); 00464 axis->setTypePrimitive(CIRCLE); 00465 section->setTypePrimitive(CIRCLE); 00466 profile->update(); 00467 section->update(); 00468 axis->update(); 00469 updateStatusBar(); 00470 }

void MainWindow::slotDrawSegment  )  [private, slot]
 

00450 { 00451 profile->setTypePrimitive(SEGMENT); 00452 axis->setTypePrimitive(SEGMENT); 00453 section->setTypePrimitive(SEGMENT); 00454 profile->update(); 00455 section->update(); 00456 axis->update(); 00457 updateStatusBar(); 00458 }

void MainWindow::slotExportPGN  )  [private, slot]
 

00547 { 00548 QString name = QFileDialog::getSaveFileName (QString::null, "PGN (*.pgn)", this); 00549 if ( (!name.isEmpty()) &&(!opengl->isEmpty()) ) 00550 { 00551 if (name.contains(".pgn") == 0) 00552 name += ".pgn"; 00553 PgnParser *pgn = new PgnParser(); 00554 int nbPoints; 00555 int nbPolys; 00556 vector<Point3D*> pointsList; 00557 vector<int> referencesList; 00558 opengl->exportOGL(nbPoints, nbPolys, pointsList, referencesList); 00559 pgn->setParameters(nbPoints, nbPolys, pointsList, referencesList); 00560 pgn->exportPGN(name); 00561 } 00562 }

void MainWindow::slotExportVRML  )  [private, slot]
 

00513 { 00514 QString name = QFileDialog::getSaveFileName (QString::null, "VRML (*.wrl)", this); 00515 if ( (!name.isEmpty())&&(!opengl->isEmpty()) ) 00516 { 00517 if (name.contains(".wrl") == 0) 00518 name += ".wrl"; 00519 VrmlParser *vrml = new VrmlParser(); 00520 int nbPoints; 00521 int nbPolys; 00522 vector<Point3D*> pointsList; 00523 vector<int> referencesList; 00524 opengl->exportOGL(nbPoints, nbPolys, pointsList, referencesList); 00525 vrml->setParameters(nbPoints, nbPolys, pointsList, referencesList); 00526 vrml->exportVrml(name); 00527 } 00528 }

void MainWindow::slotHelp  )  [private, slot]
 

00379 { 00380 QMessageBox::about(this, 00381 tr("Aide"), 00382 tr("Générateur de Cylindres Généralisés\tv1.0\n" "voir README.txt et CylinderGenerator/doc/index.html\n")); 00383 }

void MainWindow::slotImportPGN  )  [private, slot]
 

00532 { 00533 timerSimpleExtrusion->stop(); 00534 timerProfileExtrusion->stop(); 00535 QString file_PGN = QFileDialog::getOpenFileName(QString::null, "PGN (*.pgn)", this); 00536 if (!file_PGN.isEmpty()) 00537 { 00538 PgnParser *pgn = new PgnParser(); 00539 pgn->importPGN(file_PGN); 00540 opengl->clear(); 00541 opengl->load(pgn->getNbPoints(), pgn->getNbPolys(), pgn->getPointsList(), pgn->getReferencesList()); 00542 } 00543 }

void MainWindow::slotImportVRML  )  [private, slot]
 

00498 { 00499 timerSimpleExtrusion->stop(); 00500 timerProfileExtrusion->stop(); 00501 QString vrmlFile = QFileDialog::getOpenFileName(QString::null, "VRML (*.wrl)", this); 00502 if (!vrmlFile.isEmpty()) 00503 { 00504 VrmlParser *vrml = new VrmlParser(); 00505 vrml->importVrml(vrmlFile); 00506 opengl->clear(); 00507 opengl->load(vrml->getNbPoints(), vrml->getNbPolys(), vrml->getPointsList(), vrml->getReferencesList()); 00508 } 00509 }

void MainWindow::slotNew  )  [private, slot]
 

00338 { 00339 filename = "nouveau"; 00340 spinboxTwist->setValue(0); 00341 sampleComboBox->setCurrentItem(1); 00342 stringstream str; 00343 str << "Générateur de Cylindres Généralisés - " << filename; 00344 setCaption(str.str()); 00345 profile->clear(); 00346 section->clear(); 00347 axis->clear(); 00348 opengl->clear(); 00349 timerSimpleExtrusion->stop(); 00350 timerProfileExtrusion->stop(); 00351 }

void MainWindow::slotOpen  )  [private, slot]
 

00356 { 00357 00358 QString name = QFileDialog::getOpenFileName (QString::null, "XML (*.xml)", this); 00359 if (!name.isEmpty() ) 00360 { 00361 Modelml mml; 00362 profile->load(mml.load(name)[0]); 00363 section->load(mml.load(name)[1]); 00364 axis->load(mml.load(name)[2]); 00365 opengl->clear(); 00366 spinboxTwist->setValue(0); 00367 sampleComboBox->setCurrentItem(1); 00368 filename = name; 00369 stringstream str; 00370 str << "Générateur de Cylindres Généralisés - " << filename; 00371 setCaption(str.str()); 00372 timerSimpleExtrusion->stop(); 00373 timerProfileExtrusion->stop(); 00374 } 00375 }

void MainWindow::slotProfileExtrusion  )  [private, slot]
 

00601 { 00602 timerSimpleExtrusion->stop(); 00603 opengl->clear(); 00604 if (axis->getPrimitivesList().size() == 0) 00605 { 00606 QMessageBox *mbox = new QMessageBox(QString("ERREUR"),QString("Pas de primitives dans la fenêtre Axe!"), 00607 QMessageBox::Critical,QMessageBox::Ok,QMessageBox::NoButton, 00608 QMessageBox::NoButton,this); 00609 mbox->show(); 00610 } 00611 else 00612 if (section->getPrimitivesList().size() == 0) 00613 { 00614 QMessageBox *mbox = new QMessageBox(QString("ERREUR"),QString("Pas de primitives dans la fenêtre Section !"), 00615 QMessageBox::Critical,QMessageBox::Ok,QMessageBox::NoButton, 00616 QMessageBox::NoButton,this); 00617 mbox->show(); 00618 } 00619 else 00620 if (profile->getPrimitivesList().size() == 0) 00621 { 00622 QMessageBox *mbox = new QMessageBox(QString("ERREUR"), QString("Pas de primitives dans la fenêtre Profil !"), 00623 QMessageBox::Critical,QMessageBox::Ok, QMessageBox::NoButton, 00624 QMessageBox::NoButton, this); 00625 mbox->show(); 00626 } 00627 else 00628 { 00629 int twistAngle = spinboxTwist->value(); 00630 axis->changeCoordinateSystemWindow(); 00631 section->changeCoordinateSystemWindow(); 00632 profile->changeCoordinateSystemWindow(); 00633 Cylinder generalizedCylinder = Cylinder(axis->getPrimitivesList(), section->getPrimitivesList(), profile->getPrimitivesList()); 00634 vector<Point3D *> points; 00635 vector<int> facets; 00636 generalizedCylinder.setClosedSection(section->closedShape); 00637 generalizedCylinder.setTwist(twistAngle); 00638 generalizedCylinder.profileExtrusion(points,facets); 00639 opengl->load(points.size(), facets.size() / 3, points, facets); 00640 axis->changeCoordinateSystemReverseWindow(); 00641 section->changeCoordinateSystemReverseWindow(); 00642 profile->changeCoordinateSystemReverseWindow(); 00643 timerProfileExtrusion->start(1000); 00644 } 00645 }

void MainWindow::slotRefreshProfileExtrusion  )  [private, slot]
 

00695 { 00696 if((profile->isModified()) || (section->isModified()) || (axis->isModified())) 00697 { 00698 slotProfileExtrusion(); 00699 profile->setModified(); 00700 section->setModified(); 00701 axis->setModified(); 00702 } 00703 }

void MainWindow::slotRefreshSimpleExtrusion  )  [private, slot]
 

00684 { 00685 if((profile->isModified()) || (section->isModified()) || (axis->isModified())) 00686 { 00687 slotSimpleExtrusion(); 00688 profile->setModified(); 00689 section->setModified(); 00690 axis->setModified(); 00691 } 00692 }

void MainWindow::slotSave  )  [private, slot]
 

00408 { 00409 if (filename != "nouveau") 00410 { 00411 Modelml mml; 00412 mml.save(filename, profile -> getPrimitivesList(), section -> getPrimitivesList(), axis -> getPrimitivesList()); 00413 } 00414 else 00415 slotSaveAs(); 00416 }

void MainWindow::slotSaveAs  )  [private, slot]
 

00421 { 00422 QString name = QFileDialog::getSaveFileName (QString::null, "XML (*.xml)", this); 00423 if (!name.isEmpty()) 00424 { 00425 Modelml mml; 00426 if (name.contains(".xml") == 0) 00427 name += ".xml"; 00428 mml.save(name, profile->getPrimitivesList(), section->getPrimitivesList(), axis->getPrimitivesList()); 00429 filename = name; 00430 stringstream str; 00431 str << "Générateur de Cylindres Généralisés - " << filename; 00432 setCaption(str.str()); 00433 } 00434 }

void MainWindow::slotSimpleExtrusion  )  [private, slot]
 

00566 { 00567 timerProfileExtrusion->stop(); 00568 opengl->clear(); 00569 if (axis->getPrimitivesList().size() == 0) { 00570 QMessageBox *mbox = new QMessageBox(QString("ERREUR"),QString("Pas de primitives dans la fenêtre Axe!"), 00571 QMessageBox::Critical,QMessageBox::Ok,QMessageBox::NoButton, 00572 QMessageBox::NoButton,this); 00573 mbox->show(); 00574 } 00575 else 00576 if (section->getPrimitivesList().size() == 0){ 00577 QMessageBox *mbox = new QMessageBox(QString("ERREUR"),QString("Pas de primitives dans la fenêtre Section !"), 00578 QMessageBox::Critical,QMessageBox::Ok,QMessageBox::NoButton, 00579 QMessageBox::NoButton,this); 00580 mbox->show(); 00581 } 00582 else 00583 { 00584 int twistAngle = spinboxTwist->value(); 00585 axis->changeCoordinateSystemWindow(); 00586 section->changeCoordinateSystemWindow(); 00587 Cylinder generalizedCylinder = Cylinder(axis->getPrimitivesList(), section->getPrimitivesList()); 00588 vector<Point3D *> points; 00589 vector<int> facets; 00590 generalizedCylinder.setClosedSection(section->closedShape); 00591 generalizedCylinder.setTwist(twistAngle); 00592 generalizedCylinder.simpleExtrusion(points, facets); 00593 opengl->load(points.size(), facets.size() / 3, points, facets); 00594 axis->changeCoordinateSystemReverseWindow(); 00595 section->changeCoordinateSystemReverseWindow(); 00596 timerSimpleExtrusion->start(1000); 00597 } 00598 }

void MainWindow::slotTile  )  [private, slot]
 

00438 { 00439 this->getWorkspace()->tile(); 00440 }

void MainWindow::updateStatusBar  )  [private, slot]
 

00295 { 00296 QString info = "fenêtre "; 00297 00298 if (this->getWorkspace()->activeWindow()) 00299 { 00300 QString windowName = this->getWorkspace()->activeWindow()->name(); 00301 stringstream nameTypePrim; 00302 int typePrim = SEGMENT; 00303 00304 if (windowName == "axe") 00305 typePrim = axis->getTypePrimitive(); 00306 00307 if (windowName == "section") 00308 typePrim = section->getTypePrimitive(); 00309 00310 if (windowName == "profil") 00311 typePrim = profile->getTypePrimitive(); 00312 00313 if (windowName != "visualisation 3D") 00314 { 00315 switch (typePrim) 00316 { 00317 case SEGMENT : nameTypePrim << "Primitive SEGMENT"; break; 00318 case CIRCLE : nameTypePrim << "Primitive CERCLE"; break; 00319 case BEZIER : nameTypePrim << "Primitive BEZIER"; break; 00320 case BSPLINE : nameTypePrim << "Primitive BSPLINE"; break; 00321 default : break; 00322 } 00323 00324 info += windowName + " --> " + nameTypePrim.str(); 00325 } 00326 else 00327 info = "fenêtre : visualisation 3D"; 00328 } 00329 else 00330 info = "fenêtre : axe --> Primitive SEGMENT"; 00331 00332 infos->setText(info); 00333 }


Member Data Documentation

QAction* MainWindow::actionBezier [private]
 

QAction* MainWindow::actionBSpline [private]
 

QAction* MainWindow::actionCascade [private]
 

QAction* MainWindow::actionChangeSample [private]
 

QAction* MainWindow::actionCircle [private]
 

QAction* MainWindow::actionExportPGN [private]
 

QAction* MainWindow::actionExportVRML [private]
 

QAction* MainWindow::actionImportPGN [private]
 

QAction* MainWindow::actionImportVRML [private]
 

QAction* MainWindow::actionNew [private]
 

QAction* MainWindow::actionOpen [private]
 

QAction* MainWindow::actionProfileExtrusion [private]
 

QAction* MainWindow::actionQuit [private]
 

QAction* MainWindow::actionSave [private]
 

QAction* MainWindow::actionSaveAs [private]
 

QAction* MainWindow::actionSegment [private]
 

QAction* MainWindow::actionSimpleExtrusion [private]
 

QAction* MainWindow::actionTile [private]
 

Window2D* MainWindow::axis [private]
 

QToolBar* MainWindow::barDisplay [private]
 

QToolBar* MainWindow::barFile [private]
 

QToolBar* MainWindow::barPrimitives [private]
 

QToolBar* MainWindow::barSample [private]
 

QToolBar* MainWindow::barTwist [private]
 

QAction* MainWindow::changeWin [private]
 

QAction* MainWindow::clearWindow [private]
 

QString MainWindow::filename [private]
 

nom du fichier en cours d'utilisation

QLabel* MainWindow::infos [private]
 

QPopupMenu* MainWindow::menuDisplay [private]
 

QPopupMenu* MainWindow::menuExtrusion [private]
 

QPopupMenu* MainWindow::menuFile [private]
 

QPopupMenu* MainWindow::menuHelp [private]
 

QPopupMenu* MainWindow::menuPrimitives [private]
 

Window3D* MainWindow::opengl [private]
 

Window2D* MainWindow::profile [private]
 

QComboBox* MainWindow::sampleComboBox [private]
 

Window2D* MainWindow::section [private]
 

QSpinBox* MainWindow::spinboxTwist [private]
 

QPopupMenu* MainWindow::subMenuExport [private]
 

QPopupMenu* MainWindow::subMenuImport [private]
 

QTimer* MainWindow::timerProfileExtrusion [private]
 

idem pour l'extrusion profil

QTimer* MainWindow::timerSimpleExtrusion [private]
 

les changements dans les fenêtre de dessin sont répercutés après un certain temps défini par le timer pour l'extrusion simple

QWorkspace* MainWindow::workspace [private]
 


The documentation for this class was generated from the following files:
Generated on Tue Nov 29 21:58:59 2005 for CylinderGenerator by doxygen 1.3.7