Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYMaillage.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012> <EDF-R&D> <FRANCE>
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10  * See the GNU General Public License for more details.
11  * You should have received a copy of the GNU General Public License along
12  * with this program; if not, write to the Free Software Foundation, Inc.,
13  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
14  */
15 
16 #include <boost/foreach.hpp>
17 #include <boost/tuple/tuple.hpp>
18 
19 #include "Tympan/core/color.h"
20 #include "Tympan/core/logging.h"
26 #include "TYMaillage.h"
27 
28 #include <math.h>
29 
30 #if TY_USE_IHM
32 #endif
33 
35 
37 {
39 
40  _hauteur = 2.0;
41  _computeAlti = true;
42 
44  _dataFreq = 100.0f;
45 
46  _pPalette = new TYPalette();
47 
48  _pPanel = new TYPanel();
49 
50 #if TY_USE_IHM
51  QString pref = "MaillageDefault";
52  if (TYPreferenceManager::exists(TYDIRPREFERENCEMANAGER, pref + "Hauteur"))
53  {
54  _hauteur = TYPreferenceManager::getFloat(TYDIRPREFERENCEMANAGER, pref + "Hauteur");
55  _dataType = TYPreferenceManager::getInt(TYDIRPREFERENCEMANAGER, pref + "DataType");
56  _dataFreq = TYPreferenceManager::getFloat(TYDIRPREFERENCEMANAGER, pref + "DataFreq");
57  }
58  else
59  {
60  TYPreferenceManager::setFloat(TYDIRPREFERENCEMANAGER, pref + "Hauteur", _hauteur);
61  TYPreferenceManager::setInt(TYDIRPREFERENCEMANAGER, pref + "DataType", _dataType);
62  TYPreferenceManager::setFloat(TYDIRPREFERENCEMANAGER, pref + "DataFreq", _dataFreq);
63  }
64 #endif
65 }
66 
68 {
69  *this = other;
70 }
71 
73 {
75 }
76 
78 {
79  if (this != &other)
80  {
81  TYElement::operator=(other);
82  _ptsCalcul = other._ptsCalcul;
83  _hauteur = other._hauteur;
84  _computeAlti = other._computeAlti;
85  _dataType = other._dataType;
86  _dataFreq = other._dataFreq;
87  _pPalette = other._pPalette;
88  }
89  return *this;
90 }
91 
92 bool TYMaillage::operator==(const TYMaillage& other) const
93 {
94  if (this != &other)
95  {
96  if (TYElement::operator!=(other))
97  {
98  return false;
99  }
100  if (!(_ptsCalcul == other._ptsCalcul))
101  {
102  return false;
103  }
104  if (_hauteur != other._hauteur)
105  {
106  return false;
107  }
108  if (_computeAlti != other._computeAlti)
109  {
110  return false;
111  }
112  if (_dataType != other._dataType)
113  {
114  return false;
115  }
116  if (_dataFreq != other._dataFreq)
117  {
118  return false;
119  }
120  if (_pPalette != other._pPalette)
121  {
122  return false;
123  }
124  }
125  return true;
126 }
127 
128 bool TYMaillage::operator!=(const TYMaillage& other) const
129 {
130  return !operator==(other);
131 }
132 
133 bool TYMaillage::deepCopy(const TYElement* pOther, bool copyId /*=true*/, bool pUseCopyTag /*=false*/)
134 {
135  if (!TYElement::deepCopy(pOther, copyId))
136  {
137  return false;
138  }
139 
140  TYMaillage* pOtherMaillage = (TYMaillage*)pOther;
141 
142  _hauteur = pOtherMaillage->_hauteur;
143  _computeAlti = pOtherMaillage->_computeAlti;
144  _dataType = pOtherMaillage->_dataType;
145  _dataFreq = pOtherMaillage->_dataFreq;
146 
147  _pPalette->deepCopy(pOtherMaillage->_pPalette, copyId);
148 
149  _ptsCalcul.clear();
150  for (unsigned int i = 0; i < pOtherMaillage->_ptsCalcul.size(); i++)
151  {
152  LPTYPointCalcul pPointCalcul = new TYPointCalcul();
153  pPointCalcul->deepCopy(pOtherMaillage->_ptsCalcul[i], copyId);
154  addPointCalcul(pPointCalcul);
155  }
156 
157  return true;
158 }
159 
160 std::string TYMaillage::toString() const
161 {
162  return "TYMaillage";
163 }
164 
166 {
167  DOM_Element domNewElem = TYElement::toXML(domElement);
168 
169  TYXMLTools::addElementDoubleValue(domNewElem, "hauteur", _hauteur);
170  TYXMLTools::addElementIntValue(domNewElem, "computeAlti", _computeAlti);
171  TYXMLTools::addElementIntValue(domNewElem, "dataType", _dataType);
172  TYXMLTools::addElementFloatValue(domNewElem, "dataFreq", _dataFreq);
173 
174  DOM_Document domDoc = domElement.ownerDocument();
175  TYMapIdBool::iterator it_b;
176  for (it_b = _tabEtats.begin(); it_b != _tabEtats.end(); ++it_b)
177  {
178  DOM_Element tmpNode = domDoc.createElement("etatCalcul");
179  domNewElem.appendChild(tmpNode);
180 
181  tmpNode.setAttribute("idCalcul", it_b->first.toString());
182  tmpNode.setAttribute("Etat", QString(intToStr(_tabEtats[it_b->first]).c_str()));
183  }
184 
185  // Sauvegarde de la palette
186  _pPalette->toXML(domNewElem);
187 
188  return domNewElem;
189 }
190 
192 {
193  TYElement::fromXML(domElement);
194 
196 
197  unsigned int i = 0;
198  bool getOk[5];
199  for (i = 0; i < 5; i++)
200  {
201  getOk[i] = false;
202  }
203  TYPointCalcul* pPtCalcul = new TYPointCalcul();
204 
205  bool oldPalette = false;
206  float dataRange[2];
207  int nbOfColors = 0;
208  float hueRange[2];
209  float saturationRange[2];
210  float valueRange[2];
211  TYUUID idCalcul;
212 
213  DOM_Element elemCur;
214 
215  QDomNodeList childs = domElement.childNodes();
216  for (i = 0; i < childs.length(); i++)
217  {
218  elemCur = childs.item(i).toElement();
219  TYXMLTools::getElementDoubleValue(elemCur, "hauteur", _hauteur, getOk[0]);
220  TYXMLTools::getElementBoolValue(elemCur, "computeAlti", _computeAlti, getOk[1]);
221  TYXMLTools::getElementIntValue(elemCur, "dataType", _dataType, getOk[2]);
222  TYXMLTools::getElementFloatValue(elemCur, "dataFreq", _dataFreq, getOk[3]);
223 
224  if (elemCur.nodeName() == "etatCalcul")
225  {
226  QString strIdCalcul = TYXMLTools::getElementAttributeToString(elemCur, "idCalcul");
227  idCalcul.FromString(strIdCalcul);
228  bool bEtat = TYXMLTools::getElementAttributeToInt(elemCur, "Etat");
229  _tabEtats[idCalcul] = bEtat;
230  }
231 
232  // Ancienne version, on recupere les points de calcul.
233  if (pPtCalcul->callFromXMLIfEqual(elemCur))
234  {
235  addPointCalcul(pPtCalcul);
236  pPtCalcul = new TYPointCalcul();
237  }
238 
239  // Ancienne version, on recupere les attributes pour la palette
240  if (TYXMLTools::getElementFloatValue(elemCur, "dataRangeMin", dataRange[0]))
241  {
242  oldPalette = true;
243  }
244  TYXMLTools::getElementFloatValue(elemCur, "dataRangeMax", dataRange[1]);
245  TYXMLTools::getElementIntValue(elemCur, "nbOfColors", nbOfColors);
246  TYXMLTools::getElementFloatValue(elemCur, "colorRangeMinH", hueRange[0]);
247  TYXMLTools::getElementFloatValue(elemCur, "colorRangeMinS", saturationRange[0]);
248  TYXMLTools::getElementFloatValue(elemCur, "colorRangeMinV", valueRange[0]);
249  TYXMLTools::getElementFloatValue(elemCur, "colorRangeMaxH", hueRange[1]);
250  TYXMLTools::getElementFloatValue(elemCur, "colorRangeMaxS", saturationRange[1]);
251  TYXMLTools::getElementFloatValue(elemCur, "colorRangeMaxV", valueRange[1]);
252 
253  // Chargement de la palette
254  _pPalette->callFromXMLIfEqual(elemCur);
255  }
256 
257  // Ancienne version : construction d'un palette
258  if (oldPalette)
259  {
260  OLookupTable lookuptable(nbOfColors);
261  TYColorManager::getLinearColorTable(nbOfColors, hueRange, saturationRange, valueRange, lookuptable);
262  _pPalette->resetcolorMapFromColors(dataRange[0], dataRange[1], lookuptable);
263  }
264 
265  delete pPtCalcul;
266 
267  return 1;
268 }
269 
270 void TYMaillage::exportCSV(const std::string& fileName)
271 {
272  std::fstream f;
273  f.open(fileName, std::ios::out);
274 
275  if (f.is_open())
276  {
277 
278  f << "X"
279  << ";"
280  << "Y"
281  << ";"
282  << "Z"
283  << ";"
284  << "Lp"
285  << "\n";
286 
287  TYTabLPPointCalcul& tabPoints = getPtsCalcul();
288  double value = 0.0;
289  LPTYPointCalcul pPtCalcul = NULL;
290  TYSpectre spectre;
291 
292  for (int i = 0; i < tabPoints.size(); i++)
293  {
294  pPtCalcul = tabPoints[i];
295 
296  // Valeur du scalaire pour la color map
297  switch (getDataType())
298  {
300  default:
301  value = pPtCalcul->getValA();
302  break;
304  value = pPtCalcul->getValLin();
305  break;
307  spectre = *pPtCalcul->getSpectre();
308  value = spectre.getValueReal(getDataFreq());
309  break;
310  }
311 
312  f << pPtCalcul->getCoordSIG()._x << ";" << pPtCalcul->getCoordSIG()._y << ";"
313  << pPtCalcul->getCoordSIG()._z << ";" << value << "\n";
314  }
315  }
316 
317  f.close();
318 }
319 
321 {
322  std::vector<LPTYSpectre>* tabSpectre = pCalcul->getSpectrumDatas(getID());
323 
324  if (tabSpectre != nullptr)
325  {
326  TYTabLPPointCalcul& ptsCalcul = getPtsCalcul();
327  for (unsigned int i = 0; i < ptsCalcul.size(); ++i)
328  {
329  ptsCalcul[i]->setSpectre(tabSpectre->at(i));
330  }
331  }
332 }
333 
335 {
336  for (unsigned int i = 0; i < _ptsCalcul.size(); i++)
337  {
338  _ptsCalcul[i].getRealPointer()->setSpectre(new TYSpectre());
339  }
340 }
341 
343 {
344  assert(pPtCalcul);
345 
346  pPtCalcul->setParent(this);
347  pPtCalcul->setEtat(true); // Active le point pour ce calcul
348  _ptsCalcul.push_back(pPtCalcul);
349 
350  setIsGeometryModified(true);
351 
352  return true;
353 }
354 
356 {
357  assert(pPtCalcul);
358  bool ret = false;
359  TYTabLPPointCalcul::iterator ite;
360 
361  for (ite = _ptsCalcul.begin(); ite != _ptsCalcul.end(); ite++)
362  {
363  if ((*ite) == pPtCalcul)
364  {
365  _ptsCalcul.erase(ite);
366  ret = true;
367  break;
368  }
369  }
370 
371  setIsGeometryModified(true);
372 
373  return ret;
374 }
375 
376 bool TYMaillage::remPointCalcul(QString idPtCalcul)
377 {
378  bool ret = false;
379  TYTabLPPointCalcul::iterator ite;
380 
381  for (ite = _ptsCalcul.begin(); ite != _ptsCalcul.end(); ite++)
382  {
383  if ((*ite)->getID() == idPtCalcul)
384  {
385  _ptsCalcul.erase(ite);
386  ret = true;
387  break;
388  }
389  }
390 
391  setIsGeometryModified(true);
392 
393  return ret;
394 }
395 
397 {
398  _ptsCalcul.clear();
399  setIsGeometryModified(true);
400 }
401 
402 void TYMaillage::make(const TYTabPoint& points)
403 {
404  for (unsigned int i = 0; i < points.size(); i++)
405  {
406  LPTYPointCalcul pPoint = new TYPointCalcul(points[i]);
407  pPoint->setSpectre(new TYSpectre());
408  addPointCalcul(pPoint);
409  }
410 }
411 
412 bool TYMaillage::checkSimilar(const TYMaillage* const pMaillage1, const TYMaillage* const pMaillage2)
413 {
414  if (pMaillage1->getClassName() != pMaillage2->getClassName())
415  {
416  return false;
417  }
418  if (pMaillage1->isA("TYLinearMaillage"))
419  {
420  TYLinearMaillage* pLinearMaillage1 = (TYLinearMaillage*)pMaillage1;
421  TYLinearMaillage* pLinearMaillage2 = (TYLinearMaillage*)pMaillage2;
422  if (pLinearMaillage1->getSegment()->longueur() != pLinearMaillage2->getSegment()->longueur())
423  {
424  return false;
425  }
426  if (pLinearMaillage1->getDensite() != pLinearMaillage2->getDensite())
427  {
428  return false;
429  }
430  }
431  else if (pMaillage1->isA("TYRectangularMaillage"))
432  {
433  TYRectangularMaillage* pRectangularMaillage1 = (TYRectangularMaillage*)pMaillage1;
434  TYRectangularMaillage* pRectangularMaillage2 = (TYRectangularMaillage*)pMaillage2;
435  if (pRectangularMaillage1->getRectangle()->getSizeX() !=
436  pRectangularMaillage2->getRectangle()->getSizeX())
437  {
438  return false;
439  }
440  if (pRectangularMaillage1->getRectangle()->getSizeY() !=
441  pRectangularMaillage2->getRectangle()->getSizeY())
442  {
443  return false;
444  }
445  if (pRectangularMaillage1->getDensiteX() != pRectangularMaillage2->getDensiteX())
446  {
447  return false;
448  }
449  if (pRectangularMaillage1->getDensiteY() != pRectangularMaillage2->getDensiteY())
450  {
451  return false;
452  }
453  }
454  return true;
455 }
456 
457 void TYMaillage::computeMesh(std::vector<MTriangle>& mesh) const
458 {
459  mesh.clear();
460  const TYTabLPPointCalcul& ptsCalcul = getPtsCalcul();
461  int nbPointsX = 0;
462  int nbPointsY = 0;
463  getDimensions(nbPointsX, nbPointsY);
464 
465  int id1 = 0, id2 = 0, id3 = 0, id4 = 0;
466 
467  // Orientation 1-2-3 (and 2-4-3)
468  // 3----4
469  // |\ |
470  // | \ |
471  // | \ |
472  // | \|
473  // 1----2
474  for (int i = 0; i < nbPointsX - 1; ++i)
475  {
476  for (int j = 0; j < nbPointsY - 1; ++j)
477  {
478  id1 = getIndexPtCalcul(i, j);
479  id2 = getIndexPtCalcul(i + 1, j);
480  id3 = getIndexPtCalcul(i, j + 1);
481  id4 = getIndexPtCalcul(i + 1, j + 1);
482 
483  if (id1 < 0 || !ptsCalcul[id1]->etat())
484  {
485  // Higher right triangle
486  if (id2 >= 0 && id4 >= 0 && id3 >= 0)
487  if (ptsCalcul[id2]->etat() && ptsCalcul[id4]->etat() && ptsCalcul[id3]->etat())
488  {
489  mesh.push_back(computeTriangle(*ptsCalcul[id2], *ptsCalcul[id4], *ptsCalcul[id3]));
490  }
491  }
492  else if (id2 < 0 || !ptsCalcul[id2]->etat())
493  {
494  // Higher left triangle
495  if (id1 >= 0 && id4 >= 0 && id3 >= 0)
496  if (ptsCalcul[id1]->etat() && ptsCalcul[id4]->etat() && ptsCalcul[id3]->etat())
497  {
498  mesh.push_back(computeTriangle(*ptsCalcul[id1], *ptsCalcul[id4], *ptsCalcul[id3]));
499  }
500  }
501  else if (id3 < 0 || !ptsCalcul[id3]->etat())
502  {
503  // Lower right triangle
504  if (id1 >= 0 && id2 >= 0 && id4 >= 0)
505  if (ptsCalcul[id1]->etat() && ptsCalcul[id2]->etat() && ptsCalcul[id4]->etat())
506  {
507  mesh.push_back(computeTriangle(*ptsCalcul[id1], *ptsCalcul[id2], *ptsCalcul[id4]));
508  }
509  }
510  else if (id4 < 0 || !ptsCalcul[id4]->etat())
511  {
512  // Lower left triangle
513  if (id1 >= 0 && id2 >= 0 && id3 >= 0)
514  if (ptsCalcul[id1]->etat() && ptsCalcul[id2]->etat() && ptsCalcul[id3]->etat())
515  {
516  mesh.push_back(computeTriangle(*ptsCalcul[id1], *ptsCalcul[id2], *ptsCalcul[id3]));
517  }
518  }
519  else // We divide the square by two arbitrary triangles
520  {
521  // Lower left triangle
522  mesh.push_back(computeTriangle(*ptsCalcul[id1], *ptsCalcul[id2], *ptsCalcul[id3]));
523  // Higher right triangle
524  mesh.push_back(computeTriangle(*ptsCalcul[id3], *ptsCalcul[id2], *ptsCalcul[id4]));
525  }
526  }
527  }
528 }
529 
531 {
532  MTriangle tri;
533  tri.pts[0].pt = pt1;
534  tri.pts[0].scalar = getSpectrumValue(pt1);
535 
536  tri.pts[1].pt = pt2;
537  tri.pts[1].scalar = getSpectrumValue(pt2);
538 
539  tri.pts[2].pt = pt3;
540  tri.pts[2].scalar = getSpectrumValue(pt3);
541 
542  return tri;
543 }
544 
546 {
547  if (pt.getSpectre() != nullptr)
548  {
549  switch (_dataType)
550  {
551  case ValGlobalDBA:
552  default:
553  return pt.getSpectre()->valGlobDBA();
554  case ValGlobalDBLin:
555  return pt.getSpectre()->valGlobDBLin();
556  case DataFreq:
557  return pt.getSpectre()->getValueReal(_dataFreq);
558  }
559  }
560 
561  return 0.;
562 }
563 
564 void TYMaillage::computeIsoCurve(std::vector<MTriangle>& mesh, std::vector<MPoint>& isoCurve) const
565 {
566  isoCurve.clear();
567  size_t nbTriangles = mesh.size();
568 
569  OVector3D up(0, 0, 1);
570  OPoint3D origin;
571  MPoint mp1, mp2, mp3;
572  OHPlane3D plane;
573  int imask = 0; // intersections mask
574  TYPalette::values_type value = NAN;
575  OColor color;
576  BOOST_FOREACH (boost::tie(value, color), _pPalette->getColorMap())
577  {
578  origin._z = value;
579  plane.set(up, origin);
580 
581  for (size_t i = 0; i < nbTriangles; i++)
582  {
583  imask = 0;
584  const MTriangle& tri = mesh[i];
585  const MPoint& pt1 = tri.pts[0];
586  const MPoint& pt2 = tri.pts[1];
587  const MPoint& pt3 = tri.pts[2];
588 
589  if (computeIsoPoint(plane, pt1, pt2, mp1))
590  {
591  imask += 1;
592  }
593  if (computeIsoPoint(plane, pt1, pt3, mp2))
594  {
595  imask += 2;
596  }
597  if (computeIsoPoint(plane, pt2, pt3, mp3))
598  {
599  imask += 4;
600  }
601 
602  switch (imask)
603  {
604  case 0:
605  break;
606  case 3: // the plane is intersected by the segment pt1-pt2 and pt1-pt3
607  isoCurve.push_back(mp1);
608  isoCurve.push_back(mp2);
609  break;
610  case 5: // the plane is intersected by the segment pt2-pt1 and pt2-pt3
611  isoCurve.push_back(mp1);
612  isoCurve.push_back(mp3);
613  break;
614  case 6: // the plane is intersected by the segment pt3-pt1 and pt3-pt2
615  isoCurve.push_back(mp2);
616  isoCurve.push_back(mp3);
617  }
618  }
619  }
620 }
621 
622 bool TYMaillage::computeIsoPoint(const OHPlane3D& plane, const MPoint& pt1, const MPoint& pt2,
623  MPoint& mp) const
624 {
625  OVector3D a(pt1.pt._x, pt1.pt._y, pt1.scalar);
626  OVector3D b(pt2.pt._x, pt2.pt._y, pt2.scalar);
627  OPoint3D ptInter;
628  double t = NAN;
629  if (plane.intersects(a, b, ptInter, t) == 1)
630  {
631  a._z = pt1.pt._z;
632  b._z = pt2.pt._z;
633  // The position of the final point on the segment (a,b) depends from the
634  // intersection : it'll be next to a or b (visually) depending from the value
635  // of the acoustic value. We then obtain a correct isovalue.
636  mp.pt = a + t * (b - a);
637  mp.scalar = ptInter._z;
638  return true;
639  }
640  return false;
641 }
642 void TYMaillage::setEtat(const TYUUID& id_calc, bool etat)
643 {
644  _tabEtats[id_calc] = etat;
645 }
646 
648 {
649  TYUUID id_calc = dynamic_cast<TYProjet*>(getParent())->getCurrentCalcul()->getID();
650 
651  return etat(id_calc);
652 }
653 
654 bool TYMaillage::etat(const TYUUID& id_calc)
655 {
656  // Constrol point knows the calcul
657  TYMapIdBool::iterator it = _tabEtats.find(id_calc);
658  if (it != _tabEtats.end())
659  {
660  return (*it).second;
661  }
662  else
663  {
664  _tabEtats[id_calc] = false;
665  }
666 
667  return false;
668 }
669 
670 bool TYMaillage::etat(const TYCalcul* pCalc)
671 {
672  assert(pCalc != nullptr);
673  return etat(pCalc->getID());
674 }
675 
677 {
678  _tabEtats.clear(); // On vide la map actuelle
679 
680  TYMapIdBool::iterator it_b;
681  for (it_b = pOther->_tabEtats.begin(); it_b != pOther->_tabEtats.end(); ++it_b)
682  {
683  _tabEtats[it_b->first] = it_b->second;
684  }
685 }
686 
687 void TYMaillage::duplicateEtat(const TYUUID& idCalculRef, const TYUUID& idCalculNew)
688 {
689  _tabEtats[idCalculNew] = _tabEtats[idCalculRef];
690 }
691 
693 {
694  assert(pCalcul);
695  TYUUID id = pCalcul->getID();
696 
697  TYMapIdBool::iterator it = _tabEtats.find(id);
698  if (it != _tabEtats.end())
699  {
700  _tabEtats.erase(it);
701  return true;
702  }
703 
704  return false;
705 }
QDomDocument DOM_Document
Definition: QT2DOM.h:33
QDomElement DOM_Element
Definition: QT2DOM.h:30
std::vector< LPTYPointCalcul > TYTabLPPointCalcul
Collection de pointeurs de TYPointCalcul.
Definition: TYDefines.h:358
class OGenID TYUUID
Definition: TYDefines.h:59
std::vector< TYPoint > TYTabPoint
Collection de TYPoint.
Definition: TYDefines.h:340
#define TYDIRPREFERENCEMANAGER
Definition: TYElement.h:52
Outil IHM pour un maillage (fichier header)
TY_EXTENSION_INST(TYMaillage)
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
The 3D Plane class using Hessian normal form.
Definition: 3d.h:1514
int intersects(const OPoint3D &pt1, const OPoint3D &pt2, OPoint3D &ptIntersec, double &t) const
Calculate the intersection with a segment defined by two points.
Definition: 3d.cpp:2167
void set(const OVector3D &normal, const OPoint3D &origin)
set a new Plane.
Definition: 3d.cpp:2125
The 3D point class.
Definition: 3d.h:487
virtual const char * getClassName() const
Definition: TYElement.h:249
bool isA(const char *className) const
Definition: TYElement.cpp:65
virtual double longueur() const
Return the segment length.
Definition: 3d.cpp:1238
double valGlobDBA() const
Compute the global value dB[A] of a one-third Octave spectrum.
Definition: spectre.cpp:683
double valGlobDBLin() const
Compute the global value dB[Lin] of a one-third Octave spectrum.
Definition: spectre.cpp:671
double getValueReal(double freq)
Definition: spectre.cpp:959
The 3D vector class.
Definition: 3d.h:298
Calculation program.
Definition: TYCalcul.h:50
std::vector< LPTYSpectre > * getSpectrumDatas(const TYUUID &id)
Return spectrums for a given noise map.
Definition: TYCalcul.cpp:1300
static void getLinearColorTable(const unsigned int &nbColors, const float *hueRange, const float *saturationRange, const float *valueRange, OLookupTable &outColors)
Generation de la table de couleurs basee sur une rampe lineaire ( y = x+0.5/255 )
Definition: color.cpp:308
TYElement * getParent() const
Definition: TYElement.h:699
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
Definition: TYElement.cpp:307
virtual DOM_Element toXML(DOM_Element &domElement)
Definition: TYElement.cpp:368
QString _name
Nom courant de l'element.
Definition: TYElement.h:966
TYElement & operator=(const TYElement &other)
Definition: TYElement.cpp:265
bool callFromXMLIfEqual(DOM_Element &domElement, int *pRetVal=NULL)
Definition: TYElement.cpp:544
const TYUUID & getID() const
Definition: TYElement.cpp:176
void setParent(TYElement *pParent)
Definition: TYElement.h:692
virtual int fromXML(DOM_Element domElement)
Definition: TYElement.cpp:381
virtual void setIsGeometryModified(bool isModified)
Definition: TYElement.cpp:253
Classe de definition d'un maillage lineaire.
double getDensite()
Retourne la densite de points de calcul.
LPTYSegment getSegment()
Retourne le segment associe a ce maillage.
Classe de definition d'un maillage.
Definition: TYMaillage.h:51
bool _computeAlti
Indique si l'altitude des points constituant ce maillage doit etre calculee.
Definition: TYMaillage.h:418
void make(const TYTabPoint &points)
Rempli la structure de points de calcul a partir d'un tableau de points classiques.
Definition: TYMaillage.cpp:402
double _hauteur
La hauteur par rapport au sol (a l'altimetrie en fait) a laquelle se trouve ce maillage.
Definition: TYMaillage.h:415
virtual void clearResult()
Definition: TYMaillage.cpp:334
virtual ~TYMaillage()
Destructeur Destructeur de la classe TYMaillage.
Definition: TYMaillage.cpp:72
virtual void updateFromCalcul(LPTYCalcul pCalcul)
get datas from calcul void updateFromCalcul(LPTYCalcul pCalcul)
Definition: TYMaillage.cpp:320
bool operator!=(const TYMaillage &other) const
Operateur !=.
Definition: TYMaillage.cpp:128
TYTabLPPointCalcul & getPtsCalcul()
Set/Get de la liste des points de calcul.
Definition: TYMaillage.h:123
MTriangle computeTriangle(TYPointCalcul &pt1, TYPointCalcul &pt2, TYPointCalcul &pt3) const
Compute the triangle.
Definition: TYMaillage.cpp:530
@ ValGlobalDBLin
Definition: TYMaillage.h:299
static bool checkSimilar(const TYMaillage *const pMaillage1, const TYMaillage *const pMaillage2)
Definition: TYMaillage.cpp:412
void computeMesh(std::vector< MTriangle > &mesh) const
Compute the mesh.
Definition: TYMaillage.cpp:457
virtual std::string toString() const
Definition: TYMaillage.cpp:160
void computeIsoCurve(std::vector< MTriangle > &mesh, std::vector< MPoint > &isoCurve) const
Compute the isocurve.
Definition: TYMaillage.cpp:564
bool addPointCalcul(LPTYPointCalcul pPtCalcul)
Ajoute un nouveau point de calcul.
Definition: TYMaillage.cpp:342
int getDataType()
Get de l'indicateur de type des donnees a representer.
Definition: TYMaillage.h:227
virtual int getIndexPtCalcul(int x, int y) const
Return the index (should be pure virtual)
Definition: TYMaillage.h:373
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
Definition: TYMaillage.cpp:133
int _dataType
Indique le type des donnees a representer.
Definition: TYMaillage.h:421
TYTabLPPointCalcul _ptsCalcul
Liste des points de calcul.
Definition: TYMaillage.h:409
TYMapIdBool _tabEtats
L'etat du maillage pour un calcul donne.
Definition: TYMaillage.h:412
virtual int fromXML(DOM_Element domElement)
Definition: TYMaillage.cpp:191
TYMaillage & operator=(const TYMaillage &other)
Operateur =.
Definition: TYMaillage.cpp:77
void remAllPointCalcul()
Suppression de tous les elements.
Definition: TYMaillage.cpp:396
void duplicateEtat(const TYUUID &idCalculRef, const TYUUID &idCalculNew)
Duplique l'etat defini pour un calcul pour un autre calcul.
Definition: TYMaillage.cpp:687
virtual bool etat()
Definition: TYMaillage.cpp:647
virtual void getDimensions(int &x, int &y) const
Return the dimensions in x and y (should be pure virtual)
Definition: TYMaillage.h:383
virtual DOM_Element toXML(DOM_Element &domElement)
Definition: TYMaillage.cpp:165
bool operator==(const TYMaillage &other) const
Operateur ==.
Definition: TYMaillage.cpp:92
bool computeIsoPoint(const OHPlane3D &plane, const MPoint &pt1, const MPoint &pt2, MPoint &mp) const
Compute an isopoint by interpolating the value if the segment intersects the plane.
Definition: TYMaillage.cpp:622
void copyEtats(TYMaillage *pOther)
Copie du map calcul-etat.
Definition: TYMaillage.cpp:676
void exportCSV(const std::string &fileName)
export mesh to csv file
Definition: TYMaillage.cpp:270
bool remEtat(TYCalcul *pCalcul)
Remove calcul from "etat" map.
Definition: TYMaillage.cpp:692
double getSpectrumValue(TYPointCalcul &pt) const
Get the spectrum value of a calcul point.
Definition: TYMaillage.cpp:545
LPTYPanel _pPanel
Panel.
Definition: TYMaillage.h:430
LPTYPalette _pPalette
Palette.
Definition: TYMaillage.h:427
virtual void setEtat(const TYUUID &id_calc, bool etat)
Definition: TYMaillage.cpp:642
TYMaillage()
Constructeur. Constructeur de la classe TYMaillage.
Definition: TYMaillage.cpp:36
bool remPointCalcul(const LPTYPointCalcul pPtCalcul)
Supprime une entree a la liste des points de calculs.
Definition: TYMaillage.cpp:355
float getDataFreq()
Get de la frequence des donnees a representer lorsque _dataType vaut DataFreq.
Definition: TYMaillage.h:246
float _dataFreq
La frequence des donnees a representer lorsque _dataType vaut DataFreq.
Definition: TYMaillage.h:424
QString generateName(const char *classname)
Retourne le nom de la classe associe a un nombre.
static TYNameManager * get()
Retourne l'instance singleton.
Classe de definition d'une palette.
Definition: TYPalette.h:41
const color_map_type & getColorMap() const
Get de la lookup table.
Definition: TYPalette.h:226
virtual DOM_Element toXML(DOM_Element &domElement)
Definition: TYPalette.cpp:273
float values_type
The real number type used to store values (typically double or float)
Definition: TYPalette.h:49
void resetcolorMapFromColors(values_type valueMin, values_type valueMax, const std::vector< OColor > &lookupTable)
Reset the colormap as a linear scale with the given colors between minValue and maxValue.
Definition: TYPalette.cpp:126
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
Definition: TYPalette.cpp:189
Classe de definition d'un panel d'information.
Definition: TYPanel.h:34
Classe de definition d'un point de calcul.C'est une classe derivee a TYPoint avec en plus un spectrep...
Definition: TYPointCalcul.h:33
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
double getValLin()
Get de la valeur globale Lin au point.
virtual void setEtat(const bool &etat)
virtual LPTYSpectre getSpectre()
Get du spectre resultat d'un calcul donne.
TYPoint getCoordSIG()
Passage en coordonnees SIG.
void setSpectre(const LPTYSpectre spectre)
Set du spectre resultat d'un calcul donne.
double getValA()
Get de la valeur globale A au point.
classe de definition d'un projet.
Definition: TYProjet.h:45
float getSizeX()
float getSizeY()
Classe de definition d'un maillage rectangulaire.
double getDensiteY() const
Retourne la densite de points de calcul en Y.
LPTYRectangle getRectangle() const
Retourne le rectangle associe a ce maillage.
double getDensiteX() const
Retourne la densite de points de calcul en X.
static int getElementAttributeToInt(DOM_Element parentElem, DOMString attName, bool *ok=NULL)
Definition: TYXMLTools.cpp:293
static void addElementDoubleValue(DOM_Element &parentElem, DOMString nodeName, double nodeValue)
Definition: TYXMLTools.cpp:87
static bool getElementBoolValue(DOM_Element parentElem, DOMString nodeName, bool &nodeValue)
Definition: TYXMLTools.cpp:179
static QString getElementAttributeToString(DOM_Element parentElem, DOMString attName)
Definition: TYXMLTools.cpp:276
static void addElementIntValue(DOM_Element &parentElem, DOMString nodeName, int nodeValue)
Definition: TYXMLTools.cpp:72
static bool getElementFloatValue(DOM_Element parentElem, DOMString nodeName, float &nodeValue)
Definition: TYXMLTools.cpp:211
static bool getElementIntValue(DOM_Element parentElem, DOMString nodeName, int &nodeValue)
Definition: TYXMLTools.cpp:129
static bool getElementDoubleValue(DOM_Element parentElem, DOMString nodeName, double &nodeValue)
Definition: TYXMLTools.cpp:243
static void addElementFloatValue(DOM_Element &parentElem, DOMString nodeName, float nodeValue)
Definition: TYXMLTools.cpp:82
std::vector< OColor > OLookupTable
Collection de OColor.
Definition: color.h:105
std::string intToStr(int val)
Definition: macros.h:158
TYPalette::values_type scalar
Definition: TYMaillage.h:33
OVector3D pt
Definition: TYMaillage.h:32
MPoint pts[3]
Definition: TYMaillage.h:38