39 #ifdef CHECK_MEMORY_LEAKS
41 #endif // CHECK_MEMORY_LEAKS
58 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
60 for (PositionVector::const_iterator i = v.begin(); i != v.end(); i++) {
62 glVertex2d(p.
x(), p.
y());
66 glVertex2d(p.
x(), p.
y());
76 glTranslated(beg.
x(), beg.
y(), 0);
77 glRotated(rot, 0, 0, 1);
79 glVertex2d(-width, 0);
80 glVertex2d(-width, -visLength);
81 glVertex2d(width, -visLength);
93 glTranslated((beg2.
x() + beg1.
x())*.5, (beg2.
y() + beg1.
y())*.5, 0);
94 glRotated(rot, 0, 0, 1);
96 glVertex2d(-width, 0);
97 glVertex2d(-width, -visLength);
98 glVertex2d(width, -visLength);
107 const std::vector<SUMOReal>& rots,
108 const std::vector<SUMOReal>& lengths,
110 int e = (
int) geom.size() - 1;
111 for (
int i = 0; i < e; i++) {
120 const std::vector<SUMOReal>& rots,
121 const std::vector<SUMOReal>& lengths,
123 int minS = (
int)
MIN4(rots.size(), lengths.size(), geom1.size(), geom2.size());
124 for (
int i = 0; i < minS; i++) {
132 int e = (
int) geom.size() - 1;
133 for (
int i = 0; i < e; i++) {
147 glTranslated(beg.
x(), beg.
y(), 0);
148 glRotated(rot, 0, 0, 1);
151 glVertex2d(0, -visLength);
161 glTranslated((beg2.
x() + beg1.
x())*.5, (beg2.
y() + beg1.
y())*.5, 0);
162 glRotated(rot, 0, 0, 1);
165 glVertex2d(0, -visLength);
175 int e = (
int) v.size() - 1;
176 for (
int i = 0; i < e; ++i) {
177 glVertex2d(v[i].x(), v[i].y());
178 glVertex2d(v[i + 1].x(), v[i + 1].y());
188 glVertex2d(beg.
x(), beg.
y());
189 glVertex2d(end.
x(), end.
y());
204 for (
int i = 0; i < 360; i += 10) {
210 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
211 std::pair<SUMOReal, SUMOReal> p1 =
213 for (
int i = (
int)(beg / 10); i < steps && (36.0 / (
SUMOReal) steps * (
SUMOReal) i) * 10 < end; i++) {
214 const std::pair<SUMOReal, SUMOReal>& p2 =
216 glBegin(GL_TRIANGLES);
217 glVertex2d(p1.first * width, p1.second * width);
218 glVertex2d(p2.first * width, p2.second * width);
223 const std::pair<SUMOReal, SUMOReal>& p2 =
225 glBegin(GL_TRIANGLES);
226 glVertex2d(p1.first * width, p1.second * width);
227 glVertex2d(p2.first * width, p2.second * width);
243 for (
int i = 0; i < 360; i += 10) {
249 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
250 std::pair<SUMOReal, SUMOReal> p1 =
252 for (
int i = (
int)(beg / 10); i < steps && (36.0 / (
SUMOReal) steps * (
SUMOReal) i) * 10 < end; i++) {
253 const std::pair<SUMOReal, SUMOReal>& p2 =
255 glBegin(GL_TRIANGLES);
256 glVertex2d(p1.first * width, p1.second * width);
257 glVertex2d(p2.first * width, p2.second * width);
258 glVertex2d(p2.first * iwidth, p2.second * iwidth);
260 glVertex2d(p2.first * iwidth, p2.second * iwidth);
261 glVertex2d(p1.first * iwidth, p1.second * iwidth);
262 glVertex2d(p1.first * width, p1.second * width);
266 const std::pair<SUMOReal, SUMOReal>& p2 =
268 glBegin(GL_TRIANGLES);
269 glVertex2d(p1.first * width, p1.second * width);
270 glVertex2d(p2.first * width, p2.second * width);
271 glVertex2d(p2.first * iwidth, p2.second * iwidth);
273 glVertex2d(p2.first * iwidth, p2.second * iwidth);
274 glVertex2d(p1.first * iwidth, p1.second * iwidth);
275 glVertex2d(p1.first * width, p1.second * width);
283 if (l.
length() < tLength) {
284 tWidth = tWidth * l.
length() / tLength;
289 glTranslated(rl.p1().x(), rl.p1().y(), 0);
291 glBegin(GL_TRIANGLES);
292 glVertex2d(0, -tLength);
293 glVertex2d(-tWidth, 0);
294 glVertex2d(+tWidth, 0);
309 glGetDoublev(GL_CURRENT_COLOR, current);
310 return RGBColor(static_cast<unsigned char>(current[0] * 255. + 0.5),
311 static_cast<unsigned char>(current[1] * 255. + 0.5),
312 static_cast<unsigned char>(current[2] * 255. + 0.5),
313 static_cast<unsigned char>(current[3] * 255. + 0.5));
322 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
324 glTranslated(pos.
x(), pos.
y(), layer);
328 glRotated(180, 1, 0, 0);
329 glRotated(angle, 0, 0, 1);
330 glTranslated(-w / 2., 0.4, 0);
341 if (boxAngle > 360) {
346 const SUMOReal borderWidth = size / 20;
347 const SUMOReal boxHeight = size * 0.8;
348 const SUMOReal boxWidth = stringWidth + size / 2;
350 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
351 glTranslated(0, 0, layer);
354 left.
sub(boxWidth / 2, -boxHeight / 2.7);
356 left.
add(borderWidth * 1.5, 0);
358 glTranslated(0, 0, 0.01);
359 drawBoxLine(left, boxAngle, boxWidth - 3 * borderWidth, boxHeight - 2 * borderWidth);
364 glTranslated(pos.
x(), pos.
y(), 0.01);
367 glRotated(180, 1, 0, 0);
368 glRotated(angle, 0, 0, 1);
369 glTranslated(-stringWidth / 2., 0, 0);
void sub(SUMOReal dx, SUMOReal dy)
Substracts the given position from this one.
SUMOReal atan2DegreeAngle() const
int pfDrawString(const char *c)
const Position & p2() const
void add(const Position &pos)
Adds the given position to this one.
T MIN4(T a, T b, T c, T d)
static void drawOutlineCircle(SUMOReal width, SUMOReal iwidth, int steps=8)
Draws an unfilled circle around (0,0)
void pfSetPosition(SUMOReal x, SUMOReal y)
static void drawFilledPoly(const PositionVector &v, bool close)
Draws a filled polygon described by the list of points.
SUMOReal distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
static void drawText(const std::string &text, const Position &pos, const SUMOReal layer, const SUMOReal size, const RGBColor &col=RGBColor::BLACK, const SUMOReal angle=0)
draw Text with given parameters
SUMOReal x() const
Returns the x-position.
unsigned char blue() const
Returns the blue-amount of the color.
static void drawFilledCircle(SUMOReal width, int steps=8)
Draws a filled circle around (0,0)
Position getPositionAtDistance(SUMOReal offset) const
static std::vector< std::pair< SUMOReal, SUMOReal > > myCircleCoords
Storage for precomputed sin/cos-values describing a circle.
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
A point in 2D or 3D with translation and scaling methods.
unsigned char alpha() const
Returns the alpha-amount of the color.
static void drawBoxLines(const PositionVector &geom, const std::vector< SUMOReal > &rots, const std::vector< SUMOReal > &lengths, SUMOReal width)
Draws thick lines.
static void drawTextBox(const std::string &text, const Position &pos, const SUMOReal layer, const SUMOReal size, const RGBColor &txtColor=RGBColor::BLACK, const RGBColor &bgColor=RGBColor::WHITE, const RGBColor &borderColor=RGBColor::BLACK, const SUMOReal angle=0)
draw Text box with given parameters
static void drawBoxLine(const Position &beg, SUMOReal rot, SUMOReal visLength, SUMOReal width)
Draws a thick line.
void pfSetScale(SUMOReal s)
static void drawTriangleAtEnd(const Line &l, SUMOReal tLength, SUMOReal tWidth)
Draws a triangle at the end of the given line.
SUMOReal y() const
Returns the y-position.
SUMOReal pfdkGetStringWidth(const char *c)
static void drawLine(const Position &beg, SUMOReal rot, SUMOReal visLength)
Draws a thin line.
unsigned char green() const
Returns the green-amount of the color.
unsigned char red() const
Returns the red-amount of the color.
static RGBColor getColor()
gets the gl-color