Code_TYMPAN  4.2.0
Industrial site acoustic simulation
TYGeometryNode.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012> <EDF-R&D> <FRANCE>
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10  * See the GNU General Public License for more details.
11  * You should have received a copy of the GNU General Public License along
12  * with this program; if not, write to the Free Software Foundation, Inc.,
13  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
14 */
15 
16 /*
17  *
18  */
19 
20 #ifndef __TY_GEOMETRY_NODE__
21 #define __TY_GEOMETRY_NODE__
22 
23 #if _MSC_VER > 1000
24 #pragma once
25 #endif // _MSC_VER > 1000
26 
27 #ifdef _MSC_VER
28 #pragma warning( disable : 4284 )
29 #endif
30 
32 #include "TYRepere.h"
34 
42 class TYGeometryNode;
44 typedef std::map<TYElement*, TYGeometryNode*> TYMapPtrGeoNode;
46 typedef std::list<TYGeometryNode*> TYListPtrGeoNode;
47 
49 {
51 public:
63  TYGeometryNode(TYElement* pElt, TYElement* pParent = NULL);
64 
71  TYGeometryNode(LPTYElement pElt, TYElement* pParent = NULL);
72 
79  TYGeometryNode(const TYRepere& repere, TYElement* pElt);
80 
87  TYGeometryNode(const TYRepere& repere, LPTYElement pElt);
88 
95  TYGeometryNode(TYElement* pElt, const OMatrix& matrix);
96 
103  TYGeometryNode(LPTYElement pElt, const OMatrix& matrix);
104 
110  TYGeometryNode(const TYGeometryNode& other);
111 
115  virtual ~TYGeometryNode();
116 
117  virtual DOM_Element toXML(DOM_Element& domElement);
118  virtual int fromXML(DOM_Element domElement);
119 
120  virtual void getChilds(LPTYElementArray& childs, bool recursif = true);
121 
127  TYElement* getElement() const { return _pElement._pObj; }
128 
134  void setElement(LPTYElement pElt);
135 
141  void setElement(TYElement* pElt);
142 
146  void delElement();
147 
151  const ORepere3D& getORepere3D() const
152  { return _repere; }
153 
155  { return _repere; }
156 
157  void setRepere(const ORepere3D& repere) { _repere = repere; }
158 
162  OMatrix getMatrix() const { return _repere.asMatrix(); }
163 
167  void setMatrix(const OMatrix& matrix);
168 
172  TYGeometryNode& operator=(const TYGeometryNode& other);
173 
177  bool operator==(const TYGeometryNode& other) const;
178 
182  bool operator!=(const TYGeometryNode& other) const;
183 
184  virtual bool deepCopy(const TYElement* pOther, bool copyId = true, bool pUseCopyTag = false);
185 
189  OMatrix localToGlobal() const;
190 
194  OMatrix globalToLocal() const;
195 
199  void setPosition(const OPoint3D& pos);
200 
205 
209  void setRotation(const OPoint3D& rot);
210 
214  OPoint3D rotation();
215 
219  double getHauteur() { return _hauteur; }
220 
224  void setHauteur(const double& hauteur) { _hauteur = hauteur; }
225 
226 #if TY_USE_IHM
227  virtual LPTYElementGraphic getGraphicObject();
228 #endif // TY_USE_IHM
229 
230  static TYGeometryNode* GetGeoNode(TYElement* pElement);
232  void GetGeoNodeParentList(TYListPtrGeoNode& GetGeoNodeParents);
233  // Membres
234 protected:
235  //Problematique d'obtention du geoNode d'un element
236  //- Cette fonctionalite est necessaire pour former une hierarchie de geoNode, car celle-ci decoule de celle des objets (les 'pElement').
237  //- Cette information de correspondance Element-GeoNode n'est malheureusement pas stockee/stockable cote Element,
238  //car elle peut changer au cours du temps. D'ou l'interet d'une map.
239  //Map permettant d'acceder rapidement au GeoNode connaissant l'element sur lequel il pointe,
240  //pour obtenir rapidement le geoNode de l'element:
242  static TYMapPtrGeoNode* GetGeoNodeMap();
243  //En theorie, il ne peut y avoir qu'un GeoNode pour un element; en pratique, ce n'est (temporairement) pas le cas:
244  //voir operateur =, setElement,...et toutes les methodes ou figure _pElement.
245  //Afin de ne pas perdre d'information de correspondance, on maintient une liste "de doublons" contenant tous les GeoNode
246  //pointant sur un element deja reference par un autre geoNode de la map.
249 
250  //Enregistre this comme geoNode officiel de this->_pElement:
251  void addToTheMap();
252  //Supprime toute reference a this comme geoNode officiel de this->_pElement:
253  void removeFromTheMap();
254 
257 
260 
262  double _hauteur;
263 };
264 
265 #if TY_USE_IHM
267 #endif
268 
270 
271 #endif //__TY_GEOMETRY_NODE__
3D frame with a point and 3 vectors.
Definition: 3d.h:1207
QDomElement DOM_Element
Definition: QT2DOM.h:31
OMatrix asMatrix() const
return the transformation matrix from unity to this pose such as this = transform * unity ...
Definition: 3d.cpp:1432
std::vector< LPTYElement > LPTYElementArray
Definition: TYElement.h:338
void GetGeoNodeParentList(TYListPtrGeoNode &GetGeoNodeParents)
bool operator==(const TYGeometryNode &other) const
OPoint3D position()
Get the position of the element.
void setHauteur(const double &hauteur)
Set the heigth above the ground.
static TYMapPtrGeoNode * _geoNodeMap
TYGeometryNode * GetGeoNodeParent() const
const ORepere3D & getORepere3D() const
double _hauteur
Hauteur de l&#39;element par rapport au sol.
ORepere3D & getORepere3D()
SmartPtr< TYGeometryNode > LPTYGeometryNode
static TYListPtrGeoNode * _geoNodeDoublonsList
void setRepere(const ORepere3D &repere)
Representation graphique d&#39;un GeometryNode (fichier header)
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
static TYMapPtrGeoNode * GetGeoNodeMap()
std::list< TYGeometryNode * > TYListPtrGeoNode
Liste ordonnee de pointeurs de TYElement.
void setRotation(const OPoint3D &rot)
Set the rotation angle along axis x, y & z represented as an OPoint3D.
virtual ~TYGeometryNode()
#define OPROTODECL(classname)
Definition: TYElement.h:67
TYElement * getElement() const
OMatrix localToGlobal() const
void setPosition(const OPoint3D &pos)
Set the position of the element.
T * _pObj
The real pointer, must derived IRefCount.
Definition: smartptr.h:285
virtual int fromXML(DOM_Element domElement)
virtual DOM_Element toXML(DOM_Element &domElement)
std::map< TYElement *, TYGeometryNode * > TYMapPtrGeoNode
void setMatrix(const OMatrix &matrix)
static TYGeometryNode * GetGeoNode(TYElement *pElement)
The 4x4 matrix class.
Definition: 3d.h:625
TYRepere _repere
Le repere definissant la position et l&#39;orientation de l&#39;element.
static TYListPtrGeoNode * GetGeoNodeDoublonsList()
OMatrix globalToLocal() const
LPTYElement _pElement
L&#39;instance de l&#39;element geometrique.
double getHauteur()
Get the height above the ground.
TYGeometryNode & operator=(const TYGeometryNode &other)
virtual void getChilds(LPTYElementArray &childs, bool recursif=true)
The 3D point class.
Definition: 3d.h:484
OMatrix getMatrix() const
OPoint3D _origin
The origin point.
Definition: 3d.h:1276
void setElement(LPTYElement pElt)
OPoint3D rotation()
Get the rotation angle along axis x, y & z represented as an OPoint3D.
bool operator!=(const TYGeometryNode &other) const