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"));
115 if (TYElement::operator!=(other))
173 for (i = 0; i < pOtherTopo->
_listCrbNiv.size(); i++)
176 pCrbNivGeoNode->deepCopy(pOtherTopo->
_listCrbNiv[i], copyId);
177 pCrbNivGeoNode->getElement()->setParent(
this);
178 pCrbNivGeoNode->setParent(
this);
186 pTerrainGeoNode->deepCopy(pOtherTopo->
_listTerrain[i], copyId);
187 pTerrainGeoNode->getElement()->setParent(
this);
188 pTerrainGeoNode->setParent(
this);
193 for (i = 0; i < pOtherTopo->
_listCrsEau.size(); i++)
196 pCrsEauGeoNode->deepCopy(pOtherTopo->
_listCrsEau[i], copyId);
197 pCrsEauGeoNode->getElement()->setParent(
this);
198 pCrsEauGeoNode->setParent(
this);
206 pPlanEauGeoNode->deepCopy(pOtherTopo->
_listPlanEau[i], copyId);
207 pPlanEauGeoNode->getElement()->setParent(
this);
208 pPlanEauGeoNode->setParent(
this);
213 for (i = 0; i < pOtherTopo->
_emprise.size(); i++)
223 return "TYTopographie";
232 DOM_Element empriseNode = domDoc.createElement(
"Emprise");
233 domNewElem.appendChild(empriseNode);
234 DOM_Element listCrbNivNode = domDoc.createElement(
"ListCrbNiv");
235 domNewElem.appendChild(listCrbNivNode);
236 DOM_Element listTerrainNode = domDoc.createElement(
"ListTerrain");
237 domNewElem.appendChild(listTerrainNode);
238 DOM_Element listCrsEauNode = domDoc.createElement(
"ListCrsEau");
239 domNewElem.appendChild(listCrsEauNode);
240 DOM_Element listPlanEauNode = domDoc.createElement(
"ListPlanEau");
241 domNewElem.appendChild(listPlanEauNode);
247 for (i = 0; i <
_emprise.size(); i++)
285 unsigned int i = 0, j = 0;
292 bool bDefTerrainOk =
false;
295 QDomNodeList childs = domElement.childNodes();
296 unsigned int childcount = childs.length();
297 for (i = 0; i < childcount; i++)
299 elemCur = childs.item(i).toElement();
306 pDefTerrainT32->setName(std::string(
"Terrain par defaut"));
307 if (pDefTerrainT32->callFromXMLIfEqual(elemCur))
315 if (elemCur.nodeName() ==
"Emprise")
318 QDomNodeList childs2 = elemCur.childNodes();
320 for (j = 0; j < childs2.length(); j++)
322 elemCur2 = childs2.item(j).toElement();
332 else if (elemCur.nodeName() ==
"ListCrbNiv")
335 QDomNodeList childs2 = elemCur.childNodes();
337 for (j = 0; j < childs2.length(); j++)
339 elemCur2 = childs2.item(j).toElement();
340 if (pCrbNivGeoNode->callFromXMLIfEqual(elemCur2))
355 else if (elemCur.nodeName() ==
"ListTerrain")
358 QDomNodeList childs2 = elemCur.childNodes();
360 for (j = 0; j < childs2.length(); j++)
362 elemCur2 = childs2.item(j).toElement();
364 if (pTerrainGeoNode->callFromXMLIfEqual(elemCur2))
373 else if (elemCur.nodeName() ==
"ListCrsEau")
376 QDomNodeList childs2 = elemCur.childNodes();
378 for (j = 0; j < childs2.length(); j++)
380 elemCur2 = childs2.item(j).toElement();
381 if (pCrsEauGeoNode->callFromXMLIfEqual(elemCur2))
390 else if (elemCur.nodeName() ==
"ListPlanEau")
393 QDomNodeList childs2 = elemCur.childNodes();
395 for (j = 0; j < childs2.length(); j++)
397 elemCur2 = childs2.item(j).toElement();
398 if (pPlanEauGeoNode->callFromXMLIfEqual(elemCur2))
417 if (pTerrain && pTerrain->getListPoints().size() == 0)
517 for (i = 0; i < pTopo->
_emprise.size(); ++i)
526 assert(pPlanEauGeoNode);
532 pPlanEauGeoNode->setParent(
this);
552 assert(pPlanEauGeoNode);
554 TYTabPlanEauGeoNode::iterator ite;
558 if ((*ite) == pPlanEauGeoNode)
581 TYTabPlanEauGeoNode::iterator ite;
585 if (
dynamic_cast<TYPlanEau*
>((*ite)->getElement()) == pPlanEau)
607 TYTabPlanEauGeoNode::iterator ite;
611 if ((*ite)->getElement()->getID().toString() == idPlanEau)
643 TYTabPlanEauGeoNode::iterator ite;
647 if (
dynamic_cast<TYPlanEau*
>((*ite)->getElement()) == pPlanEau)
658 assert(pCoursEauGeoNode);
664 pCoursEauGeoNode->setParent(
this);
665 pCoursEau->setParent(
this);
681 assert(pCoursEauGeoNode);
683 TYTabCoursEauGeoNode::iterator ite;
687 if ((*ite) == pCoursEauGeoNode)
707 TYTabCoursEauGeoNode::iterator ite;
711 if (
dynamic_cast<TYCoursEau*
>((*ite)->getElement()) == pCoursEau)
730 TYTabCoursEauGeoNode::iterator ite;
734 if (
dynamic_cast<TYCoursEau*
>((*ite)->getElement())->
getID().toString() == idCrsEau)
759 TYTabCoursEauGeoNode::iterator ite;
763 if (
dynamic_cast<TYCoursEau*
>((*ite)->getElement()) == pCrsEau)
780 pTerGeoNode->setParent(
this);
805 unsigned int terrainNbr = 0;
807 TYTabTerrainGeoNode::iterator ite;
811 if ((*ite) == pTerGeoNode)
840 unsigned int terrainNbr = 0;
841 TYTabTerrainGeoNode::iterator ite;
845 if (
dynamic_cast<TYTerrain*
>((*ite)->getElement()) == pTer)
877 unsigned int terrainNbr = 0;
878 TYTabTerrainGeoNode::iterator ite;
882 if ((*ite)->getElement()->getID().toString() == idTerrain)
915 TYTabTerrainGeoNode::iterator ite;
919 if (
dynamic_cast<TYTerrain*
>((*ite)->getElement()) == pTerrain)
930 assert(pCrbNivGeoNode);
936 pCrbNivGeoNode->setParent(
this);
956 assert(pCrbNivGeoNode);
958 TYTabCourbeNiveauGeoNode::iterator ite;
962 if ((*ite) == pCrbNivGeoNode)
985 TYTabCourbeNiveauGeoNode::iterator ite;
1011 TYTabCourbeNiveauGeoNode::iterator ite;
1015 if ((*ite)->getElement()->getID().toString() == idCrbNiv)
1047 TYTabCourbeNiveauGeoNode::iterator ite;
1062 double longueur = 0;
1064 double minX = +20000;
1065 double maxX = -20000;
1066 double minY = +20000;
1067 double maxY = -20000;
1070 TYTabCourbeNiveauGeoNode::iterator ite;
1076 for (
unsigned int i = 0; i < tabPoint.size(); i++)
1078 if (tabPoint[i]._x < minX)
1080 minX = tabPoint[i]._x;
1082 if (tabPoint[i]._y < minY)
1084 minY = tabPoint[i]._y;
1087 if (tabPoint[i]._x > maxX)
1089 maxX = tabPoint[i]._x;
1091 if (tabPoint[i]._y > maxY)
1093 maxY = tabPoint[i]._y;
1098 OPoint3D ptMinCourbNiv(minX, minY, 0.0);
1099 OPoint3D ptMaxCourbNiv(maxX, maxY, 0.0);
1100 OSegment3D segCrbNiv(ptMinCourbNiv, ptMaxCourbNiv);
1101 double longueurCrb = segCrbNiv.
longueur();
1109 for (
unsigned int i = 0; i <
_emprise.size(); i++)
1132 OSegment3D segEmprise(ptMinEmprise, ptMaxEmprise);
1133 double longueurEmprise = segEmprise.
longueur();
1137 if (longueurCrb > longueurEmprise)
1139 segDiagonale = segCrbNiv;
1144 segDiagonale = segEmprise;
1145 return longueurEmprise;
1173 if ((defTerrainIdx > 0) && (defTerrainIdx <
_listTerrain.size()))
1207 for (
size_t i = 0; i < nbTerrains; i++)
1216 int compareSurfaceTerrains(
const void* elem1,
const void* elem2)
1226 int sgn = int(res / fabs(res));
1232 for (
unsigned int i = 0; i <
_emprise.size(); i++)
1239 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)