34 #define IMG(id) OLocalizator::getPicture("TYElementGraphic", (id))
66 if (
getModified() && pParent && pParent->getGraphicObject())
71 pParent->getGraphicObject()->updateTree();
133 glColor3f(1.0f, 0.5f, 0.0f);
137 glBegin(GL_LINE_STRIP);
138 glVertex3f(p1.
_x, p1.
_y, p1.
_z);
139 glVertex3f(p2.
_x, p2.
_y, p2.
_z);
160 glColor3f(1.0f, 1.0f, 0.5f);
164 glBegin(GL_LINE_LOOP);
165 glVertex3f(org[0] + x, org[1] - y, org[2] - z);
166 glVertex3f(org[0] - x, org[1] - y, org[2] - z);
167 glVertex3f(org[0] - x, org[1] + y, org[2] - z);
168 glVertex3f(org[0] + x, org[1] + y, org[2] - z);
170 glBegin(GL_LINE_LOOP);
171 glVertex3f(org[0] + x, org[1] - y, org[2] + z);
172 glVertex3f(org[0] - x, org[1] - y, org[2] + z);
173 glVertex3f(org[0] - x, org[1] + y, org[2] + z);
174 glVertex3f(org[0] + x, org[1] + y, org[2] + z);
176 glBegin(GL_LINE_STRIP);
177 glVertex3f(org[0] + x, org[1] - y, org[2] - z);
178 glVertex3f(org[0] + x, org[1] - y, org[2] + z);
180 glBegin(GL_LINE_STRIP);
181 glVertex3f(org[0] - x, org[1] - y, org[2] - z);
182 glVertex3f(org[0] - x, org[1] - y, org[2] + z);
184 glBegin(GL_LINE_STRIP);
185 glVertex3f(org[0] - x, org[1] + y, org[2] - z);
186 glVertex3f(org[0] - x, org[1] + y, org[2] + z);
188 glBegin(GL_LINE_STRIP);
189 glVertex3f(org[0] + x, org[1] + y, org[2] - z);
190 glVertex3f(org[0] + x, org[1] + y, org[2] + z);
193 glVertex3f(org[0] + x, org[1] - y, org[2] - z);
194 glVertex3f(org[0] - x, org[1] - y, org[2] - z);
195 glVertex3f(org[0] - x, org[1] + y, org[2] - z);
196 glVertex3f(org[0] + x, org[1] + y, org[2] - z);
197 glVertex3f(org[0] + x, org[1] - y, org[2] + z);
198 glVertex3f(org[0] - x, org[1] - y, org[2] + z);
199 glVertex3f(org[0] - x, org[1] + y, org[2] + z);
200 glVertex3f(org[0] + x, org[1] + y, org[2] + z);
217 if (pGeoNode !=
nullptr)
227 NxVec3(org[0] * mat.
_m[0][0] + org[1] * mat.
_m[0][1] + org[2] * mat.
_m[0][2] + mat.
_m[0][3],
228 org[0] * mat.
_m[2][0] + org[1] * mat.
_m[2][1] + org[2] * mat.
_m[2][2] + mat.
_m[2][3],
229 -(org[0] * mat.
_m[1][0] + org[1] * mat.
_m[1][1] + org[2] * mat.
_m[1][2] + mat.
_m[1][3]));
233 origin =
NxVec3(org[0], org[2], -org[1]);
270 glColor4f(1.0f, 1.0f, 0.0f, 0.1f);
274 glVertex3d(org[0] + x, org[1] + y, org[2] - z);
275 glVertex3d(org[0] - x, org[1] + y, org[2] - z);
276 glVertex3d(org[0] - x, org[1] + y, org[2] + z);
277 glVertex3d(org[0] + x, org[1] + y, org[2] + z);
279 glVertex3f(org[0] + x, org[1] - y, org[2] + z);
280 glVertex3f(org[0] - x, org[1] - y, org[2] + z);
281 glVertex3f(org[0] - x, org[1] - y, org[2] - z);
282 glVertex3f(org[0] + x, org[1] - y, org[2] - z);
284 glVertex3f(org[0] + x, org[1] + y, org[2] + z);
285 glVertex3f(org[0] - x, org[1] + y, org[2] + z);
286 glVertex3f(org[0] - x, org[1] - y, org[2] + z);
287 glVertex3f(org[0] + x, org[1] - y, org[2] + z);
289 glVertex3f(org[0] + x, org[1] - y, org[2] - z);
290 glVertex3f(org[0] - x, org[1] - y, org[2] - z);
291 glVertex3f(org[0] - x, org[1] + y, org[2] - z);
292 glVertex3f(org[0] + x, org[1] + y, org[2] - z);
294 glVertex3f(org[0] - x, org[1] + y, org[2] + z);
295 glVertex3f(org[0] - x, org[1] + y, org[2] - z);
296 glVertex3f(org[0] - x, org[1] - y, org[2] - z);
297 glVertex3f(org[0] - x, org[1] - y, org[2] + z);
299 glVertex3f(org[0] + x, org[1] + y, org[2] - z);
300 glVertex3f(org[0] + x, org[1] + y, org[2] + z);
301 glVertex3f(org[0] + x, org[1] - y, org[2] + z);
302 glVertex3f(org[0] + x, org[1] - y, org[2] - z);
319 GLint slices, GLint loops)
321 gluDisk(qobj, innerRadius, outerRadius, slices, loops);
325 GLdouble height, GLint slices, GLint stacks)
327 gluCylinder(qobj, baseRadius, topRadius, height, slices, stacks);
331 GLdouble outerRadius, GLint slices, GLint loops,
332 GLdouble startAngle, GLdouble sweepAngle)
334 gluPartialDisk(qobj, innerRadius, outerRadius, slices, loops, startAngle, sweepAngle);
367 for (
int i = 0; i < childs.size(); i++)
369 childs[i]->getGraphicObject()->setVisible(visible);
380 TYListPtrTYElementGraphic::iterator ite;
383 for (ite = childs.begin(); ite != childs.end(); ite++)
389 boundingBox = pChild->
GetBox();
Representation graphique d'un element de base (fichier header)
list< TYElementGraphic * > TYListPtrTYElementGraphic
List de pointeur de TYElement.
std::vector< LPTYElement > LPTYElementArray
virtual void Enlarge(const OPoint3D &pt)
Enlarge the box with the point if the point is outside the box.
OPoint3D _min
Minimal coordinates of the OBox.
OPoint3D _max
Maximal coordinates of the OBox.
static const OColor BLACK
double _y
y coordinate of OCoord3D
double _z
z coordinate of OCoord3D
double _x
x coordinate of OCoord3D
static NxVec3 worldToDisplay(NxVec3 world)
void setVisibility(bool bVisible)
void setDisplayPosition(double displayPositionX, double displayPositionY)
void setPoint1(const OPoint3D &point1)
void setColor(const OColor &oColor)
void setLineWidth(float lineWidth)
void setPoint2(const OPoint3D &point2)
void setColor(const OColor &oColor)
void setTextToDisplay(const QString &qsText)
void setFont(const QString &qsFontPath)
double _m[4][4]
The 4x4 matrix array.
classe graphique pour un element de base
void drawName(TYElement *pModelerElement=nullptr)
void glVertex3fAndEnlargeBB(GLfloat x, GLfloat y, GLfloat z)
void glVertex3dAndEnlargeBB(GLdouble x, GLdouble y, GLdouble z)
virtual void computeBoundingBox()
bool _modified
Indique si l'element associe a ete modifie.
static OBox _globalBoundingBox
void gluPartialDiskAndEnlargeBB(GLUquadric *qobj, GLdouble innerRadius, GLdouble outerRadius, GLint slices, GLint loops, GLdouble startAngle, GLdouble sweepAngle)
bool _visible
Inique si l'element est visible.
void setModified(bool modified=true)
void setRecursiveVisible(bool visible=true)
static bool _gDrawNormals
Indique si les normals doivent etre visible.
bool _texture
Indique si le texturing est active pour cet element.
TYElementGraphic(TYElement *pElt)
bool _highlight
Indique si le highlight est active pour cet element.
void displayNormal(OVector3D normal, OPoint3D p1)
virtual void update(bool force=false)
static bool _gDrawPlafond
Indique si les plafonds doivent etre visible.
virtual void getChilds(TYListPtrTYElementGraphic &childs, bool recursif=true)
void setElement(TYElement *pElt)
virtual void display(TYElement *pModelerElement=nullptr, GLenum mode=GL_RENDER)
TYElement * _pElement
L'element metier auquel cet element graphique metier est associe.
void gluDiskAndEnlargeBB(GLUquadric *qobj, GLdouble innerRadius, GLdouble outerRadius, GLint slices, GLint loops)
void viewOnlyHighlight(bool state=true)
void gluCylinderAndEnlargeBB(GLUquadric *qobj, GLdouble baseRadius, GLdouble topRadius, GLdouble height, GLint slices, GLint stacks)
bool getModified(bool andReset=false)
void highlight(bool state=true)
virtual ~TYElementGraphic()
bool _viewOnlyHighlight
Inique si on affiche la bounding box seule.
void drawLineBoundingBox()
TYElement * getParent() const
virtual bool isInCurrentCalcul()
virtual QString getName() const
virtual void getChilds(LPTYElementArray &childs, bool recursif=true)
virtual void setIsGeometryModified(bool isModified)
OMatrix localToGlobal() const
OMatrix localToGeoNode(TYGeometryNode *pGeoNode) const
static TYGeometryNode * GetGeoNode(TYElement *pElement)