53 pTYElementGraphic = getElement()->getTopographie()->getGraphicObject().getRealPointer();
54 childs.push_back(pTYElementGraphic);
57 pTYElementGraphic->
getChilds(childs, recursif);
60 pTYElementGraphic = getElement()->getInfrastructure()->getGraphicObject().getRealPointer();
61 childs.push_back(pTYElementGraphic);
64 pTYElementGraphic->
getChilds(childs, recursif);
70 for (
unsigned int i = 0; i < TabSite.size(); i++)
72 pTYElementGraphic = TabSite.at(i)->getGraphicObject().getRealPointer();
73 childs.push_back(pTYElementGraphic);
76 pTYElementGraphic->
getChilds(childs, recursif);
83 if (!getElement()->isInCurrentCalcul())
90 if ((getElement()->getUseTopoFile()) && (
_visible))
94 const char* sTopoFile = TopoFile.data();
103 QImage img(sTopoFile);
106 QImage glImg = QGLWidget::convertToGLFormat(img);
111 int tabSize = glImg.bytesPerLine() * glImg.height();
120 glColor3f(1.0, 1.0, 1.0);
125 glBindTexture(GL_TEXTURE_2D,
_texture);
127 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
128 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
130 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
131 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
133 GLenum format = GL_LUMINANCE;
138 format = GL_LUMINANCE;
141 format = GL_LUMINANCE_ALPHA;
151 glTexImage2D(GL_TEXTURE_2D, 0, internalFormat,
_imgXSize,
_imgYSize, 0, format, GL_UNSIGNED_BYTE,
156 glAlphaFunc(GL_GREATER, (GLclampf)0);
157 glEnable(GL_ALPHA_TEST);
159 TYPoint pt = getElement()->getPosition();
162 float fImgZOffset = 0.0f;
163 if (getElement()->getUseEmpriseAsCrbNiv())
165 fImgZOffset = (float)getElement()->getAltiEmprise();
169 OVector3D vecOrientation = getElement()->getOrientation().toVector3D();
172 if (vecOrientation.
norme() != 0)
175 angle =
SIGNE(vecOrientation.
_y) * acos(vecOrientation.
_x / vecOrientation.
norme());
176 angle = (
M_PI / 2.0) - angle;
179 float x =
_imgXSize / 2 * getElement()->getEchelle();
180 float y =
_imgYSize / 2 * getElement()->getEchelle();
182 glTranslatef(0.0f, 0.0f, fImgZOffset);
183 glEnable(GL_TEXTURE_2D);
185 glBindTexture(GL_TEXTURE_2D,
_texture);
187 glRotatef(angle * 180 /
M_PI, 0.0, 0.0, 1.0);
190 glTexCoord2f(0.0, 0.0);
191 glVertex3f(pt.
_x - x, pt.
_y - y, pt.
_z);
193 glTexCoord2f(0.0, 1.0);
194 glVertex3f(pt.
_x - x, pt.
_y + y, pt.
_z);
196 glTexCoord2f(1.0, 1.0);
197 glVertex3f(pt.
_x + x, pt.
_y + y, pt.
_z);
199 glTexCoord2f(1.0, 0.0);
200 glVertex3f(pt.
_x + x, pt.
_y - y, pt.
_z);
205 glDisable(GL_TEXTURE_2D);
207 glTranslatef(0.0f, 0.0f, -fImgZOffset);
210 ->setBackgroundImage(
_sOldTopoFile, x, y, pt, vecOrientation);
214 if (!getElement()->getUseTopoFile())
217 ->unsetBackgroundImage();
220 getElement()->getTopographie()->getGraphicObject()->display(pModelerElement, mode);
221 getElement()->getInfrastructure()->getGraphicObject()->display(pModelerElement, mode);
225 glTranslatef(0.0f, 0.0f, 0.01f);
227 for (
unsigned int i = 0; i < TabSite.size(); i++)
231 if (TabSite.at(i)->getElement()->isInCurrentCalcul())
233 TabSite.at(i)->getGraphicObject()->display(pModelerElement, mode);
237 glTranslatef(0.0f, 0.0f, -0.01f);
241 void TYSiteNodeGraphic::connectUpdateSignal(QObject* pReceiver,
const char* member)
248 void TYSiteNodeGraphic::disconnectUpdateSignal(QObject* pReceiver,
const char* member)
double SIGNE(double a)
Return the number sign.
list< TYElementGraphic * > TYListPtrTYElementGraphic
List de pointeur de TYElement.
Representation graphique d'un ensemble de sites (fichier header)
std::vector< LPTYSiteNodeGeoNode > TYTabSiteNodeGeoNode
Collection de noeuds geometriques de type TYSiteNode.
Representation graphique d'une topographie (fichier header)
double _y
y coordinate of OCoord3D
double _z
z coordinate of OCoord3D
double _x
x coordinate of OCoord3D
double norme() const
Computes the length of this vector.
classe graphique pour un element de base
bool _visible
Inique si l'element est visible.
virtual void update(bool force=false)
virtual void getChilds(TYListPtrTYElementGraphic &childs, bool recursif=true)
virtual void display(TYElement *pModelerElement=nullptr, GLenum mode=GL_RENDER)
virtual void update(bool force=false)
unsigned char * _imgDataPtr
virtual void display(TYElement *pModelerElement=nullptr, GLenum mode=GL_RENDER)
TYSiteNodeGraphic(TYSiteNode *pElement)
virtual void getChilds(TYListPtrTYElementGraphic &childs, bool recursif=true)
virtual ~TYSiteNodeGraphic()
std::string getTopoFileName() const
TYTabSiteNodeGeoNode & getListSiteNode()
classe graphique pour une topographie