Code_TYMPAN  4.2.0
Industrial site acoustic simulation
TYModelerFrame.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012> <EDF-R&D> <FRANCE>
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10  * See the GNU General Public License for more details.
11  * You should have received a copy of the GNU General Public License along
12  * with this program; if not, write to the Free Software Foundation, Inc.,
13  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
14 */
15 
27 #ifndef __TY_MODELER_FRAME__
28 #define __TY_MODELER_FRAME__
29 
30 
31 #include <qwidget.h>
32 //Added by qt3to4:
33 #include <QCloseEvent>
34 #include <QBoxLayout>
35 #include <QShowEvent>
36 #include <QWheelEvent>
37 #include <QResizeEvent>
38 #include <QGridLayout>
39 #include <QFocusEvent>
40 #include <QMouseEvent>
41 #include <QKeyEvent>
42 #include <QEvent>
43 
44 #include "TYAppDefines.h"
46 #include "TYActionManager.h"
48 
49 class QGridLayout;
50 class QBoxLayout;
51 class QComboBox;
52 class QStatusBar;
53 class QToolButton;
54 class OGLTextElement;
56 class OGLLineElement;
57 class OGLGridElement;
58 class OGLLightElement;
59 class OGLCamera;
60 
61 
66 class TYModelerFrame : public QWidget
67 {
68  Q_OBJECT
69 
70 public:
80  {
87  };
88 
93  {
101  };
102 
107  {
108  NoMode = -1,
115  };
116 
117 
121  TYModelerFrame(QWidget* parent = 0, const char* name = 0, Qt::WindowFlags f = 0);
125  virtual ~TYModelerFrame();
126 
131 
136 
140  int getCurrentView() { return _curViewType; }
141 
145  int getRenderMode() { return _curRenderMode; }
146 
157 
162 
167 
171  QStatusBar* statusBar() { return _pStatusBar; }
172 
177 
182 
186  bool getShowSources() { return _showSources; }
187 
191  bool getShowGrid() { return _showGrid; }
192 
200 
204  void setElement(LPTYElement pElement) { _pElement = pElement;}
209 
224  bool askForResetResultat();
225 
232  virtual bool computeCurPos(int x, int y, float* pos);
233 
234 public slots:
238  virtual void setViewType(int view);
239 
243  virtual void setRenderModeSlot(int mode);
244 
248  virtual void setRenderMode(int mode, bool bUpdateGL);
249 
253  virtual void setEditorMode(int mode);
258 
262  void showGrid(bool show);
263 
268  void showNormals(bool show);
269 
274  void showPlafond(bool show);
275 
279  void showSources(bool show);
280 
284  void showRays(bool show);
288  void setSnapGridActive(bool state);
289 
293  void setCameraCoordinates();
294 
299  void screenShot();
300 
308  virtual void updateView(bool clipping = true, bool axesAndGrid = true);
309 
314  void updateAxes();
315 
319  void updateCurPosInfo();
320 
324  void updateGrid();
325 
332  void updateElementGraphic(bool force = false);
333 
337  void print();
338 
343  void copy();
344 
348  void editElement();
349 
354  void fit();
355 
359  virtual void updatePreferences();
360 
364  void resizeGrid();
365 
370  virtual bool close();
371 
379 
386  void startMovingRenderMode();
393  void stopMovingRenderMode();
394 
398  void updateScale();
399 
403  void showScale(bool show);
404 
405 
406 signals:
410  void aboutToClose();
411 
415  void viewTypeChanged(int);
416 
420  void editorModeChanged(int mode);
421 
425  void eltModified(LPTYElement pElt);
426 
430  void mouseEnter();
431 
435  void mouseLeave();
436 
441  void frameResized();
442 
443 protected:
444  virtual void keyPressEvent(QKeyEvent* pEvent);
445  virtual void keyReleaseEvent(QKeyEvent* pEvent);
446  virtual void mouseMoveEvent(QMouseEvent* pEvent);
447  virtual void wheelEvent(QWheelEvent* pEvent);
448  virtual void resizeEvent(QResizeEvent* pEvent);
449  virtual void focusInEvent(QFocusEvent* pEvent);
450  virtual void showEvent(QShowEvent* pEvent);
451  virtual void closeEvent(QCloseEvent* pEvent);
452  virtual void enterEvent(QEvent* pEvent);
453  virtual void leaveEvent(QEvent* pEvent);
454 
458  void setGridLinesActorsVisibility(bool showGridXY, bool showGridXZ, bool showGridZY);
459 
461 
462 private:
464  QGridLayout* _pLayout;
465 
467  QComboBox* _pRenderModeBox;
468 
470  QToolButton* _pSnapGridBtn;
471 
474 
476  QToolButton* _pScreenShotBtn;
477 
479  QToolButton* _pShowSourcesBtn;
480 
483 
485  QToolButton* _pShowNormalsBtn;
486 
489 
491  QToolButton* _pShowPlafondBtn;
492 
495 
497  QToolButton* _pShowRaysBtn;
498 
500  bool _showRays;
501 
503  QStatusBar* _pStatusBar;
504 
507 
510 
513 
516 
519 
522 
525 
528 
531 
539 
541  QToolButton* _pGridBtn;
542 
546 
547 
549  bool _showGrid;
550 
553 
556 
557  //Les collections de lignes pour la grille.
559 
562 
564  QToolButton* _pShowScale;
565 
568 
570 
571 protected:
573  QBoxLayout* _pCtrlLayout;
574 
576  QComboBox* _pViewTypeBox;
577 
580 
583 
586 
589 
592 
595 
597  float _gridStep;
601  float _gridDimX;
603  float _gridDimY;
604 
607 
610 };
611 
612 #endif //__TY_MODELER_FRAME__
TYActionManager * getActionManager()
virtual void focusInEvent(QFocusEvent *pEvent)
TYCameraEditor * _pCameraEditor
Gere la camera.
QToolButton * _pSetCameraCoordinatesBtn
Bouton de specification des coordonnees de la camera.
void showGrid(bool show)
QToolButton * _pShowSourcesBtn
Bouton pour l&#39;affichage des sources ponctuelles.
outil de mesure des distances
virtual bool close()
virtual void enterEvent(QEvent *pEvent)
gestion de la position selon les modes &#39;moving&#39;, &#39;rotation&#39;, &#39;edition&#39;
void showNormals(bool show)
void setSnapGridActive(bool state)
int _curViewType
Le type de la vue courante.
TYRenderWindowInteractor * _pView
La fenetre graphique.
Gestion de l&#39;edition en mode camera.
bool isElementInCurrentProjet()
const char * name
void setCameraCoordinates()
void showPlafond(bool show)
void eltModified(LPTYElement pElt)
OGLLineElement * _pOGLLineElementY
QToolButton * _pScreenShotBtn
Bouton pour effectuer une capture d&#39;ecran.
QComboBox * _pRenderModeBox
Combo box pour le mode de rendu.
virtual void updateView(bool clipping=true, bool axesAndGrid=true)
virtual void setViewType(int view)
void frameResized()
TYCameraEditor * getCameraEditor()
bool _showScale
Indique si on affiche ou pas l&#39;echelle.
bool _showSources
Indique si on affiche ou pas les sources ponctuelles.
bool _showRays
Indique si on affiche ou pas les rayons.
Classe generique pour une fenetre de modeleur.
TYPositionEditor * _pPositionEditor
Editor pour deplacer les elements.
virtual ~TYModelerFrame()
virtual void keyPressEvent(QKeyEvent *pEvent)
bool _showPlafond
Indique si on affiche ou masque les normals.
QToolButton * _pGridBtn
Bouton d&#39;activation de la grille.
virtual void setEditorMode(int mode)
Le role de cette classe est limite a emettre des signaux pouvant etre utilise pour interagir sur le r...
TYAbstractSceneEditor * getCurrentEditor()
OGLLineElement * _pOGLLineElementX
Axes X et Y de la grille.
QComboBox * _pViewTypeBox
Combo box pour la selection de la camera courante.
virtual void keyReleaseEvent(QKeyEvent *pEvent)
Gere les undos.
virtual void showEvent(QShowEvent *pEvent)
OGLLineElement * _pOGLLineElementAxeX
La geometrie des Axes.
float _gridStep
Pas de la grille.
virtual void leaveEvent(QEvent *pEvent)
bool _editorModeAccepted
Indique si le mode d&#39;edition a ete traite.
QStatusBar * _pStatusBar
Barre d&#39;etat.
float _gridDimY
Dimension de la grille en Y.
bool getSnapGridActive()
The box class.
Definition: 3d.h:1292
TYActionManager _actionManager
Pour la gestion de l&#39;historique.
OGLTextElement * _pOGLTextElement
Label 2D pour afficher le type de la vue.
TYPickEditor * _pPickEditor
Gere le menu contextuel.
OGLGridElement * _pOGLGridElement
OGLTextElement * _pOGLTextElementLabelX
void setWireframeOnMovingCamera(bool state)
TYModelerFrame(QWidget *parent=0, const char *name=0, Qt::WindowFlags f=0)
Realise le rendu VTK et le rendu OpenGL.
virtual void closeEvent(QCloseEvent *pEvent)
QToolButton * _pShowRaysBtn
Bouton pour l&#39;affichage des rayons calcules par le lance de rayons.
void aboutToClose()
gestion de l&#39;element actionne par picking
Definition: TYPickEditor.h:41
QToolButton * _pShowScale
Bouton pour l&#39;affichage de l&#39;echelle.
TYPickEditor * getPickEditor()
Gere les undos (fichier header)
TYOpenGLRenderer * getRenderer()
void updateElementGraphic(bool force=false)
Classe abstraite pour la gestion de l&#39;interaction entre la vue graphique (2D ou 3D) et le clavier et ...
OGLCamera * _pOGLCameras[NbOfViews]
Les cameras pour chaque type de vue.
int _lastRenderMode
Le dernier mode de rendu courant.
Le role de cette classe est limite a emettre des signaux pouvant etre utilise pour interagir sur le r...
QToolButton * _pSnapGridBtn
Bouton d&#39;activation de la grille magnetique.
TYOpenGLRenderer * getRenderer()
OGLLineElement * _pOGLLineElementAxeY
QToolButton * _pShowPlafondBtn
Bouton pour l&#39;affichage des normals.
bool _showGrid
Indique si on affiche ou non la grille.
OGLLineElement * _pOGLLineElementAxeZ
virtual void setRenderMode(int mode, bool bUpdateGL)
bool _showNormals
Indique si on affiche ou masque les normals.
OGLTextElement * _pOGLTextElementLabelZ
OGLScalarBarElement * _pOGLScalarBarElement
Objet graphique pour la representation de l&#39;echelle.
void editorModeChanged(int mode)
gestion des elements selectionnes par picking
bool _snapGridActive
Indique si on active ou non la grille magnetique.
QStatusBar * statusBar()
int _curRenderMode
Le mode de rendu courant.
void startMovingRenderMode()
virtual void setRenderModeSlot(int mode)
bool getWireframeOnMovingCamera()
void showScale(bool show)
LPTYElement _pElement
Un pointeur sur l&#39;element a editer.
void setElement(LPTYElement pElement)
virtual void mouseMoveEvent(QMouseEvent *pEvent)
QGridLayout * _pLayout
Le layout de cette frame.
void setEditorModeToCamera()
TYRenderWindowInteractor * getView()
void setGridLinesActorsVisibility(bool showGridXY, bool showGridXZ, bool showGridZY)
void viewTypeChanged(int)
float _gridMagnStep
Pas de la grille magnetique.
QBoxLayout * _pCtrlLayout
Le layout ou se trouvent les boutons, etc.
virtual bool computeCurPos(int x, int y, float *pos)
virtual void resizeEvent(QResizeEvent *pEvent)
OGLLightElement * _pLightElement
La lumiere par default.
bool askForResetResultat()
virtual void updatePreferences()
bool _wireframeOnMovingCamera
Indique si on passe en rendu wireframe lors de deplacement de camera.
int _lastEditorMode
Pour conserver le dernier mode d&#39;edition.
void showRays(bool show)
void showSources(bool show)
bool isElementInCurrentCalcul()
TYElementPicker * getElementPicker()
virtual void wheelEvent(QWheelEvent *pEvent)
TYElementPicker * _pPicker
Pour le picking.
TYDistanceEditor * _pDistanceEditor
Outils pour mesurer.
QToolButton * _pShowNormalsBtn
Bouton pour l&#39;affichage des normals.
TYAbstractSceneEditor * _pCurrentEditor
L&#39;editor courant.
LPTYElement getElement()
OGLTextElement * _pOGLTextElementLabelY
float _gridDimX
Dimension de la grille en X.