Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYPointRefEditor.cpp
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 
31 #include "TYPointRefEditor.h"
32 
33 #define TR(id) OLocalizator::getString("TYPointCalculEditor", (id))
34 
36 {
37  _active = false;
38 
40 }
41 
43 
45 
47 
49 {
50  if (view == TYModelerFrame::TopView)
51  {
52  _active = true;
53  }
54  else
55  {
56  _active = false;
57  }
58 }
59 
60 void TYPointRefEditor::slotMousePressed(int x, int y, Qt::MouseButton button, Qt::KeyboardModifiers state)
61 {
62  if ((button == Qt::LeftButton) && _active)
63  {
64  }
65 }
66 
67 void TYPointRefEditor::slotMouseMoved(int x, int y, Qt::MouseButtons button, Qt::KeyboardModifiers state)
68 {
69  if ((button == Qt::LeftButton) && _active)
70  {
71  }
72 }
73 
74 void TYPointRefEditor::slotMouseReleased(int x, int y, Qt::MouseButton button, Qt::KeyboardModifiers state)
75 {
76  if ((button == Qt::LeftButton) && _active)
77  {
78  double point[4];
79  TYPoint pointRef;
80  LPTYSiteNode pSite = ((TYSiteModelerFrame*)_pModeler)->getSite();
81  TYPoint oldPos = pSite->getPosition();
82 
83  // Pt Ref
84  displayToWorld(x, _pInteractor->height() - y, 0.0, point);
85  pointRef.setFromOGL(point);
86  pointRef._x *= -1;
87  pointRef._y *= -1;
88  pointRef._z = 0.0;
89 
90  TYAction* pAction = new TYSetPointRefSiteAction(pSite, pSite->getPosition(), pointRef, _pModeler,
91  TR("id_action_setptref"));
93 
94  pointRef._x += oldPos._x;
95  pointRef._y += oldPos._y;
96 
97  pSite->setPosition(pointRef);
98  pSite->updateGraphic();
101 
102  // La scene a ete modifiee
104  }
105 }
fichier contenant differents types d'actions (fichier header)
Classe generique pour une fenetre de modeleur (fichier header)
#define TR(id)
gestion de l'edition des points de reference pour le placement des images de fond (fichier header)
Le role de cette classe est limite a emettre des signaux pouvant etre utilise pour interagir sur le r...
Classe Modeler specialisee pour l'edition des sites (fichier header)
double _y
y coordinate of OCoord3D
Definition: 3d.h:283
double _z
z coordinate of OCoord3D
Definition: 3d.h:284
double _x
x coordinate of OCoord3D
Definition: 3d.h:282
virtual void setFromOGL(double x, double y, double z)
Definition: 3d.cpp:340
Classe abstraite pour la gestion de l'interaction entre la vue graphique (2D ou 3D) et le clavier et ...
TYModelerFrame * _pModeler
Le modeler associe a cet editor.
void displayToWorld(double x, double y, double z, double *worldPoint)
Methode utilitaire pour convertir un point en coordonnees ecran en coordonnees globale.
TYRenderWindowInteractor * _pInteractor
La vue graphique associee a cet editor.
void addAction(TYAction *pAction)
Ajoute une nouvelle action a l'historique.
Definit une action, necessaire pour la gestion de l'undo.
Definition: TYAction.h:37
static void setIsSavedOk(const bool &toSave)
Definition: TYElement.h:915
TYRenderWindowInteractor * getView()
TYActionManager * getActionManager()
virtual void updateView(bool clipping=true, bool axesAndGrid=true)
void updateDisplayList(void)
bool _active
Indique si cet editor est actif.
virtual void slotMouseReleased(int x, int y, Qt::MouseButton button, Qt::KeyboardModifiers state)
virtual void init()
TYPointRefEditor(TYSiteModelerFrame *pModeler)
virtual void slotMouseMoved(int x, int y, Qt::MouseButtons button, Qt::KeyboardModifiers state)
virtual void slotViewTypeChanged(int view)
virtual void close()
virtual void slotMousePressed(int x, int y, Qt::MouseButton button, Qt::KeyboardModifiers state)
TYOpenGLRenderer * getRenderer()
Action de positionnement d'un point de reference du site par rapport a une image de fond.
Definition: TYActions.h:767
Classe Modeler specialisee pour l'edition des sites.
void setPosition(TYPoint pt)
Definition: TYSiteNode.h:327
TYPoint getPosition() const
Definition: TYSiteNode.h:303