24 #include <boost/lexical_cast.hpp>
25 #include <boost/tokenizer.hpp>
26 #include <boost/algorithm/string/trim.hpp>
27 #include <boost/foreach.hpp>
65 if (TYElement::operator!=(other))
94 return "TYDirectivity";
103 DOM_Element vectorXElem = domDoc.createElement(
"Vector");
104 domNewElem.appendChild(vectorXElem);
117 QDomNodeList childs = domElement.childNodes();
119 for (
unsigned int i = 0; i < childs.length(); i++)
121 elemCur = childs.item(i).toElement();
123 if (elemCur.nodeName() ==
"Vector")
144 QDomDocument domDoc = domElement.ownerDocument();
147 DOM_Element domChildElem = domDoc.createElement(
"DirectivityValues");
148 domNewElem.appendChild(domChildElem);
166 QDomNodeList childs = domElement.childNodes();
168 for (
unsigned int i = 0; i < childs.length(); i++)
170 elemCur = childs.item(i).toElement();
174 if (elemCur.nodeName() ==
"DirectivityValues")
189 std::ifstream input(fileName, std::ios::in);
192 using namespace boost;
194 typedef tokenizer<escaped_list_separator<char>> Tokenizer;
196 while (getline(input, line))
198 deque<double> line_array;
200 BOOST_FOREACH (
string str_rec, tok)
203 line_array.push_back(boost::lexical_cast<double>(str_rec));
215 element.
Theta = line_array[0];
216 element.
Phi = line_array[1];
219 for (
unsigned int i = 0; i < TY_SPECTRE_DEFAULT_NB_ELMT; i++)
221 spectrumValues[i] = line_array[i + 2];
241 DOM_Element directivity = domDoc.createElement(
"DirectivityType");
242 domNewElem.appendChild(directivity);
243 directivity.setAttribute(
"Type",
intToStr(
Type).data());
245 DOM_Element specificSize = domDoc.createElement(
"SpecificSize");
246 domNewElem.appendChild(specificSize);
257 QDomNodeList childs = domElement.childNodes();
259 for (
unsigned int i = 0; i < childs.length(); i++)
261 elemCur = childs.item(i).toElement();
262 if (elemCur.nodeName() ==
"DirectivityType")
267 if (elemCur.nodeName() ==
"SpecificSize")
QDomDocument DOM_Document
TY_EXTENSION_INST(TYDirectivity)
double _y
y coordinate of OCoord3D
double _z
z coordinate of OCoord3D
double _x
x coordinate of OCoord3D
virtual const char * getClassName() const
double * getTabValReel() override
virtual int fromXML(DOM_Element domElement)
virtual DOM_Element toXML(DOM_Element &domElement)
TYDirectivity & operator=(const TYDirectivity &other)
Operateur =.
virtual DOM_Element toXML(DOM_Element &domElement)
bool operator==(const TYDirectivity &other) const
Operateur ==.
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
bool operator!=(const TYDirectivity &other) const
Operateur !=.
virtual std::string toString() const
virtual int fromXML(DOM_Element domElement)
OVector3D DirectivityVector
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)
virtual int fromXML(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.
virtual int fromXML(DOM_Element domElement)
ConstraintDirectivityElement readValuesFromCSV(std::deque< double > &line_array)
void LoadFromCsv(std::string fileName)
ConstraintDirectivityDefinition DirectivityTable
virtual DOM_Element toXML(DOM_Element &domElement)
virtual int fromXML(DOM_Element domElement)
TYUserDefinedDirectivity()
std::string doubleToStrPre(double val, int precision=2)
std::string doubleToStr(double val)
std::string intToStr(int val)