24 #pragma warning(disable : 4284)
39 #define IMG(id) OLocalizator::getPicture("TYAltimetrieGraphic", (id))
43 float hueRange[2] = {0.4f, 0.15f};
44 float saturationRange[2] = {1.0f, 0.8f};
45 float valueRange[2] = {0.5f, 0.25f};
72 float hsvMinValue[3] = {80.0f, 255.0f, 255.0f};
73 float hsvMaxValue[3] = {120.0f, 255.0f, 112.0f};
81 hsvMinValue[1], hsvMinValue[2]);
83 hsvMaxValue[1], hsvMaxValue[2]);
88 hsvMinValue[1], hsvMinValue[2]);
90 hsvMaxValue[1], hsvMaxValue[2]);
102 for (
int i = 0; i < getElement()->getListFaces().size(); i++)
104 TYElementGraphic* pTYElementGraphic = getElement()->getFace(i)->getGraphicObject();
105 childs.push_back(pTYElementGraphic);
108 pTYElementGraphic->
getChilds(childs, recursif);
118 for (
int i = 0; i < getElement()->getListFaces().size(); i++)
121 (
float)(getElement()->getFace(i)->getPoints()[0]._y),
122 (
float)(getElement()->getFace(i)->getPoints()[0]._z));
124 (
float)(getElement()->getFace(i)->getPoints()[1]._y),
125 (
float)(getElement()->getFace(i)->getPoints()[1]._z));
127 (
float)(getElement()->getFace(i)->getPoints()[2]._y),
128 (
float)(getElement()->getFace(i)->getPoints()[2]._z));
134 if (getElement() == NULL)
143 if (mode == GL_SELECT)
150 double zmin = NAN, zmax = NAN, zrange = NAN;
153 zrange = zmax - zmin;
154 double color0[3], color1[3], color2[3];
165 glEnable(GL_TEXTURE_2D);
168 for (
int i = 0; i < getElement()->getListFaces().size(); i++)
172 scalar = (getElement()->getFace(i)->getPoints()[0]._z - zmin) / zrange;
174 color0[0] = oColor0.
r;
175 color0[1] = oColor0.
g;
176 color0[2] = oColor0.
b;
178 scalar = (getElement()->getFace(i)->getPoints()[1]._z - zmin) / zrange;
180 color1[0] = oColor1.
r;
181 color1[1] = oColor1.
g;
182 color1[2] = oColor1.
b;
184 scalar = (getElement()->getFace(i)->getPoints()[2]._z - zmin) / zrange;
186 color2[0] = oColor2.
r;
187 color2[1] = oColor2.
g;
188 color2[2] = oColor2.
b;
192 scalar = (getElement()->getFace(i)->getPoints()[0]._z - zmin);
194 color0[0] = oColor0.
r;
195 color0[1] = oColor0.
g;
196 color0[2] = oColor0.
b;
198 scalar = (getElement()->getFace(i)->getPoints()[1]._z - zmin);
200 color1[0] = oColor1.
r;
201 color1[1] = oColor1.
g;
202 color1[2] = oColor1.
b;
204 scalar = (getElement()->getFace(i)->getPoints()[2]._z - zmin);
206 color2[0] = oColor2.
r;
207 color2[1] = oColor2.
g;
208 color2[2] = oColor2.
b;
211 TYElementGraphic* pTYElementGraphic = getElement()->getFace(i)->getGraphicObject();
213 if (pPolygonGraphic != NULL)
215 pPolygonGraphic->unsetTextureBg();
216 pPolygonGraphic->setTexture(toTex);
222 pPolygonGraphic->setAltimetrieColor(color0, color1, color2);
223 pPolygonGraphic->display(pModelerElement, mode);
229 glDisable(GL_TEXTURE_2D);
232 if (mode == GL_SELECT)
288 QImage glImg = QGLWidget::convertToGLFormat(img);
293 int tabSize = glImg.bytesPerLine() * glImg.height();
300 glColor3f(1.0, 1.0, 1.0);
308 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
309 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
311 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
312 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
314 GLenum format = GL_LUMINANCE;
319 format = GL_LUMINANCE;
322 format = GL_LUMINANCE_ALPHA;
332 glTexImage2D(GL_TEXTURE_2D, 0, internalFormat,
_imgXSize,
_imgYSize, 0, format, GL_UNSIGNED_BYTE,
337 glAlphaFunc(GL_GREATER, (GLclampf)0);
338 glEnable(GL_ALPHA_TEST);
351 glEnable(GL_TEXTURE_2D);
double SIGNE(double a)
Return the number sign.
Representation graphique de l'altimetrie (fichier header)
list< TYElementGraphic * > TYListPtrTYElementGraphic
List de pointeur de TYElement.
#define TYDIRPREFERENCEMANAGER
Gestion de la table de correspondance indice/element pour le picking (fichier header)
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 WHITE
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.
void setBackgroundImage(QString sTopoFileName, int semiX, int semiY, TYPoint ptPosition, OVector3D bgImageOrientation)
QString _sOldTopoFileName
OVector3D _bgImageOrientation
unsigned char * _imgDataPtr
virtual ~TYAltimetrieGraphic()
virtual void computeBoundingBox()
TYAltimetrieGraphic(TYAltimetrie *pElement)
virtual void getChilds(TYListPtrTYElementGraphic &childs, bool recursif=true)
virtual void update(bool force=false)
virtual void display(TYElement *pModelerElement=nullptr, GLenum mode=GL_RENDER)
void unsetBackgroundImage()
Assigne une altitude a chaque point de l'espace.
static void getLinearColorTable(const unsigned int &nbColors, const float *hueRange, const float *saturationRange, const float *valueRange, OLookupTable &outColors)
Generation de la table de couleurs basee sur une rampe lineaire ( y = x+0.5/255 )
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)
bool getModified(bool andReset=false)
static void addElement(TYElement *pElt)
classe graphique pour un polygone