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)
518 for (i = 0; i < pTopo->
_emprise.size(); ++i)
527 assert(pPlanEauGeoNode);
533 pPlanEauGeoNode->setParent(
this);
553 assert(pPlanEauGeoNode);
555 TYTabPlanEauGeoNode::iterator ite;
559 if ((*ite) == pPlanEauGeoNode)
582 TYTabPlanEauGeoNode::iterator ite;
586 if (
dynamic_cast<TYPlanEau*
>((*ite)->getElement()) == pPlanEau)
608 TYTabPlanEauGeoNode::iterator ite;
612 if ((*ite)->getElement()->getID().toString() == idPlanEau)
644 TYTabPlanEauGeoNode::iterator ite;
648 if (
dynamic_cast<TYPlanEau*
>((*ite)->getElement()) == pPlanEau)
659 assert(pCoursEauGeoNode);
665 pCoursEauGeoNode->setParent(
this);
666 pCoursEau->setParent(
this);
682 assert(pCoursEauGeoNode);
684 TYTabCoursEauGeoNode::iterator ite;
688 if ((*ite) == pCoursEauGeoNode)
708 TYTabCoursEauGeoNode::iterator ite;
712 if (
dynamic_cast<TYCoursEau*
>((*ite)->getElement()) == pCoursEau)
731 TYTabCoursEauGeoNode::iterator ite;
735 if (
dynamic_cast<TYCoursEau*
>((*ite)->getElement())->
getID().toString() == idCrsEau)
760 TYTabCoursEauGeoNode::iterator ite;
764 if (
dynamic_cast<TYCoursEau*
>((*ite)->getElement()) == pCrsEau)
781 pTerGeoNode->setParent(
this);
806 unsigned int terrainNbr = 0;
808 TYTabTerrainGeoNode::iterator ite;
812 if ((*ite) == pTerGeoNode)
841 unsigned int terrainNbr = 0;
842 TYTabTerrainGeoNode::iterator ite;
846 if (
dynamic_cast<TYTerrain*
>((*ite)->getElement()) == pTer)
878 unsigned int terrainNbr = 0;
879 TYTabTerrainGeoNode::iterator ite;
883 if ((*ite)->getElement()->getID().toString() == idTerrain)
916 TYTabTerrainGeoNode::iterator ite;
920 if (
dynamic_cast<TYTerrain*
>((*ite)->getElement()) == pTerrain)
931 assert(pCrbNivGeoNode);
937 pCrbNivGeoNode->setParent(
this);
957 assert(pCrbNivGeoNode);
959 TYTabCourbeNiveauGeoNode::iterator ite;
963 if ((*ite) == pCrbNivGeoNode)
986 TYTabCourbeNiveauGeoNode::iterator ite;
1012 TYTabCourbeNiveauGeoNode::iterator ite;
1016 if ((*ite)->getElement()->getID().toString() == idCrbNiv)
1048 TYTabCourbeNiveauGeoNode::iterator ite;
1063 double longueur = 0;
1065 double minX = +20000;
1066 double maxX = -20000;
1067 double minY = +20000;
1068 double maxY = -20000;
1071 TYTabCourbeNiveauGeoNode::iterator ite;
1077 for (
unsigned int i = 0; i < tabPoint.size(); i++)
1079 if (tabPoint[i]._x < minX)
1081 minX = tabPoint[i]._x;
1083 if (tabPoint[i]._y < minY)
1085 minY = tabPoint[i]._y;
1088 if (tabPoint[i]._x > maxX)
1090 maxX = tabPoint[i]._x;
1092 if (tabPoint[i]._y > maxY)
1094 maxY = tabPoint[i]._y;
1099 OPoint3D ptMinCourbNiv(minX, minY, 0.0);
1100 OPoint3D ptMaxCourbNiv(maxX, maxY, 0.0);
1101 OSegment3D segCrbNiv(ptMinCourbNiv, ptMaxCourbNiv);
1102 double longueurCrb = segCrbNiv.
longueur();
1110 for (
unsigned int i = 0; i <
_emprise.size(); i++)
1133 OSegment3D segEmprise(ptMinEmprise, ptMaxEmprise);
1134 double longueurEmprise = segEmprise.
longueur();
1138 if (longueurCrb > longueurEmprise)
1140 segDiagonale = segCrbNiv;
1145 segDiagonale = segEmprise;
1146 return longueurEmprise;
1174 if ((defTerrainIdx > 0) && (defTerrainIdx <
_listTerrain.size()))
1208 for (
size_t i = 0; i < nbTerrains; i++)
1217 int compareSurfaceTerrains(
const void* elem1,
const void* elem2)
1227 int sgn = int(res / fabs(res));
1232 std::deque<LPTYSol>& materials)
All base classes related to 3D manipulation.
QDomDocument DOM_Document
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.
#define TYDIRPREFERENCEMANAGER
TYGeometryNode TYPlanEauGeoNode
Noeud geometrique 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)
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)
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.
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.
TYTabTerrainGeoNode _listTerrain
Liste des terrains.
TYTabCourbeNiveauGeoNode _listCrbNiv
Liste des courbes de niveau.
bool addPlanEau(LPTYPlanEauGeoNode pPlanEauGeoNode)
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.
void concatTopo(const TYTopographie *pTopo, bool emprise=true)
void sortTerrainsBySurface()
bool remTerrain(const LPTYTerrainGeoNode pTerGeoNode)