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  _pEditGeoNode->updateGraphic();
344  }
345 
346  _inUse = false;
347  _pEditElement = NULL;
348  _pEditPoint = NULL;
349 
350  showText(false);
353 
354  // On arrete le highlight dans la scene 3D
355  _pPicker->highlightElement(NULL); // az++
356  // TODO ensure that updateDisplay
357  // a flag in the modeler or the renderer when the)
358 
359  TYRenderContext renderContext = _pModeler->createRenderContext();
360  renderContext.pass = TYRenderPass::Overlay;
361  _pInteractor->getRenderer()->updateDisplayListOverlay(renderContext, NULL, NULL);
363  _pEditGeoNode = NULL; // az++
364 
365  _pModeler->updateView(true, true); // DT++ le 22/08/2005
366 
367  _pModeler->askForResetResultat(); // CLM++ le 10/01/2012
368 
369  // L'edition est terminee on reconnecte la camera
371 
372  // La scene a ete modifiee
374 
375  TYApplication::restoreOverrideCursor();
376  }
377 }
378 
379 void TYPositionEditor::slotMouseMoved(int x, int y, Qt::MouseButtons button, Qt::KeyboardModifiers state)
380 {
381  _currentMousePos[0] = x;
382  _currentMousePos[1] = y;
383 }
384 
386 {
387  if (!_mouseEventActive || _inUse)
388  {
389  return;
390  }
391 
392  // Pour traiter le cas d'une imbrication verticale
393  // (site in site in site in ...in siteroot), on va rechercher
394  // le site qui est directement enfant du site pointe par le modeleur
395 
396  // On recupere le site pointe par le modeleur
397  TYElement* pModelerTarget = NULL;
398  if (_pModeler->getElement()->isA("TYProjet"))
399  {
400  pModelerTarget = TYProjet::safeDownCast(_pModeler->getElement())->getSite();
401  }
402  else
403  {
404  pModelerTarget = _pModeler->getElement();
405  }
406 
407  // Ensuite on boucle pour retrouver son fils
408  TYElement* pParent = pElt->getParent();
409 
410  while (pParent && (pParent != pModelerTarget))
411  {
412  pElt = pParent;
413  pParent = pParent->getParent();
414  }
415 
416  if (!pElt)
417  {
418  return;
419  } // Au cas ou on serait parti dans les choux, on sort ...
420 
421  // On positionne l'element courant
422  _pEditElement = pElt;
423 
424  // On le highlight dans la scene 3D
426 
428  TYSiteNode* pSiteNodeParent = TYSiteNode::safeDownCast(pSiteNodeChild->getParent());
429 
430  // On ne peut rien faire sans le parent...
431  if (!pSiteNodeParent)
432  {
433  return;
434  }
435 
436  // On recupere le GeoNode associe
437  _pEditGeoNode = (TYGeometryNode*)pSiteNodeParent->findSiteNode(pSiteNodeChild).getRealPointer();
438  if (!_pEditGeoNode)
439  {
440  return;
441  }
442 
443  // Visu du highlight seulement
445  {
446  _pEditGeoNode->getGraphicObject()->setOnlyBoundingBox(_viewOnlyBoundingBox);
447  }
448 
449  if (_mode != Edition)
450  {
451  // On connecte le timer
452  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editGeoNode);
453  }
454 }
455 
457 {
458  if (!_mouseEventActive)
459  {
460  return;
461  }
462 
463  // On positionne l'element courant
464  _pEditElement = pElt;
465 
466  // On le highlight dans la scene 3D
468 
471 
472  // On ne peut rien faire sans le parent...
473  if (!pParent)
474  {
475  return;
476  }
477 
478  // On recupere le GeoNode associe
480  if (!_pEditGeoNode)
481  {
482  return;
483  }
484 
485  // Visu du highlight seulement
487  {
488  _pEditGeoNode->getGraphicObject()->setOnlyBoundingBox(_viewOnlyBoundingBox);
489  }
490 
491  if (_mode != Edition)
492  {
493  // On connecte le timer
494  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editGeoNode);
495  }
496 }
497 
499 {
500  if (!_mouseEventActive)
501  {
502  return;
503  }
504 
505  if (_bSiteModelerFrame)
506  {
507  // Si on est dans un siteModelerFrame, on s'assure que le site
508  // represente par le modeleur est le parent direct de l'element picke
509  // Si oui, on peut bouger l'element,
510  // Si non, on renvoie sur initEditSiteNode qui entrainera le mouvement
511  // du site imbrique de niveau juste inferieur au site represente par le modeleur
512  if (selectElement(pElt))
513  {
514  return;
515  }
516  }
517 
518  // On positionne l'element courant
519  _pEditElement = pElt;
520 
521  // On le highlight dans la scene 3D
523 
525  TYElement* pParent = TYElement::safeDownCast(pMachine->getParent());
526 
527  // On ne peut rien faire sans le parent...
528  if (!pParent)
529  {
530  return;
531  }
532 
533  // Le parent d'une Machine peut etre un Etage ou Infrastructure
534  if (pParent->isA("TYEtage"))
535  {
536  _pEditGeoNode = (TYGeometryNode*)((TYEtage*)pParent)->findMachine(pMachine).getRealPointer();
537  }
538  else if (pParent->isA("TYInfrastructure"))
539  {
540  _pEditGeoNode = (TYGeometryNode*)((TYInfrastructure*)pParent)->findMachine(pMachine).getRealPointer();
541  }
542  else
543  {
544  _pEditGeoNode = NULL;
545  }
546 
547  if (!_pEditGeoNode)
548  {
549  return;
550  }
551 
552  // Visu du highlight seulement
554  {
555  _pEditGeoNode->getGraphicObject()->setOnlyBoundingBox(_viewOnlyBoundingBox);
556  }
557 
558  if (_mode != Edition)
559  {
560  // On connecte le timer
561  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editGeoNode);
562 
563  // On "prend la main"
564  _inUse = true;
565  }
566 }
567 
568 /*void TYPositionEditor::initEditEtage(TYElement* pElt)
569 {
570  if (!_mouseEventActive || _inUse) {
571  return;
572  }
573 
574  if (_pModeler->getCurrentView() != TYModelerFrame::TopView) {
575  // L'edition d'un etage n'est possible qu'en vue de dessus
576  return;
577  }
578 
579  // On positionne l'element courant
580  _pEditElement = pElt;
581 
582  TYEtage * pEtage = TYEtage::safeDownCast(_pEditElement);
583  TYBatiment * pParent = TYBatiment::safeDownCast(pEtage->getParent());
584 
585  // On ne peut rien faire sans le parent...
586  if (!pParent) return;
587 
588  // On recupere le GeoNode associe
589  _pEditGeoNode = (TYGeometryNode *) pParent->findAcousticVol(pEtage).getRealPointer();
590  if (!_pEditGeoNode) return;
591 }*/
592 
594 {
595  if (!_mouseEventActive || _inUse)
596  {
597  return;
598  }
599 
601  {
602  // L'edition d'un etage n'est possible qu'en vue de dessus
603  return;
604  }
605 
606  if (_bSiteModelerFrame)
607  {
608  // Si on est dans un siteModelerFrame, on s'assure que le site
609  // represente par le modeleur est le parent direct de l'element picke
610  // Si oui, on peut bouger l'element,
611  // Si non, on renvoie sur initEditSiteNode qui entrainera le mouvement
612  // du site imbrique de niveau juste inferieur au site represente par le modeleur
613  if (selectElement(pElt))
614  {
615  return;
616  }
617  }
618 
619  // On positionne l'element courant
620  _pEditElement = pElt;
621 
623  TYBatiment* pParent = TYBatiment::safeDownCast(pEcran->getParent());
624 
625  // On ne peut rien faire sans le parent...
626  if (!pParent)
627  {
628  return;
629  }
630 
631  // On recupere le GeoNode associe
633  if (!_pEditGeoNode)
634  {
635  return;
636  }
637 }
638 
640 {
641  if (!_mouseEventActive)
642  {
643  return;
644  }
645 
646  if (_bSiteModelerFrame)
647  {
648  // Si on est dans un siteModelerFrame, on s'assure que le site
649  // represente par le modeleur est le parent direct de l'element picke
650  // Si oui, on peut bouger l'element,
651  // Si non, on renvoie sur initEditSiteNode qui entrainera le mouvement
652  // du site imbrique de niveau juste inferieur au site represente par le modeleur
653  if (selectElement(pElt))
654  {
655  return;
656  }
657  }
658 
659  // On positionne l'element courant
660  _pEditElement = pElt;
661 
662  // On le highlight dans la scene 3D
664 
667 
668  // On ne peut rien faire sans le parent...
669  if (!pParent)
670  {
671  return;
672  }
673 
674  // On recupere le GeoNode associe
675  _pEditGeoNode = (TYGeometryNode*)pParent->findBatiment(pBatiment).getRealPointer();
676  if (!_pEditGeoNode)
677  {
678  return;
679  }
680 
681  // Visu du highlight seulement
683  {
684  _pEditGeoNode->getGraphicObject()->setOnlyBoundingBox(_viewOnlyBoundingBox);
685  }
686 
687  if (_mode != Edition)
688  {
689  // On connecte le timer
690  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editGeoNode);
691 
692  // On "prend la main"//az++
693  _inUse = true; // az++
694  }
695 }
696 
698 {
699 #if WITH_NMPB
700  if (!_mouseEventActive)
701  {
702  return;
703  }
704 
705  if (_bSiteModelerFrame)
706  {
707  // Si on est dans un siteModelerFrame, on s'assure que le site
708  // represente par le modeleur est le parent direct de l'element picke
709  // Si oui, on peut bouger l'element,
710  // Si non, on renvoie sur initEditSiteNode qui entrainera le mouvement
711  // du site imbrique de niveau juste inferieur au site represente par le modeleur
712  if (selectElement(pElt))
713  {
714  return;
715  }
716  }
717 
718  // On positionne l'element courant
719  _pEditElement = pElt;
720 
723 
724  // On ne peut rien faire sans le parent...
725  if (!pParent)
726  {
727  return;
728  }
729 
730  // On recupere le GeoNode associe
731  _pEditGeoNode = (TYGeometryNode*)pParent->findRoute(pRoute).getRealPointer();
732  if (!_pEditGeoNode)
733  {
734  return;
735  }
736 
737  if (_mode == Edition)
738  {
739  TYTabPoint& pts = pRoute->getTabPoint();
740  editPolyLine(pRoute, pts, false);
741  }
742  else
743  {
745  // On connecte le timer
746  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editGeoNode);
747  // On "prend la main"
748  _inUse = true;
749  }
750 #endif
751 }
752 
754 {
755  if (!_mouseEventActive)
756  {
757  return;
758  }
759 
760  if (_bSiteModelerFrame)
761  {
762  // Si on est dans un siteModelerFrame, on s'assure que le site
763  // represente par le modeleur est le parent direct de l'element picke
764  // Si oui, on peut bouger l'element,
765  // Si non, on renvoie sur initEditSiteNode qui entrainera le mouvement
766  // du site imbrique de niveau juste inferieur au site represente par le modeleur
767  if (selectElement(pElt))
768  {
769  return;
770  }
771  }
772 
773  // On positionne l'element courant
774  _pEditElement = pElt;
775 
778 
779  // On ne peut rien faire sans le parent...
780  if (!pParent)
781  {
782  return;
783  }
784 
785  // On recupere le GeoNode associe
786  _pEditGeoNode = (TYGeometryNode*)pParent->findResTrans(pResTrans).getRealPointer();
787  if (!_pEditGeoNode)
788  {
789  return;
790  }
791 
792  if (_mode == Edition)
793  {
794  TYTabPoint& pts = pResTrans->getTabPoint();
795  editPolyLine(pResTrans, pts, false);
796  }
797  else
798  {
800  // On connecte le timer
801  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editGeoNode);
802  // On "prend la main"
803  _inUse = true;
804  }
805 }
806 
808 {
809  if (!_mouseEventActive)
810  {
811  return;
812  }
813 
814  if (_bSiteModelerFrame)
815  {
816  // Si on est dans un siteModelerFrame, on s'assure que le site
817  // represente par le modeleur est le parent direct de l'element picke
818  // Si oui, on peut bouger l'element,
819  // Si non, on renvoie sur initEditSiteNode qui entrainera le mouvement
820  // du site imbrique de niveau juste inferieur au site represente par le modeleur
821  if (selectElement(pElt))
822  {
823  return;
824  }
825  }
826 
827  // On positionne l'element courant
828  _pEditElement = pElt;
829 
831  TYTopographie* pParent = TYTopographie::safeDownCast(pCrbNiv->getParent());
832 
833  // On ne peut rien faire sans le parent...
834  if (!pParent)
835  {
836  return;
837  }
838  LPTYSiteNode pSite = dynamic_cast<TYSiteNode*>(pParent->getParent());
839 
840  // On recupere le GeoNode associe
841  _pEditGeoNode = (TYGeometryNode*)pParent->findCrbNiv(pCrbNiv).getRealPointer();
842  if (!_pEditGeoNode)
843  {
844  return;
845  }
846 
847  // On marque l'alti comme modifiee ici car on ne peut plus le faire apres
848  pSite->getAltimetry()->setIsGeometryModified(true);
849 
850  if (_mode == Edition)
851  {
852  TYTabPoint& pts = pCrbNiv->getListPoints();
853  editPolyLine(pCrbNiv, pts, false);
854  }
855  else
856  {
858  // On connecte le timer
859  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editGeoNode);
860  // On "prend la main"
861  _inUse = true;
862  }
863 }
864 
866 {
867 
868  if (!_mouseEventActive)
869  {
870  return;
871  }
872 
873  if (_bSiteModelerFrame)
874  {
875  // Si on est dans un siteModelerFrame, on s'assure que le site
876  // represente par le modeleur est le parent direct de l'element picke
877  // Si oui, on peut bouger l'element,
878  // Si non, on renvoie sur initEditSiteNode qui entrainera le mouvement
879  // du site imbrique de niveau juste inferieur au site represente par le modeleur
880  if (selectElement(pElt))
881  {
882  return;
883  }
884  }
885 
886  // On positionne l'element courant
887  _pEditElement = pElt;
889  TYTopographie* pParent = TYTopographie::safeDownCast(pCrsEau->getParent());
890 
891  // On ne peut rien faire sans le parent...
892  if (!pParent)
893  {
894  return;
895  }
896  LPTYSiteNode pSite = dynamic_cast<TYSiteNode*>(pParent->getParent());
897  assert(pSite != nullptr && "The parent of a TYTopographie element must be a TYSiteNode");
898 
899  // On recupere le GeoNode associe
900  _pEditGeoNode = (TYGeometryNode*)pParent->findCrsEau(pCrsEau).getRealPointer();
901  if (!_pEditGeoNode)
902  {
903  return;
904  }
905 
906  // We tag the altimetry as modified since we can't do it later
907  pSite->getAltimetry()->setIsGeometryModified(true);
908 
909  if (_mode == Edition)
910  {
911  TYTabPoint& pts = pCrsEau->getTabPoint();
912  editPolyLine(pCrsEau, pts, false, pSite->getAltimetry());
913  }
914  else
915  {
917  // On connecte le timer
918  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editGeoNode);
919  // On "prend la main"
920  _inUse = true;
921  }
922 }
923 
925 {
926  if (!_mouseEventActive)
927  {
928  return;
929  }
930 
931  if (_bSiteModelerFrame)
932  {
933  // Si on est dans un siteModelerFrame, on s'assure que le site
934  // represente par le modeleur est le parent direct de l'element picke
935  // Si oui, on peut bouger l'element,
936  // Si non, on renvoie sur initEditSiteNode qui entrainera le mouvement
937  // du site imbrique de niveau juste inferieur au site represente par le modeleur
938  if (selectElement(pElt))
939  {
940  return;
941  }
942  }
943 
944  // On positionne l'element courant
945  _pEditElement = pElt;
946 
948  TYTopographie* pParent = TYTopographie::safeDownCast(pPlanEau->getParent());
949 
950  // On ne peut rien faire sans le parent...
951  if (!pParent)
952  {
953  return;
954  }
955  LPTYSiteNode pSite = dynamic_cast<TYSiteNode*>(pParent->getParent());
956  assert(pSite != nullptr && "The parent of a TYTopographie element must be a TYSiteNode");
957 
958  // On recupere le GeoNode associe
959  _pEditGeoNode = (TYGeometryNode*)pParent->findPlanEau(pPlanEau).getRealPointer();
960  if (!_pEditGeoNode)
961  {
962  return;
963  }
964 
965  // On marque l'alti comme modifiee ici car on ne peut plus le faire apres
966  pSite->getAltimetry()->setIsGeometryModified(true);
967 
968  if (_mode == Edition)
969  {
970  TYTabPoint& pts = pPlanEau->getListPoints();
971  editPolyLine(pPlanEau, pts, true, pSite->getAltimetry());
972  }
973  else
974  {
976  // On connecte le timer
977  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editGeoNode);
978  // On "prend la main"
979  _inUse = true;
980  }
981 }
982 
984 {
985  if (!_mouseEventActive)
986  {
987  return;
988  }
989 
990  if (_bSiteModelerFrame)
991  {
992  // Si on est dans un siteModelerFrame, on s'assure que le site
993  // represente par le modeleur est le parent direct de l'element picke
994  // Si oui, on peut bouger l'element,
995  // Si non, on renvoie sur initEditSiteNode qui entrainera le mouvement
996  // du site imbrique de niveau juste inferieur au site represente par le modeleur
997  if (selectElement(pElt))
998  {
999  return;
1000  }
1001  }
1002 
1003  // On positionne l'element courant
1004  _pEditElement = pElt;
1005 
1007  TYTopographie* pParent = TYTopographie::safeDownCast(pTerrain->getParent());
1008 
1009  // On ne peut rien faire sans le parent...
1010  if (!pParent)
1011  {
1012  return;
1013  }
1014  LPTYSiteNode pSite = dynamic_cast<TYSiteNode*>(pParent->getParent());
1015  assert(pSite != nullptr && "The parent of a TYTopographie element must be a TYSiteNode");
1016 
1017  // On recupere le GeoNode associe
1018  _pEditGeoNode = (TYGeometryNode*)pParent->findTerrain(pTerrain).getRealPointer();
1019  if (!_pEditGeoNode)
1020  {
1021  return;
1022  }
1023 
1024  // We tag the altimetry as modified since we can't do it later
1025  pSite->getAltimetry()->setIsGeometryModified(true);
1026 
1027  if (_mode == Edition)
1028  {
1029  TYTabPoint& pts = pTerrain->getListPoints();
1030  editPolyLine(pTerrain, pts, true, pSite->getAltimetry());
1031  }
1032  else
1033  {
1035  // On connecte le timer
1036  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editGeoNode);
1037  // On "prend la main"
1038  _inUse = true;
1039  }
1040 }
1041 
1043 {
1044  if (!_mouseEventActive)
1045  {
1046  return;
1047  }
1048 
1049  if (_bSiteModelerFrame)
1050  {
1051  // Si on est dans un siteModelerFrame, on s'assure que le site
1052  // represente par le modeleur est le parent direct de l'element picke
1053  // Si oui, on peut bouger l'element,
1054  // Si non, on renvoie sur initEditSiteNode qui entrainera le mouvement
1055  // du site imbrique de niveau juste inferieur au site represente par le modeleur
1056  if (selectElement(pElt))
1057  {
1058  return;
1059  }
1060  }
1061 
1062  // On positionne l'element courant
1063  _pEditElement = pElt;
1064 
1066 
1067  if (!pSrcPonct)
1068  {
1069  return;
1070  }
1071 
1073  if (pParent)
1074  {
1075  _pEditGeoNode = (TYGeometryNode*)pParent->findSrc(pSrcPonct).getRealPointer();
1076  }
1077 
1078  if (_mode == Moving)
1079  {
1080  _pEditPoint = pSrcPonct->getPos();
1081 
1083  TR("id_action_movesrcponct"));
1084 
1086 
1087  // On connecte le timer
1088  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editPoint); // DT++ 20051201
1089  // On "prend la main"
1090  _inUse = true;
1091  }
1092  else if (_mode == Rotation)
1093  {
1094  // On le highlight dans la scene 3D
1096 
1097  _pLastAction = new TYOrienteSrcPonctAction(pSrcPonct, pSrcPonct->getOrientation(), OVector3D(),
1098  _pModeler, TR("id_action_orientsrcponct"));
1099 
1100  // On connecte le timer
1101  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::orienteSrcPonct); // az--
1102 
1103  // On "prend la main"
1104  _inUse = true;
1105  }
1106 }
1107 
1109 {
1110  if (!_mouseEventActive)
1111  {
1112  return;
1113  }
1114 
1115  // On positionne l'element courant
1116  _pEditElement = pElt;
1117 
1119 
1120  if (!pPointControl)
1121  {
1122  return;
1123  }
1124 
1125  if (_mode == Moving)
1126  {
1127  _pEditPoint = (LPTYPoint&)pPointControl;
1128 
1130  TR("id_action_movepointcontrol"));
1131 
1133 
1134  // On connecte le timer
1135  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editPoint);
1136  }
1137 }
1138 
1140 {
1141  if (!_mouseEventActive)
1142  {
1143  return;
1144  }
1145 
1146  // On positionne l'element courant
1147  _pEditElement = pElt;
1148 
1149  // On le highlight dans la scene 3D
1151 
1153  TYProjet* pProj = dynamic_cast<TYProjet*>(pMaillage->getParent());
1154 
1155  // On ne peut rien faire sans le parent...
1156  if (!pProj)
1157  {
1158  return;
1159  }
1160 
1161  // On recupere le GeoNode associe
1162  _pEditGeoNode = (TYGeometryNode*)pProj->findMaillage(pMaillage).getRealPointer();
1163  if (!_pEditGeoNode)
1164  {
1165  return;
1166  }
1167 
1168  // Visu du highlight seulement
1170  {
1171  _pEditGeoNode->getGraphicObject()->setOnlyBoundingBox(_viewOnlyBoundingBox);
1172  }
1173 
1174  if (_mode != Edition)
1175  {
1176  // On connecte le timer
1177  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editGeoNode);
1178  }
1179 }
1180 
1182  OPoint3D& centralPointGN)
1183 {
1185  true);
1186 }
1187 
1189  OPoint3D& centralPointGN)
1190 {
1192  false);
1193 }
1194 
1196  TYGeometryNode* pGeoNode, OPoint3D& centralPointGN, bool bPointOfGeoNodeInCurrentSiteCoordinates)
1197 {
1198  TYPoint centralPoint(centralPointGN);
1199  OMatrix currentMatrix;
1200  OMatrix totalMatrix;
1201  if (pGeoNode)
1202  {
1203  // Trouvons le GeoNode du Site courant (NULL si c'est le site root)
1204  TYSiteModelerFrame* pTYSiteModelerFrame = (TYSiteModelerFrame*)_pModeler;
1205  TYSiteNode* pRootSite = pTYSiteModelerFrame->getSite();
1206  TYGeometryNode* pRootGeometryNode = TYGeometryNode::GetGeoNode(pRootSite);
1207 
1208  TYListPtrGeoNode GeoNodeParents;
1209  pGeoNode->GetGeoNodeParentList(GeoNodeParents);
1210 
1211  TYListPtrGeoNode::iterator ite = GeoNodeParents.end();
1212  int i = 0, rootIndex = 0;
1213  if (pRootGeometryNode)
1214  {
1215  for (i = 0; i < (int)GeoNodeParents.size(); i++)
1216  {
1217  ite--;
1218  if ((*ite) == pRootGeometryNode)
1219  {
1220  rootIndex = i + 1;
1221  }
1222  }
1223  }
1224 
1225  for (i = rootIndex; i < ((int)GeoNodeParents.size() - rootIndex); i++)
1226  {
1227  ite--;
1228  TYGeometryNode* pCurrentTYGeometryNode = (TYGeometryNode*)(*ite);
1229  currentMatrix = pCurrentTYGeometryNode->getMatrix();
1230  if (!bPointOfGeoNodeInCurrentSiteCoordinates)
1231  {
1232  currentMatrix = currentMatrix.getInvert();
1233  }
1234  totalMatrix = totalMatrix * currentMatrix;
1235  }
1236  centralPoint = totalMatrix * centralPoint;
1237  }
1238  centralPointGN = centralPoint;
1239 }
1240 
1242 {
1243  bool modified = false;
1244  TYPoint oldPos;
1245  TYRepere oldRepere;
1246  bool enableX = true;
1247  bool enableY = true;
1248  bool enableZ = true;
1249  _pInteractor->makeCurrent();
1250  if (_mode == Moving)
1251  {
1252  // Copie de l'ancienne pos
1253  oldPos = _pEditGeoNode->getORepere3D()._origin;
1254 
1255  if ((dynamic_cast<TYCourbeNiveau*>(_pEditGeoNode->getElement()) != nullptr) ||
1256  (dynamic_cast<TYPlanEau*>(_pEditGeoNode->getElement()) != nullptr))
1257  {
1258  enableZ = false;
1259  }
1260 
1261  ORepere3D repere = _pEditGeoNode->getORepere3D();
1262 
1263  // On applique le deplacement
1264  modified = move(&repere._origin, enableX, enableY, enableZ); // az--
1265 
1266  _pEditGeoNode->setRepere(repere);
1267  }
1268  else if (_mode == Rotation)
1269  {
1270  // Copie de l'ancien repere
1271  oldRepere = _pEditGeoNode->getORepere3D();
1272 
1273  if ((dynamic_cast<TYMaillage*>(_pEditGeoNode->getElement()) != nullptr) ||
1274  (dynamic_cast<TYCourbeNiveau*>(_pEditGeoNode->getElement()) != nullptr) ||
1275  (dynamic_cast<TYPlanEau*>(_pEditGeoNode->getElement()) != nullptr) ||
1276  (dynamic_cast<TYSiteNode*>(_pEditGeoNode->getElement()) != nullptr))
1277  {
1278  enableX = false;
1279  enableY = false;
1280  }
1281 
1282  ORepere3D repere = _pEditGeoNode->getORepere3D();
1283 
1284  // On applique la rotation
1285  modified = rotate(&repere, enableX, enableY, enableZ);
1286 
1287  _pEditGeoNode->setRepere(repere);
1288  }
1289 
1290  if (modified && bTYPositionEditorFirstMove)
1291  {
1292  // az++
1293  bTYPositionEditorFirstMove = false;
1294  // Magouille infâme pour faire disparaitre temporairement le GeoNode car le setVisible ne marche plus
1295  // vraiment
1296  ORepere3D repere = _pEditGeoNode->getORepere3D();
1297  ORepere3D AlOuest;
1298  AlOuest._origin = OPoint3D(999999, 999999, 999999);
1299  _pEditGeoNode->setRepere(AlOuest);
1300  _pEditGeoNode->getGraphicObject()->setOnlyBoundingBox(_viewOnlyBoundingBox);
1301  _pInteractor->getRenderer()->invalidateScene(); // az++ : pour rendre invisible l'objet en mouvement
1302  _pInteractor->update(); // az++
1303  _pEditGeoNode->setRepere(repere);
1304  }
1305 
1306  if (modified)
1307  {
1308  if (_mode == Moving)
1309  {
1310  if (_firstCall)
1311  {
1312  _pLastAction =
1314  _pModeler, TR("id_action_movegeonode"));
1315  _firstCall = false;
1316  }
1317  else
1318  {
1320  }
1321  }
1322  else if (_mode == Rotation)
1323  {
1324  if (_firstCall)
1325  {
1326  _pLastAction =
1328  _pModeler, TR("id_action_rotategeonode"));
1329  _firstCall = false;
1330  }
1331  else
1332  {
1334  }
1335  }
1336 
1337  // Refresh
1339  _pEditGeoNode->updateGraphic();
1340  _pModeler->updateView(false, false);
1341 
1342  // Il faut maintenant afficher le GeoNode dans le repere adequat (celui choisit lors de l'ouverture du
1343  // modeler); Le repere peut etre:
1344  //* celui du repere du monde (TYSiteModelerFrame)
1345  //* celui d'un TYSiteNode fils (TYSiteModelerFrame)
1346  //* celui d'un TYBatiment (TYBatimentModelerFrame)
1347  //* celui d'un (TYMachineModelerFrame)
1348  //* celui d'un (TYFaceModelerFrame)
1349  TYElement* pRootTYElement = _pModeler->getElement();
1350  TYGeometryNode* pRootGeometryNode = TYGeometryNode::GetGeoNode(pRootTYElement);
1351 
1352  TYRenderContext renderContext = _pModeler->createRenderContext();
1353  renderContext.pass = TYRenderPass::Overlay;
1354 
1356  pRootGeometryNode);
1358  _pInteractor->update();
1359  }
1360  _pInteractor->doneCurrent();
1361 }
1362 
1364 {
1365  bool modified = false;
1366  double z = 0.0;
1367 
1369  {
1370  // En vue 3D on conserve l'altitude du point
1371  z = _pEditPoint->_z;
1372  }
1373 
1374  modified = move(_pEditPoint);
1375 
1376  if (modified)
1377  {
1379  {
1380  // En vue 3D on restitue l'altitude du point
1381  _pEditPoint->_z = z;
1382  }
1383 
1384  if (_pEditElement->isA("TYCourbeNiveau"))
1385  {
1387  }
1388  else if (dynamic_cast<TYAcousticLine*>(_pEditElement) != nullptr)
1389  {
1391  }
1392  else if (_pEditElement->isA("TYTerrain"))
1393  {
1395  }
1396  else if (_pEditElement->isA("TYPlanEau"))
1397  {
1399  }
1400  else if (dynamic_cast<TYSourcePonctuelle*>(_pEditElement) != nullptr)
1401  {
1403  }
1404  else if (dynamic_cast<TYPointControl*>(_pEditElement) != nullptr)
1405  {
1407  }
1408 
1410 
1411  if (_pEditElement->getParent())
1412  {
1414  }
1415 
1416  // Refresh
1417  _pEditElement->updateGraphic();
1418  _pModeler->updateView(false, false);
1419 
1420  // Highlight point
1421  TYPoint worldPoint(*_pEditPoint);
1422  if (_pEditGeoNode)
1423  {
1424  worldPoint = _pEditGeoNode->getMatrix() * worldPoint;
1425  }
1426  _pPicker->highlightElement(&worldPoint); // Fait un update
1427  }
1428 }
1429 
1431 {
1432  bool modified = false;
1433 
1434  modified = move(_pEditPoint);
1435 
1436  if (modified)
1437  {
1440 
1442 
1443  // Mise a jour de l'etage
1444  TYEtage* pEtage = (TYEtage*)_pEditElement;
1445  pEtage->setMurs(_editContour, pEtage->getHauteur(), pEtage->getClosed());
1446 
1447  // Refresh
1448  if (_pEditElement->getParent())
1449  {
1450  _pEditElement->getParent()->updateGraphic();
1451  }
1452  else
1453  {
1454  _pEditElement->updateGraphic();
1455  }
1456 
1457  // Highlight point
1458  TYPoint worldPoint = _pEditGeoNode->getMatrix() * (*_pEditPoint);
1459  _pPicker->highlightElement(&worldPoint); // Fait un update
1460  }
1461 }
1462 
1464 {
1465  // On ne fait rien si la souris n'a pas bougee
1466  if ((_currentMousePos[0] == _lastMousePos[0]) && (_currentMousePos[1] == _lastMousePos[1]))
1467  {
1468  return;
1469  }
1470 
1472 
1473  // Il nous faut la position du point dans le repere global
1474  TYPoint pos(0, 0, 0);
1475  OPoint3D SrcePos(pos);
1476  OPoint3D opos =
1478  SrcePos; // repere le + haut dans la hierarchie, mais pas forcement celui du modelerFrame courant
1479  pos = opos;
1480 
1481  // Calcul du vecteur orientation : il est constitue de 2 points:
1482  //- celui donnant la position de la source ponctuelle
1483  //- celui donnant la position de la souris a l'instant present
1484  // 1. Passage de coordonnees ecrans a coordonnees du repere du modeler frame
1485  double displaySrcePos[4];
1486  worldToDisplay(pos._x, pos._z, -pos._y, displaySrcePos);
1487  double ptCur[4];
1489  displaySrcePos[2], ptCur);
1490  OPoint3D optCur(ptCur[0], -ptCur[2], ptCur[1]);
1491  // optCur represente maintenant les coordonnees du second point dans le repere du ModelerFrame courant
1492  // 2. Passage de coordonnees du repere du modeler frame a coordonnees globales
1493  TYElement* pRootTYElement = _pModeler->getElement();
1494  TYGeometryNode* pRootGeometryNode = TYGeometryNode::GetGeoNode(pRootTYElement);
1495  if (pRootGeometryNode)
1496  {
1497  optCur = pRootGeometryNode->localToGlobal() * optCur;
1498  }
1499  // optCur represente maintenant les coordonnees du second point dans le repere le plus haut dans la
1500  // hierarchie:
1501  optCur = _pEditGeoNode->globalToLocal() * optCur;
1502  pos = _pEditGeoNode->globalToLocal() * pos;
1503  OVector3D vecOrient(pos, optCur);
1504 
1505  switch (_pModeler->getCurrentView())
1506  {
1508  pSrcPonct->getOrientation()._x = vecOrient._x;
1509  pSrcPonct->getOrientation()._y = vecOrient._y;
1510  break;
1512  pSrcPonct->getOrientation()._y = vecOrient._y;
1513  pSrcPonct->getOrientation()._z = vecOrient._z;
1514  break;
1516  pSrcPonct->getOrientation()._x = vecOrient._x;
1517  pSrcPonct->getOrientation()._z = vecOrient._z;
1518  break;
1519  }
1520 
1521  ((TYOrienteSrcPonctAction*)_pLastAction)->setNewOrient(pSrcPonct->getOrientation());
1522 
1524  _pEditElement->updateGraphic();
1525 
1526  // Save mouse pos car il y a eu un deplacement
1529 }
1530 
1531 bool TYPositionEditor::move(OPoint3D* pPt, bool enableX /*=true*/, bool enableY /*=true*/,
1532  bool enableZ /*=true*/)
1533 {
1534  Q_CHECK_PTR(pPt);
1535  bool ret = false;
1536 
1537  if (!enableX && !enableY && !enableZ)
1538  {
1539  return false;
1540  }
1541 
1542  // On ne fait rien si la souris n'a pas bougee
1543  if ((_currentMousePos[0] == _lastMousePos[0]) && (_currentMousePos[1] == _lastMousePos[1]))
1544  {
1545  return false;
1546  }
1547 
1548  // Chgmt de repere si besoin (si SiteNode pere)
1549  if (QString(_pModeler->metaObject()->className()).compare("TYSiteModelerFrame") == 0)
1550  {
1552  }
1553 
1554  // On garde une copie
1555  OPoint3D ptBis = *pPt;
1556 
1557  // Calcul du delta de deplacement
1558  double pt1[4];
1559  double pt2[4];
1560  double org[4];
1561  worldToDisplay(ptBis._x, ptBis._z, -ptBis._y, org);
1563  pt1);
1564  displayToWorld(_lastMousePos[0], _pInteractor->getViewport().height() - _lastMousePos[1], org[2], pt2);
1565  OVector3D delta(pt1[0] - pt2[0], -(pt1[2] - pt2[2]), pt1[1] - pt2[1]);
1566 
1567  OPoint3D deltap = delta;
1568 
1569  // Calcul de la nouvelle position
1570  ptBis = OVector3D(ptBis) + deltap; // az++
1571 
1572  // Si la grille magnetique est activee
1574  {
1575  snapToGrid(ptBis._x, ptBis._y, ptBis._z, _gridMagnStep);
1576  }
1577 
1578  // Si le deplacement n'est pas nul
1579  if (ptBis != *pPt)
1580  {
1581  // On applique le deplacement
1582  if (enableX)
1583  {
1584  pPt->_x = ptBis._x;
1585  }
1586  if (enableY)
1587  {
1588  pPt->_y = ptBis._y;
1589  }
1590  if (enableZ)
1591  {
1592  pPt->_z = ptBis._z;
1593  }
1594 
1595  // Mets a jour les moving lines
1596  updateMovingPoint(*pPt);
1597 
1598  // Mets a jour le texte d'information sur la nouvelle position
1599  if (_mode == Edition)
1600  {
1601  // Si la grille magnetique est activee
1603  {
1604  snapToGrid(pt1[0], pt1[1], pt1[2], _gridMagnStep);
1605  }
1606 
1607  // On affiche la position globale du curseur
1608  updateText(QString(TR("id_pos_info"))
1609  .arg(pPt->_x, 0, 'f', 2)
1610  .arg(pPt->_y, 0, 'f', 2)
1611  .arg(pPt->_z, 0, 'f', 2),
1613  }
1614  else
1615  {
1616  // On affiche la position globale du point
1617  updateText(QString(TR("id_pos_info"))
1618  .arg(pPt->_x, 0, 'f', 2)
1619  .arg(pPt->_y, 0, 'f', 2)
1620  .arg(pPt->_z, 0, 'f', 2),
1621  (int)org[0], (int)org[1]);
1622  }
1623 
1624  // Save mouse pos car il y a eu un deplacement
1627 
1628  // Le point a ete deplace
1629  ret = true;
1630  }
1631 
1632  // Chgmt de repere si besoin (si SiteNode pere)
1633  if (QString(_pModeler->metaObject()->className()).compare("TYSiteModelerFrame") == 0)
1634  {
1636  }
1637 
1638  return ret;
1639 }
1640 
1641 bool TYPositionEditor::rotate(ORepere3D* pRepere, bool enableX /*=true*/, bool enableY /*=true*/,
1642  bool enableZ /*=true*/)
1643 {
1644  Q_CHECK_PTR(pRepere);
1645  bool ret = false;
1646 
1647  if (!enableX && !enableY && !enableZ)
1648  {
1649  return false;
1650  }
1651 
1652  // On ne fait rien si la souris n'a pas bougee
1653  if ((_currentMousePos[0] == _lastMousePos[0]) && (_currentMousePos[1] == _lastMousePos[1]))
1654  {
1655  return false;
1656  }
1657 
1658  // Chgmt de repere si besoin (si SiteNode pere)
1659  if (QString(_pModeler->metaObject()->className()).compare("TYSiteModelerFrame") == 0)
1660  {
1662  }
1663 
1664  double center[4];
1665  worldToDisplay(pRepere->_origin._x, pRepere->_origin._z, -pRepere->_origin._y, center);
1666 
1667  int diffX1 = _currentMousePos[0] - int(center[0]);
1668  int diffY1 = _currentMousePos[1] - int(center[1]);
1669  int diffX2 = _lastMousePos[0] - int(center[0]);
1670  int diffY2 = _lastMousePos[1] - int(center[1]);
1671 
1672  double a1 = atan2(double(diffY1), double(diffX1));
1673  double a2 = atan2(double(diffY2), double(diffX2));
1674  float angle = (a2 - a1) / (2.0 * 3.1415926535) * 360.0 / 10.0 * _trackballFactor;
1675 
1677  {
1678  angle = ROUND(angle / _angleStep) * _angleStep;
1679  }
1680 
1681  // Si l'angle n'est pas nul
1682  if (angle != 0)
1683  {
1684  // On applique la rotation
1685 
1686  OMatrix tyMat;
1687  OMatrix tyMatTmpX;
1688  OMatrix tyMatTmpY;
1689  OMatrix tyMatTmpZ;
1690 
1691  QVector3D axis = _pInteractor->getActiveCamera()->front();
1692 
1693  if (!enableX)
1694  {
1695  axis.setX(0);
1696  }
1697  // Notez le changement de repere pour les cas suivants.
1698  // FIXME: Supprimer cette incohérence ou appliquer la transformation
1699  // nécessaire à axis.
1700  if (!enableY)
1701  {
1702  axis.setZ(0);
1703  }
1704  if (!enableZ)
1705  {
1706  axis.setY(0);
1707  }
1708 
1709  if (axis.x() != 0)
1710  {
1711  tyMatTmpX.setRotationOx(-axis.x() * M_PI * angle / 180);
1712  }
1713  if (axis.z() != 0)
1714  {
1715  tyMatTmpY.setRotationOy(axis.z() * M_PI * angle / 180);
1716  }
1717  if (axis.y() != 0)
1718  {
1719  tyMatTmpZ.setRotationOz(axis.y() * M_PI * angle / 180);
1720  }
1721 
1722  tyMat = pRepere->asMatrix() * tyMatTmpZ * tyMatTmpY * tyMatTmpX;
1723 
1724  OPoint3D org = pRepere->_origin; // On conserve l'origine de depart
1725  pRepere->set(tyMat);
1726  pRepere->_origin = org;
1727 
1728  // Save mouse pos car il y a eu une rotation
1731 
1732  // On affiche la somme de l'angle que l'on applique durant cette rotation
1733  _angleInfo = ((int)(_angleInfo + angle)) % 360;
1734  updateText(QString(TR("id_angle_info")).arg(_angleInfo, 0, 'f', 2), (int)center[0], (int)center[1]);
1735 
1736  // Le repere a ete modifie
1737  ret = true;
1738  }
1739 
1740  // Chgmt de repere si besoin (si SiteNode pere)
1741  if (QString(_pModeler->metaObject()->className()).compare("TYSiteModelerFrame") == 0)
1742  {
1744  }
1745 
1746  return ret;
1747 }
1748 
1749 int TYPositionEditor::findPoint(float* ptToFind, TYTabPoint* pInPoints)
1750 {
1751  int ptId = -1;
1752 
1753  for (size_t i = 0; i < pInPoints->size(); i++)
1754  {
1755  TYPoint curPt = pInPoints->at(i);
1756 
1757  if ((ptToFind[0] >= curPt._x - _pickPointPrecision) &&
1758  (ptToFind[0] <= curPt._x + _pickPointPrecision) &&
1759  (-ptToFind[2] >= curPt._y - _pickPointPrecision) &&
1760  (-ptToFind[2] <= curPt._y + _pickPointPrecision))
1761  {
1762  // Point trouve !
1763  ptId = static_cast<int>(i);
1764 
1765  updateMovingLines(pInPoints, ptId);
1766 
1767  break;
1768  }
1769  }
1770 
1771  return ptId;
1772 }
1773 
1774 void TYPositionEditor::updateMovingLines(TYTabPoint* pPoints, int centralPointId)
1775 {
1776  TYPoint centralPoint = pPoints->at(centralPointId);
1777  if (_pEditGeoNode)
1778  {
1779  centralPoint = _pEditGeoNode->getMatrix() * centralPoint;
1780  }
1781 
1782  if (centralPointId - 1 >= 0)
1783  {
1784  TYPoint prevPoint = pPoints->at(centralPointId - 1);
1785  if (_pEditGeoNode)
1786  {
1787  prevPoint = _pEditGeoNode->getMatrix() * prevPoint;
1788  }
1789 
1790  _pOGLLineElementMoving1->setPoint1(QVector3D(prevPoint._x, prevPoint._z, -prevPoint._y));
1791  _pOGLLineElementMoving1->setPoint2(QVector3D(centralPoint._x, centralPoint._z, -centralPoint._y));
1793  }
1794 
1795  if (centralPointId + 1 < (int)pPoints->size())
1796  {
1797  TYPoint nextPoint = pPoints->at(centralPointId + 1);
1798  if (_pEditGeoNode)
1799  {
1800  nextPoint = _pEditGeoNode->getMatrix() * nextPoint;
1801  }
1802 
1803  _pOGLLineElementMoving2->setPoint1(QVector3D(centralPoint._x, centralPoint._z, -centralPoint._y));
1804  _pOGLLineElementMoving2->setPoint2(QVector3D(nextPoint._x, nextPoint._z, -nextPoint._y));
1806  }
1807 }
1808 
1810 {
1811  TYPoint centralPoint(point);
1812  if (_pEditGeoNode)
1813  {
1814  centralPoint = _pEditGeoNode->getMatrix() * centralPoint;
1815  }
1816 
1817  _pOGLLineElementMoving1->setPoint2(QVector3D(centralPoint._x, centralPoint._z, -centralPoint._y));
1818  _pOGLLineElementMoving2->setPoint1(QVector3D(centralPoint._x, centralPoint._z, -centralPoint._y));
1819 }
1820 
1822 {
1823  bool stop = false;
1824 
1825  // Recherche du siteNodeParent
1826  TYElement* pParent = pElt->getParent();
1827 
1828  while (pParent && (dynamic_cast<TYSiteNode*>(pParent) == nullptr))
1829  {
1830  pParent = pParent->getParent();
1831  }
1832 
1833  // Si le modeleur point un projet on prend le sitenode racine
1834  TYElement* pModelerTarget = NULL;
1835  if (_pModeler->getElement()->isA("TYProjet"))
1836  {
1837  pModelerTarget = TYProjet::safeDownCast(_pModeler->getElement())->getSite();
1838  }
1839  else
1840  {
1841  pModelerTarget = _pModeler->getElement();
1842  }
1843 
1844  // Si le site parent n'est pas le meme que le site pointe par le modeleur
1845  if (pModelerTarget && (pParent != pModelerTarget))
1846  {
1847  // On initialise sur lui
1848  initEditSiteNode(pParent);
1849  stop = true; // La methode appelante devra se terminer
1850  }
1851 
1852  return stop;
1853 }
1854 
1856 {
1857  int ptIdToEdit = 0;
1858  if (_keyAOn) // Insert a point
1859  {
1860  TYPoint ptInsert;
1861  insertNewPoint(pts, ptInsert, ptIdToEdit, pAlti);
1862  _pLastAction = new TYInsertPointPolyLineAction(pElt, pts, ptIdToEdit, ptInsert, _pModeler,
1863  TR("id_action_insertptpolyline"));
1864  }
1865  else if (_keyDOn) // Delete a point
1866  {
1867  size_t nbPts = pts.size();
1868  if (nbPts < 3 || (closed && nbPts < 4))
1869  {
1870  return;
1871  }
1872  TYPoint ptDelete;
1873  deletePoint(pts, ptDelete, ptIdToEdit);
1874  _pLastAction = new TYRemovePointPolyLineAction(pElt, pts, ptIdToEdit, ptDelete, _pModeler,
1875  TR("id_action_delptpolyline"));
1876  }
1877  else // Move a point
1878  {
1879  // We find the id of the closest point to the mouse
1880  ptIdToEdit = findClosestPointToMouse(pts);
1881  _pEditPoint = &pts[ptIdToEdit];
1882  _pLastAction = new TYMovePointPolyLineAction(pElt, pts, ptIdToEdit, *_pEditPoint, TYPoint(),
1883  _pModeler, TR("id_action_moveptpolyline"));
1884  // Is the highlight working...?
1885  TYPoint worldPoint = _pEditGeoNode->getMatrix() * (*_pEditPoint);
1886  _pPicker->highlightElement(&worldPoint);
1887  // Connecte the timer
1888  QObject::connect(_pStepTimer, &QTimer::timeout, this, &TYPositionEditor::editPoint);
1889  _inUse = true;
1890  }
1891 }
1892 
1893 void TYPositionEditor::insertNewPoint(TYTabPoint& pts, TYPoint& newPoint, int& idInsert, LPTYAltimetrie pAlti)
1894 {
1895  idInsert = findClosestSegmentToMouse(pts);
1896  double ptProj[3];
1898  ptProj);
1899  newPoint = TYPoint(ptProj[0], -ptProj[2], pts[idInsert]._z);
1900 
1901  // Si la grille magnetique est activee
1903  {
1904  snapToGrid(newPoint._x, newPoint._y, newPoint._z, _gridMagnStep);
1905  }
1906 
1907  ++idInsert;
1908  if (pAlti && !pAlti->altitude(newPoint))
1909  {
1910  newPoint._z = std::numeric_limits<double>::quiet_NaN();
1911  }
1912  pts.insert(pts.begin() + idInsert, newPoint);
1913 }
1914 
1915 void TYPositionEditor::deletePoint(TYTabPoint& pts, TYPoint& deletedPoint, int& idDelete)
1916 {
1917  idDelete = findClosestPointToMouse(pts);
1918  deletedPoint = pts[idDelete];
1919  pts.erase(pts.begin() + idDelete);
1920 }
1921 
1923 {
1924  int idPt = 0;
1925  size_t nbPts = pts.size();
1926  double ptOnDisplay[3];
1927  OVector3D pt(0, 0, 0);
1928  const OMatrix& matrixNode = _pEditGeoNode->getMatrix();
1929 
1930  std::vector<OVector3D> ptsDisplay;
1931  // We project on the display the points of our polyline
1932  for (size_t i = 0; i < nbPts; ++i)
1933  {
1934  // Is the transformation really necessary?
1935  pt = matrixNode * pts[i];
1936  worldToDisplay(pt._x, pt._z, -pt._y, ptOnDisplay);
1937  ptsDisplay.push_back(OVector3D(ptOnDisplay[0], ptOnDisplay[1], 0.0));
1938  }
1939 
1940  double distSqrMin = (std::numeric_limits<double>::max)();
1941  double distSqr = 0;
1942  double mx = _currentMousePos[0];
1943  double my = _pInteractor->getViewport().height() - _currentMousePos[1];
1944 
1945  // Find the closest line to our mouse position
1946  size_t j = 0;
1947  for (size_t i = 0; i < nbPts; ++i)
1948  {
1949  j = i < (nbPts - 1) ? i + 1 : 0;
1950  const OVector3D& v = ptsDisplay[i];
1951  const OVector3D& w = ptsDisplay[j];
1952 
1953  distSqr = distSegmentSqr(mx, my, v._x, v._y, w._x, w._y);
1954  if (distSqr < distSqrMin)
1955  {
1956  distSqrMin = distSqr;
1957  idPt = static_cast<int>(i);
1958  }
1959  }
1960  return idPt;
1961 }
1962 
1964 {
1965  int ptId = -1;
1966  size_t nbPts = pts.size();
1967  double distSqrMin = (std::numeric_limits<double>::max)();
1968  double ptOnDisplay[3];
1969  double diffx = 0, diffy = 0, distSqr = 0;
1970  OVector3D pt(0, 0, 0);
1971  const OMatrix& matrixNode = _pEditGeoNode->getMatrix();
1972 
1973  for (size_t i = 0; i < nbPts; ++i)
1974  {
1975  // Is the transformation really necessary?
1976  pt = matrixNode * pts[i];
1977  worldToDisplay(pt._x, pt._z, -pt._y, ptOnDisplay);
1978  diffx = ptOnDisplay[0] - _currentMousePos[0];
1979  diffy = ptOnDisplay[1] - _pInteractor->getViewport().height() + _currentMousePos[1];
1980  distSqr = diffx * diffx + diffy * diffy;
1981  if (distSqr < distSqrMin)
1982  {
1983  distSqrMin = distSqr;
1984  ptId = static_cast<int>(i);
1985  }
1986  }
1987  return ptId;
1988 }
1989 
1990 double TYPositionEditor::distSegmentSqr(double mx, double my, double vx, double vy, double wx,
1991  double wy) const
1992 {
1993  double l2 = (vx - wx) * (vx - wx) + (vy - wy) * (vy - wy);
1994  if (l2 != 0)
1995  {
1996  double t = ((mx - vx) * (wx - vx) + (my - vy) * (wy - vy)) / l2;
1997  if (t < 0)
1998  {
1999  return (mx - vx) * (mx - vx) + (my - vy) * (my - vy);
2000  }
2001  else if (t > 1)
2002  {
2003  return (mx - wx) * (mx - wx) + (my - wy) * (my - wy);
2004  }
2005  else
2006  {
2007  return (mx - (vx + t * (wx - vx))) * (mx - (vx + t * (wx - vx))) +
2008  (my - (vy + t * (wy - vy))) * (my - (vy + t * (wy - vy)));
2009  }
2010  }
2011  else
2012  {
2013  return (mx - vx) * (mx - vx) + (my - vy) * (my - vy);
2014  }
2015 }
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.
@ 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:36
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:697
static void setIsSavedOk(const bool &toSave)
Definition: TYElement.h:905
virtual void setIsGeometryModified(bool isModified)
Definition: TYElement.cpp:253
double getHauteur() const
Definition: TYEtage.cpp:1041
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()
virtual TYRenderContext createRenderContext()
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:906
TYRenderPass pass
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