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) {
498 FXbool ret = FXGLCanvas::makeCurrent();
506 glViewport(0, 0, getWidth() - 1, getHeight() - 1);
544 FXEvent* e = (FXEvent*) data;
546 if (e->state & CONTROLMASK) {
651 myApp->getCursorPosition(x, y, b);
666 FXEvent* e = (FXEvent*) data;
667 if ((e->state & ALTMASK) != 0) {
668 setDefaultCursor(getApp()->getDefaultCursor(DEF_CROSSHAIR_CURSOR));
689 return FXGLCanvas::onKeyPress(o, sel, data);
695 FXEvent* e = (FXEvent*) data;
696 if ((e->state & ALTMASK) == 0) {
698 setDefaultCursor(getApp()->getDefaultCursor(DEF_ARROW_CURSOR));
700 return FXGLCanvas::onKeyRelease(o, sel, data);
713 std::string errorMessage;
714 FXString ext = FXPath::extension(destFile.c_str());
715 bool useGL2PS = ext ==
"ps" || ext ==
"eps" || ext ==
"pdf" || ext ==
"svg" || ext ==
"tex" || ext ==
"pgf";
726 glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
727 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
732 glDisable(GL_DITHER);
736 glEnable(GL_POLYGON_SMOOTH);
737 glEnable(GL_LINE_SMOOTH);
740 glDisable(GL_POLYGON_SMOOTH);
741 glDisable(GL_LINE_SMOOTH);
750 }
else if (ext ==
"eps") {
752 }
else if (ext ==
"pdf") {
754 }
else if (ext ==
"tex") {
756 }
else if (ext ==
"svg") {
758 }
else if (ext ==
"pgf") {
761 return "Could not save '" + destFile +
"'.\n Unrecognized format '" + std::string(ext.text()) +
"'.";
763 FILE* fp = fopen(destFile.c_str(),
"wb");
765 return "Could not save '" + destFile +
"'.\n Could not open file for writing";
769 glGetIntegerv(GL_VIEWPORT, viewport);
771 buffsize += 1024 * 1024;
774 GL_RGBA, 0, NULL, 0, 0, 0, buffsize, fp,
"out.eps");
775 glMatrixMode(GL_MODELVIEW);
777 glDisable(GL_TEXTURE_2D);
778 glDisable(GL_ALPHA_TEST);
780 glEnable(GL_DEPTH_TEST);
790 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
794 minB[0] = viewPort.
xmin();
795 minB[1] = viewPort.
ymin();
796 maxB[0] = viewPort.
xmax();
797 maxB[1] = viewPort.
ymax();
799 glEnable(GL_POLYGON_OFFSET_FILL);
800 glEnable(GL_POLYGON_OFFSET_LINE);
818 FXMALLOC(&buf, FXColor, getWidth()*getHeight());
820 glReadBuffer(GL_BACK);
822 glReadPixels(0, 0, getWidth(), getHeight(), GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid*)buf);
826 size_t mwidth = getWidth();
827 size_t mheight = getHeight();
829 FXColor* pbb = buf + mwidth * (mheight - 1);
843 errorMessage =
"Could not save '" + destFile +
"'.";
846 errorMessage =
"Could not save '" + destFile +
"'.\n" + e.what();
917 for (std::vector<GUISUMOAbstractView::Decal>::iterator l =
myDecals.begin(); l !=
myDecals.end();) {
936 glRotated(d.
rot, 0, 0, 1);
984 glMatrixMode(GL_PROJECTION);
989 glOrtho(0, getWidth(), 0, getHeight(), -
GLO_MAX - 1,
GLO_MAX + 1);
990 glMatrixMode(GL_MODELVIEW);
994 glScaled(scaleX, scaleY, 1);
995 glTranslated(-bound.
xmin(), -bound.
ymin(), 0);