Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYMaillage.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 
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 || id2 < 0 || id3 < 0 || id4 < 0 || !ptsCalcul[id1]->etat() ||
484  !ptsCalcul[id2]->etat() || !ptsCalcul[id3]->etat() || !ptsCalcul[id4]->etat())
485  {
486  continue;
487  }
488  else // We divide the square by two arbitrary triangles
489  {
490  // Lower left triangle
491  mesh.push_back(computeTriangle(*ptsCalcul[id1], *ptsCalcul[id2], *ptsCalcul[id3]));
492  // Higher right triangle
493  mesh.push_back(computeTriangle(*ptsCalcul[id3], *ptsCalcul[id2], *ptsCalcul[id4]));
494  }
495  }
496  }
497 }
498 
500 {
501  MTriangle tri;
502  tri.pts[0].pt = pt1;
503  tri.pts[0].scalar = getSpectrumValue(pt1);
504 
505  tri.pts[1].pt = pt2;
506  tri.pts[1].scalar = getSpectrumValue(pt2);
507 
508  tri.pts[2].pt = pt3;
509  tri.pts[2].scalar = getSpectrumValue(pt3);
510 
511  return tri;
512 }
513 
515 {
516  if (pt.getSpectre() != nullptr)
517  {
518  switch (_dataType)
519  {
520  case ValGlobalDBA:
521  default:
522  return pt.getSpectre()->valGlobDBA();
523  case ValGlobalDBLin:
524  return pt.getSpectre()->valGlobDBLin();
525  case DataFreq:
526  return pt.getSpectre()->getValueReal(_dataFreq);
527  }
528  }
529 
530  return 0.;
531 }
532 
533 void TYMaillage::computeIsoCurve(std::vector<MTriangle>& mesh, std::vector<MPoint>& isoCurve) const
534 {
535  isoCurve.clear();
536  size_t nbTriangles = mesh.size();
537 
538  OVector3D up(0, 0, 1);
539  OPoint3D origin;
540  MPoint mp1, mp2, mp3;
541  OHPlane3D plane;
542  int imask = 0; // intersections mask
543  TYPalette::values_type value = NAN;
544  OColor color;
545  BOOST_FOREACH (boost::tie(value, color), _pPalette->getColorMap())
546  {
547  origin._z = value;
548  plane.set(up, origin);
549 
550  for (size_t i = 0; i < nbTriangles; i++)
551  {
552  imask = 0;
553  const MTriangle& tri = mesh[i];
554  const MPoint& pt1 = tri.pts[0];
555  const MPoint& pt2 = tri.pts[1];
556  const MPoint& pt3 = tri.pts[2];
557 
558  if (computeIsoPoint(plane, pt1, pt2, mp1))
559  {
560  imask += 1;
561  }
562  if (computeIsoPoint(plane, pt1, pt3, mp2))
563  {
564  imask += 2;
565  }
566  if (computeIsoPoint(plane, pt2, pt3, mp3))
567  {
568  imask += 4;
569  }
570 
571  switch (imask)
572  {
573  case 0:
574  break;
575  case 3: // the plane is intersected by the segment pt1-pt2 and pt1-pt3
576  isoCurve.push_back(mp1);
577  isoCurve.push_back(mp2);
578  break;
579  case 5: // the plane is intersected by the segment pt2-pt1 and pt2-pt3
580  isoCurve.push_back(mp1);
581  isoCurve.push_back(mp3);
582  break;
583  case 6: // the plane is intersected by the segment pt3-pt1 and pt3-pt2
584  isoCurve.push_back(mp2);
585  isoCurve.push_back(mp3);
586  }
587  }
588  }
589 }
590 
591 bool TYMaillage::computeIsoPoint(const OHPlane3D& plane, const MPoint& pt1, const MPoint& pt2,
592  MPoint& mp) const
593 {
594  OVector3D a(pt1.pt._x, pt1.pt._y, pt1.scalar);
595  OVector3D b(pt2.pt._x, pt2.pt._y, pt2.scalar);
596  OPoint3D ptInter;
597  double t = NAN;
598  if (plane.intersects(a, b, ptInter, t) == 1)
599  {
600  a._z = pt1.pt._z;
601  b._z = pt2.pt._z;
602  // The position of the final point on the segment (a,b) depends from the
603  // intersection : it'll be next to a or b (visually) depending from the value
604  // of the acoustic value. We then obtain a correct isovalue.
605  mp.pt = a + t * (b - a);
606  mp.scalar = ptInter._z;
607  return true;
608  }
609  return false;
610 }
611 void TYMaillage::setEtat(const TYUUID& id_calc, bool etat)
612 {
613  _tabEtats[id_calc] = etat;
614 }
615 
617 {
618  TYUUID id_calc = dynamic_cast<TYProjet*>(getParent())->getCurrentCalcul()->getID();
619 
620  return etat(id_calc);
621 }
622 
623 bool TYMaillage::etat(const TYUUID& id_calc)
624 {
625  // Constrol point knows the calcul
626  TYMapIdBool::iterator it = _tabEtats.find(id_calc);
627  if (it != _tabEtats.end())
628  {
629  return (*it).second;
630  }
631  else
632  {
633  _tabEtats[id_calc] = false;
634  }
635 
636  return false;
637 }
638 
639 bool TYMaillage::etat(const TYCalcul* pCalc)
640 {
641  assert(pCalc != nullptr);
642  return etat(pCalc->getID());
643 }
644 
646 {
647  _tabEtats.clear(); // On vide la map actuelle
648 
649  TYMapIdBool::iterator it_b;
650  for (it_b = pOther->_tabEtats.begin(); it_b != pOther->_tabEtats.end(); ++it_b)
651  {
652  _tabEtats[it_b->first] = it_b->second;
653  }
654 }
655 
656 void TYMaillage::duplicateEtat(const TYUUID& idCalculRef, const TYUUID& idCalculNew)
657 {
658  _tabEtats[idCalculNew] = _tabEtats[idCalculRef];
659 }
660 
662 {
663  assert(pCalcul);
664  TYUUID id = pCalcul->getID();
665 
666  TYMapIdBool::iterator it = _tabEtats.find(id);
667  if (it != _tabEtats.end())
668  {
669  _tabEtats.erase(it);
670  return true;
671  }
672 
673  return false;
674 }
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:51
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:1566
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:248
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:691
double valGlobDBLin() const
Compute the global value dB[Lin] of a one-third Octave spectrum.
Definition: spectre.cpp:679
double getValueReal(double freq)
Definition: spectre.cpp:974
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:1306
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:706
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
Definition: TYElement.cpp:305
virtual DOM_Element toXML(DOM_Element &domElement)
Definition: TYElement.cpp:366
QString _name
Nom courant de l'element.
Definition: TYElement.h:965
TYElement & operator=(const TYElement &other)
Definition: TYElement.cpp:263
bool callFromXMLIfEqual(DOM_Element &domElement, int *pRetVal=NULL)
Definition: TYElement.cpp:542
const TYUUID & getID() const
Definition: TYElement.cpp:176
void setParent(TYElement *pParent)
Definition: TYElement.h:699
virtual int fromXML(DOM_Element domElement)
Definition: TYElement.cpp:379
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:499
@ 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:533
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:656
virtual bool etat()
Definition: TYMaillage.cpp:616
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:591
void copyEtats(TYMaillage *pOther)
Copie du map calcul-etat.
Definition: TYMaillage.cpp:645
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:661
double getSpectrumValue(TYPointCalcul &pt) const
Get the spectrum value of a calcul point.
Definition: TYMaillage.cpp:514
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:611
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