Code_TYMPAN  4.2.0
Industrial site acoustic simulation
Public Member Functions | Private Member Functions | Private Attributes | List of all members
TYPolygon Class Reference

#include <TYPolygon.h>

Inheritance diagram for TYPolygon:
Inheritance graph
[legend]
Collaboration diagram for TYPolygon:
Collaboration graph
[legend]

Public Member Functions

 TYPolygon ()
 
 TYPolygon (const TYPolygon &other)
 
 TYPolygon (const TYTabPoint &pts)
 
virtual ~TYPolygon ()
 
TYPolygonoperator= (const TYPolygon &other)
 Operateur =. More...
 
bool operator== (const TYPolygon &other) const
 Operateur ==. More...
 
bool operator!= (const TYPolygon &other) const
 Operateur !=. More...
 
virtual bool deepCopy (const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
 
virtual std::string toString () const
 
virtual DOM_Element toXML (DOM_Element &domElement)
 
virtual int fromXML (DOM_Element domElement)
 
virtual double surface () const
 
virtual OVector3D normal () const
 
virtual OPlan plan () const
 
virtual TYTabPoint getContour (int n=-1) const
 
virtual TYTabPoint3D getOContour (int n=-1) const
 
virtual int intersects (const TYSurfaceInterface *pSurf, OSegment3D &seg) const
 
virtual int intersects (const OSegment3D &seg, OPoint3D &pt) const
 
virtual int intersects (const OSegment3D &seg, OPoint3D &pt, bool insideTest) const
 
virtual int intersects (const OPoint3D &pt) const
 
void purge ()
 
size_t getNbPts () const
 
void setPoints (const TYTabPoint &pts)
 
bool checkCoplanar () const
 
const TYTabPointgetPoints () const
 
TYTabPointgetPoints ()
 
OPoint3D getPoint (size_t index) const
 
void transform (const OMatrix &matrix)
 
void setConvex (bool bConvex)
 
bool isConvex () const
 
bool isInBox (const OPoint3D &pt) const
 
bool isInBox2D (const OPoint3D &pt) const
 
OPoint3D getCenter () const
 
bool isValid () const
 
ORepere3D getORepere3D () const
 
TYRectangle getBoundingRect () const
 
virtual const OPlangetPlan () const
 
void updateNormal ()
 
void updateBox ()
 
virtual void inverseNormale ()
 
virtual const OBoxgetBox () const
 
void exportMesh (std::deque< OPoint3D > &points, std::deque< OTriangle > &triangles, const TYGeometryNode &geonode) const
 Export the surface as a triangular mesh. More...
 
- Public Member Functions inherited from TYElement
void * getAllUses ()
 
void setAllUses (void *allUses)
 
void cleanAllUses ()
 
 TYElement ()
 
 TYElement (TYElement *pParent, bool PutInInstanceList=true)
 
 TYElement (const TYElement &other, bool PutInInstanceList=true)
 
virtual ~TYElement ()
 
void setID (TYUUID id)
 
void setID (const QString &str_id)
 
const TYUUIDgetID () const
 
QString getStringID () const
 
bool hasNullID () const
 
void regenerateID ()
 
void setName (QString name)
 
void setName (std::string name)
 
virtual QString getName () const
 
void setParent (TYElement *pParent)
 
TYElementgetParent () const
 
virtual void setIsAcousticModified (bool isModified)
 
bool getIsAcousticModified ()
 
virtual void setIsGeometryModified (bool isModified)
 
bool getIsGeometryModified ()
 
TYElementoperator= (const TYElement &other)
 
bool operator== (const TYElement &other) const
 
bool operator!= (const TYElement &other) const
 
bool callFromXMLIfEqual (DOM_Element &domElement, int *pRetVal=NULL)
 
std::string getMetierName ()
 
virtual void updateCurrentCalcul (TYListID &listID, bool recursif=true)
 
virtual void getChilds (LPTYElementArray &childs, bool recursif=true)
 
virtual void setInCurrentCalcul (bool state, bool recurschild=true, bool recursparent=true)
 
virtual bool isInCurrentCalcul ()
 
void addCopy ()
 Increment le compteur de nombre de copies. More...
 
void setCopyCount (const unsigned int copyCount)
 Modifie la vaeur du compteur. More...
 
- Public Member Functions inherited from IRefCount
 IRefCount ()
 
virtual ~IRefCount ()
 
virtual int incRef ()
 
virtual int decRef ()
 
int getRefCount () const
 
- Public Member Functions inherited from OPrototype
virtual ~OPrototype ()
 
virtual OPrototypeclone () const =0
 
virtual const char * getClassName () const
 
bool isA (const char *className) const
 
- Public Member Functions inherited from TYSurfaceInterface
 TYSurfaceInterface ()
 
virtual ~TYSurfaceInterface ()
 
virtual int intersectsPlan (const OPlan &plan, OSegment3D &seg) const
 

Private Member Functions

int isInpolyXY (const TYTabPoint &poly, int npoints, double xt, double yt) const
 
int isInpolyXZ (const TYTabPoint &poly, int npoints, double xt, double yt) const
 
int isInpolyYZ (const TYTabPoint &poly, int npoints, double xt, double yt) const
 

Private Attributes

TYTabPoint _pts
 Sommets. More...
 
OPlan _plan
 
OBox _box
 
bool _bConvex
 

Additional Inherited Members

- Static Public Member Functions inherited from TYElement
static LPTYElementArray findTypeCollectionAndCallFromXML (DOM_Element parentElem, const char *type)
 
static void setLogInstances (bool log)
 
static bool getLogInstances ()
 
static TYElementgetInstance (TYUUID uuid)
 
static void purgeInstances ()
 
static bool testId (const TYUUID &id, const TYElement *pElem)
 
static TYUUID newID ()
 
static TYUUID fromString (QString id)
 
static QString toString (TYUUID &uuid)
 
static uint64 getConstructorCount ()
 
static uint64 getDestructorCount ()
 
static uint64 getIdGenerationCount ()
 
static bool getIsSavedOk ()
 
static void setIsSavedOk (const bool &toSave)
 
static void setRegenerateID (const bool &bRegenerate)
 
static bool getRegenerateID ()
 
- Static Public Member Functions inherited from OPrototype
static OPrototypefindAndClone (const char *className)
 
static int findPrototype (const char *className)
 
static OPrototypesafeDownCast (OPrototype *pObject)
 
static void add_factory (const char *, IOProtoFactory::ptr_type factory)
 
- Protected Member Functions inherited from OPrototype
 OPrototype ()
 
- Protected Attributes inherited from TYElement
QString _name
 Nom courant de l'element. More...
 
TYElement_pParent
 Reference sur l'element parent. More...
 
bool _bPutInInstanceList
 
unsigned int _copyCount
 
bool _inCurrentCalcul
 Indique si cet element est actif dans le Calcul courant. More...
 
bool _isAcousticModified
 Indicateur de modification acoustique. More...
 
bool _isGeometryModified
 Indicateur de modification de la geometrie. More...
 
LPTYElementGraphic _pGraphicObject
 L'object graphique metier associe a cet element. More...
 
void * _allUses
 Multi purpose void pointer (use for compatibility actually) More...
 
- Protected Attributes inherited from IRefCount
int m_refCount
 The reference counter. More...
 

Detailed Description

Classe de definition d'un polygone.

Definition at line 30 of file TYPolygon.h.

Constructor & Destructor Documentation

◆ TYPolygon() [1/3]

TYPolygon::TYPolygon ( )

Constructeur par defaut.

Definition at line 41 of file TYPolygon.cpp.

Here is the call graph for this function:

◆ TYPolygon() [2/3]

TYPolygon::TYPolygon ( const TYPolygon other)

Constructeur par copie.

Definition at line 48 of file TYPolygon.cpp.

◆ TYPolygon() [3/3]

TYPolygon::TYPolygon ( const TYTabPoint pts)

Constructeur a partir d'un tableau de points.

Definition at line 53 of file TYPolygon.cpp.

Here is the call graph for this function:

◆ ~TYPolygon()

TYPolygon::~TYPolygon ( )
virtual

Destructeur.

Definition at line 61 of file TYPolygon.cpp.

Member Function Documentation

◆ checkCoplanar()

bool TYPolygon::checkCoplanar ( ) const

Return true if the all the points of the polygon are coplanar.

Definition at line 384 of file TYPolygon.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ deepCopy()

bool TYPolygon::deepCopy ( const TYElement pOther,
bool  copyId = true,
bool  pUseCopyTag = false 
)
virtual

Effectue une copie en allouant de la memoire (deep copy) et non pas en copiant seulement les pointeurs (shallow copy). Cette methode s'utilise comme l'operateur egal. L'ID peut ne pas etre copie, le parent n'est jamais copie.

Parameters
pOtherL'element a copier.
copyIdCopie l'identifiant unique ou pas.
Returns
true si la copie est possible; false sinon.

Reimplemented from TYElement.

Definition at line 98 of file TYPolygon.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ exportMesh()

void TYPolygon::exportMesh ( std::deque< OPoint3D > &  points,
std::deque< OTriangle > &  triangles,
const TYGeometryNode geonode 
) const
virtual

Export the surface as a triangular mesh.

NB : This function expect empty deques and will clear the deque passed.

Parameters
pointsoutput argument filled with the vertices of the triangulation
trianglesoutput argument filled with the faces of the triangulation

Reimplemented from TYSurfaceInterface.

Definition at line 728 of file TYPolygon.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fromXML()

int TYPolygon::fromXML ( DOM_Element  domElement)
virtual

Extrait les informations a partir du noeud DOM passe afin de recuperer les parametres de la classe.

Parameters
domElementLe noeud DOM a partir duquel les parametres doivent etre recuperes.
Returns
1 si la recuperation des parametres a reussie.

Reimplemented from TYElement.

Definition at line 142 of file TYPolygon.cpp.

Here is the call graph for this function:

◆ getBoundingRect()

TYRectangle TYPolygon::getBoundingRect ( ) const

Calcul le rectangle englobant ce polygone.

Returns
Le rectangle englobant ce polygone.

Definition at line 442 of file TYPolygon.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBox()

virtual const OBox& TYPolygon::getBox ( ) const
inlinevirtual

Definition at line 173 of file TYPolygon.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCenter()

OPoint3D TYPolygon::getCenter ( ) const
inline

Definition at line 133 of file TYPolygon.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getContour()

TYTabPoint TYPolygon::getContour ( int  n = -1) const
virtual

Retourne un tableau de points correspondant au contour de cette surface.

Parameters
nLe nombre de portion pour le decoupage. Si n=-1, n sera calcule a partir de la precision de distance definie par defaut. Pour certaine surface, le nombre de portion demande ne sera pas forcement le nombre de points obtenus.
Returns
Un tableau de points representant le contour de cette surface.

Implements TYSurfaceInterface.

Definition at line 236 of file TYPolygon.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getNbPts()

size_t TYPolygon::getNbPts ( ) const
inline

Retourne le nombre de points composants ce polygone.

Definition at line 92 of file TYPolygon.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getOContour()

TYTabPoint3D TYPolygon::getOContour ( int  n = -1) const
virtual

Implements TYSurfaceInterface.

Definition at line 241 of file TYPolygon.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getORepere3D()

ORepere3D TYPolygon::getORepere3D ( ) const

Calcule le repere local a ce polygone par rapport au repere global.

Definition at line 418 of file TYPolygon.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPlan()

virtual const OPlan& TYPolygon::getPlan ( ) const
inlinevirtual

retourne le plan associe a cette surface

Definition at line 167 of file TYPolygon.h.

Here is the call graph for this function:

◆ getPoint()

OPoint3D TYPolygon::getPoint ( size_t  index) const
inline

Get d'un point dans collection de point

Definition at line 110 of file TYPolygon.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPoints() [1/2]

const TYTabPoint& TYPolygon::getPoints ( ) const
inline

Set/Get de la collection de points.

Definition at line 105 of file TYPolygon.h.

Here is the caller graph for this function:

◆ getPoints() [2/2]

TYTabPoint& TYPolygon::getPoints ( )
inline

Definition at line 106 of file TYPolygon.h.

◆ intersects() [1/4]

int TYPolygon::intersects ( const TYSurfaceInterface pSurf,
OSegment3D seg 
) const
virtual

Calcule le segment d'intersection avec une autre surface.

Parameters
pSurfLa surface dont on cherche l'intersection.
segLe segment resultant de l'intersection.
Returns
INTERS_OUI (1) si l'intersection existe, INTERS_CONFONDU (2) si les elements sont confondus, INTERS_NULLE (0) s'il n'y a pas d'intersection.

Reimplemented from TYSurfaceInterface.

Definition at line 255 of file TYPolygon.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ intersects() [2/4]

int TYPolygon::intersects ( const OSegment3D seg,
OPoint3D pt 
) const
virtual

Calcule le point d'intersection avec un segment.

Parameters
segLe segment dont on cherche l'intersection.
ptLe point resultant de l'intersection.
Returns
INTERS_OUI (1) si l'intersection existe, INTERS_CONFONDU (2) si les elements sont confondus, INTERS_NULLE (0) s'il n'y a pas d'intersection.

Implements TYSurfaceInterface.

Definition at line 260 of file TYPolygon.cpp.

Here is the call graph for this function:

◆ intersects() [3/4]

int TYPolygon::intersects ( const OSegment3D seg,
OPoint3D pt,
bool  insideTest 
) const
virtual

Definition at line 265 of file TYPolygon.cpp.

Here is the call graph for this function:

◆ intersects() [4/4]

int TYPolygon::intersects ( const OPoint3D pt) const
virtual

Test si le point se trouve a l'interieur de la surface, sur le meme plan.

Parameters
ptLe point pour lequel on effectue le test.
Returns
INTERS_OUI (1) si le point est a l'interieur de la surface, INTERS_NULLE (0) si le point est a l'exterieur de la surface.

Implements TYSurfaceInterface.

Definition at line 288 of file TYPolygon.cpp.

Here is the call graph for this function:

◆ inverseNormale()

void TYPolygon::inverseNormale ( )
virtual

Inverse la normale a la surface

Reimplemented from TYSurfaceInterface.

Definition at line 714 of file TYPolygon.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isConvex()

bool TYPolygon::isConvex ( ) const
inline

Get de l'attribut de convexite.

Definition at line 122 of file TYPolygon.h.

Here is the caller graph for this function:

◆ isInBox()

bool TYPolygon::isInBox ( const OPoint3D pt) const
inline

Teste si le point se trouve dans la boite du polygone.

Definition at line 126 of file TYPolygon.h.

Here is the call graph for this function:

◆ isInBox2D()

bool TYPolygon::isInBox2D ( const OPoint3D pt) const
inline

Teste si, vu de dessus, le point se trouve dans la boite du polygone.

Definition at line 131 of file TYPolygon.h.

Here is the call graph for this function:

◆ isInpolyXY()

int TYPolygon::isInpolyXY ( const TYTabPoint poly,
int  npoints,
double  xt,
double  yt 
) const
private

Definition at line 559 of file TYPolygon.cpp.

Here is the caller graph for this function:

◆ isInpolyXZ()

int TYPolygon::isInpolyXZ ( const TYTabPoint poly,
int  npoints,
double  xt,
double  yt 
) const
private

Definition at line 611 of file TYPolygon.cpp.

Here is the caller graph for this function:

◆ isInpolyYZ()

int TYPolygon::isInpolyYZ ( const TYTabPoint poly,
int  npoints,
double  xt,
double  yt 
) const
private

Definition at line 663 of file TYPolygon.cpp.

Here is the caller graph for this function:

◆ isValid()

bool TYPolygon::isValid ( ) const

Test si ce polygone est valide. Les points de ce polygone doivent appartenir au meme plan.

Returns
true si le polygon est valide; false sinon.

Definition at line 412 of file TYPolygon.cpp.

Here is the caller graph for this function:

◆ normal()

OVector3D TYPolygon::normal ( ) const
virtual

Calcule la normale a cette surface.

Implements TYSurfaceInterface.

Definition at line 226 of file TYPolygon.cpp.

Here is the caller graph for this function:

◆ operator!=()

bool TYPolygon::operator!= ( const TYPolygon other) const

Operateur !=.

Definition at line 93 of file TYPolygon.cpp.

Here is the call graph for this function:

◆ operator=()

TYPolygon & TYPolygon::operator= ( const TYPolygon other)

Operateur =.

Definition at line 66 of file TYPolygon.cpp.

Here is the call graph for this function:

◆ operator==()

bool TYPolygon::operator== ( const TYPolygon other) const

Operateur ==.

Definition at line 80 of file TYPolygon.cpp.

Here is the caller graph for this function:

◆ plan()

OPlan TYPolygon::plan ( ) const
virtual

Calcule le plan dans lequel cette surface est inscrit.

Implements TYSurfaceInterface.

Definition at line 231 of file TYPolygon.cpp.

Here is the caller graph for this function:

◆ purge()

void TYPolygon::purge ( )
inline

Vide le tableau de points.

Definition at line 87 of file TYPolygon.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setConvex()

void TYPolygon::setConvex ( bool  bConvex)
inline

Set de l'attribut de convexite.

Definition at line 118 of file TYPolygon.h.

◆ setPoints()

void TYPolygon::setPoints ( const TYTabPoint pts)

Set/Get de la collection de points.

Definition at line 374 of file TYPolygon.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ surface()

double TYPolygon::surface ( ) const
virtual

Calcule l'aire de la surface totale.

Implements TYSurfaceInterface.

Definition at line 169 of file TYPolygon.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toString()

std::string TYPolygon::toString ( ) const
virtual

Retourne une chaine de caractere donnant des informations sur cet objet (utile pour le debugage).

Returns
Une chaine de caractere informative sur cet objet.

Reimplemented from TYElement.

Definition at line 120 of file TYPolygon.cpp.

Here is the call graph for this function:

◆ toXML()

DOM_Element TYPolygon::toXML ( DOM_Element domElement)
virtual

Construit une arborescence DOM a partir du noeud passe afin de sauvegarder les parametres au format XML.

Parameters
domElementLe noeud DOM parent a partir duquel l'arborescence doit etre creee.
Returns
Le noeud DOM nouvellement cree.

Reimplemented from TYElement.

Definition at line 130 of file TYPolygon.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ transform()

void TYPolygon::transform ( const OMatrix matrix)

Transforme les points du polygone avec la matrice passee en parametre.

Definition at line 402 of file TYPolygon.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateBox()

void TYPolygon::updateBox ( )

Definition at line 534 of file TYPolygon.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateNormal()

void TYPolygon::updateNormal ( )

Definition at line 509 of file TYPolygon.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _bConvex

bool TYPolygon::_bConvex
private

Definition at line 199 of file TYPolygon.h.

◆ _box

OBox TYPolygon::_box
private

Definition at line 197 of file TYPolygon.h.

◆ _plan

OPlan TYPolygon::_plan
private

Definition at line 195 of file TYPolygon.h.

◆ _pts

TYTabPoint TYPolygon::_pts
private

Sommets.

Definition at line 193 of file TYPolygon.h.


The documentation for this class was generated from the following files: