74 #ifdef CHECK_MEMORY_LEAKS
76 #endif // CHECK_MEMORY_LEAKS
113 LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0),
118 myMouseHotspotX(app.getDefaultCursor()->getHotX()),
119 myMouseHotspotY(app.getDefaultCursor()->getHotY()),
121 myUseToolTips(false),
122 myAmInitialised(false),
123 myViewportChooser(0),
124 myVisualizationChanger(0) {
127 flags |= FLAG_ENABLED;
128 myInEditMode =
false;
132 myVisualizationSettings->
gaming = myApp->isGaming();
145 for (std::vector<GUISUMOAbstractView::Decal>::iterator it =
myDecals.begin(); it !=
myDecals.end(); ++it) {
198 if (getWidth() == 0 || getHeight() == 0) {
217 glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
218 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
223 glDisable(GL_DITHER);
227 glEnable(GL_POLYGON_SMOOTH);
228 glEnable(GL_LINE_SMOOTH);
231 glDisable(GL_POLYGON_SMOOTH);
232 glDisable(GL_LINE_SMOOTH);
260 selection.
grow(SENSITIVITY);
263 unsigned int idMax = 0;
265 for (std::vector<GUIGlID>::const_iterator it = ids.begin(); it != ids.end(); it++) {
282 layer =
dynamic_cast<Shape*
>(o)->getLayer();
285 if (layer > maxLayer) {
298 const int NB_HITS_MAX = 1024 * 1024;
300 static GUIGlID hits[NB_HITS_MAX];
301 static GLint nb_hits = 0;
302 glSelectBuffer(NB_HITS_MAX, hits);
312 nb_hits = glRenderMode(GL_RENDER);
316 std::vector<GUIGlID> result;
317 for (
int i = 0; i < nb_hits; ++i) {
318 assert(i * 4 + 3 < NB_HITS_MAX);
319 result.push_back(hits[i * 4 + 3]);
343 glEnable(GL_DEPTH_TEST);
353 glTranslated(0, 0, .55);
354 glColor3d(0.5, 0.5, 0.5);
357 for (; ypos < yend;) {
358 glVertex2d(xmin, ypos);
359 glVertex2d(xend, ypos);
363 for (; xpos < xend;) {
364 glVertex2d(xpos, ymin);
365 glVertex2d(xpos, yend);
369 glTranslated(0, 0, -.55);
377 const std::string text(
"10000000000");
379 size_t pixelSize = (size_t)
m2p((
SUMOReal) length);
380 while (pixelSize <= 20) {
383 if (noDigits > text.length()) {
391 glMatrixMode(GL_PROJECTION);
394 glMatrixMode(GL_MODELVIEW);
399 glDisable(GL_TEXTURE_2D);
400 glDisable(GL_ALPHA_TEST);
402 glEnable(GL_DEPTH_TEST);
406 double o = double(15) / double(getHeight());
408 double oo = double(5) / double(getHeight());
411 glVertex2d(-.98, -1. + o);
412 glVertex2d(-.98 + len, -1. + o);
414 glVertex2d(-.98, -1. + o);
415 glVertex2d(-.98, -1. + o2);
417 glVertex2d(-.98 + len, -1. + o);
418 glVertex2d(-.98 + len, -1. + o2);
425 glRotated(180, 1, 0, 0);
427 glRotated(-180, 1, 0, 0);
430 glRotated(180, 1, 0, 0);
432 glRotated(-180, 1, 0, 0);
435 glMatrixMode(GL_PROJECTION);
437 glMatrixMode(GL_MODELVIEW);
463 if (o != 0 && dynamic_cast<GUIGlObject*>(o) != 0) {
464 if (applyZoom && zoomDist < 0) {
505 glViewport(0, 0, getWidth() - 1, getHeight() - 1);
543 FXEvent* e = (FXEvent*) data;
545 if (e->state & CONTROLMASK) {
648 myApp->getCursorPosition(x, y, b);
663 FXEvent* e = (FXEvent*) data;
664 if ((e->state & ALTMASK) != 0) {
665 setDefaultCursor(getApp()->getDefaultCursor(DEF_CROSSHAIR_CURSOR));
692 FXEvent* e = (FXEvent*) data;
693 if ((e->state & ALTMASK) == 0) {
695 setDefaultCursor(getApp()->getDefaultCursor(DEF_ARROW_CURSOR));
710 std::string errorMessage;
711 FXString ext = FXPath::extension(destFile.c_str());
712 bool useGL2PS = ext ==
"ps" || ext ==
"eps" || ext ==
"pdf" || ext ==
"svg" || ext ==
"tex" || ext ==
"pgf";
723 glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
724 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
729 glDisable(GL_DITHER);
733 glEnable(GL_POLYGON_SMOOTH);
734 glEnable(GL_LINE_SMOOTH);
737 glDisable(GL_POLYGON_SMOOTH);
738 glDisable(GL_LINE_SMOOTH);
747 }
else if (ext ==
"eps") {
749 }
else if (ext ==
"pdf") {
751 }
else if (ext ==
"tex") {
753 }
else if (ext ==
"svg") {
755 }
else if (ext ==
"pgf") {
758 return "Could not save '" + destFile +
"'.\n Unrecognized format '" + std::string(ext.text()) +
"'.";
760 FILE* fp = fopen(destFile.c_str(),
"wb");
762 return "Could not save '" + destFile +
"'.\n Could not open file for writing";
766 glGetIntegerv(GL_VIEWPORT, viewport);
768 buffsize += 1024 * 1024;
771 GL_RGBA, 0, NULL, 0, 0, 0, buffsize, fp,
"out.eps");
772 glMatrixMode(GL_MODELVIEW);
774 glDisable(GL_TEXTURE_2D);
775 glDisable(GL_ALPHA_TEST);
777 glEnable(GL_DEPTH_TEST);
787 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
791 minB[0] = viewPort.
xmin();
792 minB[1] = viewPort.
ymin();
793 maxB[0] = viewPort.
xmax();
794 maxB[1] = viewPort.
ymax();
796 glEnable(GL_POLYGON_OFFSET_FILL);
797 glEnable(GL_POLYGON_OFFSET_LINE);
815 FXMALLOC(&buf, FXColor, getWidth()*getHeight());
817 glReadBuffer(GL_BACK);
819 glReadPixels(0, 0, getWidth(), getHeight(), GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid*)buf);
823 size_t mwidth = getWidth();
824 size_t mheight = getHeight();
826 FXColor* pbb = buf + mwidth * (mheight - 1);
840 errorMessage =
"Could not save '" + destFile +
"'.";
843 errorMessage =
"Could not save '" + destFile +
"'.\n" + e.what();
927 for (std::vector<GUISUMOAbstractView::Decal>::iterator l =
myDecals.begin(); l !=
myDecals.end(); ++l) {
948 glRotated(d.
rot, 0, 0, 1);
995 glMatrixMode(GL_PROJECTION);
1000 glOrtho(0, getWidth(), 0, getHeight(), -
GLO_MAX - 1,
GLO_MAX + 1);
1001 glMatrixMode(GL_MODELVIEW);
1005 glScaled(scaleX, scaleY, 1);
1006 glTranslated(-bound.
xmin(), -bound.
ymin(), 0);