55 if (TYAcousticSurfaceNode::operator!=(other))
70 return "TYAcousticRectangleNode";
118 if ((factorX == 0) || (factorX == 1))
124 scale(factorX, 1.0f);
131 if ((factorY == 0) || (factorY == 1))
137 scale(1.0f, factorY);
188 return makeGrid(nbCol, nbRow,
"TYAcousticRectangle");
195 if ((nbCol <= 0) || (nbRow <= 0) || (childType == NULL))
201 int nbCase = nbCol * nbRow;
215 for (
int i = 0; i < nbCase; i++)
221 double curRow = (int)(i / nbCol);
222 double curCol = (int)(i % nbCol);
224 OVector3D vec0 = (vecCol * curCol) + (vecRow * curRow);
225 OVector3D vec1 = (vecCol * (curCol + 1)) + (vecRow * curRow);
226 OVector3D vec3 = (vecRow * (curRow + 1)) + (vecCol * curCol);
227 OVector3D vec2 = (vecRow * (curRow + 1)) + (vecCol * (curCol + 1));
230 pAccRect->
getShape()->
_pts[0] = vecBoundingRectPt0 + vec0;
231 pAccRect->
getShape()->
_pts[1] = vecBoundingRectPt0 + vec1;
232 pAccRect->
getShape()->
_pts[2] = vecBoundingRectPt0 + vec2;
246 assert(pAccRectGeoNode);
247 assert(pAccRectGeoNode->getElement());
254 ORepere3D repRect = pAccRectGeoNode->getORepere3D();
323 unsigned int i = 0, j = 0;
329 for (i = 0; i < childs.size(); i++)
335 TYTabAcousticSurfaceGeoNode::iterator iter;
378 for (j = 0; j < 4; j++)
386 pRectGlobal->
_pts[j].
_z = 0.0;
388 pRectSub->
_pts[j] = pRectGlobal->
_pts[j];
391 tabGlobal.push_back(pRectGlobal);
392 tabSub.push_back(pRectSub);
398 for (i = 0; i < tabGlobal.size(); i++)
405 tabGlobal[i]->_pts[3]._x = rect.
_pts[1].
_x;
416 tabGlobal[i]->_pts[1]._x = rect.
_pts[0].
_x;
417 tabGlobal[i]->_pts[2]._x = rect.
_pts[0].
_x;
429 tabGlobal[i]->_pts[3]._y = rect.
_pts[0].
_y;
430 tabGlobal[i]->_pts[2]._y = rect.
_pts[0].
_y;
441 tabGlobal[i]->_pts[0]._y = rect.
_pts[2].
_y;
442 tabGlobal[i]->_pts[1]._y = rect.
_pts[2].
_y;
453 for (i = 0; i < tabGlobal.size(); i++)
459 double lMax = pGlobalRect->
getSizeX();
460 double hRect = pSubRect->
getSizeY();
464 double longueur = lMax;
531 const double epsilon = 1E-3;
532 double longueur = 0.0;
533 double shortest = 1E6;
540 for (i = 0; i < tabGlobal.size(); i++)
542 if (tabGlobal[i] != currentRect)
544 longueur = currentRect->
_pts[0].
_x - tabGlobal[i]->_pts[1]._x;
546 if ((longueur >= 0.0) &&
547 (
ABS(longueur) < shortest))
551 test.
_pts[0].
_x = tabGlobal[i]->_pts[1]._x - epsilon;
552 test.
_pts[3].
_x = tabGlobal[i]->_pts[2]._x - epsilon;
556 shortest =
ABS(longueur);
557 rect = *tabGlobal[i];
566 for (i = 0; i < tabGlobal.size(); i++)
568 if (tabGlobal[i] != currentRect)
570 longueur = currentRect->
_pts[1].
_x - tabGlobal[i]->_pts[0]._x;
572 if ((longueur <= 0.0) && (
ABS(longueur) < shortest))
576 test.
_pts[1].
_x = tabGlobal[i]->_pts[0]._x + epsilon;
577 test.
_pts[2].
_x = tabGlobal[i]->_pts[3]._x + epsilon;
581 shortest =
ABS(longueur);
582 rect = *tabGlobal[i];
594 for (i = 0; i < tabGlobal.size(); i++)
596 if (tabGlobal[i] != currentRect)
598 longueur = currentRect->
_pts[2].
_y - tabGlobal[i]->_pts[1]._y;
600 if ((longueur >= 0.0) && (
ABS(longueur) < shortest))
604 test.
_pts[3].
_y = tabGlobal[i]->_pts[0]._y - epsilon;
605 test.
_pts[2].
_y = tabGlobal[i]->_pts[1]._y - epsilon;
609 shortest =
ABS(longueur);
610 rect = *tabGlobal[i];
619 for (i = 0; i < tabGlobal.size(); i++)
621 if (tabGlobal[i] != currentRect)
623 longueur = currentRect->
_pts[1].
_y - tabGlobal[i]->_pts[2]._y;
625 if ((longueur <= 0.0) && (
ABS(longueur) < shortest))
629 test.
_pts[0].
_y = tabGlobal[i]->_pts[3]._y + epsilon;
630 test.
_pts[1].
_y = tabGlobal[i]->_pts[2]._y + epsilon;
634 shortest =
ABS(longueur);
635 rect = *tabGlobal[i];
double ABS(double a)
Return the absolute value.
Representation graphique d'un ensemble de rectangles acoustiques (fichier header)
TY_EXT_GRAPHIC_INST(TYAcousticRectangleNode)
TY_EXTENSION_INST(TYAcousticRectangleNode)
std::vector< LPTYRectangle > TYTabLPRectangle
TYGeometryNode TYAcousticRectangleGeoNode
Noeud geometrique de type TYAcousticRectangle.
TYGeometryNode TYAcousticSurfaceGeoNode
Noeud geometrique de type TYAcousticSurface.
std::vector< LPTYElement > LPTYElementArray
std::vector< LPTYSourcePonctuelleGeoNode > TYTabSourcePonctuelleGeoNode
Collection de noeuds geometriques de type TYSourcePonctuelle.
double _y
y coordinate of OCoord3D
double _z
z coordinate of OCoord3D
double _x
x coordinate of OCoord3D
static int findPrototype(const char *className)
virtual const char * getClassName() const
static OPrototype * safeDownCast(OPrototype *pObject)
static OPrototype * findAndClone(const char *className)
3D frame with a point and 3 vectors.
OPoint3D _origin
The origin point.
virtual std::string toString() const
virtual DOM_Element toXML(DOM_Element &domElement)
bool findNearestRect(const LPTYRectangle currentRect, const TYTabLPRectangle tabGlobal, const short signe, const short dir, TYRectangle &rect)
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
bool addSubRect(LPTYAcousticRectangleGeoNode pAccRectGeoNode)
TYAcousticRectangleNode()
void getSize(float &sizeX, float &sizeY)
virtual TYTabSourcePonctuelleGeoNode getSrcs() const
bool operator==(const TYAcousticRectangleNode &other) const
Operateur ==.
virtual ~TYAcousticRectangleNode()
void scale(float factorX, float factorY)
virtual void setSize(float sizeX, float sizeY)
virtual TYSourcePonctuelle srcPonctEquiv() const
virtual void updateGrid()
bool operator!=(const TYAcousticRectangleNode &other) const
Operateur !=.
virtual bool remAcousticSurf(const LPTYAcousticSurfaceGeoNode pAccSurfGeoNode)
TYAcousticRectangleNode & operator=(const TYAcousticRectangleNode &other)
Operateur =.
virtual double activeSurface()
virtual void setSizeX(float sizeX)
virtual bool makeGrid(int nbCol, int nbRow)
virtual void distriSrcs()
virtual void setSizeY(float sizeY)
virtual void remAllSrcs()
virtual int fromXML(DOM_Element domElement)
virtual void distriSrcs()
virtual void remAllSrcs()
virtual double activeSurface() const
virtual int fromXML(DOM_Element domElement)
virtual bool remAcousticSurf(const LPTYAcousticSurfaceGeoNode pAccSurfGeoNode)
LPTYRectangle _pBoundingRect
Rectangle englobant.
TYAcousticSurfaceNode & operator=(const TYAcousticSurfaceNode &other)
Operateur =.
LPTYRectangle getBoundingRect()
TYTabAcousticSurfaceGeoNode _tabAcousticSurf
Tableau des AcousticSurfaces.
virtual void getChilds(LPTYElementArray &childs, bool recursif=true)
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
virtual DOM_Element toXML(DOM_Element &domElement)
bool addAcousticSurf(LPTYAcousticSurfaceGeoNode pAccSurfGeoNode)
virtual TYTabSourcePonctuelleGeoNode getSrcs() const
TYRectangle * getBoundingRect()
void setIsSub(bool isSub)
virtual void setColor(const OColor &color)
virtual bool isInCurrentCalcul()
QString _name
Nom courant de l'element.
void setParent(TYElement *pParent)
virtual void setIsGeometryModified(bool isModified)
QString generateName(const char *classname)
Retourne le nom de la classe associe a un nombre.
static TYNameManager * get()
Retourne l'instance singleton.
void setSize(float sizeX, float sizeY)
void scale(float factorX, float factorY)
void setDimension(float lon, float haut)
bool intersectRect(LPTYRectangle pRect, TYPoint originRect=TYPoint(0, 0, 0), TYPoint origin=TYPoint(0, 0, 0))
base_vec3< decimal > vec3