39 #ifdef CHECK_MEMORY_LEAKS
41 #endif // CHECK_MEMORY_LEAKS
51 GLdouble* vertex_data[4],
52 GLfloat weight[4], GLdouble** dataOut) {
57 vertex = (GLdouble*)malloc(7 *
sizeof(GLdouble));
59 vertex[0] = coords[0];
60 vertex[1] = coords[1];
61 vertex[2] = coords[2];
75 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
77 for (PositionVector::const_iterator i = v.begin(); i != v.end(); i++) {
79 glVertex2d(p.
x(), p.
y());
83 glVertex2d(p.
x(), p.
y());
94 GLUtesselator* tobj = gluNewTess();
95 gluTessCallback(tobj, GLU_TESS_VERTEX, (GLvoid(APIENTRY*)()) &glVertex3dv);
96 gluTessCallback(tobj, GLU_TESS_BEGIN, (GLvoid(APIENTRY*)()) &glBegin);
97 gluTessCallback(tobj, GLU_TESS_END, (GLvoid(APIENTRY*)()) &glEnd);
98 gluTessCallback(tobj, GLU_TESS_COMBINE, (GLvoid(APIENTRY*)()) &
combCallback);
99 gluTessProperty(tobj, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_ODD);
100 gluTessBeginPolygon(tobj, NULL);
101 gluTessBeginContour(tobj);
102 double* points =
new double[(v.size() +
int(close)) * 3];
104 for (
size_t i = 0; i != v.size(); ++i) {
105 points[3 * i] = v[(
int)i].x();
106 points[3 * i + 1] = v[(
int)i].y();
107 points[3 * i + 2] = 0;
108 gluTessVertex(tobj, points + 3 * i, points + 3 * i);
111 const size_t i = v.size();
112 points[3 * i] = v[0].x();
113 points[3 * i + 1] = v[0].y();
114 points[3 * i + 2] = 0;
115 gluTessVertex(tobj, points + 3 * i, points + 3 * i);
117 gluTessEndContour(tobj);
118 gluTessEndPolygon(tobj);
127 glTranslated(beg.
x(), beg.
y(), 0);
128 glRotated(rot, 0, 0, 1);
130 glVertex2d(-width, 0);
131 glVertex2d(-width, -visLength);
132 glVertex2d(width, -visLength);
133 glVertex2d(width, 0);
144 glTranslated((beg2.
x() + beg1.
x())*.5, (beg2.
y() + beg1.
y())*.5, 0);
145 glRotated(rot, 0, 0, 1);
147 glVertex2d(-width, 0);
148 glVertex2d(-width, -visLength);
149 glVertex2d(width, -visLength);
150 glVertex2d(width, 0);
158 const std::vector<SUMOReal>& rots,
159 const std::vector<SUMOReal>& lengths,
161 int e = (
int) geom.size() - 1;
162 for (
int i = 0; i < e; i++) {
165 if (cornerDetail > 0) {
166 for (
int i = 1; i < e; i++) {
168 glTranslated(geom[i].x(), geom[i].y(), 0);
180 const std::vector<SUMOReal>& rots,
181 const std::vector<SUMOReal>& lengths,
183 int minS = (
int)
MIN4(rots.size(), lengths.size(), geom1.size(), geom2.size());
184 for (
int i = 0; i < minS; i++) {
192 int e = (
int) geom.size() - 1;
193 for (
int i = 0; i < e; i++) {
207 glTranslated(beg.
x(), beg.
y(), 0);
208 glRotated(rot, 0, 0, 1);
211 glVertex2d(0, -visLength);
221 glTranslated((beg2.
x() + beg1.
x())*.5, (beg2.
y() + beg1.
y())*.5, 0);
222 glRotated(rot, 0, 0, 1);
225 glVertex2d(0, -visLength);
235 int e = (
int) v.size() - 1;
236 for (
int i = 0; i < e; ++i) {
237 glVertex2d(v[i].x(), v[i].y());
238 glVertex2d(v[i + 1].x(), v[i + 1].y());
248 glVertex2d(beg.
x(), beg.
y());
249 glVertex2d(end.
x(), end.
y());
264 for (
int i = 0; i < 360; i += 10) {
270 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
271 std::pair<SUMOReal, SUMOReal> p1 =
273 for (
int i = (
int)(beg / 10); i < steps && (36.0 / (
SUMOReal) steps * (
SUMOReal) i) * 10 < end; i++) {
274 const std::pair<SUMOReal, SUMOReal>& p2 =
276 glBegin(GL_TRIANGLES);
277 glVertex2d(p1.first * width, p1.second * width);
278 glVertex2d(p2.first * width, p2.second * width);
283 const std::pair<SUMOReal, SUMOReal>& p2 =
285 glBegin(GL_TRIANGLES);
286 glVertex2d(p1.first * width, p1.second * width);
287 glVertex2d(p2.first * width, p2.second * width);
303 for (
int i = 0; i < 360; i += 10) {
309 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
310 std::pair<SUMOReal, SUMOReal> p1 =
312 for (
int i = (
int)(beg / 10); i < steps && (36.0 / (
SUMOReal) steps * (
SUMOReal) i) * 10 < end; i++) {
313 const std::pair<SUMOReal, SUMOReal>& p2 =
315 glBegin(GL_TRIANGLES);
316 glVertex2d(p1.first * width, p1.second * width);
317 glVertex2d(p2.first * width, p2.second * width);
318 glVertex2d(p2.first * iwidth, p2.second * iwidth);
320 glVertex2d(p2.first * iwidth, p2.second * iwidth);
321 glVertex2d(p1.first * iwidth, p1.second * iwidth);
322 glVertex2d(p1.first * width, p1.second * width);
326 const std::pair<SUMOReal, SUMOReal>& p2 =
328 glBegin(GL_TRIANGLES);
329 glVertex2d(p1.first * width, p1.second * width);
330 glVertex2d(p2.first * width, p2.second * width);
331 glVertex2d(p2.first * iwidth, p2.second * iwidth);
333 glVertex2d(p2.first * iwidth, p2.second * iwidth);
334 glVertex2d(p1.first * iwidth, p1.second * iwidth);
335 glVertex2d(p1.first * width, p1.second * width);
343 if (l.
length() < tLength) {
344 tWidth = tWidth * l.
length() / tLength;
349 glTranslated(rl.p1().x(), rl.p1().y(), 0);
351 glBegin(GL_TRIANGLES);
352 glVertex2d(0, -tLength);
353 glVertex2d(-tWidth, 0);
354 glVertex2d(+tWidth, 0);
369 glGetDoublev(GL_CURRENT_COLOR, current);
370 return RGBColor(static_cast<unsigned char>(current[0] * 255. + 0.5),
371 static_cast<unsigned char>(current[1] * 255. + 0.5),
372 static_cast<unsigned char>(current[2] * 255. + 0.5),
373 static_cast<unsigned char>(current[3] * 255. + 0.5));
382 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
384 glTranslated(pos.
x(), pos.
y(), layer);
388 glRotated(180, 1, 0, 0);
389 glRotated(angle, 0, 0, 1);
390 glTranslated(-w / 2., 0.4, 0);
401 if (boxAngle > 360) {
406 const SUMOReal borderWidth = size / 20;
407 const SUMOReal boxHeight = size * 0.8;
408 const SUMOReal boxWidth = stringWidth + size / 2;
410 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
411 glTranslated(0, 0, layer);
414 left.
sub(boxWidth / 2, -boxHeight / 2.7);
416 left.
add(borderWidth * 1.5, 0);
418 glTranslated(0, 0, 0.01);
419 drawBoxLine(left, boxAngle, boxWidth - 3 * borderWidth, boxHeight - 2 * borderWidth);
424 glTranslated(pos.
x(), pos.
y(), 0.01);
427 glRotated(180, 1, 0, 0);
428 glRotated(angle, 0, 0, 1);
429 glTranslated(-stringWidth / 2., 0, 0);