Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYPositionEditor.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012-2024> <EDF-DTG> <FRANCE>
3  * This file is part of Code_TYMPAN (R).
4  * Code_TYMPAN (R) is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  * Code_TYMPAN (R) is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11  * See the GNU General Public License for more details.
12  * You should have received a copy of the GNU General Public License along
13  * with Code_TYMPAN (R). If not, see <https://www.gnu.org/licenses/>.
14  */
15 
21 #include <qtimer.h>
22 #include <qcursor.h>
23 #include <qstatusbar.h>
24 #include <qvector3d.h>
25 
42 #include "TYPositionEditor.h"
44 #include "models/common/3d.h"
45 
46 #define TR(id) OLocalizator::getString("TYPositionEditor", (id))
47 
48 static bool bTYPositionEditorFirstMove = true;
49 
50 TYPositionEditor::TYPositionEditor(TYModelerFrame* pModeler, int mode /*=Moving*/)
51  : TYAbstractSceneEditor(pModeler)
52 {
53  setMode(mode);
54 
55  setAngleStep(15.0);
57 
58  // On recupere le pointeur sur le picker du modeler
60 
61  // Camera
62  _pCameraEditor = new TYCameraEditor(pModeler);
68 
69  _shiftOn = false;
70  _keyAOn = false;
71  _keyDOn = false;
72  _active = true;
73  _firstCall = false;
74  _viewOnlyBoundingBox = true;
75  _angleInfo = 0.0;
76  _pLastAction = NULL;
77  _inUse = false;
78  _bSiteModelerFrame = false;
79 
80  _pStepTimer = new QTimer(this);
81  _mouseEventActive = false;
82 
84  setSensitivity(20.0);
85 
86  _pEditElement = NULL;
87  _pEditGeoNode = NULL;
88  _pEditPoint = NULL;
89 
90  // Line 1
92  _pOGLLineElementMoving1->setColor(OColor(1.0, 0.0, 0.0));
95 
97  _pOGLLineElementMoving2->setColor(OColor(1.0, 0.0, 0.0));
100 
103 }
104 
106 {
107  delete _pCameraEditor;
108 
109  if (_pLastAction)
110  {
111  delete _pLastAction;
112  _pLastAction = NULL;
113  }
114 
119 }
120 
122 {
124 
125  // En fonction du type de modeler on edite pas le meme parent
126  if (QString(_pModeler->metaObject()->className()).compare("TYMachineModelerFrame") == 0)
127  {
128  // On edite les volumes
129  QObject::connect(_pPicker, &TYElementPicker::acousticCylinderPicked, this,
131  QObject::connect(_pPicker, &TYElementPicker::acousticSemiCylinderPicked, this,
133  QObject::connect(_pPicker, &TYElementPicker::acousticBoxPicked, this,
135  }
136  else if (QString(_pModeler->metaObject()->className()).compare("TYBatimentModelerFrame") == 0)
137  {
138  // On edite les silos
139  QObject::connect(_pPicker, &TYElementPicker::acousticCylinderPicked, this,
141  // On edite les machines
143  // Et les Sources ponctuelles
144  QObject::connect(_pPicker, &TYElementPicker::sourcePonctuellePicked, this,
146  // Et les etages
148  // Et les ecrans
150  }
151  else if (QString(_pModeler->metaObject()->className()).compare("TYSiteModelerFrame") == 0)
152  {
153  _bSiteModelerFrame = true;
154 
155  // On edite les batiments
156  QObject::connect(_pPicker, &TYElementPicker::batimentPicked, this,
158  // Et les machines "en plein air"
160 
161  // Les elements de topo et d'infra
163  QObject::connect(_pPicker, &TYElementPicker::reseauTransportPicked, this,
165  QObject::connect(_pPicker, &TYElementPicker::courbeNiveauPicked, this,
170  QObject::connect(_pPicker, &TYElementPicker::sourcePonctuellePicked, this,
173 
174  // Les maillages et elements propres aux calculs
175  QObject::connect(_pPicker, &TYElementPicker::pointControlPicked, this,
177  QObject::connect(_pPicker, &TYElementPicker::rectangularMaillagePicked, this,
179  QObject::connect(_pPicker, &TYElementPicker::linearMaillagePicked, this,
181  }
182 
183  // On connect la camera aussi
185 
186  // Preferences
187  static const char dirName[] = "UserPreferences";
188 
189  if (TYPreferenceManager::getInstance().exists(dirName, "ViewOnlyHighlight"))
190  {
191  _viewOnlyBoundingBox = TYPreferenceManager::getInstance().getBool(dirName, "ViewOnlyHighlight");
192  }
193  else
194  {
195  TYPreferenceManager::getInstance().setBool(dirName, "ViewOnlyHighlight", _viewOnlyBoundingBox);
196  }
197 }
198 
200 {
202 
203  _pPicker->disconnect(this);
205 }
206 
208 
210 {
211  _pPicker->reset();
212  _inUse = false;
213 
214  showText(false);
215  _pInteractor->update();
216 }
217 
219 {
220  cancel();
221 }
222 
224 {
225  switch (key)
226  {
227  case Qt::Key_Shift:
228  _shiftOn = true;
229  break;
230  case Qt::Key_A:
231  _keyAOn = true;
232  break;
233  case Qt::Key_D:
234  _keyDOn = true;
235  break;
236  case Qt::Key_Escape:
237  cancel();
238  break;
239  }
240 }
241 
243 {
244  switch (key)
245  {
246  case Qt::Key_Shift:
247  _shiftOn = false;
248  break;
249  case Qt::Key_A:
250  _keyAOn = false;
251  break;
252  case Qt::Key_D:
253  _keyDOn = false;
254  break;
255  }
256 }
257 
259 {
260  showText(false);
261  _pInteractor->update();
262 
263  // On relaie le signal au CameraEditor
265 }
266 
267 void TYPositionEditor::slotMousePressed(int x, int y, Qt::MouseButton button, Qt::KeyboardModifiers state)
268 {
269  if (_mouseEventActive)
270  {
271  return;
272  }
273 
274  if (_pLastAction)
275  {
276  delete _pLastAction;
277  _pLastAction = NULL;
278  }
279 
280  if (_active && !_shiftOn)
281  {
282  if (button == Qt::LeftButton)
283  {
284  _pPicker->reset();
285 
286  // On met a true car la "pick" emet des signaux.
287  _mouseEventActive = true;
288 
289  // On effectue le picking
290  if (!_pPicker->pick(x, _pInteractor->getViewport().height() - y))
291  {
292  // Rien de picker, on peut remettre a false, normalement
293  // aucun signaux n'ont ete emis par "pick"
294  _mouseEventActive = false;
295  }
296  }
297  }
298 
299  // Si un element a ete picke et si l'utilisateur accepte d'effacer
300  // les resultats courant le cas echeant
301  if (_mouseEventActive) // && _pModeler->askForResetResultat()) // DT -- le 22/08/2005
302  {
303  // On deconnecte la camera le temps de l'edition
305 
306  _currentMousePos[0] = x;
307  _currentMousePos[1] = y;
308  _lastMousePos[0] = x;
309  _lastMousePos[1] = y;
310  _firstCall = true;
311  _angleInfo = 0.0;
313 
314  if (_mode == Moving)
315  {
316  TYApplication::setOverrideCursor(Qt::SizeAllCursor);
317  }
318  else
319  {
320  TYApplication::setOverrideCursor(Qt::BlankCursor);
321  }
322  }
323 }
324 
325 void TYPositionEditor::slotMouseReleased(int x, int y, Qt::MouseButton button, Qt::KeyboardModifiers state)
326 {
327  bTYPositionEditorFirstMove = true;
328  if (_mouseEventActive)
329  {
330  _pStepTimer->stop();
331  _mouseEventActive = false;
332  QObject::disconnect(_pStepTimer, 0, this, 0);
333 
334  if (_pLastAction)
335  {
337  _pLastAction = NULL;
338  }
339 
341  {
342  _pEditGeoNode->getGraphicObject()->setOnlyBoundingBox(false);
343  }
344 
345  _inUse = false;
346  _pEditElement = NULL;
347  _pEditPoint = NULL;
348 
349  showText(false);
352 
353  // On arrete le highlight dans la scene 3D
354  _pPicker->highlightElement(NULL); // az++
355  // TODO ensure that updateDisplay
356  // a flag in the modeler or the renderer when the)
359  _pInteractor->getRenderer()->updateDisplayListOverlay(renderContext, NULL, NULL);
361  _pEditGeoNode = NULL; // az++
362 
363  _pModeler->updateView(true, true); // DT++ le 22/08/2005
364 
365  _pModeler->askForResetResultat(); // CLM++ le 10/01/2012
366 
367  // L'edition est terminee on reconnecte la camera
369 
370  // La scene a ete modifiee
372 
373  TYApplication::restoreOverrideCursor();
374  }
375 }
376 
377 void TYPositionEditor::slotMouseMoved(int x, int y, Qt::MouseButtons button, Qt::KeyboardModifiers state)
378 {
379  _currentMousePos[0] = x;
380  _currentMousePos[1] = y;
381 }
382 
384 {
385  if (!_mouseEventActive || _inUse)
386  {
387  return;
388  }
389 
390  // Pour traiter le cas d'une imbrication verticale
391  // (site in site in site in ...in siteroot), on va rechercher
392  // le site qui est directement enfant du site pointe par le modeleur
393 
394  // On recupere le site pointe par le modeleur
395  TYElement* pModelerTarget = NULL;
396  if (_pModeler->getElement()->isA("TYProjet"))
397  {
398  pModelerTarget = TYProjet::safeDownCast(_pModeler->getElement())->getSite();
399  }
400  else
401  {
402  pModelerTarget = _pModeler->getElement();
403  }
404 
405  // Ensuite on boucle pour retrouver son fils
406  TYElement* pParent = pElt->getParent();
407 
408  while (pParent && (pParent != pModelerTarget))
409  {
410  pElt = pParent;
411  pParent = pParent->getParent();
412  }
413 
414  if (!pElt)
415  {
416  return;
417  } // Au cas ou on serait parti dans les choux, on sort ...
418 
419  // On positionne l'element courant
420  _pEditElement = pElt;
421 
422  // On le highlight dans la scene 3D
424 
426  TYSiteNode* pSiteNodeParent = TYSiteNode::safeDownCast(pSiteNodeChild->getParent());
427 
428  // On ne peut rien faire sans le parent...
429  if (!pSiteNodeParent)
430  {
431  return;
432  }
433 
434  // On recupere le GeoNode associe
435  _pEditGeoNode = (TYGeometryNode*)pSiteNodeParent->findSiteNode(pSiteNodeChild).getRealPointer();
436  if (!_pEditGeoNode)
437  {
438  return;
439  }
440 
441  // Visu du highlight seulement
443  {
444  _pEditGeoNode->getGraphicObject()->setOnlyBoundingBox(_viewOnlyBoundingBox);
445  }
446 
447  if (_mode != Edition)
448  {
449  // On connecte le timer
450  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editGeoNode);
451  }
452 }
453 
455 {
456  if (!_mouseEventActive)
457  {
458  return;
459  }
460 
461  // On positionne l'element courant
462  _pEditElement = pElt;
463 
464  // On le highlight dans la scene 3D
466 
469 
470  // On ne peut rien faire sans le parent...
471  if (!pParent)
472  {
473  return;
474  }
475 
476  // On recupere le GeoNode associe
478  if (!_pEditGeoNode)
479  {
480  return;
481  }
482 
483  // Visu du highlight seulement
485  {
486  _pEditGeoNode->getGraphicObject()->setOnlyBoundingBox(_viewOnlyBoundingBox);
487  }
488 
489  if (_mode != Edition)
490  {
491  // On connecte le timer
492  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editGeoNode);
493  }
494 }
495 
497 {
498  if (!_mouseEventActive)
499  {
500  return;
501  }
502 
503  if (_bSiteModelerFrame)
504  {
505  // Si on est dans un siteModelerFrame, on s'assure que le site
506  // represente par le modeleur est le parent direct de l'element picke
507  // Si oui, on peut bouger l'element,
508  // Si non, on renvoie sur initEditSiteNode qui entrainera le mouvement
509  // du site imbrique de niveau juste inferieur au site represente par le modeleur
510  if (selectElement(pElt))
511  {
512  return;
513  }
514  }
515 
516  // On positionne l'element courant
517  _pEditElement = pElt;
518 
519  // On le highlight dans la scene 3D
521 
523  TYElement* pParent = TYElement::safeDownCast(pMachine->getParent());
524 
525  // On ne peut rien faire sans le parent...
526  if (!pParent)
527  {
528  return;
529  }
530 
531  // Le parent d'une Machine peut etre un Etage ou Infrastructure
532  if (pParent->isA("TYEtage"))
533  {
534  _pEditGeoNode = (TYGeometryNode*)((TYEtage*)pParent)->findMachine(pMachine).getRealPointer();
535  }
536  else if (pParent->isA("TYInfrastructure"))
537  {
538  _pEditGeoNode = (TYGeometryNode*)((TYInfrastructure*)pParent)->findMachine(pMachine).getRealPointer();
539  }
540  else
541  {
542  _pEditGeoNode = NULL;
543  }
544 
545  if (!_pEditGeoNode)
546  {
547  return;
548  }
549 
550  // Visu du highlight seulement
552  {
553  _pEditGeoNode->getGraphicObject()->setOnlyBoundingBox(_viewOnlyBoundingBox);
554  }
555 
556  if (_mode != Edition)
557  {
558  // On connecte le timer
559  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editGeoNode);
560 
561  // On "prend la main"
562  _inUse = true;
563  }
564 }
565 
566 /*void TYPositionEditor::initEditEtage(TYElement* pElt)
567 {
568  if (!_mouseEventActive || _inUse) {
569  return;
570  }
571 
572  if (_pModeler->getCurrentView() != TYModelerFrame::TopView) {
573  // L'edition d'un etage n'est possible qu'en vue de dessus
574  return;
575  }
576 
577  // On positionne l'element courant
578  _pEditElement = pElt;
579 
580  TYEtage * pEtage = TYEtage::safeDownCast(_pEditElement);
581  TYBatiment * pParent = TYBatiment::safeDownCast(pEtage->getParent());
582 
583  // On ne peut rien faire sans le parent...
584  if (!pParent) return;
585 
586  // On recupere le GeoNode associe
587  _pEditGeoNode = (TYGeometryNode *) pParent->findAcousticVol(pEtage).getRealPointer();
588  if (!_pEditGeoNode) return;
589 }*/
590 
592 {
593  if (!_mouseEventActive || _inUse)
594  {
595  return;
596  }
597 
599  {
600  // L'edition d'un etage n'est possible qu'en vue de dessus
601  return;
602  }
603 
604  if (_bSiteModelerFrame)
605  {
606  // Si on est dans un siteModelerFrame, on s'assure que le site
607  // represente par le modeleur est le parent direct de l'element picke
608  // Si oui, on peut bouger l'element,
609  // Si non, on renvoie sur initEditSiteNode qui entrainera le mouvement
610  // du site imbrique de niveau juste inferieur au site represente par le modeleur
611  if (selectElement(pElt))
612  {
613  return;
614  }
615  }
616 
617  // On positionne l'element courant
618  _pEditElement = pElt;
619 
621  TYBatiment* pParent = TYBatiment::safeDownCast(pEcran->getParent());
622 
623  // On ne peut rien faire sans le parent...
624  if (!pParent)
625  {
626  return;
627  }
628 
629  // On recupere le GeoNode associe
631  if (!_pEditGeoNode)
632  {
633  return;
634  }
635 }
636 
638 {
639  if (!_mouseEventActive)
640  {
641  return;
642  }
643 
644  if (_bSiteModelerFrame)
645  {
646  // Si on est dans un siteModelerFrame, on s'assure que le site
647  // represente par le modeleur est le parent direct de l'element picke
648  // Si oui, on peut bouger l'element,
649  // Si non, on renvoie sur initEditSiteNode qui entrainera le mouvement
650  // du site imbrique de niveau juste inferieur au site represente par le modeleur
651  if (selectElement(pElt))
652  {
653  return;
654  }
655  }
656 
657  // On positionne l'element courant
658  _pEditElement = pElt;
659 
660  // On le highlight dans la scene 3D
662 
665 
666  // On ne peut rien faire sans le parent...
667  if (!pParent)
668  {
669  return;
670  }
671 
672  // On recupere le GeoNode associe
673  _pEditGeoNode = (TYGeometryNode*)pParent->findBatiment(pBatiment).getRealPointer();
674  if (!_pEditGeoNode)
675  {
676  return;
677  }
678 
679  // Visu du highlight seulement
681  {
682  _pEditGeoNode->getGraphicObject()->setOnlyBoundingBox(_viewOnlyBoundingBox);
683  }
684 
685  if (_mode != Edition)
686  {
687  // On connecte le timer
688  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editGeoNode);
689 
690  // On "prend la main"//az++
691  _inUse = true; // az++
692  }
693 }
694 
696 {
697 #if WITH_NMPB
698  if (!_mouseEventActive)
699  {
700  return;
701  }
702 
703  if (_bSiteModelerFrame)
704  {
705  // Si on est dans un siteModelerFrame, on s'assure que le site
706  // represente par le modeleur est le parent direct de l'element picke
707  // Si oui, on peut bouger l'element,
708  // Si non, on renvoie sur initEditSiteNode qui entrainera le mouvement
709  // du site imbrique de niveau juste inferieur au site represente par le modeleur
710  if (selectElement(pElt))
711  {
712  return;
713  }
714  }
715 
716  // On positionne l'element courant
717  _pEditElement = pElt;
718 
721 
722  // On ne peut rien faire sans le parent...
723  if (!pParent)
724  {
725  return;
726  }
727 
728  // On recupere le GeoNode associe
729  _pEditGeoNode = (TYGeometryNode*)pParent->findRoute(pRoute).getRealPointer();
730  if (!_pEditGeoNode)
731  {
732  return;
733  }
734 
735  if (_mode == Edition)
736  {
737  TYTabPoint& pts = pRoute->getTabPoint();
738  editPolyLine(pRoute, pts, false);
739  }
740  else
741  {
743  // On connecte le timer
744  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editGeoNode);
745  // On "prend la main"
746  _inUse = true;
747  }
748 #endif
749 }
750 
752 {
753  if (!_mouseEventActive)
754  {
755  return;
756  }
757 
758  if (_bSiteModelerFrame)
759  {
760  // Si on est dans un siteModelerFrame, on s'assure que le site
761  // represente par le modeleur est le parent direct de l'element picke
762  // Si oui, on peut bouger l'element,
763  // Si non, on renvoie sur initEditSiteNode qui entrainera le mouvement
764  // du site imbrique de niveau juste inferieur au site represente par le modeleur
765  if (selectElement(pElt))
766  {
767  return;
768  }
769  }
770 
771  // On positionne l'element courant
772  _pEditElement = pElt;
773 
776 
777  // On ne peut rien faire sans le parent...
778  if (!pParent)
779  {
780  return;
781  }
782 
783  // On recupere le GeoNode associe
784  _pEditGeoNode = (TYGeometryNode*)pParent->findResTrans(pResTrans).getRealPointer();
785  if (!_pEditGeoNode)
786  {
787  return;
788  }
789 
790  if (_mode == Edition)
791  {
792  TYTabPoint& pts = pResTrans->getTabPoint();
793  editPolyLine(pResTrans, pts, false);
794  }
795  else
796  {
798  // On connecte le timer
799  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editGeoNode);
800  // On "prend la main"
801  _inUse = true;
802  }
803 }
804 
806 {
807  if (!_mouseEventActive)
808  {
809  return;
810  }
811 
812  if (_bSiteModelerFrame)
813  {
814  // Si on est dans un siteModelerFrame, on s'assure que le site
815  // represente par le modeleur est le parent direct de l'element picke
816  // Si oui, on peut bouger l'element,
817  // Si non, on renvoie sur initEditSiteNode qui entrainera le mouvement
818  // du site imbrique de niveau juste inferieur au site represente par le modeleur
819  if (selectElement(pElt))
820  {
821  return;
822  }
823  }
824 
825  // On positionne l'element courant
826  _pEditElement = pElt;
827 
829  TYTopographie* pParent = TYTopographie::safeDownCast(pCrbNiv->getParent());
830 
831  // On ne peut rien faire sans le parent...
832  if (!pParent)
833  {
834  return;
835  }
836  LPTYSiteNode pSite = dynamic_cast<TYSiteNode*>(pParent->getParent());
837 
838  // On recupere le GeoNode associe
839  _pEditGeoNode = (TYGeometryNode*)pParent->findCrbNiv(pCrbNiv).getRealPointer();
840  if (!_pEditGeoNode)
841  {
842  return;
843  }
844 
845  // On marque l'alti comme modifiee ici car on ne peut plus le faire apres
846  pSite->getAltimetry()->setIsGeometryModified(true);
847 
848  if (_mode == Edition)
849  {
850  TYTabPoint& pts = pCrbNiv->getListPoints();
851  editPolyLine(pCrbNiv, pts, false);
852  }
853  else
854  {
856  // On connecte le timer
857  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editGeoNode);
858  // On "prend la main"
859  _inUse = true;
860  }
861 }
862 
864 {
865 
866  if (!_mouseEventActive)
867  {
868  return;
869  }
870 
871  if (_bSiteModelerFrame)
872  {
873  // Si on est dans un siteModelerFrame, on s'assure que le site
874  // represente par le modeleur est le parent direct de l'element picke
875  // Si oui, on peut bouger l'element,
876  // Si non, on renvoie sur initEditSiteNode qui entrainera le mouvement
877  // du site imbrique de niveau juste inferieur au site represente par le modeleur
878  if (selectElement(pElt))
879  {
880  return;
881  }
882  }
883 
884  // On positionne l'element courant
885  _pEditElement = pElt;
887  TYTopographie* pParent = TYTopographie::safeDownCast(pCrsEau->getParent());
888 
889  // On ne peut rien faire sans le parent...
890  if (!pParent)
891  {
892  return;
893  }
894  LPTYSiteNode pSite = dynamic_cast<TYSiteNode*>(pParent->getParent());
895  assert(pSite != nullptr && "The parent of a TYTopographie element must be a TYSiteNode");
896 
897  // On recupere le GeoNode associe
898  _pEditGeoNode = (TYGeometryNode*)pParent->findCrsEau(pCrsEau).getRealPointer();
899  if (!_pEditGeoNode)
900  {
901  return;
902  }
903 
904  // We tag the altimetry as modified since we can't do it later
905  pSite->getAltimetry()->setIsGeometryModified(true);
906 
907  if (_mode == Edition)
908  {
909  TYTabPoint& pts = pCrsEau->getTabPoint();
910  editPolyLine(pCrsEau, pts, false, pSite->getAltimetry());
911  }
912  else
913  {
915  // On connecte le timer
916  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editGeoNode);
917  // On "prend la main"
918  _inUse = true;
919  }
920 }
921 
923 {
924  if (!_mouseEventActive)
925  {
926  return;
927  }
928 
929  if (_bSiteModelerFrame)
930  {
931  // Si on est dans un siteModelerFrame, on s'assure que le site
932  // represente par le modeleur est le parent direct de l'element picke
933  // Si oui, on peut bouger l'element,
934  // Si non, on renvoie sur initEditSiteNode qui entrainera le mouvement
935  // du site imbrique de niveau juste inferieur au site represente par le modeleur
936  if (selectElement(pElt))
937  {
938  return;
939  }
940  }
941 
942  // On positionne l'element courant
943  _pEditElement = pElt;
944 
946  TYTopographie* pParent = TYTopographie::safeDownCast(pPlanEau->getParent());
947 
948  // On ne peut rien faire sans le parent...
949  if (!pParent)
950  {
951  return;
952  }
953  LPTYSiteNode pSite = dynamic_cast<TYSiteNode*>(pParent->getParent());
954  assert(pSite != nullptr && "The parent of a TYTopographie element must be a TYSiteNode");
955 
956  // On recupere le GeoNode associe
957  _pEditGeoNode = (TYGeometryNode*)pParent->findPlanEau(pPlanEau).getRealPointer();
958  if (!_pEditGeoNode)
959  {
960  return;
961  }
962 
963  // On marque l'alti comme modifiee ici car on ne peut plus le faire apres
964  pSite->getAltimetry()->setIsGeometryModified(true);
965 
966  if (_mode == Edition)
967  {
968  TYTabPoint& pts = pPlanEau->getListPoints();
969  editPolyLine(pPlanEau, pts, true, pSite->getAltimetry());
970  }
971  else
972  {
974  // On connecte le timer
975  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editGeoNode);
976  // On "prend la main"
977  _inUse = true;
978  }
979 }
980 
982 {
983  if (!_mouseEventActive)
984  {
985  return;
986  }
987 
988  if (_bSiteModelerFrame)
989  {
990  // Si on est dans un siteModelerFrame, on s'assure que le site
991  // represente par le modeleur est le parent direct de l'element picke
992  // Si oui, on peut bouger l'element,
993  // Si non, on renvoie sur initEditSiteNode qui entrainera le mouvement
994  // du site imbrique de niveau juste inferieur au site represente par le modeleur
995  if (selectElement(pElt))
996  {
997  return;
998  }
999  }
1000 
1001  // On positionne l'element courant
1002  _pEditElement = pElt;
1003 
1005  TYTopographie* pParent = TYTopographie::safeDownCast(pTerrain->getParent());
1006 
1007  // On ne peut rien faire sans le parent...
1008  if (!pParent)
1009  {
1010  return;
1011  }
1012  LPTYSiteNode pSite = dynamic_cast<TYSiteNode*>(pParent->getParent());
1013  assert(pSite != nullptr && "The parent of a TYTopographie element must be a TYSiteNode");
1014 
1015  // On recupere le GeoNode associe
1016  _pEditGeoNode = (TYGeometryNode*)pParent->findTerrain(pTerrain).getRealPointer();
1017  if (!_pEditGeoNode)
1018  {
1019  return;
1020  }
1021 
1022  // We tag the altimetry as modified since we can't do it later
1023  pSite->getAltimetry()->setIsGeometryModified(true);
1024 
1025  if (_mode == Edition)
1026  {
1027  TYTabPoint& pts = pTerrain->getListPoints();
1028  editPolyLine(pTerrain, pts, true, pSite->getAltimetry());
1029  }
1030  else
1031  {
1033  // On connecte le timer
1034  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editGeoNode);
1035  // On "prend la main"
1036  _inUse = true;
1037  }
1038 }
1039 
1041 {
1042  if (!_mouseEventActive)
1043  {
1044  return;
1045  }
1046 
1047  if (_bSiteModelerFrame)
1048  {
1049  // Si on est dans un siteModelerFrame, on s'assure que le site
1050  // represente par le modeleur est le parent direct de l'element picke
1051  // Si oui, on peut bouger l'element,
1052  // Si non, on renvoie sur initEditSiteNode qui entrainera le mouvement
1053  // du site imbrique de niveau juste inferieur au site represente par le modeleur
1054  if (selectElement(pElt))
1055  {
1056  return;
1057  }
1058  }
1059 
1060  // On positionne l'element courant
1061  _pEditElement = pElt;
1062 
1064 
1065  if (!pSrcPonct)
1066  {
1067  return;
1068  }
1069 
1070  TYInfrastructure* pParent = TYInfrastructure::safeDownCast(pSrcPonct->getParent()); // az--
1071  if (pParent) // az--
1072  {
1073  _pEditGeoNode = (TYGeometryNode*)pParent->findSrc(pSrcPonct).getRealPointer(); // az--
1074  }
1075 
1076  if (_mode == Moving)
1077  {
1078  _pEditPoint = pSrcPonct->getPos();
1079 
1081  TR("id_action_movesrcponct"));
1082 
1084 
1085  // On connecte le timer
1086  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editPoint); // DT++ 20051201
1087  // On "prend la main"
1088  _inUse = true;
1089  }
1090  else if (_mode == Rotation)
1091  {
1092  // On le highlight dans la scene 3D
1094 
1095  _pLastAction = new TYOrienteSrcPonctAction(pSrcPonct, pSrcPonct->getOrientation(), OVector3D(),
1096  _pModeler, TR("id_action_orientsrcponct"));
1097 
1098  // On connecte le timer
1099  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::orienteSrcPonct); // az--
1100 
1101  // On "prend la main"
1102  _inUse = true;
1103  }
1104 }
1105 
1107 {
1108  if (!_mouseEventActive)
1109  {
1110  return;
1111  }
1112 
1113  // On positionne l'element courant
1114  _pEditElement = pElt;
1115 
1117 
1118  if (!pPointControl)
1119  {
1120  return;
1121  }
1122 
1123  if (_mode == Moving)
1124  {
1125  _pEditPoint = (LPTYPoint&)pPointControl;
1126 
1128  TR("id_action_movepointcontrol"));
1129 
1131 
1132  // On connecte le timer
1133  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editPoint);
1134  }
1135 }
1136 
1138 {
1139  if (!_mouseEventActive)
1140  {
1141  return;
1142  }
1143 
1144  // On positionne l'element courant
1145  _pEditElement = pElt;
1146 
1147  // On le highlight dans la scene 3D
1149 
1151  TYProjet* pProj = dynamic_cast<TYProjet*>(pMaillage->getParent());
1152 
1153  // On ne peut rien faire sans le parent...
1154  if (!pProj)
1155  {
1156  return;
1157  }
1158 
1159  // On recupere le GeoNode associe
1160  _pEditGeoNode = (TYGeometryNode*)pProj->findMaillage(pMaillage).getRealPointer();
1161  if (!_pEditGeoNode)
1162  {
1163  return;
1164  }
1165 
1166  // Visu du highlight seulement
1168  {
1169  _pEditGeoNode->getGraphicObject()->setOnlyBoundingBox(_viewOnlyBoundingBox);
1170  }
1171 
1172  if (_mode != Edition)
1173  {
1174  // On connecte le timer
1175  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editGeoNode);
1176  }
1177 }
1178 
1180  OPoint3D& centralPointGN)
1181 {
1183  true);
1184 }
1185 
1187  OPoint3D& centralPointGN)
1188 {
1190  false);
1191 }
1192 
1194  TYGeometryNode* pGeoNode, OPoint3D& centralPointGN, bool bPointOfGeoNodeInCurrentSiteCoordinates)
1195 {
1196  TYPoint centralPoint(centralPointGN);
1197  OMatrix currentMatrix;
1198  OMatrix totalMatrix;
1199  if (pGeoNode)
1200  {
1201  // Trouvons le GeoNode du Site courant (NULL si c'est le site root)
1202  TYSiteModelerFrame* pTYSiteModelerFrame = (TYSiteModelerFrame*)_pModeler;
1203  TYSiteNode* pRootSite = pTYSiteModelerFrame->getSite();
1204  TYGeometryNode* pRootGeometryNode = TYGeometryNode::GetGeoNode(pRootSite);
1205 
1206  TYListPtrGeoNode GeoNodeParents;
1207  pGeoNode->GetGeoNodeParentList(GeoNodeParents);
1208 
1209  TYListPtrGeoNode::iterator ite = GeoNodeParents.end();
1210  int i = 0, rootIndex = 0;
1211  if (pRootGeometryNode)
1212  {
1213  for (i = 0; i < (int)GeoNodeParents.size(); i++)
1214  {
1215  ite--;
1216  if ((*ite) == pRootGeometryNode)
1217  {
1218  rootIndex = i + 1;
1219  }
1220  }
1221  }
1222 
1223  for (i = rootIndex; i < ((int)GeoNodeParents.size() - rootIndex); i++)
1224  {
1225  ite--;
1226  TYGeometryNode* pCurrentTYGeometryNode = (TYGeometryNode*)(*ite);
1227  currentMatrix = pCurrentTYGeometryNode->getMatrix();
1228  if (!bPointOfGeoNodeInCurrentSiteCoordinates)
1229  {
1230  currentMatrix = currentMatrix.getInvert();
1231  }
1232  totalMatrix = totalMatrix * currentMatrix;
1233  }
1234  centralPoint = totalMatrix * centralPoint;
1235  }
1236  centralPointGN = centralPoint;
1237 }
1238 
1240 {
1241  bool modified = false;
1242  TYPoint oldPos;
1243  TYRepere oldRepere;
1244  bool enableX = true;
1245  bool enableY = true;
1246  bool enableZ = true;
1247  _pInteractor->makeCurrent();
1248  if (_mode == Moving)
1249  {
1250  // Copie de l'ancienne pos
1251  oldPos = _pEditGeoNode->getORepere3D()._origin;
1252 
1253  if ((dynamic_cast<TYCourbeNiveau*>(_pEditGeoNode->getElement()) != nullptr) ||
1254  (dynamic_cast<TYPlanEau*>(_pEditGeoNode->getElement()) != nullptr))
1255  {
1256  enableZ = false;
1257  }
1258 
1259  ORepere3D repere = _pEditGeoNode->getORepere3D();
1260 
1261  // On applique le deplacement
1262  modified = move(&repere._origin, enableX, enableY, enableZ); // az--
1263 
1264  _pEditGeoNode->setRepere(repere);
1265  }
1266  else if (_mode == Rotation)
1267  {
1268  // Copie de l'ancien repere
1269  oldRepere = _pEditGeoNode->getORepere3D();
1270 
1271  if ((dynamic_cast<TYMaillage*>(_pEditGeoNode->getElement()) != nullptr) ||
1272  (dynamic_cast<TYCourbeNiveau*>(_pEditGeoNode->getElement()) != nullptr) ||
1273  (dynamic_cast<TYPlanEau*>(_pEditGeoNode->getElement()) != nullptr) ||
1274  (dynamic_cast<TYSiteNode*>(_pEditGeoNode->getElement()) != nullptr))
1275  {
1276  enableX = false;
1277  enableY = false;
1278  }
1279 
1280  ORepere3D repere = _pEditGeoNode->getORepere3D();
1281 
1282  // On applique la rotation
1283  modified = rotate(&repere, enableX, enableY, enableZ);
1284 
1285  _pEditGeoNode->setRepere(repere);
1286  }
1287 
1288  if (modified && bTYPositionEditorFirstMove)
1289  {
1290  // az++
1291  bTYPositionEditorFirstMove = false;
1292  // Magouille infâme pour faire disparaitre temporairement le GeoNode car le setVisible ne marche plus
1293  // vraiment
1294  ORepere3D repere = _pEditGeoNode->getORepere3D();
1295  ORepere3D AlOuest;
1296  AlOuest._origin = OPoint3D(999999, 999999, 999999);
1297  _pEditGeoNode->setRepere(AlOuest);
1298  _pEditGeoNode->getGraphicObject()->setOnlyBoundingBox(true);
1299  _pInteractor->getRenderer()->invalidateScene(); // az++ : pour rendre invisible l'objet en mouvement
1300  _pInteractor->update(); // az++
1301  _pEditGeoNode->setRepere(repere);
1302  }
1303 
1304  if (modified)
1305  {
1306  if (_mode == Moving)
1307  {
1308  if (_firstCall)
1309  {
1310  _pLastAction =
1312  _pModeler, TR("id_action_movegeonode"));
1313  _firstCall = false;
1314  }
1315  else
1316  {
1318  }
1319  }
1320  else if (_mode == Rotation)
1321  {
1322  if (_firstCall)
1323  {
1324  _pLastAction =
1326  _pModeler, TR("id_action_rotategeonode"));
1327  _firstCall = false;
1328  }
1329  else
1330  {
1332  }
1333  }
1334 
1335  // Refresh
1337  _pEditGeoNode->updateGraphic();
1338  _pModeler->updateView(false, false);
1339 
1340  // Il faut maintenant afficher le GeoNode dans le repere adequat (celui choisit lors de l'ouverture du
1341  // modeler); Le repere peut etre:
1342  //* celui du repere du monde (TYSiteModelerFrame)
1343  //* celui d'un TYSiteNode fils (TYSiteModelerFrame)
1344  //* celui d'un TYBatiment (TYBatimentModelerFrame)
1345  //* celui d'un (TYMachineModelerFrame)
1346  //* celui d'un (TYFaceModelerFrame)
1347  TYElement* pRootTYElement = _pModeler->getElement();
1348  TYGeometryNode* pRootGeometryNode = TYGeometryNode::GetGeoNode(pRootTYElement);
1349 
1351  _pInteractor->getViewport(), pRootTYElement};
1353  pRootGeometryNode);
1355  _pInteractor->update();
1356  }
1357  _pInteractor->doneCurrent();
1358 }
1359 
1361 {
1362  bool modified = false;
1363  double z = 0.0;
1364 
1366  {
1367  // En vue 3D on conserve l'altitude du point
1368  z = _pEditPoint->_z;
1369  }
1370 
1371  modified = move(_pEditPoint);
1372 
1373  if (modified)
1374  {
1376  {
1377  // En vue 3D on restitue l'altitude du point
1378  _pEditPoint->_z = z;
1379  }
1380 
1381  if (_pEditElement->isA("TYCourbeNiveau"))
1382  {
1384  }
1385  else if (dynamic_cast<TYAcousticLine*>(_pEditElement) != nullptr)
1386  {
1388  }
1389  else if (_pEditElement->isA("TYTerrain"))
1390  {
1392  }
1393  else if (_pEditElement->isA("TYPlanEau"))
1394  {
1396  }
1397  else if (dynamic_cast<TYSourcePonctuelle*>(_pEditElement) != nullptr)
1398  {
1400  }
1401  else if (dynamic_cast<TYPointControl*>(_pEditElement) != nullptr)
1402  {
1404  }
1405 
1407 
1408  if (_pEditElement->getParent())
1409  {
1411  }
1412 
1413  // Refresh
1414  _pEditElement->updateGraphic();
1415  _pModeler->updateView(false, false);
1416 
1417  // Highlight point
1418  TYPoint worldPoint(*_pEditPoint);
1419  if (_pEditGeoNode)
1420  {
1421  worldPoint = _pEditGeoNode->getMatrix() * worldPoint;
1422  }
1423  _pPicker->highlightElement(&worldPoint); // Fait un update
1424  }
1425 }
1426 
1428 {
1429  bool modified = false;
1430 
1431  modified = move(_pEditPoint);
1432 
1433  if (modified)
1434  {
1437 
1439 
1440  // Mise a jour de l'etage
1441  TYEtage* pEtage = (TYEtage*)_pEditElement;
1442  pEtage->setMurs(_editContour, pEtage->getHauteur(), pEtage->getClosed());
1443 
1444  // Refresh
1445  if (_pEditElement->getParent())
1446  {
1447  _pEditElement->getParent()->updateGraphic();
1448  }
1449  else
1450  {
1451  _pEditElement->updateGraphic();
1452  }
1453 
1454  // Highlight point
1455  TYPoint worldPoint = _pEditGeoNode->getMatrix() * (*_pEditPoint);
1456  _pPicker->highlightElement(&worldPoint); // Fait un update
1457  }
1458 }
1459 
1461 {
1462  // On ne fait rien si la souris n'a pas bougee
1463  if ((_currentMousePos[0] == _lastMousePos[0]) && (_currentMousePos[1] == _lastMousePos[1]))
1464  {
1465  return;
1466  }
1467 
1469 
1470  // Il nous faut la position du point dans le repere global
1471  TYPoint pos(0, 0, 0);
1472  OPoint3D SrcePos(pos);
1473  OPoint3D opos =
1475  SrcePos; // repere le + haut dans la hierarchie, mais pas forcement celui du modelerFrame courant
1476  pos = opos;
1477 
1478  // Calcul du vecteur orientation : il est constitue de 2 points:
1479  //- celui donnant la position de la source ponctuelle
1480  //- celui donnant la position de la souris a l'instant present
1481  // 1. Passage de coordonnees ecrans a coordonnees du repere du modeler frame
1482  double displaySrcePos[4];
1483  worldToDisplay(pos._x, pos._z, -pos._y, displaySrcePos);
1484  double ptCur[4];
1486  displaySrcePos[2], ptCur);
1487  OPoint3D optCur(ptCur[0], -ptCur[2], ptCur[1]);
1488  // optCur represente maintenant les coordonnees du second point dans le repere du ModelerFrame courant
1489  // 2. Passage de coordonnees du repere du modeler frame a coordonnees globales
1490  TYElement* pRootTYElement = _pModeler->getElement();
1491  TYGeometryNode* pRootGeometryNode = TYGeometryNode::GetGeoNode(pRootTYElement);
1492  if (pRootGeometryNode)
1493  {
1494  optCur = pRootGeometryNode->localToGlobal() * optCur;
1495  }
1496  // optCur represente maintenant les coordonnees du second point dans le repere le plus haut dans la
1497  // hierarchie:
1498  optCur = _pEditGeoNode->globalToLocal() * optCur;
1499  pos = _pEditGeoNode->globalToLocal() * pos;
1500  OVector3D vecOrient(pos, optCur);
1501 
1502  switch (_pModeler->getCurrentView())
1503  {
1505  pSrcPonct->getOrientation()._x = vecOrient._x;
1506  pSrcPonct->getOrientation()._y = vecOrient._y;
1507  break;
1509  pSrcPonct->getOrientation()._y = vecOrient._y;
1510  pSrcPonct->getOrientation()._z = vecOrient._z;
1511  break;
1513  pSrcPonct->getOrientation()._x = vecOrient._x;
1514  pSrcPonct->getOrientation()._z = vecOrient._z;
1515  break;
1516  }
1517 
1518  ((TYOrienteSrcPonctAction*)_pLastAction)->setNewOrient(pSrcPonct->getOrientation());
1519 
1521  _pEditElement->updateGraphic();
1522 
1523  // Save mouse pos car il y a eu un deplacement
1526 }
1527 
1528 bool TYPositionEditor::move(OPoint3D* pPt, bool enableX /*=true*/, bool enableY /*=true*/,
1529  bool enableZ /*=true*/)
1530 {
1531  Q_CHECK_PTR(pPt);
1532  bool ret = false;
1533 
1534  if (!enableX && !enableY && !enableZ)
1535  {
1536  return false;
1537  }
1538 
1539  // On ne fait rien si la souris n'a pas bougee
1540  if ((_currentMousePos[0] == _lastMousePos[0]) && (_currentMousePos[1] == _lastMousePos[1]))
1541  {
1542  return false;
1543  }
1544 
1545  // Chgmt de repere si besoin (si SiteNode pere)
1546  if (QString(_pModeler->metaObject()->className()).compare("TYSiteModelerFrame") == 0)
1547  {
1549  }
1550 
1551  // On garde une copie
1552  OPoint3D ptBis = *pPt;
1553 
1554  // Calcul du delta de deplacement
1555  double pt1[4];
1556  double pt2[4];
1557  double org[4];
1558  worldToDisplay(ptBis._x, ptBis._z, -ptBis._y, org);
1560  pt1);
1561  displayToWorld(_lastMousePos[0], _pInteractor->getViewport().height() - _lastMousePos[1], org[2], pt2);
1562  OVector3D delta(pt1[0] - pt2[0], -(pt1[2] - pt2[2]), pt1[1] - pt2[1]);
1563 
1564  OPoint3D deltap = delta;
1565 
1566  // Calcul de la nouvelle position
1567  ptBis = OVector3D(ptBis) + deltap; // az++
1568 
1569  // Si la grille magnetique est activee
1571  {
1572  snapToGrid(ptBis._x, ptBis._y, ptBis._z, _gridMagnStep);
1573  }
1574 
1575  // Si le deplacement n'est pas nul
1576  if (ptBis != *pPt)
1577  {
1578  // On applique le deplacement
1579  if (enableX)
1580  {
1581  pPt->_x = ptBis._x;
1582  }
1583  if (enableY)
1584  {
1585  pPt->_y = ptBis._y;
1586  }
1587  if (enableZ)
1588  {
1589  pPt->_z = ptBis._z;
1590  }
1591 
1592  // Mets a jour les moving lines
1593  updateMovingPoint(*pPt);
1594 
1595  // Mets a jour le texte d'information sur la nouvelle position
1596  if (_mode == Edition)
1597  {
1598  // Si la grille magnetique est activee
1600  {
1601  snapToGrid(pt1[0], pt1[1], pt1[2], _gridMagnStep);
1602  }
1603 
1604  // On affiche la position globale du curseur
1605  updateText(QString(TR("id_pos_info"))
1606  .arg(pPt->_x, 0, 'f', 2)
1607  .arg(pPt->_y, 0, 'f', 2)
1608  .arg(pPt->_z, 0, 'f', 2),
1610  }
1611  else
1612  {
1613  // On affiche la position globale du point
1614  updateText(QString(TR("id_pos_info"))
1615  .arg(pPt->_x, 0, 'f', 2)
1616  .arg(pPt->_y, 0, 'f', 2)
1617  .arg(pPt->_z, 0, 'f', 2),
1618  (int)org[0], (int)org[1]);
1619  }
1620 
1621  // Save mouse pos car il y a eu un deplacement
1624 
1625  // Le point a ete deplace
1626  ret = true;
1627  }
1628 
1629  // Chgmt de repere si besoin (si SiteNode pere)
1630  if (QString(_pModeler->metaObject()->className()).compare("TYSiteModelerFrame") == 0)
1631  {
1633  }
1634 
1635  return ret;
1636 }
1637 
1638 bool TYPositionEditor::rotate(ORepere3D* pRepere, bool enableX /*=true*/, bool enableY /*=true*/,
1639  bool enableZ /*=true*/)
1640 {
1641  Q_CHECK_PTR(pRepere);
1642  bool ret = false;
1643 
1644  if (!enableX && !enableY && !enableZ)
1645  {
1646  return false;
1647  }
1648 
1649  // On ne fait rien si la souris n'a pas bougee
1650  if ((_currentMousePos[0] == _lastMousePos[0]) && (_currentMousePos[1] == _lastMousePos[1]))
1651  {
1652  return false;
1653  }
1654 
1655  // Chgmt de repere si besoin (si SiteNode pere)
1656  if (QString(_pModeler->metaObject()->className()).compare("TYSiteModelerFrame") == 0)
1657  {
1659  }
1660 
1661  double center[4];
1662  worldToDisplay(pRepere->_origin._x, pRepere->_origin._z, -pRepere->_origin._y, center);
1663 
1664  int diffX1 = _currentMousePos[0] - int(center[0]);
1665  int diffY1 = _currentMousePos[1] - int(center[1]);
1666  int diffX2 = _lastMousePos[0] - int(center[0]);
1667  int diffY2 = _lastMousePos[1] - int(center[1]);
1668 
1669  double a1 = atan2(double(diffY1), double(diffX1));
1670  double a2 = atan2(double(diffY2), double(diffX2));
1671  float angle = (a2 - a1) / (2.0 * 3.1415926535) * 360.0 / 10.0 * _trackballFactor;
1672 
1674  {
1675  angle = ROUND(angle / _angleStep) * _angleStep;
1676  }
1677 
1678  // Si l'angle n'est pas nul
1679  if (angle != 0)
1680  {
1681  // On applique la rotation
1682 
1683  OMatrix tyMat;
1684  OMatrix tyMatTmpX;
1685  OMatrix tyMatTmpY;
1686  OMatrix tyMatTmpZ;
1687 
1688  QVector3D axis = _pInteractor->getActiveCamera()->front();
1689 
1690  if (!enableX)
1691  {
1692  axis.setX(0);
1693  }
1694  // Notez le changement de repere pour les cas suivants.
1695  // FIXME: Supprimer cette incohérence ou appliquer la transformation
1696  // nécessaire à axis.
1697  if (!enableY)
1698  {
1699  axis.setZ(0);
1700  }
1701  if (!enableZ)
1702  {
1703  axis.setY(0);
1704  }
1705 
1706  if (axis.x() != 0)
1707  {
1708  tyMatTmpX.setRotationOx(-axis.x() * M_PI * angle / 180);
1709  }
1710  if (axis.z() != 0)
1711  {
1712  tyMatTmpY.setRotationOy(axis.z() * M_PI * angle / 180);
1713  }
1714  if (axis.y() != 0)
1715  {
1716  tyMatTmpZ.setRotationOz(axis.y() * M_PI * angle / 180);
1717  }
1718 
1719  tyMat = pRepere->asMatrix() * tyMatTmpZ * tyMatTmpY * tyMatTmpX;
1720 
1721  OPoint3D org = pRepere->_origin; // On conserve l'origine de depart
1722  pRepere->set(tyMat);
1723  pRepere->_origin = org;
1724 
1725  // Save mouse pos car il y a eu une rotation
1728 
1729  // On affiche la somme de l'angle que l'on applique durant cette rotation
1730  _angleInfo = ((int)(_angleInfo + angle)) % 360;
1731  updateText(QString(TR("id_angle_info")).arg(_angleInfo, 0, 'f', 2), (int)center[0], (int)center[1]);
1732 
1733  // Le repere a ete modifie
1734  ret = true;
1735  }
1736 
1737  // Chgmt de repere si besoin (si SiteNode pere)
1738  if (QString(_pModeler->metaObject()->className()).compare("TYSiteModelerFrame") == 0)
1739  {
1741  }
1742 
1743  return ret;
1744 }
1745 
1746 int TYPositionEditor::findPoint(float* ptToFind, TYTabPoint* pInPoints)
1747 {
1748  int ptId = -1;
1749 
1750  for (size_t i = 0; i < pInPoints->size(); i++)
1751  {
1752  TYPoint curPt = pInPoints->at(i);
1753 
1754  if ((ptToFind[0] >= curPt._x - _pickPointPrecision) &&
1755  (ptToFind[0] <= curPt._x + _pickPointPrecision) &&
1756  (-ptToFind[2] >= curPt._y - _pickPointPrecision) &&
1757  (-ptToFind[2] <= curPt._y + _pickPointPrecision))
1758  {
1759  // Point trouve !
1760  ptId = static_cast<int>(i);
1761 
1762  updateMovingLines(pInPoints, ptId);
1763 
1764  break;
1765  }
1766  }
1767 
1768  return ptId;
1769 }
1770 
1771 void TYPositionEditor::updateMovingLines(TYTabPoint* pPoints, int centralPointId)
1772 {
1773  TYPoint centralPoint = pPoints->at(centralPointId);
1774  if (_pEditGeoNode)
1775  {
1776  centralPoint = _pEditGeoNode->getMatrix() * centralPoint;
1777  }
1778 
1779  if (centralPointId - 1 >= 0)
1780  {
1781  TYPoint prevPoint = pPoints->at(centralPointId - 1);
1782  if (_pEditGeoNode)
1783  {
1784  prevPoint = _pEditGeoNode->getMatrix() * prevPoint;
1785  }
1786 
1787  _pOGLLineElementMoving1->setPoint1(QVector3D(prevPoint._x, prevPoint._z, -prevPoint._y));
1788  _pOGLLineElementMoving1->setPoint2(QVector3D(centralPoint._x, centralPoint._z, -centralPoint._y));
1790  }
1791 
1792  if (centralPointId + 1 < (int)pPoints->size())
1793  {
1794  TYPoint nextPoint = pPoints->at(centralPointId + 1);
1795  if (_pEditGeoNode)
1796  {
1797  nextPoint = _pEditGeoNode->getMatrix() * nextPoint;
1798  }
1799 
1800  _pOGLLineElementMoving2->setPoint1(QVector3D(centralPoint._x, centralPoint._z, -centralPoint._y));
1801  _pOGLLineElementMoving2->setPoint2(QVector3D(nextPoint._x, nextPoint._z, -nextPoint._y));
1803  }
1804 }
1805 
1807 {
1808  TYPoint centralPoint(point);
1809  if (_pEditGeoNode)
1810  {
1811  centralPoint = _pEditGeoNode->getMatrix() * centralPoint;
1812  }
1813 
1814  _pOGLLineElementMoving1->setPoint2(QVector3D(centralPoint._x, centralPoint._z, -centralPoint._y));
1815  _pOGLLineElementMoving2->setPoint1(QVector3D(centralPoint._x, centralPoint._z, -centralPoint._y));
1816 }
1817 
1819 {
1820  bool stop = false;
1821 
1822  // Recherche du siteNodeParent
1823  TYElement* pParent = pElt->getParent();
1824 
1825  while (pParent && (dynamic_cast<TYSiteNode*>(pParent) == nullptr))
1826  {
1827  pParent = pParent->getParent();
1828  }
1829 
1830  // Si le modeleur point un projet on prend le sitenode racine
1831  TYElement* pModelerTarget = NULL;
1832  if (_pModeler->getElement()->isA("TYProjet"))
1833  {
1834  pModelerTarget = TYProjet::safeDownCast(_pModeler->getElement())->getSite();
1835  }
1836  else
1837  {
1838  pModelerTarget = _pModeler->getElement();
1839  }
1840 
1841  // Si le site parent n'est pas le meme que le site pointe par le modeleur
1842  if (pModelerTarget && (pParent != pModelerTarget))
1843  {
1844  // On initialise sur lui
1845  initEditSiteNode(pParent);
1846  stop = true; // La methode appelante devra se terminer
1847  }
1848 
1849  return stop;
1850 }
1851 
1853 {
1854  int ptIdToEdit = 0;
1855  if (_keyAOn) // Insert a point
1856  {
1857  TYPoint ptInsert;
1858  insertNewPoint(pts, ptInsert, ptIdToEdit, pAlti);
1859  _pLastAction = new TYInsertPointPolyLineAction(pElt, pts, ptIdToEdit, ptInsert, _pModeler,
1860  TR("id_action_insertptpolyline"));
1861  }
1862  else if (_keyDOn) // Delete a point
1863  {
1864  size_t nbPts = pts.size();
1865  if (nbPts < 3 || (closed && nbPts < 4))
1866  {
1867  return;
1868  }
1869  TYPoint ptDelete;
1870  deletePoint(pts, ptDelete, ptIdToEdit);
1871  _pLastAction = new TYRemovePointPolyLineAction(pElt, pts, ptIdToEdit, ptDelete, _pModeler,
1872  TR("id_action_delptpolyline"));
1873  }
1874  else // Move a point
1875  {
1876  // We find the id of the closest point to the mouse
1877  ptIdToEdit = findClosestPointToMouse(pts);
1878  _pEditPoint = &pts[ptIdToEdit];
1879  _pLastAction = new TYMovePointPolyLineAction(pElt, pts, ptIdToEdit, *_pEditPoint, TYPoint(),
1880  _pModeler, TR("id_action_moveptpolyline"));
1881  // Is the highlight working...?
1882  TYPoint worldPoint = _pEditGeoNode->getMatrix() * (*_pEditPoint);
1883  _pPicker->highlightElement(&worldPoint);
1884  // Connecte the timer
1885  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editPoint);
1886  _inUse = true;
1887  }
1888 }
1889 
1890 void TYPositionEditor::insertNewPoint(TYTabPoint& pts, TYPoint& newPoint, int& idInsert, LPTYAltimetrie pAlti)
1891 {
1892  idInsert = findClosestSegmentToMouse(pts);
1893  double ptProj[3];
1895  ptProj);
1896  newPoint = TYPoint(ptProj[0], -ptProj[2], pts[idInsert]._z);
1897 
1898  // Si la grille magnetique est activee
1900  {
1901  snapToGrid(newPoint._x, newPoint._y, newPoint._z, _gridMagnStep);
1902  }
1903 
1904  ++idInsert;
1905  if (pAlti && !pAlti->altitude(newPoint))
1906  {
1907  newPoint._z = std::numeric_limits<double>::quiet_NaN();
1908  }
1909  pts.insert(pts.begin() + idInsert, newPoint);
1910 }
1911 
1912 void TYPositionEditor::deletePoint(TYTabPoint& pts, TYPoint& deletedPoint, int& idDelete)
1913 {
1914  idDelete = findClosestPointToMouse(pts);
1915  deletedPoint = pts[idDelete];
1916  pts.erase(pts.begin() + idDelete);
1917 }
1918 
1920 {
1921  int idPt = 0;
1922  size_t nbPts = pts.size();
1923  double ptOnDisplay[3];
1924  OVector3D pt(0, 0, 0);
1925  const OMatrix& matrixNode = _pEditGeoNode->getMatrix();
1926 
1927  std::vector<OVector3D> ptsDisplay;
1928  // We project on the display the points of our polyline
1929  for (size_t i = 0; i < nbPts; ++i)
1930  {
1931  // Is the transformation really necessary?
1932  pt = matrixNode * pts[i];
1933  worldToDisplay(pt._x, pt._z, -pt._y, ptOnDisplay);
1934  ptsDisplay.push_back(OVector3D(ptOnDisplay[0], ptOnDisplay[1], 0.0));
1935  }
1936 
1937  double distSqrMin = (std::numeric_limits<double>::max)();
1938  double distSqr = 0;
1939  double mx = _currentMousePos[0];
1940  double my = _pInteractor->getViewport().height() - _currentMousePos[1];
1941 
1942  // Find the closest line to our mouse position
1943  size_t j = 0;
1944  for (size_t i = 0; i < nbPts; ++i)
1945  {
1946  j = i < (nbPts - 1) ? i + 1 : 0;
1947  const OVector3D& v = ptsDisplay[i];
1948  const OVector3D& w = ptsDisplay[j];
1949 
1950  distSqr = distSegmentSqr(mx, my, v._x, v._y, w._x, w._y);
1951  if (distSqr < distSqrMin)
1952  {
1953  distSqrMin = distSqr;
1954  idPt = static_cast<int>(i);
1955  }
1956  }
1957  return idPt;
1958 }
1959 
1961 {
1962  int ptId = -1;
1963  size_t nbPts = pts.size();
1964  double distSqrMin = (std::numeric_limits<double>::max)();
1965  double ptOnDisplay[3];
1966  double diffx = 0, diffy = 0, distSqr = 0;
1967  OVector3D pt(0, 0, 0);
1968  const OMatrix& matrixNode = _pEditGeoNode->getMatrix();
1969 
1970  for (size_t i = 0; i < nbPts; ++i)
1971  {
1972  // Is the transformation really necessary?
1973  pt = matrixNode * pts[i];
1974  worldToDisplay(pt._x, pt._z, -pt._y, ptOnDisplay);
1975  diffx = ptOnDisplay[0] - _currentMousePos[0];
1976  diffy = ptOnDisplay[1] - _pInteractor->getViewport().height() + _currentMousePos[1];
1977  distSqr = diffx * diffx + diffy * diffy;
1978  if (distSqr < distSqrMin)
1979  {
1980  distSqrMin = distSqr;
1981  ptId = static_cast<int>(i);
1982  }
1983  }
1984  return ptId;
1985 }
1986 
1987 double TYPositionEditor::distSegmentSqr(double mx, double my, double vx, double vy, double wx,
1988  double wy) const
1989 {
1990  double l2 = (vx - wx) * (vx - wx) + (vy - wy) * (vy - wy);
1991  if (l2 != 0)
1992  {
1993  double t = ((mx - vx) * (wx - vx) + (my - vy) * (wy - vy)) / l2;
1994  if (t < 0)
1995  {
1996  return (mx - vx) * (mx - vx) + (my - vy) * (my - vy);
1997  }
1998  else if (t > 1)
1999  {
2000  return (mx - wx) * (mx - wx) + (my - wy) * (my - wy);
2001  }
2002  else
2003  {
2004  return (mx - (vx + t * (wx - vx))) * (mx - (vx + t * (wx - vx))) +
2005  (my - (vy + t * (wy - vy))) * (my - (vy + t * (wy - vy)));
2006  }
2007  }
2008  else
2009  {
2010  return (mx - vx) * (mx - vx) + (my - vy) * (my - vy);
2011  }
2012 }
All base classes related to 3D manipulation.
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)
Contexte de rendu utilisé par les fonctions d'affichage.
@ Display
The current render is intended to be displayed on screen.
@ Overlay
The current render pass is for overlay elements.
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)
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
const QVector3D & front() const
Definition: OGLCamera.cpp:313
void setVisibility(bool bVisible)
Definition: OGLElement.h:51
void setIs3D(bool bIs3D)
Definition: OGLElement.h:59
void setPoint2(const QVector3D &point2)
void setColor(const OColor &oColor)
void setPoint1(const QVector3D &point1)
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:1263
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:1331
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.
TYCameraEditor * _pCameraEditor
Le caméra editor associé Ã&#160; cet éditor.
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:706
static void setIsSavedOk(const bool &toSave)
Definition: TYElement.h:914
virtual void setIsGeometryModified(bool isModified)
Definition: TYElement.cpp:253
double getHauteur() const
Definition: TYEtage.cpp:1039
bool getClosed()
Definition: TYEtage.h:206
bool setMurs(const TYTabPoint &tabPts, double hauteur=2.0, bool close=true)
Definition: TYEtage.cpp:897
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:1109
Classe de definition d'un maillage.
Definition: TYMaillage.h:51
Generic class for a modeler window.
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:576
Action de deplacement d'un point de controle.
Definition: TYActions.h:736
Action de deplacement d'un point d'un etage.
Definition: TYActions.h:639
Action editing for a polyline (when moving point)
Definition: TYActions.h:1052
Action de deplacement d'un source ponctuelle.
Definition: TYActions.h:672
void addOGLElement(OGLElement *pOGLElement)
void invalidateScene(void)
void removeOGLElement(OGLElement *pOGLElement)
void updateDisplayListOverlay(TYRenderContext &renderContext, TYGeometryNode *pElement, TYGeometryNode *pDansCeRepere)
Action d'orientation d'une source ponctuelle.
Definition: TYActions.h:704
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 _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.
bool _viewOnlyBoundingBox
Indique si on affiche que la bounding box lors de l'edition.
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.
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:927
const TYRenderViewport & getViewport() const
TYOpenGLRenderer * getRenderer()
OGLCamera * getActiveCamera()
Actions de rotation d'un GeometryNode.
Definition: TYActions.h:608
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