80 #ifdef CHECK_MEMORY_LEAKS
82 #endif // CHECK_MEMORY_LEAKS
119 LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0),
124 myMouseHotspotX(app.getDefaultCursor()->getHotX()),
125 myMouseHotspotY(app.getDefaultCursor()->getHotY()),
127 myUseToolTips(false),
128 myAmInitialised(false),
129 myViewportChooser(0),
130 myVisualizationChanger(0) {
133 flags |= FLAG_ENABLED;
134 myInEditMode =
false;
138 myVisualizationSettings->
gaming = myApp->isGaming();
200 if (getWidth() == 0 || getHeight() == 0) {
219 glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
220 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
225 glDisable(GL_DITHER);
229 glEnable(GL_POLYGON_SMOOTH);
230 glEnable(GL_LINE_SMOOTH);
233 glDisable(GL_POLYGON_SMOOTH);
234 glDisable(GL_LINE_SMOOTH);
262 selection.
grow(SENSITIVITY);
265 unsigned int idMax = 0;
266 int prevLayer = -1000;
267 for (std::vector<GUIGlID>::const_iterator it = ids.begin(); it != ids.end(); it++) {
279 int clayer = (
int) type;
284 if (dynamic_cast<GUIPolygon*>(o) != 0) {
285 if (dynamic_cast<GUIPolygon*>(o)->getLayer() > 0) {
288 if (dynamic_cast<GUIPolygon*>(o)->getLayer() < 0) {
289 clayer =
dynamic_cast<GUIPolygon*
>(o)->getLayer();
292 if (dynamic_cast<GUIPointOfInterest*>(o) != 0) {
293 if (dynamic_cast<GUIPointOfInterest*>(o)->getLayer() > 0) {
296 if (dynamic_cast<GUIPointOfInterest*>(o)->getLayer() < 0) {
302 if (prevLayer == -1000 || prevLayer < clayer) {
315 const int NB_HITS_MAX = 1024 * 1024;
317 static GUIGlID hits[NB_HITS_MAX];
318 static GLint nb_hits = 0;
319 glSelectBuffer(NB_HITS_MAX, hits);
329 nb_hits = glRenderMode(GL_RENDER);
333 std::vector<GUIGlID> result;
334 for (
int i = 0; i < nb_hits; ++i) {
335 assert(i * 4 + 3 < NB_HITS_MAX);
336 result.push_back(hits[i * 4 + 3]);
360 glEnable(GL_DEPTH_TEST);
370 glTranslated(0, 0, .55);
371 glColor3d(0.5, 0.5, 0.5);
374 for (; ypos < yend;) {
375 glVertex2d(xmin, ypos);
376 glVertex2d(xend, ypos);
380 for (; xpos < xend;) {
381 glVertex2d(xpos, ymin);
382 glVertex2d(xpos, yend);
386 glTranslated(0, 0, -.55);
394 const std::string text(
"10000000000");
396 size_t pixelSize = 0;
399 if (pixelSize > 20) {
404 if (noDigits > text.length()) {
411 glMatrixMode(GL_PROJECTION);
414 glMatrixMode(GL_MODELVIEW);
419 glDisable(GL_TEXTURE_2D);
420 glDisable(GL_ALPHA_TEST);
422 glEnable(GL_DEPTH_TEST);
426 double o = double(15) / double(getHeight());
428 double oo = double(5) / double(getHeight());
431 glVertex2d(-.98, -1. + o);
432 glVertex2d(-.98 + len, -1. + o);
434 glVertex2d(-.98, -1. + o);
435 glVertex2d(-.98, -1. + o2);
437 glVertex2d(-.98 + len, -1. + o);
438 glVertex2d(-.98 + len, -1. + o2);
445 glRotated(180, 1, 0, 0);
447 glRotated(-180, 1, 0, 0);
450 glRotated(180, 1, 0, 0);
452 glRotated(-180, 1, 0, 0);
455 glMatrixMode(GL_PROJECTION);
457 glMatrixMode(GL_MODELVIEW);
483 if (o != 0 && dynamic_cast<GUIGlObject*>(o) != 0) {
484 if (applyZoom && zoomDist < 0) {
525 glViewport(0, 0, getWidth() - 1, getHeight() - 1);
563 FXEvent* e = (FXEvent*) data;
565 if (e->state & CONTROLMASK) {
670 myApp->getCursorPosition(x, y, b);
685 FXEvent* e = (FXEvent*) data;
686 if ((e->state & ALTMASK) != 0) {
687 setDefaultCursor(getApp()->getDefaultCursor(DEF_CROSSHAIR_CURSOR));
714 FXEvent* e = (FXEvent*) data;
715 if ((e->state & ALTMASK) == 0) {
717 setDefaultCursor(getApp()->getDefaultCursor(DEF_ARROW_CURSOR));
732 std::string errorMessage;
733 FXString ext = FXPath::extension(destFile.c_str());
734 bool useGL2PS = ext ==
"ps" || ext ==
"eps" || ext ==
"pdf" || ext ==
"svg" || ext ==
"tex" || ext ==
"pgf";
745 glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
746 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
751 glDisable(GL_DITHER);
755 glEnable(GL_POLYGON_SMOOTH);
756 glEnable(GL_LINE_SMOOTH);
759 glDisable(GL_POLYGON_SMOOTH);
760 glDisable(GL_LINE_SMOOTH);
769 }
else if (ext ==
"eps") {
771 }
else if (ext ==
"pdf") {
773 }
else if (ext ==
"tex") {
775 }
else if (ext ==
"svg") {
777 }
else if (ext ==
"pgf") {
780 return "Could not save '" + destFile +
"'.\n Unrecognized format '" + std::string(ext.text()) +
"'.";
782 FILE* fp = fopen(destFile.c_str(),
"wb");
784 return "Could not save '" + destFile +
"'.\n Could not open file for writing";
788 glGetIntegerv(GL_VIEWPORT, viewport);
790 buffsize += 1024 * 1024;
793 GL_RGBA, 0, NULL, 0, 0, 0, buffsize, fp,
"out.eps");
794 glMatrixMode(GL_MODELVIEW);
796 glDisable(GL_TEXTURE_2D);
797 glDisable(GL_ALPHA_TEST);
799 glEnable(GL_DEPTH_TEST);
809 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
813 minB[0] = viewPort.
xmin();
814 minB[1] = viewPort.
ymin();
815 maxB[0] = viewPort.
xmax();
816 maxB[1] = viewPort.
ymax();
818 glEnable(GL_POLYGON_OFFSET_FILL);
819 glEnable(GL_POLYGON_OFFSET_LINE);
837 FXMALLOC(&buf, FXColor, getWidth()*getHeight());
839 glReadBuffer(GL_BACK);
841 glReadPixels(0, 0, getWidth(), getHeight(), GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid*)buf);
845 size_t mwidth = getWidth();
846 size_t mheight = getHeight();
848 FXColor* pbb = buf + mwidth * (mheight - 1);
862 errorMessage =
"Could not save '" + destFile +
"'.";
865 errorMessage =
"Could not save '" + destFile +
"'.\n" + e.what();
934 glTranslated(0, 0, .99);
936 for (std::vector<GUISUMOAbstractView::Decal>::iterator l =
myDecals.begin(); l !=
myDecals.end();) {
954 glRotated(d.
rot, 0, 0, 1);
963 glTranslated(0, 0, -.99);
1002 glMatrixMode(GL_PROJECTION);
1007 glOrtho(0, getWidth(), 0, getHeight(), -
GLO_MAX - 1,
GLO_MAX + 1);
1008 glMatrixMode(GL_MODELVIEW);
1012 glScaled(scaleX, scaleY, 1);
1013 glTranslated(-bound.
xmin(), -bound.
ymin(), 0);