66#include <unordered_set>
77#pragma warning(disable: 4435 5219 5220)
80#pragma GCC diagnostic push
81#pragma GCC diagnostic ignored "-Wpedantic"
85#pragma GCC diagnostic pop
130FXIMPLEMENT_ABSTRACT(
GUISUMOAbstractView, FXGLCanvas, GUISUMOAbstractViewMap, ARRAYNUMBER(GUISUMOAbstractViewMap))
137 FXGLCanvas(p, glVis, share, p,
MID_GLCANVAS, LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0),
147 flags |= FLAG_ENABLED;
166 if (decal.glID > 0) {
176 additional.first->removeActiveAddVisualisation(
this, ~0);
195 if (
myGlChildWindowParent->getGUIMainWindowParent()->getStaticTooltipView()->isStaticToolTipEnabled()) {
214 result.setx(pos.
x() - xRest + (xRest < myVisualizationSettings->gridXSize * 0.5 ? 0 :
myVisualizationSettings->gridXSize));
215 result.sety(pos.
y() - yRest + (yRest < myVisualizationSettings->gridYSize * 0.5 ? 0 :
myVisualizationSettings->gridYSize));
219 result.setz(pos.
z() - zRest + (zRest < myVisualizationSettings->gridYSize * 0.5 ? 0 :
myVisualizationSettings->gridYSize));
229 double xNet = bound.
xmin() + bound.
getWidth() * x / getWidth();
231 double yNet = bound.
ymin() + bound.
getHeight() * (getHeight() - y) / getHeight();
245 for (
const auto& d : decals) {
247 for (
const auto& existing :
myDecals) {
248 if (existing.filename == d.filename &&
249 existing.centerX == d.centerX &&
250 existing.centerY == d.centerY &&
251 existing.centerZ == d.centerZ) {
258 myDecals.back().initialised =
false;
274 myApp->getGeoLabel()->setText(
TL(
"(No projection defined)"));
277 if (
myApp->getTestFrame()) {
279 myApp->getTestFrame()->show();
283 myApp->getTestFrame()->hide();
321 if (getWidth() == 0 || getHeight() == 0) {
339 glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
340 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
345 glDisable(GL_DITHER);
348 glDisable(GL_LINE_SMOOTH);
361 if (
myGlChildWindowParent->getGUIMainWindowParent()->getStaticTooltipView()->isStaticToolTipEnabled()) {
425std::vector<GUIGlObject*>
431std::vector<GUIGlObject*>
441 positionBoundary.
add(pos);
442 positionBoundary.
grow(sensitivity);
446 double maxLayer = -std::numeric_limits<double>::max();
447 double minDist = std::numeric_limits<double>::max();
449 for (
const auto& i : ids) {
464 if (layer > maxLayer) {
468 }
else if (layer == maxLayer && dist < minDist) {
482 std::vector<GUIGlID> result;
486 selection.
grow(radius);
490 for (
const auto& i : ids) {
514std::vector<GUIGlObject*>
517 std::vector<GUIGlObject*> result;
521 selection.
grow(radius);
525 for (
const auto& i : ids) {
546 const int NB_HITS_MAX = 1024 * 1024;
548 static GUIGlID hits[NB_HITS_MAX];
549 static GLint nb_hits = 0;
550 glSelectBuffer(NB_HITS_MAX, hits);
563 nb_hits = glRenderMode(GL_RENDER);
565 myApp->setStatusBarText(
"Selection in boundary failed. Try to select fewer than " +
toString(hits2) +
" items");
567 std::vector<GUIGlID> result;
570 for (
int i = 0; i < nb_hits; ++i) {
573 for (
int j = 0; j < (int)numNames; j++) {
574 result.push_back(*ptr);
584std::vector<GUIGlObject*>
587 size_t internalLanes = 0;
588 for (
const auto&
object : objects) {
589 if ((object->getType() ==
GLO_LANE) && (object->getMicrosimID().find(
':') != std::string::npos)) {
598 std::vector<GUIGlObject*> filteredObjects;
599 for (
const auto&
object : objects) {
600 if ((object->getType() ==
GLO_LANE) && (object->getMicrosimID().find(
':') != std::string::npos)) {
603 filteredObjects.push_back(
object);
605 return filteredObjects;
613 if (
object !=
nullptr) {
614 myGlChildWindowParent->getGUIMainWindowParent()->getStaticTooltipView()->showStaticToolTip(object->getFullName().c_str());
630 glEnable(GL_DEPTH_TEST);
645 glTranslated(0, 0, .55);
646 glColor3d(0.5, 0.5, 0.5);
650 glVertex2d(xmin, yp);
651 glVertex2d(xmax, yp);
656 glVertex2d(xp, ymin);
657 glVertex2d(xp, ymax);
661 glTranslated(0, 0, -.55);
670 const std::string text(
"10000000000");
672 int pixelSize = (int)
m2p((
double) length);
673 while (pixelSize <= 20) {
676 if (noDigits > (
int)text.length()) {
679 pixelSize = (int)
m2p((
double) length);
683 glMatrixMode(GL_PROJECTION);
686 glMatrixMode(GL_MODELVIEW);
692 glDisable(GL_TEXTURE_2D);
693 glDisable(GL_ALPHA_TEST);
695 glEnable(GL_DEPTH_TEST);
697 glTranslated(0, 0, z);
699 double len = (double) pixelSize / (
double)(getWidth() - 1) * (
double) 2.0;
701 double o = double(15) / double(getHeight());
703 double oo = double(5) / double(getHeight());
706 glVertex2d(-.98, -1. + o);
707 glVertex2d(-.98 + len, -1. + o);
709 glVertex2d(-.98, -1. + o);
710 glVertex2d(-.98, -1. + o2);
712 glVertex2d(-.98 + len, -1. + o);
713 glVertex2d(-.98 + len, -1. + o2);
717 const double fontHeight = 0.1 * 300. / getHeight();
718 const double fontWidth = 0.1 * 300. / getWidth();
726 glMatrixMode(GL_PROJECTION);
728 glMatrixMode(GL_MODELVIEW);
737 std::string key =
"";
762 glMatrixMode(GL_PROJECTION);
765 glMatrixMode(GL_MODELVIEW);
770 glEnable(GL_DEPTH_TEST);
773 glTranslated(0, 0, z);
775 const bool fixed = scheme.
isFixed();
776 const int numColors = (int)scheme.
getColors().size();
781 double textX = left - 0.01;
784 const double top = -0.7;
785 const double bot = 0.9;
786 const double dy = (top - bot) / numColors;
787 const double bot2 = fixed ? bot : bot + dy / 2;
792 std::swap(right, left);
793 textX = right + 0.01;
800 glVertex2d(right, top);
801 glVertex2d(right, bot2);
802 glVertex2d(left, bot2);
803 glVertex2d(left, top);
804 glVertex2d(right, top);
805 glVertex2d(left, top);
806 glVertex2d(right, bot2);
807 glVertex2d(left, bot2);
810 const double fontHeight = 0.20 * 300. / getHeight();
811 const double fontWidth = 0.20 * 300. / getWidth();
813 const int fadeSteps = fixed ? 1 : 10;
814 double colorStep = dy / fadeSteps;
815 for (
int i = 0; i < numColors; i++) {
817 const double topi = top - i * dy;
820 if (i + 1 < numColors) {
828 glVertex2d(left, topi);
829 glVertex2d(right, topi);
830 glVertex2d(right, topi - 5 * colorStep);
831 glVertex2d(left, topi - 5 * colorStep);
835 glVertex2d(right, topi - 10 * colorStep);
836 glVertex2d(left, topi - 10 * colorStep);
839 glVertex2d(right, topi - 5 * colorStep);
840 glVertex2d(left, topi - 5 * colorStep);
844 for (
double j = 0.0; j < fadeSteps; j++) {
847 glVertex2d(left, topi - j * colorStep);
848 glVertex2d(right, topi - j * colorStep);
849 glVertex2d(right, topi - (j + 1) * colorStep);
850 glVertex2d(left, topi - (j + 1) * colorStep);
857 glVertex2d(left, topi);
858 glVertex2d(right, topi);
859 glVertex2d(right, bot2);
860 glVertex2d(left, bot2);
865 std::string name = scheme.
getNames()[i];
868 const double bgShift = 0.0;
869 const double textShift = 0.01;
870 const double textXShift = -0.005;
873 glTranslated(0, 0, 0.1);
875 glVertex2d(textX, topi + fontHeight * bgShift);
876 glVertex2d(textX - textDir * fontWidth * (
double)text.size() / 2.1, topi + fontHeight * bgShift);
877 glVertex2d(textX - textDir * fontWidth * (
double)text.size() / 2.1, topi + fontHeight * (0.8 + bgShift));
878 glVertex2d(textX, topi + fontHeight * (0.8 + bgShift));
880 glTranslated(0, 0, -0.1);
884 std::string name = scheme.
getName();
886 name =
"edgeData (" + key +
")";
888 name =
"edgeParam (" + key +
")";
890 name =
"laneParam (" + key +
")";
892 name =
"param (" + key +
")";
894 name =
"attribute (" + key +
")";
896 name = name.substr(3);
898 const double topN = -0.8;
899 const double bgShift = 0.0;
901 glTranslated(0, 0, 0.1);
903 glVertex2d(textX + textDir * 0.04, topN + fontHeight * bgShift - 0.01);
904 glVertex2d(textX + textDir * 0.04 - textDir * fontWidth * (
double)name.size() / 2.3, topN + fontHeight * bgShift - 0.01);
905 glVertex2d(textX + textDir * 0.04 - textDir * fontWidth * (
double)name.size() / 2.3, topN + fontHeight * (0.8 + bgShift));
906 glVertex2d(textX + textDir * 0.04, topN + fontHeight * (0.8 + bgShift));
908 glTranslated(0, 0, -0.1);
913 glMatrixMode(GL_PROJECTION);
915 glMatrixMode(GL_MODELVIEW);
934 glMatrixMode(GL_PROJECTION);
937 glMatrixMode(GL_MODELVIEW);
940 const double fontHeight = 0.2 * 300. / getHeight();
941 const double fontWidth = 0.2 * 300. / getWidth();
943#ifdef CHECK_ELEMENTCOUNTER
948 glMatrixMode(GL_PROJECTION);
950 glMatrixMode(GL_MODELVIEW);
957 return meter * getWidth() /
myChanger->getViewport().getWidth();
963 return pixel *
myChanger->getViewport().getWidth() / getWidth();
976 if (o !=
nullptr &&
dynamic_cast<GUIGlObject*
>(o) !=
nullptr) {
979 if (applyZoom && zoomDist < 0) {
984 myChanger->centerTo(b.getCenter(), zoomDist, applyZoom);
1029 FXbool ret = FXGLCanvas::makeCurrent();
1037 glViewport(0, 0, getWidth() - 1, getHeight() - 1);
1082 myPopup->removePopupFromObject();
1096 myPopup->removePopupFromObject();
1111 FXEvent* e = (FXEvent*) ptr;
1113 if ((e->state & CONTROLMASK) != 0) {
1128 if ((e->state & SHIFTMASK) != 0) {
1146 if (e->click_count == 2) {
1147 handle(
this, FXSEL(SEL_DOUBLECLICKED, 0), ptr);
1157 if (
myApp->isGaming()) {
1169 if (!
myApp->isGaming()) {
1185 if (!
myApp->isGaming()) {
1201 if (!
myApp->isGaming()) {
1216 if (
myApp->isGaming()) {
1232 if (!
myApp->isGaming()) {
1255 }
else if (!
myPopup->shown()) {
1279std::vector<GUIGlObject*>
1282 std::vector<GUIGlObject*> result;
1285 result.push_back(o);
1297 const bool altKeyPressed = ((ev->state & ALTMASK) != 0);
1301 if (objectsUnderCursor.empty()) {
1306 if (filtered.size() > 1 && (altKeyPressed
1307 || filtered[0]->getClickPriority() == filtered[1]->getClickPriority())) {
1311 myPopup = objectsUnderCursor.front()->getPopUpMenu(*
myApp, *
this);
1322 if (objects.size() > 0) {
1324 if (objects.size() == 1) {
1326 }
else if (filter) {
1328 std::vector<GUIGlObject*> filteredGLObjects;
1330 for (
const auto& glObject : objects) {
1332 if (glObject->getType() == objects.front()->getType()) {
1333 filteredGLObjects.push_back(glObject);
1353 const FXEvent* e = (FXEvent*) ptr;
1356 return myPopup->onKeyPress(o, sel, ptr);
1358 if (e->state & CONTROLMASK) {
1359 if (e->code == FX::KEY_Page_Up) {
1364 }
else if (e->code == FX::KEY_Page_Down) {
1371 FXGLCanvas::onKeyPress(o, sel, ptr);
1381 return myPopup->onKeyRelease(o, sel, ptr);
1383 FXGLCanvas::onKeyRelease(o, sel, ptr);
1392#ifdef DEBUG_SNAPSHOT
1393 std::cout <<
"add snapshot time=" << time <<
" file=" << file <<
"\n";
1396 mySnapshots[time].push_back(std::make_tuple(file, w, h));
1406 std::string errorMessage;
1407 FXString ext = FXPath::extension(destFile.c_str());
1408 const bool useGL2PS = ext ==
"ps" || ext ==
"eps" || ext ==
"pdf" || ext ==
"svg" || ext ==
"tex" || ext ==
"pgf";
1410 const bool useVideo = destFile ==
"" || ext ==
"h264" || ext ==
"hevc" || ext ==
"mp4";
1421 glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
1422 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
1425 glEnable(GL_DITHER);
1427 glDisable(GL_DITHER);
1430 glDisable(GL_LINE_SMOOTH);
1436 GLint format = GL2PS_PS;
1439 }
else if (ext ==
"eps") {
1441 }
else if (ext ==
"pdf") {
1443 }
else if (ext ==
"tex") {
1445 }
else if (ext ==
"svg") {
1447 }
else if (ext ==
"pgf") {
1450 return "Could not save '" + destFile +
"'.\n Unrecognized format '" + std::string(ext.text()) +
"'.";
1452 FILE* fp = fopen(destFile.c_str(),
"wb");
1454 return "Could not save '" + destFile +
"'.\n Could not open file for writing";
1457 GLint buffsize = 0, state = GL2PS_OVERFLOW;
1459 glGetIntegerv(GL_VIEWPORT, viewport);
1460 while (state == GL2PS_OVERFLOW) {
1461 buffsize += 1024 * 1024;
1462 gl2psBeginPage(destFile.c_str(),
"sumo-gui; https://sumo.dlr.de", viewport, format, GL2PS_SIMPLE_SORT,
1463 GL2PS_DRAW_BACKGROUND | GL2PS_USE_CURRENT_VIEWPORT,
1464 GL_RGBA, 0, NULL, 0, 0, 0, buffsize, fp,
"out.eps");
1465 glMatrixMode(GL_MODELVIEW);
1467 glDisable(GL_TEXTURE_2D);
1468 glDisable(GL_ALPHA_TEST);
1469 glDisable(GL_BLEND);
1470 glEnable(GL_DEPTH_TEST);
1479 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
1481 const float minB[2] = { (float)viewPort.
xmin(), (float)viewPort.
ymin() };
1482 const float maxB[2] = { (float)viewPort.
xmax(), (float)viewPort.
ymax() };
1484 glEnable(GL_POLYGON_OFFSET_FILL);
1485 glEnable(GL_POLYGON_OFFSET_LINE);
1489 state = gl2psEndPage();
1495 return "Could not save '" + destFile +
"', gl2ps was not enabled at compile time.";
1503 FXMALLOC(&buf, FXColor, getWidth()*getHeight());
1505 glReadBuffer(GL_BACK);
1507 glReadPixels(0, 0, getWidth(), getHeight(), GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid*)buf);
1511 int mwidth = getWidth();
1512 int mheight = getHeight();
1514 FXColor* pbb = buf + mwidth * (mheight - 1);
1525 }
while (paa < pbb);
1531 errorMessage =
"video";
1532 }
catch (std::runtime_error& err) {
1533 errorMessage = err.what();
1538 errorMessage =
"Could not save '" + destFile +
"'.";
1541 errorMessage =
"Could not save '" + destFile +
"'.\n" + e.what();
1545 return errorMessage;
1559#ifdef DEBUG_SNAPSHOT
1560 std::cout <<
"check snapshots time=" << time <<
" registeredTimes=" <<
mySnapshots.size() <<
"\n";
1567 std::vector<std::tuple<std::string, int, int> > files = snapIt->second;
1570 for (
const auto& entry : files) {
1571#ifdef DEBUG_SNAPSHOT
1572 std::cout <<
"make snapshot time=" << time <<
" file=" << file <<
"\n";
1574 const std::string& error =
makeSnapshot(std::get<0>(entry), std::get<1>(entry), std::get<2>(entry));
1575 if (error !=
"" && error !=
"video") {
1583#ifdef DEBUG_SNAPSHOT
1584 std::cout <<
" files=" <<
toString(files) <<
" myApplicationSnapshots=" <<
joinToString(*myApplicationSnapshots,
",") <<
"\n";
1646 myChanger->setViewportFrom(lookFrom.
x(), lookFrom.
y(), lookFrom.
z());
1693 return myGrid->getWidth();
1699 return myGrid->getHeight();
1728std::vector<GUISUMOAbstractView::Decal>&
1764 if (decal.glID > 0) {
1768 decal.initialised =
false;
1784 GDALDataset* poDataset = (GDALDataset*)GDALOpen(d.
filename.c_str(), GA_ReadOnly);
1785 if (poDataset == 0) {
1788 const int xSize = poDataset->GetRasterXSize();
1789 const int ySize = poDataset->GetRasterYSize();
1791 if (d.
width <= 0.) {
1792 double adfGeoTransform[6];
1793 if (poDataset->GetGeoTransform(adfGeoTransform) == CE_None) {
1794 Position topLeft(adfGeoTransform[0], adfGeoTransform[3]);
1795 const double horizontalSize = xSize * adfGeoTransform[1];
1796 const double verticalSize = ySize * adfGeoTransform[5];
1797 Position bottomRight(topLeft.
x() + horizontalSize, topLeft.
y() + verticalSize);
1805 d.
width = bottomRight.
x() - topLeft.
x();
1806 d.
height = topLeft.
y() - bottomRight.
y();
1807 d.
centerX = (topLeft.
x() + bottomRight.
x()) / 2;
1808 d.
centerY = (topLeft.
y() + bottomRight.
y()) / 2;
1812 if (d.
width <= 0.) {
1819 const int picSize = xSize * ySize;
1821 if (!FXMALLOC(&result, FXColor, picSize)) {
1825 for (
int j = 0; j < picSize; j++) {
1829 for (
int i = 1; i <= poDataset->GetRasterCount(); i++) {
1830 GDALRasterBand* poBand = poDataset->GetRasterBand(i);
1832 if (poBand->GetColorInterpretation() == GCI_RedBand) {
1834 }
else if (poBand->GetColorInterpretation() == GCI_GreenBand) {
1836 }
else if (poBand->GetColorInterpretation() == GCI_BlueBand) {
1838 }
else if (poBand->GetColorInterpretation() == GCI_AlphaBand) {
1844 assert(xSize == poBand->GetXSize() && ySize == poBand->GetYSize());
1845 if (poBand->RasterIO(GF_Read, 0, 0, xSize, ySize, ((
unsigned char*)result) + shift, xSize, ySize, GDT_Byte, 4, 4 * xSize) == CE_Failure) {
1850 GDALClose(poDataset);
1852 return new FXImage(getApp(), result, IMAGE_OWNED | IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP, xSize, ySize);
1865 if (decal.skip2D || decal.filename.empty()) {
1868 if (!decal.initialised) {
1871 if (img ==
nullptr) {
1877 decal.initialised =
true;
1879 WRITE_ERROR(
"Could not load '" + decal.filename +
"'.\n" + e.what());
1880 decal.skip2D =
true;
1884 if (decal.screenRelative) {
1886 glTranslated(center.
x(), center.
y(), decal.layer);
1888 glTranslated(decal.centerX, decal.centerY, decal.layer);
1890 glRotated(decal.rot, 0, 0, 1);
1892 double halfWidth = decal.width / 2.;
1893 double halfHeight = decal.height / 2.;
1894 if (decal.screenRelative) {
1895 halfWidth =
p2m(halfWidth);
1896 halfHeight =
p2m(halfHeight);
1910 myApp->getCursorPosition(x, y, b);
1911 int appX =
myApp->getX();
1912 int popX = x + appX;
1913 int popY = y +
myApp->getY();
1919 const int rootWidth = getApp()->getRootWindow()->getWidth();
1920 const int rootHeight = getApp()->getRootWindow()->getHeight();
1921 if (popX <= rootWidth) {
1922 const int maxX = (appX < 0) ? 0 : rootWidth;
1923 popX =
MIN2(popX, maxX -
myPopup->getWidth() - 10);
1925 popY =
MIN2(popY, rootHeight -
myPopup->getHeight() - 50);
1975 glMatrixMode(GL_PROJECTION);
1980 glOrtho(0, getWidth(), 0, getHeight(), -
GLO_MAX - 1,
GLO_MAX + 1);
1981 glMatrixMode(GL_MODELVIEW);
1983 double scaleX = (double)getWidth() / bound.
getWidth();
1984 double scaleY = (double)getHeight() / bound.
getHeight();
1985 glScaled(scaleX, scaleY, 1);
1986 glTranslated(-bound.
xmin(), -bound.
ymin(), 0);
1991 glRotated(
myChanger->getRotation(), 0, 0, 1);
2008 return myApp->getDelay();
2014 myApp->setDelay(delay);
2020 myApp->setBreakpoints(breakpoints);
2027 if (rs.
hideMin && rs.
hideMax && minValue == std::numeric_limits<double>::infinity()) {
2039 if (minValue != std::numeric_limits<double>::infinity()) {
2047 || hasMissingData) {
2051 const double rawRange = maxValue - minValue;
2056 const double rawRange = maxValue - minValue;
2060 const double range = maxValue - minValue;
2062 const int steps = (int)rs.
colors.size() - 1;
2064 const int steps1 = steps / 2;
2065 const int steps2 = steps - steps1;
2068 for (
int i = 1; i < steps1; i++) {
2072 for (
int i = 1; i < steps2; i++) {
2076 for (
int i = 1; i < steps; i++) {
2088 second.first =
object->getType();
2089 second.second =
object->getMicrosimID();
2095 first =
object->getType();
2096 second.first =
object->getType();
2097 second.second =
object->getMicrosimID();
@ MID_GLCANVAS
GLCanvas - ID.
@ MID_REACHABILITY
show reachability from a given lane
@ MID_CLOSE_LANE
close lane
@ MID_CURSORDIALOG_FRONT
remove/select/mark front element
@ MID_CLOSE_EDGE
close edge
@ MID_SIMPLE_VIEW_COLORCHANGE
Informs the dialog about a value's change.
@ MID_ADD_REROUTER
add rerouter
GUICompleteSchemeStorage gSchemeStorage
@ MOVEVIEW
move view cursor
#define GUIDesignTextColorBlack
black color (for correct text)
@ GLO_NETWORK
The network - empty.
GUISelectedStorage gSelected
A global holder of selected objects.
GUIPropertyScheme< RGBColor > GUIColorScheme
FXDEFMAP(GUISUMOAbstractView) GUISUMOAbstractViewMap[]
#define WRITE_WARNINGF(...)
#define WRITE_WARNING(msg)
const double SUMO_const_laneWidth
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
#define TLC(context, string)
A class that stores a 2D geometrical boundary.
Position getCenter() const
Returns the center of the boundary.
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
double ymin() const
Returns minimum y-coordinate.
double xmin() const
Returns minimum x-coordinate.
Boundary & grow(double by)
extends the boundary by the given amount
double getHeight() const
Returns the height of the boundary (y-axis).
double getWidth() const
Returns the width of the boudary (x-axis).
double ymax() const
Returns maximum y-coordinate.
double xmax() const
Returns maximum x-coordinate.
static void resetVertexCounter()
reset vertex counter
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
static void pushName(unsigned int name)
push Name
static void checkCounterMatrix()
check counter matrix (for debug purposes)
static void popMatrix()
pop matrix
static int getMatrixCounter()
get matrix counter
static void checkCounterName()
check counter name (for debug purposes)
static void popName()
pop Name
static void pushMatrix()
push matrix
static void setGL2PS(bool active=true)
set GL2PS
static int getVertexCounter()
get vertex counter
static void drawText(const std::string &text, const Position &pos, const double layer, const double size, const RGBColor &col=RGBColor::BLACK, const double angle=0, const int align=0, double width=-1)
static void resetMatrixCounter()
reset matrix counter
Dialog for edit rerouter intervals.
static FXCursor * getCursor(GUICursor which)
returns a cursor previously defined in the enum GUICursor
A dialog to change the viewport.
The dialog to change the view (gui) settings.
static const double INVALID_PRIORITY
static const GUIGlID INVALID_ID
virtual double getClickPriority() const
Returns the priority of receiving mouse clicks.
virtual Boundary getCenteringBoundary() const =0
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
virtual Position getCenter() const
GUIGlID getGlID() const
Returns the numerical id of the object.
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
Representation of a lane in the micro simulation (gui-version).
const std::vector< double > & getThresholds() const
const std::vector< std::string > & getNames() const
const std::string & getName() const
const std::vector< T > & getColors() const
int addColor(const T &color, const double threshold, const std::string &name="")
MFXComboBoxIcon * getColoringSchemesCombo()
get coloring schemes combo
bool myAmInitialised
Internal information whether doInit() was called.
Position snapToActiveGrid(const Position &pos, bool snapXY=true) const
Returns a position that is mapped to the closest grid point if the grid is active.
std::vector< GUIGlObject * > myCurrentObjectsDialog
vector with current objects dialog
std::string makeSnapshot(const std::string &destFile, const int w=-1, const int h=-1)
Takes a snapshots and writes it into the given file.
void updateToolTip()
A method that updates the tooltip.
void addDecals(const std::vector< Decal > &decals)
add decals
virtual void checkSnapshots()
Checks whether it is time for a snapshot.
void showViewschemeEditor()
show viewsscheme editor
GUISUMOAbstractView(FXComposite *p, GUIMainWindow &app, GUIGlChildWindow *parent, const SUMORTree &grid, FXGLVisual *glVis, FXGLCanvas *share)
constructor
static const double SENSITIVITY
virtual long onLeftBtnRelease(FXObject *, FXSelector, void *)
void displayLegend()
Draws a line with ticks, and the length information.
virtual long onVisualizationChange(FXObject *, FXSelector, void *)
hook to react on change in visualization settings
std::vector< GUIGlObject * > getGUIGlObjectsUnderCursor()
returns the GUIGlObject under the cursor using GL_SELECT (including overlapped objects)
long myFrameDrawTime
counter for measuring rendering time
void processPendingTextureDeletes()
process pending texture deletions
void replacePopup(GUIGLObjectPopupMenu *popUp)
replace PopUp
FXMutex myTextureDeleteMutex
mutex for pending texture deletes
std::vector< GUIGlID > getObjectsAtPosition(Position pos, double radius)
returns the ids of the object at position within the given (rectangular) radius using GL_SELECT
const SUMORTree * myGrid
The visualization speed-up.
void openObjectDialog(const std::vector< GUIGlObject * > &objects, const bool filter=true)
open object dialog for the given object
virtual void saveFrame(const std::string &destFile, FXColor *buf)
Adds a frame to a video snapshot which will be initialized if necessary.
virtual void recenterView()
recenters the view
virtual SUMOTime getCurrentTimeStep() const
get the current simulation time
void paintGLGrid() const
paints a grid
FXbool makeCurrent()
A reimplementation due to some internal reasons.
int myMouseHotspotX
Offset to the mouse-hotspot from the mouse position.
GUIMainWindow * getMainWindow() const
get main window
bool isInEditMode()
returns true, if the edit button was pressed
void buildMinMaxRainbow(const GUIVisualizationSettings &s, GUIColorScheme &scheme, const GUIVisualizationRainbowSettings &rs, double minValue, double maxValue, bool hasMissingData)
helper function for buildColorRainbow
virtual long onMiddleBtnRelease(FXObject *, FXSelector, void *)
virtual long onMouseMove(FXObject *, FXSelector, void *)
bool myPanning
Panning flag.
bool isAdditionalGLVisualisationEnabled(GUIGlObject *const which) const
Check if an object is added in the additional GL visualitation.
FXMutex myDecalsLockMutex
The mutex to use before accessing the decals list in order to avoid thread conflicts.
FXCondition mySnapshotCondition
the semaphore when waiting for snapshots to finish
virtual GUIGlID getToolTipID()
returns the id of object under cursor to show their tooltip
Position myPopupPosition
The current popup-menu position.
virtual void doInit()
doInit
FXint myWindowCursorPositionY
std::vector< GUIGlObject * > filterContextObjects(const std::vector< GUIGlObject * > &objects)
filter out duplicate and forbidden objects
GUIGlID getObjectUnderCursor(double sensitivity=SENSITIVITY)
returns the id of the front object under the cursor using GL_SELECT
virtual long onCmdCloseEdge(FXObject *, FXSelector, void *)
virtual int doPaintGL(int, const Boundary &)
paint GL
virtual void showViewportEditor()
show viewport editor
const GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings (read only)
void queueTextureDelete(unsigned int textureId)
queue a texture for deletion
void setDelay(double delay)
Sets the delay of the parent application.
Boundary getVisibleBoundary() const
get visible boundary
Position screenPos2NetPos(int x, int y) const
Translate screen position to network position.
void addSnapshot(SUMOTime time, const std::string &file, const int w=-1, const int h=-1)
Sets the snapshot time to file map.
GUIPerspectiveChanger & getChanger() const
get changer
virtual void centerTo(GUIGlID id, bool applyZoom, double zoomDist=20)
centers to the chosen artifact
GUIMainWindow * myApp
The application.
GUIDialog_EditViewport * getViewportEditor()
get the viewport and create it on first access
virtual void zoom2Pos(Position &camera, Position &lookAt, double zoom)
zoom interface for 3D view
GUIGlID getObjectAtPosition(Position pos, double sensitivity=SENSITIVITY)
returns the id of the object at position using GL_SELECT
std::vector< GUIGlID > getObjectsInBoundary(Boundary bound)
returns the ids of all objects in the given boundary
virtual long onCmdCloseLane(FXObject *, FXSelector, void *)
interaction with the simulation
void drawFPS()
Draws frames-per-second indicator.
virtual long onMouseWheel(FXObject *, FXSelector, void *)
double getGridWidth() const
get grid width
std::vector< Decal > & getDecals()
The list of decals to show.
void clearDecals()
clear all decals
bool removeAdditionalGLVisualisation(GUIGlObject *const which)
Removes an object from the list of objects that show additional things.
GUIGlChildWindow * myGlChildWindowParent
The parent window.
GUIGlChildWindow * getGUIGlChildWindow()
get GUIGlChildWindow
double getDelay() const
Returns the delay of the parent application.
virtual void updatePositionInformationLabel() const
update position information labels
std::vector< GUIGlObject * > getGUIGlObjectsAtPosition(Position pos, double radius)
returns the GUIGlObjects at position within the given (rectangular) radius using GL_SELECT
virtual long onLeftBtnPress(FXObject *, FXSelector, void *)
virtual void setViewportFromToRot(const Position &lookFrom, const Position &lookAt, double rotation)
applies the given viewport settings
double p2m(double pixel) const
pixels-to-meters conversion method
std::vector< Decal > myDecals
The list of decals to show.
const Position & getPopupPosition() const
get position of current popup
double m2p(double meter) const
meter-to-pixels conversion method
virtual GUILane * getLaneUnderCursor()
returns the GUILane at cursor position (implementation depends on view)
virtual void openObjectDialogAtCursor(const FXEvent *ev)
open object dialog at the cursor position
virtual void onGamingClick(Position)
on gaming click
bool myInEditMode
Information whether too-tip informations shall be generated.
GUIVisualizationSettings * editVisualisationSettings() const
edit visualization settings (allow modify VisualizationSetings, use carefully)
GUIVisualizationSettings * myVisualizationSettings
visualization settings
void destroyPopup()
destroys the popup
Position getWindowCursorPosition() const
return windows cursor position
virtual long onKeyPress(FXObject *o, FXSelector sel, void *data)
keyboard functions
GUIDialog_EditViewport * myGUIDialogEditViewport
viewport chooser
void displayColorLegend(const GUIColorScheme &scheme, bool leftSide, const std::string &key)
Draws a legend for the given scheme.
virtual long onMiddleBtnPress(FXObject *, FXSelector, void *)
void paintGL()
FOX needs this.
virtual void stopTrack()
stop track
virtual Position getPositionInformation() const
Returns the cursor's x/y position within the network.
std::vector< GUIGlObject * > getGUIGlObjectsUnderSnappedCursor()
returns the GUIGlObject under the gripped cursor using GL_SELECT (including overlapped objects)
bool showToolTipFor(const GUIGlID idToolTip)
invokes the tooltip for the given object
virtual long onKeyRelease(FXObject *o, FXSelector sel, void *data)
GUIDialog_ViewSettings * myGUIDialogViewSettings
Visualization changer.
virtual void onGamingRightClick(Position)
void setWindowCursorPosition(FXint x, FXint y)
Returns the gl-id of the object under the given coordinates.
double getFPS() const
retrieve FPS
virtual long onCmdShowReachability(FXObject *, FXSelector, void *)
highlight edges according to reachability
std::map< GUIGlObject *, int > myAdditionallyDrawn
List of objects for which GUIGlObject::drawGLAdditional is called.
void drawDecals()
Draws the stored decals.
std::vector< GUIGlID > getObjectsUnderCursor()
returns the id of the objects under the cursor using GL_SELECT (including overlapped objects)
Boundary applyGLTransform(bool fixRatio=true)
applies gl-transformations to fit the Boundary given by myChanger onto the canvas....
virtual void updateViewportValues()
update the viewport chooser with the current view values
FXImage * checkGDALImage(Decal &d)
check whether we can read image data or position with gdal
double getGridHeight() const
get grid height
virtual void startTrack(int)
star track
virtual long onDoubleClicked(FXObject *, FXSelector, void *)
FXMutex & getDecalsLockMutex()
The mutex to use before accessing the decals list in order to avoid thread conflicts.
virtual bool is3DView() const
return whether this is a 3D view
void displayLegends()
Draws the configured legends.
FXMutex mySnapshotsMutex
The mutex to use before accessing the decals list in order to avoid thread conflicts.
virtual long onMouseLeft(FXObject *, FXSelector, void *)
virtual long onRightBtnRelease(FXObject *, FXSelector, void *)
FXint myWindowCursorPositionX
Position of the cursor relative to the window.
GUIPerspectiveChanger * myChanger
The perspective changer.
GUIGLObjectPopupMenu * myPopup
The current popup-menu.
virtual void copyViewportTo(GUISUMOAbstractView *view)
copy the viewport to the given view
void setBreakpoints(const std::vector< SUMOTime > &breakpoints)
Sets the breakpoints of the parent application.
void waitForSnapshots(const SUMOTime snapshotTime)
bool addAdditionalGLVisualisation(GUIGlObject *const which)
Adds an object to call its additional visualisation method.
virtual bool setColorScheme(const std::string &)
set color scheme
GUIGLObjectPopupMenu * getPopup() const
ge the current popup-menu
virtual long onCmdAddRerouter(FXObject *, FXSelector, void *)
std::vector< GUIGlObject * > filterInternalLanes(const std::vector< GUIGlObject * > &objects) const
filter internal lanes in Objects under cursor
virtual long onPaint(FXObject *, FXSelector, void *)
virtual long onRightBtnPress(FXObject *, FXSelector, void *)
virtual ~GUISUMOAbstractView()
destructor
virtual long onConfigure(FXObject *, FXSelector, void *)
mouse functions
std::map< SUMOTime, std::vector< std::tuple< std::string, int, int > > > mySnapshots
Snapshots.
void remove(GUIDialog_EditViewport *)
remove viewport
virtual GUIGlID getTrackedID() const
get tracked id
void openPopupDialog()
open popup dialog
std::vector< unsigned int > myPendingTextureDeletes
texture IDs pending deletion
static void drawTexturedBox(int which, double size)
Draws a named texture as a box with the given size.
static GUIGlID add(FXImage *i)
Adds a texture to use.
static int getMaxTextureSize()
return maximum number of pixels in x and y direction
Stores the information about how to visualize structures.
static const std::string SCHEME_NAME_DATA_ATTRIBUTE_NUMERICAL
static const double MISSING_DATA
static const std::string SCHEME_NAME_EDGEDATA_NUMERICAL
static const std::string SCHEME_NAME_LANE_PARAM_NUMERICAL
static RGBColor COL_MISSING_DATA
static const std::string SCHEME_NAME_EDGE_PARAM_NUMERICAL
scheme names
static const std::string SCHEME_NAME_PARAM_NUMERICAL
const Position getOffset() const
Returns the network offset.
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
void cartesian2geo(Position &cartesian) const
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
static FXImage * loadImage(FXApp *a, const std::string &file)
static FXbool scalePower2(FXImage *image, int maxSize=(2<< 29))
static FXbool saveImage(const std::string &file, int width, int height, FXColor *data)
static void sleep(long ms)
static OptionsCont & getOptions()
Retrieves the options.
A point in 2D or 3D with translation and scaling methods.
static const Position INVALID
used to indicate that a position is valid
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
double x() const
Returns the x-position.
Position rotateAround2D(double rad, const Position &origin)
rotate this position by rad around origin and return the result
double z() const
Returns the z-position.
double y() const
Returns the y-position.
static RGBColor interpolate(const RGBColor &minColor, const RGBColor &maxColor, double weight)
Interpolates between two colors.
static const RGBColor WHITE
static const RGBColor BLACK
static const RGBColor RED
named colors
A RT-tree for efficient storing of SUMO's GL-objects.
static bool startsWith(const std::string &str, const std::string prefix)
Checks whether a given string starts with the prefix.
static long getCurrentMillis()
Returns the current time in milliseconds.
#define UNUSED_PARAMETER(x)
comparator for resolving clicks
A decal (an image) that can be shown.
double centerX
The center of the image in x-direction (net coordinates, in m).
double height
The height of the image (net coordinates in y-direction, in m).
double width
The width of the image (net coordinates in x-direction, in m).
double centerY
The center of the image in y-direction (net coordinates, in m).
std::string filename
The path to the file the image is located at.
GUIGlObject * getGLObject() const
get GLObject
GUIGlObject * myGLObject
GLObject.
LayerObject(double layer, GUIGlObject *object)
constructor for shapes
bool hideMax
whether data above threshold should not be colored
bool setNeutral
whether the scale should be centered at a specific value
bool fixRange
whether the color scale should be fixed to the given min/max values
double minThreshold
threshold below which value should not be colored
std::vector< RGBColor > colors
color steps for the rainbow;
bool hideMin
whether data below threshold should not be colored
double neutralThreshold
neutral point of scale
double maxThreshold
threshold above which value should not be colored