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)
519 for (i = 0; i < pTopo->
_emprise.size(); ++i)
528 assert(pPlanEauGeoNode);
534 pPlanEauGeoNode->setParent(
this);
554 assert(pPlanEauGeoNode);
556 TYTabPlanEauGeoNode::iterator ite;
560 if ((*ite) == pPlanEauGeoNode)
583 TYTabPlanEauGeoNode::iterator ite;
587 if (
dynamic_cast<TYPlanEau*
>((*ite)->getElement()) == pPlanEau)
609 TYTabPlanEauGeoNode::iterator ite;
613 if ((*ite)->getElement()->getID().toString() == idPlanEau)
645 TYTabPlanEauGeoNode::iterator ite;
649 if (
dynamic_cast<TYPlanEau*
>((*ite)->getElement()) == pPlanEau)
660 assert(pCoursEauGeoNode);
666 pCoursEauGeoNode->setParent(
this);
667 pCoursEau->setParent(
this);
683 assert(pCoursEauGeoNode);
685 TYTabCoursEauGeoNode::iterator ite;
689 if ((*ite) == pCoursEauGeoNode)
709 TYTabCoursEauGeoNode::iterator ite;
713 if (
dynamic_cast<TYCoursEau*
>((*ite)->getElement()) == pCoursEau)
732 TYTabCoursEauGeoNode::iterator ite;
736 if (
dynamic_cast<TYCoursEau*
>((*ite)->getElement())->
getID().toString() == idCrsEau)
761 TYTabCoursEauGeoNode::iterator ite;
765 if (
dynamic_cast<TYCoursEau*
>((*ite)->getElement()) == pCrsEau)
782 pTerGeoNode->setParent(
this);
807 unsigned int terrainNbr = 0;
809 TYTabTerrainGeoNode::iterator ite;
813 if ((*ite) == pTerGeoNode)
842 unsigned int terrainNbr = 0;
843 TYTabTerrainGeoNode::iterator ite;
847 if (
dynamic_cast<TYTerrain*
>((*ite)->getElement()) == pTer)
879 unsigned int terrainNbr = 0;
880 TYTabTerrainGeoNode::iterator ite;
884 if ((*ite)->getElement()->getID().toString() == idTerrain)
917 TYTabTerrainGeoNode::iterator ite;
921 if (
dynamic_cast<TYTerrain*
>((*ite)->getElement()) == pTerrain)
932 assert(pCrbNivGeoNode);
938 pCrbNivGeoNode->setParent(
this);
958 assert(pCrbNivGeoNode);
960 TYTabCourbeNiveauGeoNode::iterator ite;
964 if ((*ite) == pCrbNivGeoNode)
987 TYTabCourbeNiveauGeoNode::iterator ite;
1013 TYTabCourbeNiveauGeoNode::iterator ite;
1017 if ((*ite)->getElement()->getID().toString() == idCrbNiv)
1049 TYTabCourbeNiveauGeoNode::iterator ite;
1064 double longueur = 0;
1066 double minX = +20000;
1067 double maxX = -20000;
1068 double minY = +20000;
1069 double maxY = -20000;
1072 TYTabCourbeNiveauGeoNode::iterator ite;
1078 for (
unsigned int i = 0; i < tabPoint.size(); i++)
1080 if (tabPoint[i]._x < minX)
1082 minX = tabPoint[i]._x;
1084 if (tabPoint[i]._y < minY)
1086 minY = tabPoint[i]._y;
1089 if (tabPoint[i]._x > maxX)
1091 maxX = tabPoint[i]._x;
1093 if (tabPoint[i]._y > maxY)
1095 maxY = tabPoint[i]._y;
1100 OPoint3D ptMinCourbNiv(minX, minY, 0.0);
1101 OPoint3D ptMaxCourbNiv(maxX, maxY, 0.0);
1102 OSegment3D segCrbNiv(ptMinCourbNiv, ptMaxCourbNiv);
1103 double longueurCrb = segCrbNiv.
longueur();
1111 for (
unsigned int i = 0; i <
_emprise.size(); i++)
1134 OSegment3D segEmprise(ptMinEmprise, ptMaxEmprise);
1135 double longueurEmprise = segEmprise.
longueur();
1139 if (longueurCrb > longueurEmprise)
1141 segDiagonale = segCrbNiv;
1146 segDiagonale = segEmprise;
1147 return longueurEmprise;
1175 if ((defTerrainIdx > 0) && (defTerrainIdx <
_listTerrain.size()))
1209 for (
size_t i = 0; i < nbTerrains; i++)
1218 int compareSurfaceTerrains(
const void* elem1,
const void* elem2)
1228 int sgn = int(res / fabs(res));
1234 for (
unsigned int i = 0; i <
_emprise.size(); i++)
1241 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)
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)
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)
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.
void concatTopo(const TYTopographie *pTopo, bool emprise=true)
void sortTerrainsBySurface()
bool remTerrain(const LPTYTerrainGeoNode pTerGeoNode)