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

#include <TYRectangle.h>

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

Public Member Functions

 TYRectangle ()
 
 TYRectangle (const TYRectangle &other)
 
 TYRectangle (const TYPoint &pt0, const TYPoint &pt1, const TYPoint &pt2, const TYPoint &pt3)
 
 TYRectangle (const TYSegment &seg0, const TYSegment &seg1)
 
virtual ~TYRectangle ()
 
void set (TYPoint pt0, TYPoint pt1, TYPoint pt2, TYPoint pt3)
 
void setDimension (float lon, float haut)
 
void setSize (float sizeX, float sizeY)
 
void getSize (float &sizeX, float &sizeY)
 
float getSizeX ()
 
float getSizeY ()
 
double getMinX () const
 
double getMinY () const
 
double getMaxY () const
 
double getDiagSize ()
 
double getCircleEqDiameter ()
 
void scale (float factorX, float factorY)
 
void scale (float factor)
 
bool intersectRect (LPTYRectangle pRect, TYPoint originRect=TYPoint(0, 0, 0), TYPoint origin=TYPoint(0, 0, 0))
 
TYRectangleoperator= (const TYRectangle &other)
 Operateur =. More...
 
bool operator== (const TYRectangle &other) const
 Operateur ==. More...
 
bool operator!= (const TYRectangle &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 OPoint3D &pt) const
 
bool isValid () const
 
ORepere3D getORepere3D () const
 
TYPolygontoPolygon () const
 
virtual const OPlangetPlan () const
 
virtual void inverseNormale ()
 
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
 

Public Attributes

TYPoint _pts [4]
 Sommets. More...
 
OPlan _plan
 
OBox _box
 
OVector3D _normale
 

Static Public Attributes

static const int _nbPts = 4
 

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 rectangle.

Definition at line 32 of file TYRectangle.h.

Constructor & Destructor Documentation

◆ TYRectangle() [1/4]

TYRectangle::TYRectangle ( )

Constructeur par defaut.

Definition at line 34 of file TYRectangle.cpp.

Here is the call graph for this function:

◆ TYRectangle() [2/4]

TYRectangle::TYRectangle ( const TYRectangle other)

Constructeur par copie.

Definition at line 44 of file TYRectangle.cpp.

◆ TYRectangle() [3/4]

TYRectangle::TYRectangle ( const TYPoint pt0,
const TYPoint pt1,
const TYPoint pt2,
const TYPoint pt3 
)

Constructeur a partir de 4 points.

             0-----------1
             |           |
             |           |
             |           |
             3-----------2
Parameters
pt0Le point 0 du rectangle.
pt1Le point 1 du rectangle.
pt2Le point 2 du rectangle.
pt3Le point 3 du rectangle.

Definition at line 49 of file TYRectangle.cpp.

Here is the call graph for this function:

◆ TYRectangle() [4/4]

TYRectangle::TYRectangle ( const TYSegment seg0,
const TYSegment seg1 
)

Constructeur a partir du premier segment (n°0, segment directeur) et du second segment (n°1). Le point B du segment 0 et le point A du segment 1 doivent evidement etre confondus.

             ----- 0 -----
             |           |
             3           1
             |           |
             ----- 2 -----
Parameters
seg0Le segment 0 du rectangle (segment directeur).
seg1Le segment 1 du rectangle.

Definition at line 77 of file TYRectangle.cpp.

Here is the call graph for this function:

◆ ~TYRectangle()

TYRectangle::~TYRectangle ( )
virtual

Destructeur.

Definition at line 112 of file TYRectangle.cpp.

Member Function Documentation

◆ deepCopy()

bool TYRectangle::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 387 of file TYRectangle.cpp.

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

◆ exportMesh()

void TYRectangle::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 654 of file TYRectangle.cpp.

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

◆ fromXML()

int TYRectangle::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 442 of file TYRectangle.cpp.

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

◆ getCircleEqDiameter()

double TYRectangle::getCircleEqDiameter ( )

Retourne le diametre du cercle de surface equivalente

Returns
un double

Definition at line 267 of file TYRectangle.cpp.

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

◆ getContour()

TYTabPoint TYRectangle::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 510 of file TYRectangle.cpp.

Here is the caller graph for this function:

◆ getDiagSize()

double TYRectangle::getDiagSize ( )

Retourne la longueur de la diagonale du rectangle

Returns
la longueur de la diagonale

Definition at line 259 of file TYRectangle.cpp.

Here is the caller graph for this function:

◆ getMaxY()

double TYRectangle::getMaxY ( ) const

Retourne la valeur max en Y

Definition at line 218 of file TYRectangle.cpp.

◆ getMinX()

double TYRectangle::getMinX ( ) const

Retourne la valeur min en X

Definition at line 194 of file TYRectangle.cpp.

Here is the caller graph for this function:

◆ getMinY()

double TYRectangle::getMinY ( ) const

Retourne la valeur min en Y

Definition at line 206 of file TYRectangle.cpp.

Here is the caller graph for this function:

◆ getOContour()

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

Implements TYSurfaceInterface.

Definition at line 522 of file TYRectangle.cpp.

Here is the caller graph for this function:

◆ getORepere3D()

ORepere3D TYRectangle::getORepere3D ( ) const

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

Definition at line 615 of file TYRectangle.cpp.

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

◆ getPlan()

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

retourne le plan associe a cette surface

Definition at line 239 of file TYRectangle.h.

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

◆ getSize()

void TYRectangle::getSize ( float &  sizeX,
float &  sizeY 
)

Retourne les dimensions de ce rectangle node.

Parameters
sizeXLa taille en X.
sizeYLa taille en Y.

Definition at line 178 of file TYRectangle.cpp.

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

◆ getSizeX()

float TYRectangle::getSizeX ( )

Retourne la taille en X de ce rectangle node.

Returns
La taille en X.

Definition at line 184 of file TYRectangle.cpp.

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

◆ getSizeY()

float TYRectangle::getSizeY ( )

Retourne la taille en Y de ce rectangle node.

Returns
La taille en Y.

Definition at line 189 of file TYRectangle.cpp.

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

◆ intersectRect()

bool TYRectangle::intersectRect ( LPTYRectangle  pRect,
TYPoint  originRect = TYPoint(0, 0, 0),
TYPoint  origin = TYPoint(0, 0, 0) 
)

Test l'intersection avec un autre rectangle.

Parameters
pRectL'autre rectangle.
originRectL'origine du repere a appliquer a l'autre rectangle.
originL'origine du repere a appliquer au rectangle.
Returns
1 si l'intersection existe, 0 sinon.

Definition at line 273 of file TYRectangle.cpp.

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

◆ intersects() [1/3]

int TYRectangle::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 534 of file TYRectangle.cpp.

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

◆ intersects() [2/3]

int TYRectangle::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 539 of file TYRectangle.cpp.

Here is the call graph for this function:

◆ intersects() [3/3]

int TYRectangle::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 556 of file TYRectangle.cpp.

Here is the call graph for this function:

◆ inverseNormale()

void TYRectangle::inverseNormale ( )
virtual

Inverse la normale a la surface

Reimplemented from TYSurfaceInterface.

Definition at line 642 of file TYRectangle.cpp.

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

◆ isValid()

bool TYRectangle::isValid ( ) const

Test si ce rectangle est valide. Les 4 points de ce rectangle doivent appartenir au meme plan, et les 4 angles doivent etre droits.

Returns
true si le rectangle est valide; false sinon.

Definition at line 574 of file TYRectangle.cpp.

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

◆ normal()

OVector3D TYRectangle::normal ( ) const
virtual

Calcule la normale a cette surface.

Implements TYSurfaceInterface.

Definition at line 492 of file TYRectangle.cpp.

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

◆ operator!=()

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

Operateur !=.

Definition at line 382 of file TYRectangle.cpp.

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

◆ operator=()

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

Operateur =.

Definition at line 337 of file TYRectangle.cpp.

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

◆ operator==()

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

Operateur ==.

Definition at line 368 of file TYRectangle.cpp.

Here is the caller graph for this function:

◆ plan()

OPlan TYRectangle::plan ( ) const
virtual

Calcule le plan dans lequel cette surface est inscrit.

Implements TYSurfaceInterface.

Definition at line 505 of file TYRectangle.cpp.

Here is the caller graph for this function:

◆ scale() [1/2]

void TYRectangle::scale ( float  factorX,
float  factorY 
)

Applique un facteur d'echelle au rectangle.

Parameters
factorXLe facteur d'echelle en X.
factorYLe facteur d'echelle en Y.

Definition at line 230 of file TYRectangle.cpp.

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

◆ scale() [2/2]

void TYRectangle::scale ( float  factor)
inline

Applique un facteur d'echelle au rectangle.

Parameters
factorLe facteur d'echelle.

Definition at line 176 of file TYRectangle.h.

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

◆ set()

void TYRectangle::set ( TYPoint  pt0,
TYPoint  pt1,
TYPoint  pt2,
TYPoint  pt3 
)

Assigne des valeurs a l'objet.

Parameters
pt0Le point 0 du rectangle.
pt1Le point 1 du rectangle.
pt2Le point 2 du rectangle.
pt3Le point 3 du rectangle.

Definition at line 116 of file TYRectangle.cpp.

Here is the call graph for this function:

◆ setDimension()

void TYRectangle::setDimension ( float  lon,
float  haut 
)

Definit les points de l'objet a partir de ses dimensions.

Parameters
lonLa longueur du rectangle.
hautLa hauteur du rectangle.

Definition at line 143 of file TYRectangle.cpp.

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

◆ setSize()

void TYRectangle::setSize ( float  sizeX,
float  sizeY 
)

Idem setDimension(). Redimensionne le rectangle node en appliquant le meme facteur d'echelle aux sous rectangles.

Parameters
sizeXLa nouvelle taille en X.
sizeYLa nouvelle taille en Y.

Definition at line 173 of file TYRectangle.cpp.

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

◆ surface()

double TYRectangle::surface ( ) const
virtual

Calcule l'aire de la surface totale.

Implements TYSurfaceInterface.

Definition at line 483 of file TYRectangle.cpp.

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

◆ toPolygon()

TYPolygon * TYRectangle::toPolygon ( ) const

Convertit ce rectangle en un polygone. Remqarque : L'appelant est responsable de la gestion de la memoire de l'element retourne.

Returns
Un nouveau polygone representant ce rectangle.

Definition at line 630 of file TYRectangle.cpp.

Here is the caller graph for this function:

◆ toString()

std::string TYRectangle::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 420 of file TYRectangle.cpp.

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

◆ toXML()

DOM_Element TYRectangle::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 430 of file TYRectangle.cpp.

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

Member Data Documentation

◆ _box

OBox TYRectangle::_box

Definition at line 263 of file TYRectangle.h.

◆ _nbPts

const int TYRectangle::_nbPts = 4
static

Definition at line 266 of file TYRectangle.h.

◆ _normale

OVector3D TYRectangle::_normale

Definition at line 264 of file TYRectangle.h.

◆ _plan

OPlan TYRectangle::_plan

Definition at line 262 of file TYRectangle.h.

◆ _pts

TYPoint TYRectangle::_pts[4]

Sommets.

Definition at line 261 of file TYRectangle.h.


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