16 #include <boost/foreach.hpp>
17 #include <boost/tuple/tuple.hpp>
51 QString pref =
"MaillageDefault";
96 if (TYElement::operator!=(other))
150 for (
unsigned int i = 0; i < pOtherMaillage->
_ptsCalcul.size(); i++)
175 TYMapIdBool::iterator it_b;
178 DOM_Element tmpNode = domDoc.createElement(
"etatCalcul");
179 domNewElem.appendChild(tmpNode);
181 tmpNode.setAttribute(
"idCalcul", it_b->first.toString());
199 for (i = 0; i < 5; i++)
205 bool oldPalette =
false;
209 float saturationRange[2];
215 QDomNodeList childs = domElement.childNodes();
216 for (i = 0; i < childs.length(); i++)
218 elemCur = childs.item(i).toElement();
224 if (elemCur.nodeName() ==
"etatCalcul")
227 idCalcul.FromString(strIdCalcul);
273 f.open(fileName, std::ios::out);
292 for (
int i = 0; i < tabPoints.size(); i++)
294 pPtCalcul = tabPoints[i];
324 if (tabSpectre !=
nullptr)
327 for (
unsigned int i = 0; i < ptsCalcul.size(); ++i)
329 ptsCalcul[i]->setSpectre(tabSpectre->at(i));
336 for (
unsigned int i = 0; i <
_ptsCalcul.size(); i++)
359 TYTabLPPointCalcul::iterator ite;
363 if ((*ite) == pPtCalcul)
379 TYTabLPPointCalcul::iterator ite;
383 if ((*ite)->getID() == idPtCalcul)
404 for (
unsigned int i = 0; i < points.size(); i++)
418 if (pMaillage1->
isA(
"TYLinearMaillage"))
431 else if (pMaillage1->
isA(
"TYRectangularMaillage"))
465 int id1 = 0, id2 = 0, id3 = 0, id4 = 0;
474 for (
int i = 0; i < nbPointsX - 1; ++i)
476 for (
int j = 0; j < nbPointsY - 1; ++j)
483 if (id1 < 0 || !ptsCalcul[id1]->
etat())
486 if (id2 >= 0 && id4 >= 0 && id3 >= 0)
487 if (ptsCalcul[id2]->
etat() && ptsCalcul[id4]->
etat() && ptsCalcul[id3]->
etat())
489 mesh.push_back(
computeTriangle(*ptsCalcul[id2], *ptsCalcul[id4], *ptsCalcul[id3]));
492 else if (id2 < 0 || !ptsCalcul[id2]->
etat())
495 if (id1 >= 0 && id4 >= 0 && id3 >= 0)
496 if (ptsCalcul[id1]->
etat() && ptsCalcul[id4]->
etat() && ptsCalcul[id3]->
etat())
498 mesh.push_back(
computeTriangle(*ptsCalcul[id1], *ptsCalcul[id4], *ptsCalcul[id3]));
501 else if (id3 < 0 || !ptsCalcul[id3]->
etat())
504 if (id1 >= 0 && id2 >= 0 && id4 >= 0)
505 if (ptsCalcul[id1]->
etat() && ptsCalcul[id2]->
etat() && ptsCalcul[id4]->
etat())
507 mesh.push_back(
computeTriangle(*ptsCalcul[id1], *ptsCalcul[id2], *ptsCalcul[id4]));
510 else if (id4 < 0 || !ptsCalcul[id4]->
etat())
513 if (id1 >= 0 && id2 >= 0 && id3 >= 0)
514 if (ptsCalcul[id1]->
etat() && ptsCalcul[id2]->
etat() && ptsCalcul[id3]->
etat())
516 mesh.push_back(
computeTriangle(*ptsCalcul[id1], *ptsCalcul[id2], *ptsCalcul[id3]));
522 mesh.push_back(
computeTriangle(*ptsCalcul[id1], *ptsCalcul[id2], *ptsCalcul[id3]));
524 mesh.push_back(
computeTriangle(*ptsCalcul[id3], *ptsCalcul[id2], *ptsCalcul[id4]));
567 size_t nbTriangles = mesh.size();
579 plane.
set(up, origin);
581 for (
size_t i = 0; i < nbTriangles; i++)
607 isoCurve.push_back(mp1);
608 isoCurve.push_back(mp2);
611 isoCurve.push_back(mp1);
612 isoCurve.push_back(mp3);
615 isoCurve.push_back(mp2);
616 isoCurve.push_back(mp3);
636 mp.
pt = a + t * (b - a);
651 return etat(id_calc);
657 TYMapIdBool::iterator it =
_tabEtats.find(id_calc);
672 assert(pCalc !=
nullptr);
680 TYMapIdBool::iterator it_b;
697 TYMapIdBool::iterator it =
_tabEtats.find(
id);
QDomDocument DOM_Document
std::vector< LPTYPointCalcul > TYTabLPPointCalcul
Collection de pointeurs de TYPointCalcul.
std::vector< TYPoint > TYTabPoint
Collection de TYPoint.
#define TYDIRPREFERENCEMANAGER
TY_EXTENSION_INST(TYMaillage)
double _y
y coordinate of OCoord3D
double _z
z coordinate of OCoord3D
double _x
x coordinate of OCoord3D
The 3D Plane class using Hessian normal form.
int intersects(const OPoint3D &pt1, const OPoint3D &pt2, OPoint3D &ptIntersec, double &t) const
Calculate the intersection with a segment defined by two points.
void set(const OVector3D &normal, const OPoint3D &origin)
set a new Plane.
virtual const char * getClassName() const
bool isA(const char *className) const
virtual double longueur() const
Return the segment length.
double valGlobDBA() const
Compute the global value dB[A] of a one-third Octave spectrum.
double valGlobDBLin() const
Compute the global value dB[Lin] of a one-third Octave spectrum.
double getValueReal(double freq)
std::vector< LPTYSpectre > * getSpectrumDatas(const TYUUID &id)
Return spectrums for a given noise map.
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 )
TYElement * getParent() const
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
virtual DOM_Element toXML(DOM_Element &domElement)
QString _name
Nom courant de l'element.
TYElement & operator=(const TYElement &other)
bool callFromXMLIfEqual(DOM_Element &domElement, int *pRetVal=NULL)
const TYUUID & getID() const
void setParent(TYElement *pParent)
virtual int fromXML(DOM_Element domElement)
virtual void setIsGeometryModified(bool isModified)
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.
bool _computeAlti
Indique si l'altitude des points constituant ce maillage doit etre calculee.
void make(const TYTabPoint &points)
Rempli la structure de points de calcul a partir d'un tableau de points classiques.
double _hauteur
La hauteur par rapport au sol (a l'altimetrie en fait) a laquelle se trouve ce maillage.
virtual void clearResult()
virtual ~TYMaillage()
Destructeur Destructeur de la classe TYMaillage.
virtual void updateFromCalcul(LPTYCalcul pCalcul)
get datas from calcul void updateFromCalcul(LPTYCalcul pCalcul)
bool operator!=(const TYMaillage &other) const
Operateur !=.
TYTabLPPointCalcul & getPtsCalcul()
Set/Get de la liste des points de calcul.
MTriangle computeTriangle(TYPointCalcul &pt1, TYPointCalcul &pt2, TYPointCalcul &pt3) const
Compute the triangle.
static bool checkSimilar(const TYMaillage *const pMaillage1, const TYMaillage *const pMaillage2)
void computeMesh(std::vector< MTriangle > &mesh) const
Compute the mesh.
virtual std::string toString() const
void computeIsoCurve(std::vector< MTriangle > &mesh, std::vector< MPoint > &isoCurve) const
Compute the isocurve.
bool addPointCalcul(LPTYPointCalcul pPtCalcul)
Ajoute un nouveau point de calcul.
int getDataType()
Get de l'indicateur de type des donnees a representer.
virtual int getIndexPtCalcul(int x, int y) const
Return the index (should be pure virtual)
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
int _dataType
Indique le type des donnees a representer.
TYTabLPPointCalcul _ptsCalcul
Liste des points de calcul.
TYMapIdBool _tabEtats
L'etat du maillage pour un calcul donne.
virtual int fromXML(DOM_Element domElement)
TYMaillage & operator=(const TYMaillage &other)
Operateur =.
void remAllPointCalcul()
Suppression de tous les elements.
void duplicateEtat(const TYUUID &idCalculRef, const TYUUID &idCalculNew)
Duplique l'etat defini pour un calcul pour un autre calcul.
virtual void getDimensions(int &x, int &y) const
Return the dimensions in x and y (should be pure virtual)
virtual DOM_Element toXML(DOM_Element &domElement)
bool operator==(const TYMaillage &other) const
Operateur ==.
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.
void copyEtats(TYMaillage *pOther)
Copie du map calcul-etat.
void exportCSV(const std::string &fileName)
export mesh to csv file
bool remEtat(TYCalcul *pCalcul)
Remove calcul from "etat" map.
double getSpectrumValue(TYPointCalcul &pt) const
Get the spectrum value of a calcul point.
LPTYPalette _pPalette
Palette.
virtual void setEtat(const TYUUID &id_calc, bool etat)
TYMaillage()
Constructeur. Constructeur de la classe TYMaillage.
bool remPointCalcul(const LPTYPointCalcul pPtCalcul)
Supprime une entree a la liste des points de calculs.
float getDataFreq()
Get de la frequence des donnees a representer lorsque _dataType vaut DataFreq.
float _dataFreq
La frequence des donnees a representer lorsque _dataType vaut DataFreq.
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.
const color_map_type & getColorMap() const
Get de la lookup table.
virtual DOM_Element toXML(DOM_Element &domElement)
float values_type
The real number type used to store values (typically double or float)
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.
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
Classe de definition d'un panel d'information.
Classe de definition d'un point de calcul.C'est une classe derivee a TYPoint avec en plus un spectrep...
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.
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.
std::vector< OColor > OLookupTable
Collection de OColor.
std::string intToStr(int val)
TYPalette::values_type scalar