Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYPositionEditor.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 
21 #include <qtimer.h>
22 #include <qcursor.h>
23 #include <qstatusbar.h>
24 
41 #include "TYPositionEditor.h"
42 
43 #define TR(id) OLocalizator::getString("TYPositionEditor", (id))
44 
45 static bool bTYPositionEditorFirstMove = true;
46 
47 TYPositionEditor::TYPositionEditor(TYModelerFrame* pModeler, int mode /*=Moving*/)
48  : TYAbstractSceneEditor(pModeler)
49 {
50  setMode(mode);
51 
52  setAngleStep(15.0);
54 
55  // On recupere le pointeur sur le picker du modeler
57 
58  // Camera
59  _pCamEditor = new TYCameraEditor(pModeler);
65 
66  _shiftOn = false;
67  _keyAOn = false;
68  _keyDOn = false;
69  _active = true;
70  _firstCall = false;
71  _viewOnlyHighlight = true;
72  _angleInfo = 0.0;
73  _pLastAction = NULL;
74  _inUse = false;
75  _bSiteModelerFrame = false;
76 
77  _pStepTimer = new QTimer(this);
78  _mouseEventActive = false;
79 
81  setSensitivity(20.0);
82 
83  _pEditElement = NULL;
84  _pEditGeoNode = NULL;
85  _pEditPoint = NULL;
86 
87  // Line 1
89  _pOGLLineElementMoving1->setColor(OColor(1.0, 0.0, 0.0));
92 
94  _pOGLLineElementMoving2->setColor(OColor(1.0, 0.0, 0.0));
97 
100 }
101 
103 {
104  delete _pCamEditor;
105 
106  if (_pLastAction)
107  {
108  delete _pLastAction;
109  _pLastAction = NULL;
110  }
111 
116 }
117 
119 {
121 
122  // En fonction du type de modeler on edite pas le meme parent
123  if (QString(_pModeler->metaObject()->className()).compare("TYMachineModelerFrame") == 0)
124  {
125  // On edite les volumes
126  QObject::connect(_pPicker, &TYElementPicker::acousticCylinderPicked, this,
128  QObject::connect(_pPicker, &TYElementPicker::acousticSemiCylinderPicked, this,
130  QObject::connect(_pPicker, &TYElementPicker::acousticBoxPicked, this,
132  }
133  else if (QString(_pModeler->metaObject()->className()).compare("TYBatimentModelerFrame") == 0)
134  {
135  // On edite les silos
136  QObject::connect(_pPicker, &TYElementPicker::acousticCylinderPicked, this,
138  // On edite les machines
140  // Et les Sources ponctuelles
141  QObject::connect(_pPicker, &TYElementPicker::sourcePonctuellePicked, this,
143  // Et les etages
145  // Et les ecrans
147  }
148  else if (QString(_pModeler->metaObject()->className()).compare("TYSiteModelerFrame") == 0)
149  {
150  _bSiteModelerFrame = true;
151 
152  // On edite les batiments
153  QObject::connect(_pPicker, &TYElementPicker::batimentPicked, this,
155  // Et les machines "en plein air"
157 
158  // Les elements de topo et d'infra
160  QObject::connect(_pPicker, &TYElementPicker::reseauTransportPicked, this,
162  QObject::connect(_pPicker, &TYElementPicker::courbeNiveauPicked, this,
167  QObject::connect(_pPicker, &TYElementPicker::sourcePonctuellePicked, this,
170 
171  // Les maillages et elements propres aux calculs
172  QObject::connect(_pPicker, &TYElementPicker::pointControlPicked, this,
174  QObject::connect(_pPicker, &TYElementPicker::rectangularMaillagePicked, this,
176  QObject::connect(_pPicker, &TYElementPicker::linearMaillagePicked, this,
178  }
179 
180  // On connect la camera aussi
181  _pCamEditor->connect();
182 
183  // Preferences
184  static const char dirName[] = "UserPreferences";
185 
186  if (TYPreferenceManager::getInstance().exists(dirName, "ViewOnlyHighlight"))
187  {
188  _viewOnlyHighlight = TYPreferenceManager::getInstance().getBool(dirName, "ViewOnlyHighlight");
189  }
190  else
191  {
192  TYPreferenceManager::getInstance().setBool(dirName, "ViewOnlyHighlight", _viewOnlyHighlight);
193  }
194 }
195 
197 {
199 
200  _pPicker->disconnect(this);
202 }
203 
205 
207 {
208  _pPicker->reset();
209  _inUse = false;
210 
211  showText(false);
213 }
214 
216 {
217  cancel();
218 }
219 
221 {
222  switch (key)
223  {
224  case Qt::Key_Shift:
225  _shiftOn = true;
226  break;
227  case Qt::Key_A:
228  _keyAOn = true;
229  break;
230  case Qt::Key_D:
231  _keyDOn = true;
232  break;
233  case Qt::Key_Escape:
234  cancel();
235  break;
236  }
237 }
238 
240 {
241  switch (key)
242  {
243  case Qt::Key_Shift:
244  _shiftOn = false;
245  break;
246  case Qt::Key_A:
247  _keyAOn = false;
248  break;
249  case Qt::Key_D:
250  _keyDOn = false;
251  break;
252  }
253 }
254 
256 {
257  showText(false);
259 
260  // On relaie le signal au CameraEditor
262 }
263 
264 void TYPositionEditor::slotMousePressed(int x, int y, Qt::MouseButton button, Qt::KeyboardModifiers state)
265 {
266  if (_mouseEventActive)
267  {
268  return;
269  }
270 
271  if (_pLastAction)
272  {
273  delete _pLastAction;
274  _pLastAction = NULL;
275  }
276 
277  if (_active && !_shiftOn)
278  {
279  if (button == Qt::LeftButton)
280  {
281  _pPicker->reset();
282 
283  // On met a true car la "pick" emet des signaux.
284  _mouseEventActive = true;
285 
286  // On effectue le picking
287  if (!_pPicker->pick(x, _pInteractor->height() - y))
288  {
289  // Rien de picker, on peut remettre a false, normalement
290  // aucun signaux n'ont ete emis par "pick"
291  _mouseEventActive = false;
292  }
293  }
294  }
295 
296  // Si un element a ete picke et si l'utilisateur accepte d'effacer
297  // les resultats courant le cas echeant
298  if (_mouseEventActive) // && _pModeler->askForResetResultat()) // DT -- le 22/08/2005
299  {
300  // On deconnecte la camera le temps de l'edition
302 
303  _currentMousePos[0] = x;
304  _currentMousePos[1] = y;
305  _lastMousePos[0] = x;
306  _lastMousePos[1] = y;
307  _firstCall = true;
308  _angleInfo = 0.0;
310 
311  if (_mode == Moving)
312  {
313  TYApplication::setOverrideCursor(Qt::SizeAllCursor);
314  }
315  else
316  {
317  TYApplication::setOverrideCursor(Qt::BlankCursor);
318  }
319  }
320 }
321 
322 void TYPositionEditor::slotMouseReleased(int x, int y, Qt::MouseButton button, Qt::KeyboardModifiers state)
323 {
324  bTYPositionEditorFirstMove = true;
325  if (_mouseEventActive)
326  {
327  _pStepTimer->stop();
328  _mouseEventActive = false;
329  QObject::disconnect(_pStepTimer, 0, this, 0);
330 
331  if (_pLastAction)
332  {
334  _pLastAction = NULL;
335  }
336 
338  {
339  _pEditGeoNode->getGraphicObject()->viewOnlyHighlight(false);
340  }
341 
342  _inUse = false;
343  _pEditElement = NULL;
344  _pEditPoint = NULL;
345 
346  showText(false);
349 
350  // On arrete le highlight dans la scene 3D
351  _pPicker->highlightElement(NULL); // az++
352 
355  _pEditGeoNode = NULL; // az++
356 
357  _pModeler->updateView(true, true); // DT++ le 22/08/2005
358 
359  _pModeler->askForResetResultat(); // CLM++ le 10/01/2012
360 
361  // L'edition est terminee on reconnecte la camera
362  _pCamEditor->connect();
363 
364  // La scene a ete modifiee
366 
367  TYApplication::restoreOverrideCursor();
368  }
369 }
370 
371 void TYPositionEditor::slotMouseMoved(int x, int y, Qt::MouseButtons button, Qt::KeyboardModifiers state)
372 {
373  _currentMousePos[0] = x;
374  _currentMousePos[1] = y;
375 }
376 
378 {
379  if (!_mouseEventActive || _inUse)
380  {
381  return;
382  }
383 
384  // Pour traiter le cas d'une imbrication verticale
385  // (site in site in site in ...in siteroot), on va rechercher
386  // le site qui est directement enfant du site pointe par le modeleur
387 
388  // On recupere le site pointe par le modeleur
389  TYElement* pModelerTarget = NULL;
390  if (_pModeler->getElement()->isA("TYProjet"))
391  {
392  pModelerTarget = TYProjet::safeDownCast(_pModeler->getElement())->getSite();
393  }
394  else
395  {
396  pModelerTarget = _pModeler->getElement();
397  }
398 
399  // Ensuite on boucle pour retrouver son fils
400  TYElement* pParent = pElt->getParent();
401 
402  while (pParent && (pParent != pModelerTarget))
403  {
404  pElt = pParent;
405  pParent = pParent->getParent();
406  }
407 
408  if (!pElt)
409  {
410  return;
411  } // Au cas ou on serait parti dans les choux, on sort ...
412 
413  // On positionne l'element courant
414  _pEditElement = pElt;
415 
416  // On le highlight dans la scene 3D
418 
420  TYSiteNode* pSiteNodeParent = TYSiteNode::safeDownCast(pSiteNodeChild->getParent());
421 
422  // On ne peut rien faire sans le parent...
423  if (!pSiteNodeParent)
424  {
425  return;
426  }
427 
428  // On recupere le GeoNode associe
429  _pEditGeoNode = (TYGeometryNode*)pSiteNodeParent->findSiteNode(pSiteNodeChild).getRealPointer();
430  if (!_pEditGeoNode)
431  {
432  return;
433  }
434 
435  // Visu du highlight seulement
436  if (_viewOnlyHighlight)
437  {
438  _pEditGeoNode->getGraphicObject()->viewOnlyHighlight(_viewOnlyHighlight);
439  }
440 
441  if (_mode != Edition)
442  {
443  // On connecte le timer
444  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editGeoNode);
445  }
446 }
447 
449 {
450  if (!_mouseEventActive)
451  {
452  return;
453  }
454 
455  // On positionne l'element courant
456  _pEditElement = pElt;
457 
458  // On le highlight dans la scene 3D
460 
463 
464  // On ne peut rien faire sans le parent...
465  if (!pParent)
466  {
467  return;
468  }
469 
470  // On recupere le GeoNode associe
472  if (!_pEditGeoNode)
473  {
474  return;
475  }
476 
477  // Visu du highlight seulement
478  if (_viewOnlyHighlight)
479  {
480  _pEditGeoNode->getGraphicObject()->viewOnlyHighlight(_viewOnlyHighlight);
481  }
482 
483  if (_mode != Edition)
484  {
485  // On connecte le timer
486  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editGeoNode);
487  }
488 }
489 
491 {
492  if (!_mouseEventActive)
493  {
494  return;
495  }
496 
497  if (_bSiteModelerFrame)
498  {
499  // Si on est dans un siteModelerFrame, on s'assure que le site
500  // represente par le modeleur est le parent direct de l'element picke
501  // Si oui, on peut bouger l'element,
502  // Si non, on renvoie sur initEditSiteNode qui entrainera le mouvement
503  // du site imbrique de niveau juste inferieur au site represente par le modeleur
504  if (selectElement(pElt))
505  {
506  return;
507  }
508  }
509 
510  // On positionne l'element courant
511  _pEditElement = pElt;
512 
513  // On le highlight dans la scene 3D
515 
517  TYElement* pParent = TYElement::safeDownCast(pMachine->getParent());
518 
519  // On ne peut rien faire sans le parent...
520  if (!pParent)
521  {
522  return;
523  }
524 
525  // Le parent d'une Machine peut etre un Etage ou Infrastructure
526  if (pParent->isA("TYEtage"))
527  {
528  _pEditGeoNode = (TYGeometryNode*)((TYEtage*)pParent)->findMachine(pMachine).getRealPointer();
529  }
530  else if (pParent->isA("TYInfrastructure"))
531  {
532  _pEditGeoNode = (TYGeometryNode*)((TYInfrastructure*)pParent)->findMachine(pMachine).getRealPointer();
533  }
534  else
535  {
536  _pEditGeoNode = NULL;
537  }
538 
539  if (!_pEditGeoNode)
540  {
541  return;
542  }
543 
544  // Visu du highlight seulement
545  if (_viewOnlyHighlight)
546  {
547  _pEditGeoNode->getGraphicObject()->viewOnlyHighlight(_viewOnlyHighlight);
548  }
549 
550  if (_mode != Edition)
551  {
552  // On connecte le timer
553  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editGeoNode);
554 
555  // On "prend la main"
556  _inUse = true;
557  }
558 }
559 
560 /*void TYPositionEditor::initEditEtage(TYElement* pElt)
561 {
562  if (!_mouseEventActive || _inUse) {
563  return;
564  }
565 
566  if (_pModeler->getCurrentView() != TYModelerFrame::TopView) {
567  // L'edition d'un etage n'est possible qu'en vue de dessus
568  return;
569  }
570 
571  // On positionne l'element courant
572  _pEditElement = pElt;
573 
574  TYEtage * pEtage = TYEtage::safeDownCast(_pEditElement);
575  TYBatiment * pParent = TYBatiment::safeDownCast(pEtage->getParent());
576 
577  // On ne peut rien faire sans le parent...
578  if (!pParent) return;
579 
580  // On recupere le GeoNode associe
581  _pEditGeoNode = (TYGeometryNode *) pParent->findAcousticVol(pEtage).getRealPointer();
582  if (!_pEditGeoNode) return;
583 }*/
584 
586 {
587  if (!_mouseEventActive || _inUse)
588  {
589  return;
590  }
591 
593  {
594  // L'edition d'un etage n'est possible qu'en vue de dessus
595  return;
596  }
597 
598  if (_bSiteModelerFrame)
599  {
600  // Si on est dans un siteModelerFrame, on s'assure que le site
601  // represente par le modeleur est le parent direct de l'element picke
602  // Si oui, on peut bouger l'element,
603  // Si non, on renvoie sur initEditSiteNode qui entrainera le mouvement
604  // du site imbrique de niveau juste inferieur au site represente par le modeleur
605  if (selectElement(pElt))
606  {
607  return;
608  }
609  }
610 
611  // On positionne l'element courant
612  _pEditElement = pElt;
613 
615  TYBatiment* pParent = TYBatiment::safeDownCast(pEcran->getParent());
616 
617  // On ne peut rien faire sans le parent...
618  if (!pParent)
619  {
620  return;
621  }
622 
623  // On recupere le GeoNode associe
625  if (!_pEditGeoNode)
626  {
627  return;
628  }
629 }
630 
632 {
633  if (!_mouseEventActive)
634  {
635  return;
636  }
637 
638  if (_bSiteModelerFrame)
639  {
640  // Si on est dans un siteModelerFrame, on s'assure que le site
641  // represente par le modeleur est le parent direct de l'element picke
642  // Si oui, on peut bouger l'element,
643  // Si non, on renvoie sur initEditSiteNode qui entrainera le mouvement
644  // du site imbrique de niveau juste inferieur au site represente par le modeleur
645  if (selectElement(pElt))
646  {
647  return;
648  }
649  }
650 
651  // On positionne l'element courant
652  _pEditElement = pElt;
653 
654  // On le highlight dans la scene 3D
656 
659 
660  // On ne peut rien faire sans le parent...
661  if (!pParent)
662  {
663  return;
664  }
665 
666  // On recupere le GeoNode associe
667  _pEditGeoNode = (TYGeometryNode*)pParent->findBatiment(pBatiment).getRealPointer();
668  if (!_pEditGeoNode)
669  {
670  return;
671  }
672 
673  // Visu du highlight seulement
674  if (_viewOnlyHighlight)
675  {
676  _pEditGeoNode->getGraphicObject()->viewOnlyHighlight(_viewOnlyHighlight);
677  }
678 
679  if (_mode != Edition)
680  {
681  // On connecte le timer
682  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editGeoNode);
683 
684  // On "prend la main"//az++
685  _inUse = true; // az++
686  }
687 }
688 
690 {
691 #if WITH_NMPB
692  if (!_mouseEventActive)
693  {
694  return;
695  }
696 
697  if (_bSiteModelerFrame)
698  {
699  // Si on est dans un siteModelerFrame, on s'assure que le site
700  // represente par le modeleur est le parent direct de l'element picke
701  // Si oui, on peut bouger l'element,
702  // Si non, on renvoie sur initEditSiteNode qui entrainera le mouvement
703  // du site imbrique de niveau juste inferieur au site represente par le modeleur
704  if (selectElement(pElt))
705  {
706  return;
707  }
708  }
709 
710  // On positionne l'element courant
711  _pEditElement = pElt;
712 
715 
716  // On ne peut rien faire sans le parent...
717  if (!pParent)
718  {
719  return;
720  }
721 
722  // On recupere le GeoNode associe
723  _pEditGeoNode = (TYGeometryNode*)pParent->findRoute(pRoute).getRealPointer();
724  if (!_pEditGeoNode)
725  {
726  return;
727  }
728 
729  if (_mode == Edition)
730  {
731  TYTabPoint& pts = pRoute->getTabPoint();
732  editPolyLine(pRoute, pts, false);
733  }
734  else
735  {
737  // On connecte le timer
738  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editGeoNode);
739  // On "prend la main"
740  _inUse = true;
741  }
742 #endif
743 }
744 
746 {
747  if (!_mouseEventActive)
748  {
749  return;
750  }
751 
752  if (_bSiteModelerFrame)
753  {
754  // Si on est dans un siteModelerFrame, on s'assure que le site
755  // represente par le modeleur est le parent direct de l'element picke
756  // Si oui, on peut bouger l'element,
757  // Si non, on renvoie sur initEditSiteNode qui entrainera le mouvement
758  // du site imbrique de niveau juste inferieur au site represente par le modeleur
759  if (selectElement(pElt))
760  {
761  return;
762  }
763  }
764 
765  // On positionne l'element courant
766  _pEditElement = pElt;
767 
770 
771  // On ne peut rien faire sans le parent...
772  if (!pParent)
773  {
774  return;
775  }
776 
777  // On recupere le GeoNode associe
778  _pEditGeoNode = (TYGeometryNode*)pParent->findResTrans(pResTrans).getRealPointer();
779  if (!_pEditGeoNode)
780  {
781  return;
782  }
783 
784  if (_mode == Edition)
785  {
786  TYTabPoint& pts = pResTrans->getTabPoint();
787  editPolyLine(pResTrans, pts, false);
788  }
789  else
790  {
792  // On connecte le timer
793  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editGeoNode);
794  // On "prend la main"
795  _inUse = true;
796  }
797 }
798 
800 {
801  if (!_mouseEventActive)
802  {
803  return;
804  }
805 
806  if (_bSiteModelerFrame)
807  {
808  // Si on est dans un siteModelerFrame, on s'assure que le site
809  // represente par le modeleur est le parent direct de l'element picke
810  // Si oui, on peut bouger l'element,
811  // Si non, on renvoie sur initEditSiteNode qui entrainera le mouvement
812  // du site imbrique de niveau juste inferieur au site represente par le modeleur
813  if (selectElement(pElt))
814  {
815  return;
816  }
817  }
818 
819  // On positionne l'element courant
820  _pEditElement = pElt;
821 
823  TYTopographie* pParent = TYTopographie::safeDownCast(pCrbNiv->getParent());
824 
825  // On ne peut rien faire sans le parent...
826  if (!pParent)
827  {
828  return;
829  }
830  LPTYSiteNode pSite = dynamic_cast<TYSiteNode*>(pParent->getParent());
831 
832  // On recupere le GeoNode associe
833  _pEditGeoNode = (TYGeometryNode*)pParent->findCrbNiv(pCrbNiv).getRealPointer();
834  if (!_pEditGeoNode)
835  {
836  return;
837  }
838 
839  // On marque l'alti comme modifiee ici car on ne peut plus le faire apres
840  pSite->getAltimetry()->setIsGeometryModified(true);
841 
842  if (_mode == Edition)
843  {
844  TYTabPoint& pts = pCrbNiv->getListPoints();
845  editPolyLine(pCrbNiv, pts, false);
846  }
847  else
848  {
850  // On connecte le timer
851  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editGeoNode);
852  // On "prend la main"
853  _inUse = true;
854  }
855 }
856 
858 {
859 
860  if (!_mouseEventActive)
861  {
862  return;
863  }
864 
865  if (_bSiteModelerFrame)
866  {
867  // Si on est dans un siteModelerFrame, on s'assure que le site
868  // represente par le modeleur est le parent direct de l'element picke
869  // Si oui, on peut bouger l'element,
870  // Si non, on renvoie sur initEditSiteNode qui entrainera le mouvement
871  // du site imbrique de niveau juste inferieur au site represente par le modeleur
872  if (selectElement(pElt))
873  {
874  return;
875  }
876  }
877 
878  // On positionne l'element courant
879  _pEditElement = pElt;
881  TYTopographie* pParent = TYTopographie::safeDownCast(pCrsEau->getParent());
882 
883  // On ne peut rien faire sans le parent...
884  if (!pParent)
885  {
886  return;
887  }
888  LPTYSiteNode pSite = dynamic_cast<TYSiteNode*>(pParent->getParent());
889  assert(pSite != nullptr && "The parent of a TYTopographie element must be a TYSiteNode");
890 
891  // On recupere le GeoNode associe
892  _pEditGeoNode = (TYGeometryNode*)pParent->findCrsEau(pCrsEau).getRealPointer();
893  if (!_pEditGeoNode)
894  {
895  return;
896  }
897 
898  // We tag the altimetry as modified since we can't do it later
899  pSite->getAltimetry()->setIsGeometryModified(true);
900 
901  if (_mode == Edition)
902  {
903  TYTabPoint& pts = pCrsEau->getTabPoint();
904  editPolyLine(pCrsEau, pts, false, pSite->getAltimetry());
905  }
906  else
907  {
909  // On connecte le timer
910  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editGeoNode);
911  // On "prend la main"
912  _inUse = true;
913  }
914 }
915 
917 {
918  if (!_mouseEventActive)
919  {
920  return;
921  }
922 
923  if (_bSiteModelerFrame)
924  {
925  // Si on est dans un siteModelerFrame, on s'assure que le site
926  // represente par le modeleur est le parent direct de l'element picke
927  // Si oui, on peut bouger l'element,
928  // Si non, on renvoie sur initEditSiteNode qui entrainera le mouvement
929  // du site imbrique de niveau juste inferieur au site represente par le modeleur
930  if (selectElement(pElt))
931  {
932  return;
933  }
934  }
935 
936  // On positionne l'element courant
937  _pEditElement = pElt;
938 
940  TYTopographie* pParent = TYTopographie::safeDownCast(pPlanEau->getParent());
941 
942  // On ne peut rien faire sans le parent...
943  if (!pParent)
944  {
945  return;
946  }
947  LPTYSiteNode pSite = dynamic_cast<TYSiteNode*>(pParent->getParent());
948  assert(pSite != nullptr && "The parent of a TYTopographie element must be a TYSiteNode");
949 
950  // On recupere le GeoNode associe
951  _pEditGeoNode = (TYGeometryNode*)pParent->findPlanEau(pPlanEau).getRealPointer();
952  if (!_pEditGeoNode)
953  {
954  return;
955  }
956 
957  // On marque l'alti comme modifiee ici car on ne peut plus le faire apres
958  pSite->getAltimetry()->setIsGeometryModified(true);
959 
960  if (_mode == Edition)
961  {
962  TYTabPoint& pts = pPlanEau->getListPoints();
963  editPolyLine(pPlanEau, pts, true, pSite->getAltimetry());
964  }
965  else
966  {
968  // On connecte le timer
969  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editGeoNode);
970  // On "prend la main"
971  _inUse = true;
972  }
973 }
974 
976 {
977  if (!_mouseEventActive)
978  {
979  return;
980  }
981 
982  if (_bSiteModelerFrame)
983  {
984  // Si on est dans un siteModelerFrame, on s'assure que le site
985  // represente par le modeleur est le parent direct de l'element picke
986  // Si oui, on peut bouger l'element,
987  // Si non, on renvoie sur initEditSiteNode qui entrainera le mouvement
988  // du site imbrique de niveau juste inferieur au site represente par le modeleur
989  if (selectElement(pElt))
990  {
991  return;
992  }
993  }
994 
995  // On positionne l'element courant
996  _pEditElement = pElt;
997 
999  TYTopographie* pParent = TYTopographie::safeDownCast(pTerrain->getParent());
1000 
1001  // On ne peut rien faire sans le parent...
1002  if (!pParent)
1003  {
1004  return;
1005  }
1006  LPTYSiteNode pSite = dynamic_cast<TYSiteNode*>(pParent->getParent());
1007  assert(pSite != nullptr && "The parent of a TYTopographie element must be a TYSiteNode");
1008 
1009  // On recupere le GeoNode associe
1010  _pEditGeoNode = (TYGeometryNode*)pParent->findTerrain(pTerrain).getRealPointer();
1011  if (!_pEditGeoNode)
1012  {
1013  return;
1014  }
1015 
1016  // We tag the altimetry as modified since we can't do it later
1017  pSite->getAltimetry()->setIsGeometryModified(true);
1018 
1019  if (_mode == Edition)
1020  {
1021  TYTabPoint& pts = pTerrain->getListPoints();
1022  editPolyLine(pTerrain, pts, true, pSite->getAltimetry());
1023  }
1024  else
1025  {
1027  // On connecte le timer
1028  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editGeoNode);
1029  // On "prend la main"
1030  _inUse = true;
1031  }
1032 }
1033 
1035 {
1036  if (!_mouseEventActive)
1037  {
1038  return;
1039  }
1040 
1041  if (_bSiteModelerFrame)
1042  {
1043  // Si on est dans un siteModelerFrame, on s'assure que le site
1044  // represente par le modeleur est le parent direct de l'element picke
1045  // Si oui, on peut bouger l'element,
1046  // Si non, on renvoie sur initEditSiteNode qui entrainera le mouvement
1047  // du site imbrique de niveau juste inferieur au site represente par le modeleur
1048  if (selectElement(pElt))
1049  {
1050  return;
1051  }
1052  }
1053 
1054  // On positionne l'element courant
1055  _pEditElement = pElt;
1056 
1058 
1059  if (!pSrcPonct)
1060  {
1061  return;
1062  }
1063 
1064  TYInfrastructure* pParent = TYInfrastructure::safeDownCast(pSrcPonct->getParent()); // az--
1065  if (pParent) // az--
1066  {
1067  _pEditGeoNode = (TYGeometryNode*)pParent->findSrc(pSrcPonct).getRealPointer(); // az--
1068  } // az--
1069 
1070  if (_mode == Moving)
1071  {
1072  _pEditPoint = pSrcPonct->getPos();
1073 
1075  TR("id_action_movesrcponct"));
1076 
1078 
1079  // On connecte le timer
1080  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editPoint); // DT++ 20051201
1081  // On "prend la main"
1082  _inUse = true;
1083  }
1084  else if (_mode == Rotation)
1085  {
1086  // On le highlight dans la scene 3D
1088 
1089  _pLastAction = new TYOrienteSrcPonctAction(pSrcPonct, pSrcPonct->getOrientation(), OVector3D(),
1090  _pModeler, TR("id_action_orientsrcponct"));
1091 
1092  // On connecte le timer
1093  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::orienteSrcPonct); // az--
1094 
1095  // On "prend la main"
1096  _inUse = true;
1097  }
1098 }
1099 
1101 {
1102  if (!_mouseEventActive)
1103  {
1104  return;
1105  }
1106 
1107  // On positionne l'element courant
1108  _pEditElement = pElt;
1109 
1111 
1112  if (!pPointControl)
1113  {
1114  return;
1115  }
1116 
1117  if (_mode == Moving)
1118  {
1119  _pEditPoint = (LPTYPoint&)pPointControl;
1120 
1122  TR("id_action_movepointcontrol"));
1123 
1125 
1126  // On connecte le timer
1127  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editPoint);
1128  }
1129 }
1130 
1132 {
1133  if (!_mouseEventActive)
1134  {
1135  return;
1136  }
1137 
1138  // On positionne l'element courant
1139  _pEditElement = pElt;
1140 
1141  // On le highlight dans la scene 3D
1143 
1145  TYProjet* pProj = dynamic_cast<TYProjet*>(pMaillage->getParent());
1146 
1147  // On ne peut rien faire sans le parent...
1148  if (!pProj)
1149  {
1150  return;
1151  }
1152 
1153  // On recupere le GeoNode associe
1154  _pEditGeoNode = (TYGeometryNode*)pProj->findMaillage(pMaillage).getRealPointer();
1155  if (!_pEditGeoNode)
1156  {
1157  return;
1158  }
1159 
1160  // Visu du highlight seulement
1161  if (_viewOnlyHighlight)
1162  {
1163  _pEditGeoNode->getGraphicObject()->viewOnlyHighlight(_viewOnlyHighlight);
1164  }
1165 
1166  if (_mode != Edition)
1167  {
1168  // On connecte le timer
1169  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editGeoNode);
1170  }
1171 }
1172 
1174  OPoint3D& centralPointGN)
1175 {
1177  true);
1178 }
1179 
1181  OPoint3D& centralPointGN)
1182 {
1184  false);
1185 }
1186 
1188  TYGeometryNode* pGeoNode, OPoint3D& centralPointGN, bool bPointOfGeoNodeInCurrentSiteCoordinates)
1189 {
1190  TYPoint centralPoint(centralPointGN);
1191  OMatrix currentMatrix;
1192  OMatrix totalMatrix;
1193  if (pGeoNode)
1194  {
1195  // Trouvons le GeoNode du Site courant (NULL si c'est le site root)
1196  TYSiteModelerFrame* pTYSiteModelerFrame = (TYSiteModelerFrame*)_pModeler;
1197  TYSiteNode* pRootSite = pTYSiteModelerFrame->getSite();
1198  TYGeometryNode* pRootGeometryNode = TYGeometryNode::GetGeoNode(pRootSite);
1199 
1200  TYListPtrGeoNode GeoNodeParents;
1201  pGeoNode->GetGeoNodeParentList(GeoNodeParents);
1202 
1203  TYListPtrGeoNode::iterator ite = GeoNodeParents.end();
1204  int i = 0, rootIndex = 0;
1205  if (pRootGeometryNode)
1206  {
1207  for (i = 0; i < (int)GeoNodeParents.size(); i++)
1208  {
1209  ite--;
1210  if ((*ite) == pRootGeometryNode)
1211  {
1212  rootIndex = i + 1;
1213  }
1214  }
1215  }
1216 
1217  for (i = rootIndex; i < ((int)GeoNodeParents.size() - rootIndex); i++)
1218  {
1219  ite--;
1220  TYGeometryNode* pCurrentTYGeometryNode = (TYGeometryNode*)(*ite);
1221  currentMatrix = pCurrentTYGeometryNode->getMatrix();
1222  if (!bPointOfGeoNodeInCurrentSiteCoordinates)
1223  {
1224  currentMatrix = currentMatrix.getInvert();
1225  }
1226  totalMatrix = totalMatrix * currentMatrix;
1227  }
1228  centralPoint = totalMatrix * centralPoint;
1229  }
1230  centralPointGN = centralPoint;
1231 }
1232 
1234 {
1235  bool modified = false;
1236  TYPoint oldPos;
1237  TYRepere oldRepere;
1238  bool enableX = true;
1239  bool enableY = true;
1240  bool enableZ = true;
1241 
1242  if (_mode == Moving)
1243  {
1244  // Copie de l'ancienne pos
1245  oldPos = _pEditGeoNode->getORepere3D()._origin;
1246 
1247  if ((dynamic_cast<TYCourbeNiveau*>(_pEditGeoNode->getElement()) != nullptr) ||
1248  (dynamic_cast<TYPlanEau*>(_pEditGeoNode->getElement()) != nullptr))
1249  {
1250  enableZ = false;
1251  }
1252 
1253  ORepere3D repere = _pEditGeoNode->getORepere3D();
1254 
1255  // On applique le deplacement
1256  modified = move(&repere._origin, enableX, enableY, enableZ); // az--
1257 
1258  _pEditGeoNode->setRepere(repere);
1259  }
1260  else if (_mode == Rotation)
1261  {
1262  // Copie de l'ancien repere
1263  oldRepere = _pEditGeoNode->getORepere3D();
1264 
1265  if ((dynamic_cast<TYMaillage*>(_pEditGeoNode->getElement()) != nullptr) ||
1266  (dynamic_cast<TYCourbeNiveau*>(_pEditGeoNode->getElement()) != nullptr) ||
1267  (dynamic_cast<TYPlanEau*>(_pEditGeoNode->getElement()) != nullptr) ||
1268  (dynamic_cast<TYSiteNode*>(_pEditGeoNode->getElement()) != nullptr))
1269  {
1270  enableX = false;
1271  enableY = false;
1272  }
1273 
1274  ORepere3D repere = _pEditGeoNode->getORepere3D();
1275 
1276  // On applique la rotation
1277  modified = rotate(&repere, enableX, enableY, enableZ);
1278 
1279  _pEditGeoNode->setRepere(repere);
1280  }
1281 
1282  if (modified && bTYPositionEditorFirstMove)
1283  {
1284  // az++
1285  bTYPositionEditorFirstMove = false;
1286  // Magouille infâme pour faire disparaitre temporairement le GeoNode car le setVisible ne marche plus
1287  // vraiment
1288  ORepere3D repere = _pEditGeoNode->getORepere3D();
1289  ORepere3D AlOuest;
1290  AlOuest._origin = OPoint3D(999999, 999999, 999999);
1291  _pEditGeoNode->setRepere(AlOuest);
1292  _pEditGeoNode->getGraphicObject()->viewOnlyHighlight(true);
1293  _pInteractor->getRenderer()->updateDisplayList(); // az++ : pour rendre invisible l'objet en mouvement
1294  _pInteractor->updateGL(); // az++
1295  _pEditGeoNode->setRepere(repere);
1296  }
1297 
1298  if (modified)
1299  {
1300  if (_mode == Moving)
1301  {
1302  if (_firstCall)
1303  {
1304  _pLastAction =
1306  _pModeler, TR("id_action_movegeonode"));
1307  _firstCall = false;
1308  }
1309  else
1310  {
1312  }
1313  }
1314  else if (_mode == Rotation)
1315  {
1316  if (_firstCall)
1317  {
1318  _pLastAction =
1320  _pModeler, TR("id_action_rotategeonode"));
1321  _firstCall = false;
1322  }
1323  else
1324  {
1326  }
1327  }
1328 
1329  // Refresh
1331  _pEditGeoNode->updateGraphic();
1332  _pModeler->updateView(false, false);
1333 
1334  // Il faut maintenant afficher le GeoNode dans le repere adequat (celui choisit lors de l'ouverture du
1335  // modeler); Le repere peut etre:
1336  //* celui du repere du monde (TYSiteModelerFrame)
1337  //* celui d'un TYSiteNode fils (TYSiteModelerFrame)
1338  //* celui d'un TYBatiment (TYBatimentModelerFrame)
1339  //* celui d'un (TYMachineModelerFrame)
1340  //* celui d'un (TYFaceModelerFrame)
1341  TYElement* pRootTYElement = _pModeler->getElement();
1342  TYGeometryNode* pRootGeometryNode = TYGeometryNode::GetGeoNode(pRootTYElement);
1343 
1347  }
1348 }
1349 
1351 {
1352  bool modified = false;
1353  double z = 0.0;
1354 
1356  {
1357  // En vue 3D on conserve l'altitude du point
1358  z = _pEditPoint->_z;
1359  }
1360 
1361  modified = move(_pEditPoint);
1362 
1363  if (modified)
1364  {
1366  {
1367  // En vue 3D on restitue l'altitude du point
1368  _pEditPoint->_z = z;
1369  }
1370 
1371  if (_pEditElement->isA("TYCourbeNiveau"))
1372  {
1374  }
1375  else if (dynamic_cast<TYAcousticLine*>(_pEditElement) != nullptr)
1376  {
1378  }
1379  else if (_pEditElement->isA("TYTerrain"))
1380  {
1382  }
1383  else if (_pEditElement->isA("TYPlanEau"))
1384  {
1386  }
1387  else if (dynamic_cast<TYSourcePonctuelle*>(_pEditElement) != nullptr)
1388  {
1390  }
1391  else if (dynamic_cast<TYPointControl*>(_pEditElement) != nullptr)
1392  {
1394  }
1395 
1397 
1398  if (_pEditElement->getParent())
1399  {
1401  }
1402 
1403  // Refresh
1404  _pEditElement->updateGraphic();
1405  _pModeler->updateView(false, false);
1406 
1407  // Highlight point
1408  TYPoint worldPoint(*_pEditPoint);
1409  if (_pEditGeoNode)
1410  {
1411  worldPoint = _pEditGeoNode->getMatrix() * worldPoint;
1412  }
1413  _pPicker->highlightElement(&worldPoint); // Fait un updateGL
1414  }
1415 }
1416 
1418 {
1419  bool modified = false;
1420 
1421  modified = move(_pEditPoint);
1422 
1423  if (modified)
1424  {
1427 
1429 
1430  // Mise a jour de l'etage
1431  TYEtage* pEtage = (TYEtage*)_pEditElement;
1432  pEtage->setMurs(_editContour, pEtage->getHauteur(), pEtage->getClosed());
1433 
1434  // Refresh
1435  if (_pEditElement->getParent())
1436  {
1437  _pEditElement->getParent()->updateGraphic();
1438  }
1439  else
1440  {
1441  _pEditElement->updateGraphic();
1442  }
1443 
1444  // Highlight point
1445  TYPoint worldPoint = _pEditGeoNode->getMatrix() * (*_pEditPoint);
1446  _pPicker->highlightElement(&worldPoint); // Fait un updateGL
1447  }
1448 }
1449 
1451 {
1452  // On ne fait rien si la souris n'a pas bougee
1453  if ((_currentMousePos[0] == _lastMousePos[0]) && (_currentMousePos[1] == _lastMousePos[1]))
1454  {
1455  return;
1456  }
1457 
1459 
1460  // Il nous faut la position du point dans le repere global
1461  TYPoint pos(0, 0, 0);
1462  OPoint3D SrcePos(pos);
1463  OPoint3D opos =
1465  SrcePos; // repere le + haut dans la hierarchie, mais pas forcement celui du modelerFrame courant
1466  pos = opos;
1467 
1468  // Calcul du vecteur orientation : il est constitue de 2 points:
1469  //- celui donnant la position de la source ponctuelle
1470  //- celui donnant la position de la souris a l'instant present
1471  // 1. Passage de coordonnees ecrans a coordonnees du repere du modeler frame
1472  double displaySrcePos[4];
1473  worldToDisplay(pos._x, pos._z, -pos._y, displaySrcePos);
1474  double ptCur[4];
1475  displayToWorld(_currentMousePos[0], _pInteractor->height() - _currentMousePos[1], displaySrcePos[2],
1476  ptCur);
1477  OPoint3D optCur(ptCur[0], -ptCur[2], ptCur[1]);
1478  // optCur represente maintenant les coordonnees du second point dans le repere du ModelerFrame courant
1479  // 2. Passage de coordonnees du repere du modeler frame a coordonnees globales
1480  TYElement* pRootTYElement = _pModeler->getElement();
1481  TYGeometryNode* pRootGeometryNode = TYGeometryNode::GetGeoNode(pRootTYElement);
1482  if (pRootGeometryNode)
1483  {
1484  optCur = pRootGeometryNode->localToGlobal() * optCur;
1485  }
1486  // optCur represente maintenant les coordonnees du second point dans le repere le plus haut dans la
1487  // hierarchie:
1488  optCur = _pEditGeoNode->globalToLocal() * optCur;
1489  pos = _pEditGeoNode->globalToLocal() * pos;
1490  OVector3D vecOrient(pos, optCur);
1491 
1492  switch (_pModeler->getCurrentView())
1493  {
1495  pSrcPonct->getOrientation()._x = vecOrient._x;
1496  pSrcPonct->getOrientation()._y = vecOrient._y;
1497  break;
1499  pSrcPonct->getOrientation()._y = vecOrient._y;
1500  pSrcPonct->getOrientation()._z = vecOrient._z;
1501  break;
1503  pSrcPonct->getOrientation()._x = vecOrient._x;
1504  pSrcPonct->getOrientation()._z = vecOrient._z;
1505  break;
1506  }
1507 
1508  ((TYOrienteSrcPonctAction*)_pLastAction)->setNewOrient(pSrcPonct->getOrientation());
1509 
1511  _pEditElement->updateGraphic();
1512 
1513  // Save mouse pos car il y a eu un deplacement
1516 }
1517 
1518 bool TYPositionEditor::move(OPoint3D* pPt, bool enableX /*=true*/, bool enableY /*=true*/,
1519  bool enableZ /*=true*/)
1520 {
1521  Q_CHECK_PTR(pPt);
1522  bool ret = false;
1523 
1524  if (!enableX && !enableY && !enableZ)
1525  {
1526  return false;
1527  }
1528 
1529  // On ne fait rien si la souris n'a pas bougee
1530  if ((_currentMousePos[0] == _lastMousePos[0]) && (_currentMousePos[1] == _lastMousePos[1]))
1531  {
1532  return false;
1533  }
1534 
1535  // Chgmt de repere si besoin (si SiteNode pere)
1536  if (QString(_pModeler->metaObject()->className()).compare("TYSiteModelerFrame") == 0)
1537  {
1539  }
1540 
1541  // On garde une copie
1542  OPoint3D ptBis = *pPt;
1543 
1544  // Calcul du delta de deplacement
1545  double pt1[4];
1546  double pt2[4];
1547  double org[4];
1548  worldToDisplay(ptBis._x, ptBis._z, -ptBis._y, org);
1549  displayToWorld(_currentMousePos[0], _pInteractor->height() - _currentMousePos[1], org[2], pt1);
1550  displayToWorld(_lastMousePos[0], _pInteractor->height() - _lastMousePos[1], org[2], pt2);
1551  OVector3D delta(pt1[0] - pt2[0], -(pt1[2] - pt2[2]), pt1[1] - pt2[1]);
1552 
1553  OPoint3D deltap = delta;
1554 
1555  // Calcul de la nouvelle position
1556  ptBis = OVector3D(ptBis) + deltap; // az++
1557 
1558  // Si la grille magnetique est activee
1560  {
1561  snapToGrid(ptBis._x, ptBis._y, ptBis._z, _gridMagnStep);
1562  }
1563 
1564  // Si le deplacement n'est pas nul
1565  if (ptBis != *pPt)
1566  {
1567  // On applique le deplacement
1568  if (enableX)
1569  {
1570  pPt->_x = ptBis._x;
1571  }
1572  if (enableY)
1573  {
1574  pPt->_y = ptBis._y;
1575  }
1576  if (enableZ)
1577  {
1578  pPt->_z = ptBis._z;
1579  }
1580 
1581  // Mets a jour les moving lines
1582  updateMovingPoint(*pPt);
1583 
1584  // Mets a jour le texte d'information sur la nouvelle position
1585  if (_mode == Edition)
1586  {
1587  // Si la grille magnetique est activee
1589  {
1590  snapToGrid(pt1[0], pt1[1], pt1[2], _gridMagnStep);
1591  }
1592 
1593  // On affiche la position globale du curseur
1594  updateText(QString(TR("id_pos_info"))
1595  .arg(pPt->_x, 0, 'f', 2)
1596  .arg(pPt->_y, 0, 'f', 2)
1597  .arg(pPt->_z, 0, 'f', 2),
1598  _currentMousePos[0], _pInteractor->height() - _currentMousePos[1]);
1599  }
1600  else
1601  {
1602  // On affiche la position globale du point
1603  updateText(QString(TR("id_pos_info"))
1604  .arg(pPt->_x, 0, 'f', 2)
1605  .arg(pPt->_y, 0, 'f', 2)
1606  .arg(pPt->_z, 0, 'f', 2),
1607  (int)org[0], (int)org[1]);
1608  }
1609 
1610  // Save mouse pos car il y a eu un deplacement
1613 
1614  // Le point a ete deplace
1615  ret = true;
1616  }
1617 
1618  // Chgmt de repere si besoin (si SiteNode pere)
1619  if (QString(_pModeler->metaObject()->className()).compare("TYSiteModelerFrame") == 0)
1620  {
1622  }
1623 
1624  return ret;
1625 }
1626 
1627 bool TYPositionEditor::rotate(ORepere3D* pRepere, bool enableX /*=true*/, bool enableY /*=true*/,
1628  bool enableZ /*=true*/)
1629 {
1630  Q_CHECK_PTR(pRepere);
1631  bool ret = false;
1632 
1633  if (!enableX && !enableY && !enableZ)
1634  {
1635  return false;
1636  }
1637 
1638  // On ne fait rien si la souris n'a pas bougee
1639  if ((_currentMousePos[0] == _lastMousePos[0]) && (_currentMousePos[1] == _lastMousePos[1]))
1640  {
1641  return false;
1642  }
1643 
1644  // Chgmt de repere si besoin (si SiteNode pere)
1645  if (QString(_pModeler->metaObject()->className()).compare("TYSiteModelerFrame") == 0)
1646  {
1648  }
1649 
1650  double center[4];
1651  worldToDisplay(pRepere->_origin._x, pRepere->_origin._z, -pRepere->_origin._y, center);
1652 
1653  int diffX1 = _currentMousePos[0] - int(center[0]);
1654  int diffY1 = _currentMousePos[1] - int(center[1]);
1655  int diffX2 = _lastMousePos[0] - int(center[0]);
1656  int diffY2 = _lastMousePos[1] - int(center[1]);
1657 
1658  double a1 = atan2(double(diffY1), double(diffX1));
1659  double a2 = atan2(double(diffY2), double(diffX2));
1660  float angle = (a2 - a1) / (2.0 * 3.1415926535) * 360.0 / 10.0 * _trackballFactor;
1661 
1663  {
1664  angle = ROUND(angle / _angleStep) * _angleStep;
1665  }
1666 
1667  // Si l'angle n'est pas nul
1668  if (angle != 0)
1669  {
1670  // On applique la rotation
1671 
1672  OMatrix tyMat;
1673  OMatrix tyMatTmpX;
1674  OMatrix tyMatTmpY;
1675  OMatrix tyMatTmpZ;
1676 
1677  double vpNormal[3];
1678  vpNormal[0] = _pInteractor->getRenderer()->getActiveCamera()->front.x;
1679  vpNormal[1] = _pInteractor->getRenderer()->getActiveCamera()->front.y;
1680  vpNormal[2] = _pInteractor->getRenderer()->getActiveCamera()->front.z;
1681 
1682  if (!enableX)
1683  {
1684  vpNormal[0] = 0.0;
1685  }
1686  if (!enableY)
1687  {
1688  vpNormal[2] = 0.0;
1689  }
1690  if (!enableZ)
1691  {
1692  vpNormal[1] = 0.0;
1693  }
1694 
1695  if (vpNormal[0] != 0)
1696  {
1697  tyMatTmpX.setRotationOx(-vpNormal[0] * M_PI * angle / 180);
1698  }
1699  if (vpNormal[2] != 0)
1700  {
1701  tyMatTmpY.setRotationOy(vpNormal[2] * M_PI * angle / 180);
1702  }
1703  if (vpNormal[1] != 0)
1704  {
1705  tyMatTmpZ.setRotationOz(-vpNormal[1] * M_PI * angle / 180);
1706  }
1707 
1708  tyMat = pRepere->asMatrix() * tyMatTmpZ * tyMatTmpY * tyMatTmpX;
1709 
1710  OPoint3D org = pRepere->_origin; // On conserve l'origine de depart
1711  pRepere->set(tyMat);
1712  pRepere->_origin = org;
1713 
1714  // Save mouse pos car il y a eu une rotation
1717 
1718  // On affiche la somme de l'angle que l'on applique durant cette rotation
1719  _angleInfo = ((int)(_angleInfo + angle)) % 360;
1720  updateText(QString(TR("id_angle_info")).arg(_angleInfo, 0, 'f', 2), (int)center[0], (int)center[1]);
1721 
1722  // Le repere a ete modifie
1723  ret = true;
1724  }
1725 
1726  // Chgmt de repere si besoin (si SiteNode pere)
1727  if (QString(_pModeler->metaObject()->className()).compare("TYSiteModelerFrame") == 0)
1728  {
1730  }
1731 
1732  return ret;
1733 }
1734 
1735 int TYPositionEditor::findPoint(float* ptToFind, TYTabPoint* pInPoints)
1736 {
1737  int ptId = -1;
1738 
1739  for (size_t i = 0; i < pInPoints->size(); i++)
1740  {
1741  TYPoint curPt = pInPoints->at(i);
1742 
1743  if ((ptToFind[0] >= curPt._x - _pickPointPrecision) &&
1744  (ptToFind[0] <= curPt._x + _pickPointPrecision) &&
1745  (-ptToFind[2] >= curPt._y - _pickPointPrecision) &&
1746  (-ptToFind[2] <= curPt._y + _pickPointPrecision))
1747  {
1748  // Point trouve !
1749  ptId = static_cast<int>(i);
1750 
1751  updateMovingLines(pInPoints, ptId);
1752 
1753  break;
1754  }
1755  }
1756 
1757  return ptId;
1758 }
1759 
1760 void TYPositionEditor::updateMovingLines(TYTabPoint* pPoints, int centralPointId)
1761 {
1762  TYPoint centralPoint = pPoints->at(centralPointId);
1763  if (_pEditGeoNode)
1764  {
1765  centralPoint = _pEditGeoNode->getMatrix() * centralPoint;
1766  }
1767 
1768  if (centralPointId - 1 >= 0)
1769  {
1770  TYPoint prevPoint = pPoints->at(centralPointId - 1);
1771  if (_pEditGeoNode)
1772  {
1773  prevPoint = _pEditGeoNode->getMatrix() * prevPoint;
1774  }
1775 
1776  _pOGLLineElementMoving1->setPoint1(OPoint3D(prevPoint._x, prevPoint._z, -prevPoint._y));
1777  _pOGLLineElementMoving1->setPoint2(OPoint3D(centralPoint._x, centralPoint._z, -centralPoint._y));
1779  }
1780 
1781  if (centralPointId + 1 < (int)pPoints->size())
1782  {
1783  TYPoint nextPoint = pPoints->at(centralPointId + 1);
1784  if (_pEditGeoNode)
1785  {
1786  nextPoint = _pEditGeoNode->getMatrix() * nextPoint;
1787  }
1788 
1789  _pOGLLineElementMoving2->setPoint1(OPoint3D(centralPoint._x, centralPoint._z, -centralPoint._y));
1790  _pOGLLineElementMoving2->setPoint2(OPoint3D(nextPoint._x, nextPoint._z, -nextPoint._y));
1792  }
1793 }
1794 
1796 {
1797  TYPoint centralPoint(point);
1798  if (_pEditGeoNode)
1799  {
1800  centralPoint = _pEditGeoNode->getMatrix() * centralPoint;
1801  }
1802 
1803  _pOGLLineElementMoving1->setPoint2(OPoint3D(centralPoint._x, centralPoint._z, -centralPoint._y));
1804  _pOGLLineElementMoving2->setPoint1(OPoint3D(centralPoint._x, centralPoint._z, -centralPoint._y));
1805 }
1806 
1808 {
1809  bool stop = false;
1810 
1811  // Recherche du siteNodeParent
1812  TYElement* pParent = pElt->getParent();
1813 
1814  while (pParent && (dynamic_cast<TYSiteNode*>(pParent) == nullptr))
1815  {
1816  pParent = pParent->getParent();
1817  }
1818 
1819  // Si le modeleur point un projet on prend le sitenode racine
1820  TYElement* pModelerTarget = NULL;
1821  if (_pModeler->getElement()->isA("TYProjet"))
1822  {
1823  pModelerTarget = TYProjet::safeDownCast(_pModeler->getElement())->getSite();
1824  }
1825  else
1826  {
1827  pModelerTarget = _pModeler->getElement();
1828  }
1829 
1830  // Si le site parent n'est pas le meme que le site pointe par le modeleur
1831  if (pModelerTarget && (pParent != pModelerTarget))
1832  {
1833  // On initialise sur lui
1834  initEditSiteNode(pParent);
1835  stop = true; // La methode appelante devra se terminer
1836  }
1837 
1838  return stop;
1839 }
1840 
1842 {
1843  int ptIdToEdit = 0;
1844  if (_keyAOn) // Insert a point
1845  {
1846  TYPoint ptInsert;
1847  insertNewPoint(pts, ptInsert, ptIdToEdit, pAlti);
1848  _pLastAction = new TYInsertPointPolyLineAction(pElt, pts, ptIdToEdit, ptInsert, _pModeler,
1849  TR("id_action_insertptpolyline"));
1850  }
1851  else if (_keyDOn) // Delete a point
1852  {
1853  size_t nbPts = pts.size();
1854  if (nbPts < 3 || (closed && nbPts < 4))
1855  {
1856  return;
1857  }
1858  TYPoint ptDelete;
1859  deletePoint(pts, ptDelete, ptIdToEdit);
1860  _pLastAction = new TYRemovePointPolyLineAction(pElt, pts, ptIdToEdit, ptDelete, _pModeler,
1861  TR("id_action_delptpolyline"));
1862  }
1863  else // Move a point
1864  {
1865  // We find the id of the closest point to the mouse
1866  ptIdToEdit = findClosestPointToMouse(pts);
1867  _pEditPoint = &pts[ptIdToEdit];
1868  _pLastAction = new TYMovePointPolyLineAction(pElt, pts, ptIdToEdit, *_pEditPoint, TYPoint(),
1869  _pModeler, TR("id_action_moveptpolyline"));
1870  // Is the highlight working...?
1871  TYPoint worldPoint = _pEditGeoNode->getMatrix() * (*_pEditPoint);
1872  _pPicker->highlightElement(&worldPoint);
1873  // Connecte the timer
1874  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editPoint);
1875  _inUse = true;
1876  }
1877 }
1878 
1879 void TYPositionEditor::insertNewPoint(TYTabPoint& pts, TYPoint& newPoint, int& idInsert, LPTYAltimetrie pAlti)
1880 {
1881  idInsert = findClosestSegmentToMouse(pts);
1882  double ptProj[3];
1883  displayToWorld(_currentMousePos[0], _pInteractor->height() - _currentMousePos[1], 0.5, ptProj);
1884  newPoint = TYPoint(ptProj[0], -ptProj[2], pts[idInsert]._z);
1885 
1886  // Si la grille magnetique est activee
1888  {
1889  snapToGrid(newPoint._x, newPoint._y, newPoint._z, _gridMagnStep);
1890  }
1891 
1892  ++idInsert;
1893  if (pAlti && !pAlti->altitude(newPoint))
1894  {
1895  newPoint._z = std::numeric_limits<double>::quiet_NaN();
1896  }
1897  pts.insert(pts.begin() + idInsert, newPoint);
1898 }
1899 
1900 void TYPositionEditor::deletePoint(TYTabPoint& pts, TYPoint& deletedPoint, int& idDelete)
1901 {
1902  idDelete = findClosestPointToMouse(pts);
1903  deletedPoint = pts[idDelete];
1904  pts.erase(pts.begin() + idDelete);
1905 }
1906 
1908 {
1909  int idPt = 0;
1910  size_t nbPts = pts.size();
1911  double ptOnDisplay[3];
1912  OVector3D pt(0, 0, 0);
1913  const OMatrix& matrixNode = _pEditGeoNode->getMatrix();
1914 
1915  std::vector<OVector3D> ptsDisplay;
1916  // We project on the display the points of our polyline
1917  for (size_t i = 0; i < nbPts; ++i)
1918  {
1919  // Is the transformation really necessary?
1920  pt = matrixNode * pts[i];
1921  worldToDisplay(pt._x, pt._z, -pt._y, ptOnDisplay);
1922  ptsDisplay.push_back(OVector3D(ptOnDisplay[0], ptOnDisplay[1], 0.0));
1923  }
1924 
1925  double distSqrMin = (std::numeric_limits<double>::max)();
1926  double distSqr = 0;
1927  double mx = _currentMousePos[0];
1928  double my = _pInteractor->height() - _currentMousePos[1];
1929 
1930  // Find the closest line to our mouse position
1931  size_t j = 0;
1932  for (size_t i = 0; i < nbPts; ++i)
1933  {
1934  j = i < (nbPts - 1) ? i + 1 : 0;
1935  const OVector3D& v = ptsDisplay[i];
1936  const OVector3D& w = ptsDisplay[j];
1937 
1938  distSqr = distSegmentSqr(mx, my, v._x, v._y, w._x, w._y);
1939  if (distSqr < distSqrMin)
1940  {
1941  distSqrMin = distSqr;
1942  idPt = static_cast<int>(i);
1943  }
1944  }
1945  return idPt;
1946 }
1947 
1949 {
1950  int ptId = -1;
1951  size_t nbPts = pts.size();
1952  double distSqrMin = (std::numeric_limits<double>::max)();
1953  double ptOnDisplay[3];
1954  double diffx = 0, diffy = 0, distSqr = 0;
1955  OVector3D pt(0, 0, 0);
1956  const OMatrix& matrixNode = _pEditGeoNode->getMatrix();
1957 
1958  for (size_t i = 0; i < nbPts; ++i)
1959  {
1960  // Is the transformation really necessary?
1961  pt = matrixNode * pts[i];
1962  worldToDisplay(pt._x, pt._z, -pt._y, ptOnDisplay);
1963  diffx = ptOnDisplay[0] - _currentMousePos[0];
1964  diffy = ptOnDisplay[1] - _pInteractor->height() + _currentMousePos[1];
1965  distSqr = diffx * diffx + diffy * diffy;
1966  if (distSqr < distSqrMin)
1967  {
1968  distSqrMin = distSqr;
1969  ptId = static_cast<int>(i);
1970  }
1971  }
1972  return ptId;
1973 }
1974 
1975 double TYPositionEditor::distSegmentSqr(double mx, double my, double vx, double vy, double wx,
1976  double wy) const
1977 {
1978  double l2 = (vx - wx) * (vx - wx) + (vy - wy) * (vy - wy);
1979  if (l2 != 0)
1980  {
1981  double t = ((mx - vx) * (wx - vx) + (my - vy) * (wy - vy)) / l2;
1982  if (t < 0)
1983  {
1984  return (mx - vx) * (mx - vx) + (my - vy) * (my - vy);
1985  }
1986  else if (t > 1)
1987  {
1988  return (mx - wx) * (mx - wx) + (my - wy) * (my - wy);
1989  }
1990  else
1991  {
1992  return (mx - (vx + t * (wx - vx))) * (mx - (vx + t * (wx - vx))) +
1993  (my - (vy + t * (wy - vy))) * (my - (vy + t * (wy - vy)));
1994  }
1995  }
1996  else
1997  {
1998  return (mx - vx) * (mx - vx) + (my - vy) * (my - vy);
1999  }
2000 }
int ROUND(double a)
Compute the rounded value of a number.
Definition: 3d.h:192
fichier contenant differents types d'actions (fichier header)
pour l'application Tympan (fichier header)
gestion de l'edition de la camera (fichier header)
std::vector< TYPoint > TYTabPoint
Collection de TYPoint.
Definition: TYDefines.h:340
gestion des elements selectionnes par picking (fichier header)
std::list< TYGeometryNode * > TYListPtrGeoNode
Liste ordonnee de pointeurs de TYElement.
Classe generique pour une fenetre de modeleur (fichier header)
#define TR(id)
gestion de la position selon les modes 'moving', 'rotation', 'edition' (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)
NxReal z
Definition: NxVec3.h:80
NxReal y
Definition: NxVec3.h:80
NxReal x
Definition: NxVec3.h:80
Definition: color.h:31
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
NxVec3 front
Definition: OGLCamera.h:125
void setVisibility(bool bVisible)
Definition: OGLElement.h:51
void setIs3D(bool bIs3D)
Definition: OGLElement.h:59
void setPoint1(const OPoint3D &point1)
void setColor(const OColor &oColor)
void setPoint2(const OPoint3D &point2)
The 4x4 matrix class.
Definition: 3d.h:625
int setRotationOz(double a)
Update a rotation matrix (Oz axis).
Definition: 3d.cpp:688
int setRotationOy(double a)
Update a rotation matrix (Oy axis).
Definition: 3d.cpp:676
OMatrix getInvert(int *ok=0) const
Return the inverse matrix of this matrix.
Definition: 3d.cpp:813
int setRotationOx(double a)
Update a rotation matrix (Ox axis).
Definition: 3d.cpp:664
The 3D point class.
Definition: 3d.h:487
static OPrototype * safeDownCast(OPrototype *pObject)
Definition: TYElement.cpp:71
bool isA(const char *className) const
Definition: TYElement.cpp:65
3D frame with a point and 3 vectors.
Definition: 3d.h:1211
void set(const OPoint3D &origin, const OVector3D &vecI, const OVector3D &vecJ, const OVector3D &vecK)
Sets with a point and 3 vectors.
Definition: 3d.cpp:1427
OPoint3D _origin
The origin point.
Definition: 3d.h:1279
OMatrix asMatrix() const
return the transformation matrix from unity to this pose such as this = transform * unity
Definition: 3d.cpp:1462
The 3D vector class.
Definition: 3d.h:298
T * getRealPointer()
Definition: smartptr.h:291
Classe abstraite pour la gestion de l'interaction entre la vue graphique (2D ou 3D) et le clavier et ...
double _gridMagnStep
Pas de la grille magnétique de positionnement.
void worldToDisplay(double x, double y, double z, double *displayPoint)
Methode utilitaire pour convertir un point en coordonnees globale en coordonnees ecran.
static void snapToGrid(float &x, float &y, float &z, float &gridMagnStep)
Methode utilitaire qui adapte les coordonnees d'un point pour que celui-ci soit aligne avec la grille...
virtual void disconnect()
Deconnecte cet editor a l'interactor associe.
void updateText(QString msg="", int posX=0, int posY=0, bool show=true)
Mets a jour le texte informatif sur la vue 3D.
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.
virtual void connect()
Connecte cet editor a l'interactor associe.
void showText(bool show=true)
Affiche ou pas le texte informatif sur la vue 3D.
TYRenderWindowInteractor * _pInteractor
La vue graphique associee a cet editor.
TYTabPoint & getTabPoint()
LPTYAcousticVolumeGeoNode findAcousticVol(const LPTYAcousticVolume pAccVol)
void addAction(TYAction *pAction)
Ajoute une nouvelle action a l'historique.
double altitude(const OPoint3D &pt)
Gestion de l'edition en mode camera.
void setLeftButtonFunction2D(void(TYCameraEditor::*function)())
void setMiddleButtonFunction2D(void(TYCameraEditor::*function)())
void setRightButtonFunction2D(void(TYCameraEditor::*function)())
void setShiftRightButtonFunction2D(void(TYCameraEditor::*function)())
void setShiftLeftButtonFunction2D(void(TYCameraEditor::*function)())
virtual void slotViewTypeChanged(int view)
TYTabPoint & getListPoints()
void courbeNiveauPicked(TYElement *pElt)
void etagePicked(TYElement *pElt)
void linearMaillagePicked(TYElement *pElt)
void sourcePonctuellePicked(TYElement *pElt)
void ecranPicked(TYElement *pElt)
void reset()
Retourne dans son etat initial.
void acousticSemiCylinderPicked(TYElement *pElt)
void pointControlPicked(TYElement *pElt)
void highlightElement(TYElement *pElt)
Dessine la boite englobante de l'element passe.
void machinePicked(TYElement *pElt)
void routePicked(TYElement *pElt)
void acousticBoxPicked(TYElement *pElt)
void acousticCylinderPicked(TYElement *pElt)
void coursEauPicked(TYElement *pElt)
bool pick(int x, int y)
Effectue un picking en (x, y).
void reseauTransportPicked(TYElement *pElt)
void planEauPicked(TYElement *pElt)
void batimentPicked(TYElement *pElt)
void terrainPicked(TYElement *pElt)
void rectangularMaillagePicked(TYElement *pElt)
TYElement * getParent() const
Definition: TYElement.h:699
static void setIsSavedOk(const bool &toSave)
Definition: TYElement.h:915
virtual void setIsGeometryModified(bool isModified)
Definition: TYElement.cpp:253
double getHauteur() const
Definition: TYEtage.cpp:1018
bool getClosed()
Definition: TYEtage.h:206
bool setMurs(const TYTabPoint &tabPts, double hauteur=2.0, bool close=true)
Definition: TYEtage.cpp:875
const ORepere3D & getORepere3D() const
OMatrix localToGlobal() const
OMatrix globalToLocal() const
void GetGeoNodeParentList(TYListPtrGeoNode &GetGeoNodeParents)
TYElement * getElement() const
OMatrix getMatrix() const
static TYGeometryNode * GetGeoNode(TYElement *pElement)
void setRepere(const ORepere3D &repere)
LPTYBatimentGeoNode findBatiment(const LPTYBatiment pBatiment)
LPTYUserSourcePonctuelleGeoNode findSrc(const LPTYUserSourcePonctuelle pSrc)
LPTYReseauTransportGeoNode findResTrans(const LPTYReseauTransport pResTrans)
Action editing for a polyline (when inserting point)
Definition: TYActions.h:1108
Classe de definition d'un maillage.
Definition: TYMaillage.h:51
Classe generique pour une fenetre de modeleur.
LPTYElement getElement()
TYElementPicker * getElementPicker()
bool getSnapGridActive()
TYActionManager * getActionManager()
bool askForResetResultat()
virtual void updateView(bool clipping=true, bool axesAndGrid=true)
Actions de deplacement d'un GeometryNode.
Definition: TYActions.h:575
Action de deplacement d'un point de controle.
Definition: TYActions.h:735
Action de deplacement d'un point d'un etage.
Definition: TYActions.h:638
Action editing for a polyline (when moving point)
Definition: TYActions.h:1051
Action de deplacement d'un source ponctuelle.
Definition: TYActions.h:671
void updateDisplayList(void)
void updateDisplayListOverlay(TYGeometryNode *pElement, TYGeometryNode *pDansCeRepere)
void addOGLElement(OGLElement *pOGLElement)
void removeOGLElement(OGLElement *pOGLElement)
OGLCamera * getActiveCamera()
Action d'orientation d'une source ponctuelle.
Definition: TYActions.h:703
virtual TYTabPoint & getListPoints()
Definition: TYPlanEau.h:118
Classe de definition d'un point de controle.Le point de controle est un point de calcul avec une haut...
void initEditPlanEau(TYElement *pElt)
virtual void connect()
double distSegmentSqr(double mx, double my, double vx, double vy, double wx, double wy) const
Shortest distance (squared) between a segment and a point.
int _interactionTime
La duree de step pour le timer.
QTimer * _pStepTimer
Timer pour miniser le nombre de refresh.
bool _viewOnlyHighlight
Indique si on affiche que la bounding box lors de l'edition.
bool _mouseEventActive
Indique si l'editor est en pleine action.
void updateMovingPoint(const TYPoint &point)
float _pickPointPrecision
Precision pour la detection d'un point clique.
bool rotate(ORepere3D *pRepere, bool enableX=true, bool enableY=true, bool enableZ=true)
void setInteractionTime(int time)
void deletePoint(TYTabPoint &pts, TYPoint &deletedPoint, int &idDelete)
Delete the closest point of a polyline to the mouse position.
void editPolyLine(LPTYElement pElt, TYTabPoint &pts, bool close, LPTYAltimetrie pAlti=NULL)
Edit a polyline.
void setMode(int mode)
void initEditTerrain(TYElement *pElt)
void initEditMaillage(TYElement *pElt)
virtual void disconnect()
virtual void close()
int _mode
Le mode pour cet editor.
void initEditSiteNode(TYElement *pElt)
void initEditRoute(TYElement *pElt)
virtual void slotKeyReleased(int key)
bool _keyAOn
If the A key is pressed.
bool _shiftOn
Indique si le bouton Shift est enfonce.
bool _active
Indique si cet editor est actif.
void initEditPointControl(TYElement *pElt)
TYAction * _pLastAction
La derniere action (pour le undo).
OGLLineElement * _pOGLLineElementMoving2
void insertNewPoint(TYTabPoint &pts, TYPoint &newPoint, int &idInsert, LPTYAltimetrie pAlti=NULL)
Add a new point on the closest line to the mouse position.
void updateMovingLines(TYTabPoint *pPoints, int centralPointId)
bool _firstCall
Indiquateur pour l'init de calculs.
TYPoint * _pEditPoint
Le point a deplacer.
bool _inUse
Indique si une action est deja en cours.
void initEditBatiment(TYElement *pElt)
float _angleInfo
Pour l'affichage de l'angle de rotation a appliquer.
void initEditEcran(TYElement *pElt)
void PointOfGeoNodeInCurrentSiteCoordinatesOrPointOfCurrentSiteInGeoNodeCoordinates(TYGeometryNode *pGeoNode, OPoint3D &centralPointGN, bool bPointOfGeoNodeInCurrentSiteCoordinates)
void initEditResTrans(TYElement *pElt)
int findClosestSegmentToMouse(const TYTabPoint &pts)
Find the closest segment of a polyline to the mouse position.
int findClosestPointToMouse(const TYTabPoint &pts)
Return the id of the closest point of a polyline to the mouse position.
TYCameraEditor * _pCamEditor
Un CameraEditor associe a cet editor.
virtual void init()
TYTabPoint _editContour
Le contour de l'etage a editer.
void PointOfCurrentSiteInGeoNodeCoordinates(TYGeometryNode *pGeoNode, OPoint3D &centralPointGN)
virtual void slotMousePressed(int x, int y, Qt::MouseButton button, Qt::KeyboardModifiers state)
TYPositionEditor(TYModelerFrame *pModeler, int mode=Moving)
void setPickPointPrecision(float precision)
void initEditCrbNiv(TYElement *pElt)
int _currentMousePos[2]
La position courante du curseur.
TYGeometryNode * _pEditGeoNode
Le GeoNode associe a l'element que l'on edite.
bool move(OPoint3D *pPt, bool enableX=true, bool enableY=true, bool enableZ=true)
virtual void cancel()
int findPoint(float *ptToFind, TYTabPoint *pInPoints)
bool selectElement(TYElement *pElt)
void setAngleStep(float step)
void initEditSrcPonct(TYElement *pElt)
OGLLineElement * _pOGLLineElementMoving1
Pour la representation de l'edition d'un point.
float _trackballFactor
Facteur de rotation.
virtual void slotMouseMoved(int x, int y, Qt::MouseButtons button, Qt::KeyboardModifiers state)
void PointOfGeoNodeInCurrentSiteCoordinates(TYGeometryNode *pGeoNode, OPoint3D &centralPointGN)
virtual void slotKeyPressed(int key)
virtual void slotViewTypeChanged(int view)
int _lastMousePos[2]
La derniere position connue du curseur.
virtual void slotMouseReleased(int x, int y, Qt::MouseButton button, Qt::KeyboardModifiers state)
void initEditVolume(TYElement *pElt)
void setSensitivity(float t)
TYElement * _pEditElement
L'element que l'on edite.
TYElementPicker * _pPicker
Le picker du modeler.
bool _keyDOn
If the D key is pressed.
bool _bSiteModelerFrame
Indicateur d'edition dans un modeler frame.
float _angleStep
Pas d'angle pour la rotation.
void initEditCrsEau(TYElement *pElt)
void initEditMachine(TYElement *pElt)
classe de definition d'un projet.
Definition: TYProjet.h:45
LPTYMaillageGeoNode findMaillage(const LPTYMaillage pMaillage)
Retrouve le GeoNode associe a un maillage.
Definition: TYProjet.cpp:873
virtual void updateGL()
TYOpenGLRenderer * getRenderer()
Actions de rotation d'un GeometryNode.
Definition: TYActions.h:607
Classe Modeler specialisee pour l'edition des sites.
LPTYSiteNode getSite()
LPTYAltimetrie getAltimetry() const
LPTYSiteNodeGeoNode findSiteNode(const LPTYSiteNode pSiteNode)
OVector3D & getOrientation()
virtual TYTabPoint & getListPoints()
Definition: TYTerrain.h:131
LPTYCourbeNiveauGeoNode findCrbNiv(const LPTYCourbeNiveau pCrbNiv)
LPTYTerrainGeoNode findTerrain(const LPTYTerrain pTerrain)
LPTYPlanEauGeoNode findPlanEau(const LPTYPlanEau pPlanEau)
LPTYCoursEauGeoNode findCrsEau(const LPTYCoursEau pCrsEau)
#define M_PI
Pi.
Definition: color.cpp:25