29 #define TR(id) OLocalizator::getString("OMessageManager", (id))
32 static int compareSurfaceTerrains(
const void* elem1,
const void* elem2);
42 pDefTerrain->setParent(
this);
43 pDefTerrain->setName(std::string(
"Terrain par defaut"));
117 if (TYElement::operator!=(other))
175 for (i = 0; i < pOtherTopo->
_listCrbNiv.size(); i++)
178 pCrbNivGeoNode->deepCopy(pOtherTopo->
_listCrbNiv[i], copyId);
179 pCrbNivGeoNode->getElement()->setParent(
this);
180 pCrbNivGeoNode->setParent(
this);
188 pTerrainGeoNode->deepCopy(pOtherTopo->
_listTerrain[i], copyId);
189 pTerrainGeoNode->getElement()->setParent(
this);
190 pTerrainGeoNode->setParent(
this);
195 for (i = 0; i < pOtherTopo->
_listCrsEau.size(); i++)
198 pCrsEauGeoNode->deepCopy(pOtherTopo->
_listCrsEau[i], copyId);
199 pCrsEauGeoNode->getElement()->setParent(
this);
200 pCrsEauGeoNode->setParent(
this);
208 pPlanEauGeoNode->deepCopy(pOtherTopo->
_listPlanEau[i], copyId);
209 pPlanEauGeoNode->getElement()->setParent(
this);
210 pPlanEauGeoNode->setParent(
this);
215 for (i = 0; i < pOtherTopo->
_emprise.size(); i++)
225 return "TYTopographie";
234 DOM_Element empriseNode = domDoc.createElement(
"Emprise");
235 domNewElem.appendChild(empriseNode);
236 DOM_Element listCrbNivNode = domDoc.createElement(
"ListCrbNiv");
237 domNewElem.appendChild(listCrbNivNode);
238 DOM_Element listTerrainNode = domDoc.createElement(
"ListTerrain");
239 domNewElem.appendChild(listTerrainNode);
240 DOM_Element listCrsEauNode = domDoc.createElement(
"ListCrsEau");
241 domNewElem.appendChild(listCrsEauNode);
242 DOM_Element listPlanEauNode = domDoc.createElement(
"ListPlanEau");
243 domNewElem.appendChild(listPlanEauNode);
249 for (i = 0; i <
_emprise.size(); i++)
287 unsigned int i = 0, j = 0;
294 bool bDefTerrainOk =
false;
297 QDomNodeList childs = domElement.childNodes();
298 unsigned int childcount = childs.length();
299 for (i = 0; i < childcount; i++)
301 elemCur = childs.item(i).toElement();
308 pDefTerrainT32->setName(std::string(
"Terrain par defaut"));
309 if (pDefTerrainT32->callFromXMLIfEqual(elemCur))
317 if (elemCur.nodeName() ==
"Emprise")
320 QDomNodeList childs2 = elemCur.childNodes();
322 for (j = 0; j < childs2.length(); j++)
324 elemCur2 = childs2.item(j).toElement();
334 else if (elemCur.nodeName() ==
"ListCrbNiv")
337 QDomNodeList childs2 = elemCur.childNodes();
339 for (j = 0; j < childs2.length(); j++)
341 elemCur2 = childs2.item(j).toElement();
342 if (pCrbNivGeoNode->callFromXMLIfEqual(elemCur2))
357 else if (elemCur.nodeName() ==
"ListTerrain")
360 QDomNodeList childs2 = elemCur.childNodes();
362 for (j = 0; j < childs2.length(); j++)
364 elemCur2 = childs2.item(j).toElement();
366 if (pTerrainGeoNode->callFromXMLIfEqual(elemCur2))
375 else if (elemCur.nodeName() ==
"ListCrsEau")
378 QDomNodeList childs2 = elemCur.childNodes();
380 for (j = 0; j < childs2.length(); j++)
382 elemCur2 = childs2.item(j).toElement();
383 if (pCrsEauGeoNode->callFromXMLIfEqual(elemCur2))
392 else if (elemCur.nodeName() ==
"ListPlanEau")
395 QDomNodeList childs2 = elemCur.childNodes();
397 for (j = 0; j < childs2.length(); j++)
399 elemCur2 = childs2.item(j).toElement();
400 if (pPlanEauGeoNode->callFromXMLIfEqual(elemCur2))
419 if (pTerrain && pTerrain->getListPoints().size() == 0)
495 for (
int i = 0; i < childs.size(); i++)
497 childs[i]->updateCurrentCalcul(listID, recursif);
548 for (i = 0; i < pTopo->
_emprise.size(); ++i)
557 assert(pPlanEauGeoNode);
563 pPlanEauGeoNode->setParent(
this);
583 assert(pPlanEauGeoNode);
585 TYTabPlanEauGeoNode::iterator ite;
589 if ((*ite) == pPlanEauGeoNode)
612 TYTabPlanEauGeoNode::iterator ite;
616 if (
dynamic_cast<TYPlanEau*
>((*ite)->getElement()) == pPlanEau)
638 TYTabPlanEauGeoNode::iterator ite;
642 if ((*ite)->getElement()->getID().toString() == idPlanEau)
674 TYTabPlanEauGeoNode::iterator ite;
678 if (
dynamic_cast<TYPlanEau*
>((*ite)->getElement()) == pPlanEau)
695 if (pPlanEauGeoNode->getElement()->isInCurrentCalcul())
697 ret.push_back(pPlanEauGeoNode);
705 assert(pCoursEauGeoNode);
711 pCoursEauGeoNode->setParent(
this);
712 pCoursEau->setParent(
this);
728 assert(pCoursEauGeoNode);
730 TYTabCoursEauGeoNode::iterator ite;
734 if ((*ite) == pCoursEauGeoNode)
754 TYTabCoursEauGeoNode::iterator ite;
758 if (
dynamic_cast<TYCoursEau*
>((*ite)->getElement()) == pCoursEau)
777 TYTabCoursEauGeoNode::iterator ite;
781 if (
dynamic_cast<TYCoursEau*
>((*ite)->getElement())->
getID().toString() == idCrsEau)
806 TYTabCoursEauGeoNode::iterator ite;
810 if (
dynamic_cast<TYCoursEau*
>((*ite)->getElement()) == pCrsEau)
827 pTerGeoNode->setParent(
this);
852 unsigned int terrainNbr = 0;
854 TYTabTerrainGeoNode::iterator ite;
858 if ((*ite) == pTerGeoNode)
887 unsigned int terrainNbr = 0;
888 TYTabTerrainGeoNode::iterator ite;
892 if (
dynamic_cast<TYTerrain*
>((*ite)->getElement()) == pTer)
924 unsigned int terrainNbr = 0;
925 TYTabTerrainGeoNode::iterator ite;
929 if ((*ite)->getElement()->getID().toString() == idTerrain)
962 TYTabTerrainGeoNode::iterator ite;
966 if (
dynamic_cast<TYTerrain*
>((*ite)->getElement()) == pTerrain)
977 assert(pCrbNivGeoNode);
983 pCrbNivGeoNode->setParent(
this);
1003 assert(pCrbNivGeoNode);
1005 TYTabCourbeNiveauGeoNode::iterator ite;
1009 if ((*ite) == pCrbNivGeoNode)
1032 TYTabCourbeNiveauGeoNode::iterator ite;
1058 TYTabCourbeNiveauGeoNode::iterator ite;
1062 if ((*ite)->getElement()->getID().toString() == idCrbNiv)
1099 if (pCourbeNiveauGeoNode->getElement()->isInCurrentCalcul())
1101 ret.push_back(pCourbeNiveauGeoNode);
1110 TYTabCourbeNiveauGeoNode::iterator ite;
1125 double longueur = 0;
1127 double minX = +20000;
1128 double maxX = -20000;
1129 double minY = +20000;
1130 double maxY = -20000;
1133 TYTabCourbeNiveauGeoNode::iterator ite;
1139 for (
unsigned int i = 0; i < tabPoint.size(); i++)
1141 if (tabPoint[i]._x < minX)
1143 minX = tabPoint[i]._x;
1145 if (tabPoint[i]._y < minY)
1147 minY = tabPoint[i]._y;
1150 if (tabPoint[i]._x > maxX)
1152 maxX = tabPoint[i]._x;
1154 if (tabPoint[i]._y > maxY)
1156 maxY = tabPoint[i]._y;
1161 OPoint3D ptMinCourbNiv(minX, minY, 0.0);
1162 OPoint3D ptMaxCourbNiv(maxX, maxY, 0.0);
1163 OSegment3D segCrbNiv(ptMinCourbNiv, ptMaxCourbNiv);
1164 double longueurCrb = segCrbNiv.
longueur();
1172 for (
unsigned int i = 0; i <
_emprise.size(); i++)
1195 OSegment3D segEmprise(ptMinEmprise, ptMaxEmprise);
1196 double longueurEmprise = segEmprise.
longueur();
1200 if (longueurCrb > longueurEmprise)
1202 segDiagonale = segCrbNiv;
1207 segDiagonale = segEmprise;
1208 return longueurEmprise;
1236 if ((defTerrainIdx > 0) && (defTerrainIdx <
_listTerrain.size()))
1270 for (
size_t i = 0; i < nbTerrains; i++)
1279 int compareSurfaceTerrains(
const void* elem1,
const void* elem2)
1289 int sgn = int(res / fabs(res));
1295 for (
unsigned int i = 0; i <
_emprise.size(); i++)
1302 std::deque<LPTYSol>& materials)
All base classes related to 3D manipulation.
QDomDocument DOM_Document
std::vector< LPTYCourbeNiveauGeoNode > TYTabCourbeNiveauGeoNode
Collection de noeuds geometriques de type TYCourbeNiveau.
TYGeometryNode TYCourbeNiveauGeoNode
Noeud geometrique de type TYCourbeNiveau.
TYGeometryNode TYCoursEauGeoNode
Noeud geometrique de type TYCoursEau.
#define TAILLETOPOY
Largeur par defaut de la topographie.
std::vector< TYPoint > TYTabPoint
Collection de TYPoint.
#define TAILLETOPOX
Longueur par defaut de la topographie.
std::list< TYUUID > TYListID
Collection d'identifiants.
std::vector< LPTYElement > LPTYElementArray
#define TYDIRPREFERENCEMANAGER
TYGeometryNode TYPlanEauGeoNode
Noeud geometrique de type TYPlanEau.
std::vector< LPTYPlanEauGeoNode > TYTabPlanEauGeoNode
Collection de noeuds geometriques de type TYPlanEau.
TYGeometryNode TYTerrainGeoNode
Noeud geometrique de type TYTerrain.
Representation graphique d'une topographie (fichier header)
TY_EXTENSION_INST(TYTopographie)
TY_EXT_GRAPHIC_INST(TYTopographie)
static OMessageManager * get()
virtual void info(const char *message,...)
virtual const char * getClassName() const
Class to define a segment.
virtual double longueur() const
Return the segment length.
Assigne une altitude a chaque point de l'espace.
void exportMesh(std::deque< OPoint3D > &vertices, std::deque< OTriangle > &faces, std::deque< LPTYSol > &materials)
virtual DOM_Element toXML(DOM_Element &domElement)
void setIsUpToDate(bool isUpToDate)
TYTabPoint & getListPoints()
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
TYElement * _pParent
Reference sur l'element parent.
virtual void updateCurrentCalcul(TYListID &listID, bool recursif=true)
virtual void getChilds(LPTYElementArray &childs, bool recursif=true)
void setParent(TYElement *pParent)
virtual int fromXML(DOM_Element domElement)
virtual void setIsGeometryModified(bool isModified)
TYElement * getElement() const
QString generateName(const char *classname)
Retourne le nom de la classe associe a un nombre.
static TYNameManager * get()
Retourne l'instance singleton.
virtual TYTabPoint getContourFerme(int n=-1) const
void setDimension(float lon, float haut)
void setSol(const LPTYSol pSol)
TYTerrain * getDefTerrain()
int _DefTerrainIdx
Terrain par default.
virtual void setIsGeometryModified(bool isModified)
LPTYCourbeNiveauGeoNode findCrbNiv(const LPTYCourbeNiveau pCrbNiv)
TYTerrainGeoNode ** _pSortedTerrains
void exportMesh(std::deque< OPoint3D > &points, std::deque< OTriangle > &triangles, std::deque< LPTYSol > &materials)
Export the altimetry as a triangular mesh.
virtual void getChilds(LPTYElementArray &childs, bool recursif=true)
LPTYTerrainGeoNode findTerrain(const LPTYTerrain pTerrain)
bool remCrbNiv(const LPTYCourbeNiveauGeoNode pCrbNivGeoNode)
bool addCrsEau(LPTYCoursEauGeoNode pCoursEauGeoNode)
virtual std::string toString() const
virtual int fromXML(DOM_Element domElement)
virtual DOM_Element toXML(DOM_Element &domElement)
void addPointEmprise(TYPoint pt)
bool operator!=(const TYTopographie &other) const
Operateur !=.
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
LPTYPlanEauGeoNode findPlanEau(const LPTYPlanEau pPlanEau)
bool remPlanEau(const LPTYPlanEauGeoNode pPlanEauGeoNode)
bool operator==(const TYTopographie &other) const
Operateur ==.
void setDefTerrain(int defTerrainIdx)
LPTYCoursEauGeoNode findCrsEau(const LPTYCoursEau pCrsEau)
bool addCrbNiv(LPTYCourbeNiveauGeoNode pCrbNivGeoNode)
double getTopoSize(OSegment3D &segDiagonale)
virtual void updateCurrentCalcul(TYListID &listID, bool recursif=true)
TYTabPlanEauGeoNode _listPlanEau
Liste des plans d'eau.
TYTabCoursEauGeoNode _listCrsEau
Liste des cours d'eau.
const TYTabCourbeNiveauGeoNode getListCrbNivInCurrentCalcul() const
TYTabTerrainGeoNode _listTerrain
Liste des terrains.
TYTabCourbeNiveauGeoNode _listCrbNiv
Liste des courbes de niveau.
bool addPlanEau(LPTYPlanEauGeoNode pPlanEauGeoNode)
void updateEmpriseAltitude(double empriseAltitude)
Update z ccordinates of emprise points.
LPTYAltimetrie _pAltimetrie
Altimetrie.
LPTYTerrain getTerrain(int index)
bool remCrsEau(const LPTYCoursEauGeoNode pCoursEauGeoNode)
void setEmprise(const TYTabPoint &pts, const bool &defTerrain=true)
TYTopographie & operator=(const TYTopographie &other)
Operateur =.
bool addTerrain(LPTYTerrainGeoNode pTerGeoNode)
TYTabPoint _emprise
Emprise.
const TYTabPlanEauGeoNode getListPlanEauInCurrentCalcul() const
void concatTopo(const TYTopographie *pTopo, bool emprise=true)
void sortTerrainsBySurface()
bool remTerrain(const LPTYTerrainGeoNode pTerGeoNode)