18 #include "Tympan/core/config.h"
62 if (TYMaillage::operator!=(other))
106 return "TYLinearMaillage";
117 for (
unsigned int i = 0; i <
_ptsCalcul.size(); i++)
119 _ptsCalcul[i]->getSpectre()->toXML(domNewElem);
129 bool densiteOk =
false;
130 bool bOldDatas =
false;
131 double densite = 0.0;
138 QDomNodeList childs = domElement.childNodes();
139 for (
unsigned int i = 0; i < childs.length(); i++)
141 elemCur = childs.item(i).toElement();
150 compatibilityVector->push_back(pSpectre);
156 if (bOldDatas ==
true)
162 delete compatibilityVector;
174 QString fileName = QString(sFilePath.c_str());
175 int i = fileName.lastIndexOf(
'/');
176 QDir fileDirectory = QDir(fileName.mid(0, i));
177 if (!fileDirectory.exists())
179 fileDirectory.mkdir(fileName.mid(0, i));
182 if (!fileName.isEmpty())
184 if (!fileName.endsWith(
".xml"))
196 xmlManager.
createDoc(TY_PRODUCT_XMLTAG_, TY_PRODUCT_VERSION_);
199 if (xmlManager.
save(fileName) == 0)
210 QString fileName = QString(sFilePath.c_str());
212 if (fileName.isEmpty())
219 if (xmlManager.
load(fileName, elements))
221 if (elements.size() == 1)
224 if (strcmp(elt->
getClassName(),
"TYLinearMaillage") == 0)
240 xmlManager.
createDoc(TY_PRODUCT_XMLTAG_, TY_PRODUCT_VERSION_);
245 return retString.toStdString();
254 if (xmlManager.
loadFromString(QString(sXMLString.c_str()), elements))
256 if (elements.size() == 1)
259 if (strcmp(elt->
getClassName(),
"TYLinearMaillage") == 0)
290 int nbPts = (int)(densite * vec.
norme());
293 vec = vec * (1.0 / (double)nbPts);
299 for (
int i = 0; i < nbPts; i++)
std::vector< LPTYSpectre > TYTabLPSpectre
Collection de TYSpectre.
std::vector< LPTYElement > LPTYElementArray
Representation graphique d'un maillage lineaire (fichier header)
TY_EXTENSION_INST(TYLinearMaillage)
TY_EXT_GRAPHIC_INST(TYLinearMaillage)
virtual const char * getClassName() const
OPoint3D _ptA
Point A of the segment.
OPoint3D _ptB
Point B of the segment.
double norme() const
Computes the length of this vector.
QString _name
Nom courant de l'element.
bool callFromXMLIfEqual(DOM_Element &domElement, int *pRetVal=NULL)
void setAllUses(void *allUses)
virtual void setIsGeometryModified(bool isModified)
Classe de definition d'un maillage lineaire.
bool operator!=(const TYLinearMaillage &other) const
Operateur !=.
virtual void clearResult()
LPTYSegment _pSeg
Le segment associe a ce maillage.
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
TYLinearMaillage & operator=(const TYLinearMaillage &other)
Operateur =.
virtual void make(LPTYSegment pSeg, double densite=TY_MAILLAGE_DEFAULT_DENSITE)
Rempli la structure de points de calcul a partir d'un segment et d'une densite de points.
double _distancePointsCalcul
La distance entre 2 points de calcul consécutifs.
virtual DOM_Element toXML(DOM_Element &domElement)
bool fromXMLString(const std::string &sXMLString)
double _densite
La densite de points de calcul.
virtual ~TYLinearMaillage()
Destructeur. Destructeur de la classe TYLinearMaillage.
bool operator==(const TYLinearMaillage &other) const
Operateur ==.
TYLinearMaillage()
Constructeur. Constructeur de la classe TYLinearMaillage.
virtual std::string toString() const
std::string toXMLString()
virtual int fromXML(DOM_Element domElement)
void setDensite(double densite)
Fixe la densite de points de calcul.
virtual void clearResult()
bool addPointCalcul(LPTYPointCalcul pPtCalcul)
Ajoute un nouveau point de calcul.
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
TYTabLPPointCalcul _ptsCalcul
Liste des points de calcul.
virtual int fromXML(DOM_Element domElement)
TYMaillage & operator=(const TYMaillage &other)
Operateur =.
void remAllPointCalcul()
Suppression de tous les elements.
virtual DOM_Element toXML(DOM_Element &domElement)
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'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)
virtual DOM_Element toXML(DOM_Element &domElement)
int save(QString fileName)
int load(const QString &fileName, LPTYElementArray &eltCollection)
void createDoc(QString docName, QString version)
int addElement(TYElement *pElt)
int loadFromString(const QString &xmlString, LPTYElementArray &eltCollection)