69 #pragma GCC diagnostic push
70 #pragma GCC diagnostic ignored "-Wpedantic"
72 #include <gdal_priv.h>
74 #pragma GCC diagnostic pop
116 FXIMPLEMENT_ABSTRACT(
GUISUMOAbstractView, FXGLCanvas, GUISUMOAbstractViewMap, ARRAYNUMBER(GUISUMOAbstractViewMap))
123 FXGLCanvas(p, glVis, share, p,
MID_GLCANVAS, LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0),
128 myMouseHotspotX(app.getDefaultCursor()->getHotX()),
129 myMouseHotspotY(app.getDefaultCursor()->getHotY()),
132 myUseToolTips(false),
133 myAmInitialised(false),
134 myViewportChooser(
nullptr),
135 myWindowCursorPositionX(getWidth() / 2),
136 myWindowCursorPositionY(getHeight() / 2),
137 myVisualizationChanger(
nullptr),
141 flags |= FLAG_ENABLED;
142 myInEditMode =
false;
146 myVisualizationSettings->
gaming = myApp->isGaming();
159 for (std::vector<GUISUMOAbstractView::Decal>::iterator it =
myDecals.begin(); it !=
myDecals.end(); ++it) {
163 i.first->removeActiveAddVisualisation(
this, ~0);
217 double xNet = bound.
xmin() + bound.
getWidth() * x / getWidth();
219 double yNet = bound.
ymin() + bound.
getHeight() * (getHeight() - y) / getHeight();
269 if (getWidth() == 0 || getHeight() == 0) {
289 glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
290 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
295 glDisable(GL_DITHER);
298 glDisable(GL_LINE_SMOOTH);
331 std::vector<GUIGlObject*>
337 std::vector<GUIGlObject*>
347 positionBoundary.
add(pos);
352 double maxLayer = -std::numeric_limits<double>::max();
354 for (
const auto& i : ids) {
369 double layer = (double)type;
374 layer =
dynamic_cast<Shape*
>(o)->getShapeLayer();
381 if (layer > maxLayer) {
396 std::vector<GUIGlID> result;
400 selection.
grow(radius);
404 for (
const auto& i : ids) {
428 std::vector<GUIGlObject*>
431 std::vector<GUIGlObject*> result;
435 selection.
grow(radius);
439 for (
const auto& i : ids) {
460 const int NB_HITS_MAX = 1024 * 1024;
462 static GUIGlID hits[NB_HITS_MAX];
463 static GLint nb_hits = 0;
464 glSelectBuffer(NB_HITS_MAX, hits);
472 if (singlePosition) {
482 nb_hits = glRenderMode(GL_RENDER);
486 std::vector<GUIGlID> result;
489 for (
int i = 0; i < nb_hits; ++i) {
492 for (
int j = 0; j < (int)numNames; j++) {
493 result.push_back(*ptr);
507 if (
object !=
nullptr) {
510 std::string label =
object->getFullName();
529 glEnable(GL_DEPTH_TEST);
544 glTranslated(0, 0, .55);
545 glColor3d(0.5, 0.5, 0.5);
549 glVertex2d(xmin, yp);
550 glVertex2d(xmax, yp);
555 glVertex2d(xp, ymin);
556 glVertex2d(xp, ymax);
560 glTranslated(0, 0, -.55);
569 const std::string text(
"10000000000");
571 int pixelSize = (int)
m2p((
double) length);
572 while (pixelSize <= 20) {
575 if (noDigits > (
int)text.length()) {
578 pixelSize = (int)
m2p((
double) length);
582 glMatrixMode(GL_PROJECTION);
585 glMatrixMode(GL_MODELVIEW);
591 glDisable(GL_TEXTURE_2D);
592 glDisable(GL_ALPHA_TEST);
594 glEnable(GL_DEPTH_TEST);
596 glTranslated(0, 0, z);
598 double len = (double) pixelSize / (
double)(getWidth() - 1) * (
double) 2.0;
600 double o = double(15) / double(getHeight());
602 double oo = double(5) / double(getHeight());
605 glVertex2d(-.98, -1. + o);
606 glVertex2d(-.98 + len, -1. + o);
608 glVertex2d(-.98, -1. + o);
609 glVertex2d(-.98, -1. + o2);
611 glVertex2d(-.98 + len, -1. + o);
612 glVertex2d(-.98 + len, -1. + o2);
616 const double fontHeight = 0.1 * 300. / getHeight();
617 const double fontWidth = 0.1 * 300. / getWidth();
625 glMatrixMode(GL_PROJECTION);
627 glMatrixMode(GL_MODELVIEW);
648 glMatrixMode(GL_PROJECTION);
651 glMatrixMode(GL_MODELVIEW);
656 glEnable(GL_DEPTH_TEST);
659 glTranslated(0, 0, z);
661 const bool fixed = scheme.
isFixed();
662 const int numColors = (int)scheme.
getColors().size();
667 double textX = left - 0.01;
669 const double top = -0.8;
670 const double bot = 0.8;
671 const double dy = (top - bot) / numColors;
672 const double bot2 = fixed ? bot : bot + dy / 2;
677 std::swap(right, left);
678 textX = right + 0.01;
684 glVertex2d(right, top);
685 glVertex2d(right, bot2);
686 glVertex2d(left, bot2);
687 glVertex2d(left, top);
688 glVertex2d(right, top);
689 glVertex2d(left, top);
690 glVertex2d(right, bot2);
691 glVertex2d(left, bot2);
694 const double fontHeight = 0.20 * 300. / getHeight();
695 const double fontWidth = 0.20 * 300. / getWidth();
697 const int fadeSteps = fixed ? 1 : 10;
698 double colorStep = dy / fadeSteps;
699 for (
int i = 0; i < numColors; i++) {
701 const double topi = top - i * dy;
704 if (i + 1 < numColors) {
707 for (
double j = 0.0; j < fadeSteps; j++) {
710 glVertex2d(left, topi - j * colorStep);
711 glVertex2d(right, topi - j * colorStep);
712 glVertex2d(right, topi - (j + 1) * colorStep);
713 glVertex2d(left, topi - (j + 1) * colorStep);
719 glVertex2d(left, topi);
720 glVertex2d(right, topi);
721 glVertex2d(right, bot2);
722 glVertex2d(left, bot2);
727 std::string name = scheme.
getNames()[i];
730 const double bgShift = 0.0;
731 const double textShift = 0.02;
734 glTranslated(0, 0, 0.1);
736 glVertex2d(left, topi + fontHeight * bgShift);
737 glVertex2d(left - fontWidth * text.size() / 2, topi + fontHeight * bgShift);
738 glVertex2d(left - fontWidth * text.size() / 2, topi + fontHeight * (1 + bgShift));
739 glVertex2d(left, topi + fontHeight * (1 + bgShift));
741 glTranslated(0, 0, -0.1);
746 glMatrixMode(GL_PROJECTION);
748 glMatrixMode(GL_MODELVIEW);
760 glMatrixMode(GL_PROJECTION);
763 glMatrixMode(GL_MODELVIEW);
766 const double fontHeight = 0.2 * 300. / getHeight();
767 const double fontWidth = 0.2 * 300. / getWidth();
771 glMatrixMode(GL_PROJECTION);
773 glMatrixMode(GL_MODELVIEW);
799 if (o !=
nullptr &&
dynamic_cast<GUIGlObject*
>(o) !=
nullptr) {
800 if (applyZoom && zoomDist < 0) {
850 FXbool ret = FXGLCanvas::makeCurrent();
858 glViewport(0, 0, getWidth() - 1, getHeight() - 1);
905 FXEvent* e = (FXEvent*) ptr;
907 if ((e->state & CONTROLMASK) != 0) {
922 if ((e->state & SHIFTMASK) != 0) {
943 if (e->click_count == 2) {
944 handle(
this, FXSEL(SEL_DOUBLECLICKED, 0), ptr);
1073 myApp->getCursorPosition(x, y, b);
1074 int popX = x +
myApp->getX();
1075 int popY = y +
myApp->getY();
1081 const int rootWidth = getApp()->getRootWindow()->getWidth();
1082 const int rootHeight = getApp()->getRootWindow()->getHeight();
1083 if (popX <= rootWidth) {
1086 if (popY <= rootHeight) {
1101 return myPopup->onKeyPress(o, sel, ptr);
1103 FXEvent* e = (FXEvent*) ptr;
1104 if (e->state & CONTROLMASK) {
1105 if (e->code == FX::KEY_Page_Up) {
1110 }
else if (e->code == FX::KEY_Page_Down) {
1117 FXGLCanvas::onKeyPress(o, sel, ptr);
1126 return myPopup->onKeyRelease(o, sel, ptr);
1128 FXGLCanvas::onKeyRelease(o, sel, ptr);
1137 #ifdef DEBUG_SNAPSHOT
1138 std::cout <<
"add snapshot time=" << time <<
" file=" << file <<
"\n";
1141 mySnapshots[time].push_back(std::make_tuple(file, w, h));
1151 std::string errorMessage;
1152 FXString ext = FXPath::extension(destFile.c_str());
1153 const bool useGL2PS = ext ==
"ps" || ext ==
"eps" || ext ==
"pdf" || ext ==
"svg" || ext ==
"tex" || ext ==
"pgf";
1155 const bool useVideo = destFile ==
"" || ext ==
"h264" || ext ==
"hevc" || ext ==
"mp4";
1166 glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
1167 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
1170 glEnable(GL_DITHER);
1172 glDisable(GL_DITHER);
1175 glDisable(GL_LINE_SMOOTH);
1181 GLint format = GL2PS_PS;
1184 }
else if (ext ==
"eps") {
1186 }
else if (ext ==
"pdf") {
1188 }
else if (ext ==
"tex") {
1190 }
else if (ext ==
"svg") {
1192 }
else if (ext ==
"pgf") {
1195 return "Could not save '" + destFile +
"'.\n Unrecognized format '" + std::string(ext.text()) +
"'.";
1197 FILE* fp = fopen(destFile.c_str(),
"wb");
1199 return "Could not save '" + destFile +
"'.\n Could not open file for writing";
1202 GLint buffsize = 0, state = GL2PS_OVERFLOW;
1204 glGetIntegerv(GL_VIEWPORT, viewport);
1205 while (state == GL2PS_OVERFLOW) {
1206 buffsize += 1024 * 1024;
1207 gl2psBeginPage(destFile.c_str(),
"sumo-gui; https://sumo.dlr.de", viewport, format, GL2PS_SIMPLE_SORT,
1208 GL2PS_DRAW_BACKGROUND | GL2PS_USE_CURRENT_VIEWPORT,
1209 GL_RGBA, 0, NULL, 0, 0, 0, buffsize, fp,
"out.eps");
1210 glMatrixMode(GL_MODELVIEW);
1212 glDisable(GL_TEXTURE_2D);
1213 glDisable(GL_ALPHA_TEST);
1214 glDisable(GL_BLEND);
1215 glEnable(GL_DEPTH_TEST);
1224 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
1226 const float minB[2] = { (float)viewPort.
xmin(), (float)viewPort.
ymin() };
1227 const float maxB[2] = { (float)viewPort.
xmax(), (float)viewPort.
ymax() };
1229 glEnable(GL_POLYGON_OFFSET_FILL);
1230 glEnable(GL_POLYGON_OFFSET_LINE);
1234 state = gl2psEndPage();
1240 return "Could not save '" + destFile +
"', gl2ps was not enabled at compile time.";
1248 FXMALLOC(&buf, FXColor, getWidth()*getHeight());
1250 glReadBuffer(GL_BACK);
1252 glReadPixels(0, 0, getWidth(), getHeight(), GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid*)buf);
1256 int mwidth = getWidth();
1257 int mheight = getHeight();
1259 FXColor* pbb = buf + mwidth * (mheight - 1);
1270 }
while (paa < pbb);
1276 errorMessage =
"video";
1277 }
catch (std::runtime_error& err) {
1278 errorMessage = err.what();
1283 errorMessage =
"Could not save '" + destFile +
"'.";
1286 errorMessage =
"Could not save '" + destFile +
"'.\n" + e.what();
1290 return errorMessage;
1304 #ifdef DEBUG_SNAPSHOT
1305 std::cout <<
"check snapshots time=" << time <<
" registeredTimes=" <<
mySnapshots.size() <<
"\n";
1312 std::vector<std::tuple<std::string, int, int> > files = snapIt->second;
1315 for (
const auto& entry : files) {
1316 #ifdef DEBUG_SNAPSHOT
1317 std::cout <<
"make snapshot time=" << time <<
" file=" << file <<
"\n";
1319 const std::string& error =
makeSnapshot(std::get<0>(entry), std::get<1>(entry), std::get<2>(entry));
1320 if (error !=
"" && error !=
"video") {
1328 #ifdef DEBUG_SNAPSHOT
1329 std::cout <<
" files=" <<
toString(files) <<
" myApplicationSnapshots=" <<
joinToString(*myApplicationSnapshots,
",") <<
"\n";
1367 const FXint minSize = 100;
1368 const FXint minTitlebarHeight = 20;
1369 int x =
MAX2(0,
MIN2(getApp()->reg().readIntEntry(
1370 "VIEWPORT_DIALOG_SETTINGS",
"x", 150),
1371 getApp()->getRootWindow()->getWidth() - minSize));
1372 int y =
MAX2(minTitlebarHeight,
MIN2(getApp()->reg().readIntEntry(
1373 "VIEWPORT_DIALOG_SETTINGS",
"y", 150),
1374 getApp()->getRootWindow()->getHeight() - minSize));
1488 GDALDataset* poDataset = (GDALDataset*)GDALOpen(d.
filename.c_str(), GA_ReadOnly);
1489 if (poDataset == 0) {
1492 const int xSize = poDataset->GetRasterXSize();
1493 const int ySize = poDataset->GetRasterYSize();
1495 if (d.
width <= 0.) {
1496 double adfGeoTransform[6];
1497 if (poDataset->GetGeoTransform(adfGeoTransform) == CE_None) {
1498 Position topLeft(adfGeoTransform[0], adfGeoTransform[3]);
1499 const double horizontalSize = xSize * adfGeoTransform[1];
1500 const double verticalSize = ySize * adfGeoTransform[5];
1501 Position bottomRight(topLeft.
x() + horizontalSize, topLeft.
y() + verticalSize);
1503 d.
width = bottomRight.
x() - topLeft.
x();
1504 d.
height = topLeft.
y() - bottomRight.
y();
1505 d.
centerX = (topLeft.
x() + bottomRight.
x()) / 2;
1506 d.
centerY = (topLeft.
y() + bottomRight.
y()) / 2;
1514 if (d.
width <= 0.) {
1521 const int picSize = xSize * ySize;
1523 if (!FXMALLOC(&result, FXColor, picSize)) {
1527 for (
int j = 0; j < picSize; j++) {
1528 result[j] = FXRGB(0, 0, 0);
1531 for (
int i = 1; i <= poDataset->GetRasterCount(); i++) {
1532 GDALRasterBand* poBand = poDataset->GetRasterBand(i);
1534 if (poBand->GetColorInterpretation() == GCI_RedBand) {
1536 }
else if (poBand->GetColorInterpretation() == GCI_GreenBand) {
1538 }
else if (poBand->GetColorInterpretation() == GCI_BlueBand) {
1540 }
else if (poBand->GetColorInterpretation() == GCI_AlphaBand) {
1546 assert(xSize == poBand->GetXSize() && ySize == poBand->GetYSize());
1547 if (poBand->RasterIO(GF_Read, 0, 0, xSize, ySize, ((
unsigned char*)result) + shift, xSize, ySize, GDT_Byte, 4, 4 * xSize) == CE_Failure) {
1552 GDALClose(poDataset);
1554 return new FXImage(getApp(), result, IMAGE_OWNED | IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP, xSize, ySize);
1566 for (std::vector<GUISUMOAbstractView::Decal>::iterator l =
myDecals.begin(); l !=
myDecals.end(); ++l) {
1574 if (img ==
nullptr) {
1589 glTranslated(center.
x(), center.
y(), d.
layer);
1593 glRotated(d.
rot, 0, 0, 1);
1595 double halfWidth = d.
width / 2.;
1596 double halfHeight = d.
height / 2.;
1598 halfWidth =
p2m(halfWidth);
1599 halfHeight =
p2m(halfHeight);
1651 glMatrixMode(GL_PROJECTION);
1656 glOrtho(0, getWidth(), 0, getHeight(), -
GLO_MAX - 1,
GLO_MAX + 1);
1657 glMatrixMode(GL_MODELVIEW);
1659 double scaleX = (double)getWidth() / bound.
getWidth();
1660 double scaleY = (double)getHeight() / bound.
getHeight();
1661 glScaled(scaleX, scaleY, 1);
1662 glTranslated(-bound.
xmin(), -bound.
ymin(), 0);
1714 screenRelative(false),
@ MID_GLCANVAS
GLCanvas - ID.
GUICompleteSchemeStorage gSchemeStorage
@ GLO_REROUTER_EDGE
a Rerouter over edge
@ GLO_NETWORK
The network - empty.
GUISelectedStorage gSelected
A global holder of selected objects.
FXDEFMAP(GUISUMOAbstractView) GUISUMOAbstractViewMap[]
#define WRITE_WARNING(msg)
const double SUMO_const_laneWidth
#define UNUSED_PARAMETER(x)
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)
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 sleep(long ms)
static void drawTextBox(const std::string &text, const Position &pos, const double layer, const double size, const RGBColor &txtColor=RGBColor::BLACK, const RGBColor &bgColor=RGBColor::WHITE, const RGBColor &borderColor=RGBColor::BLACK, const double angle=0, const double relBorder=0.05, const double relMargin=0.5, const int align=0)
draw Text box with given parameters
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
static void popMatrix()
pop matrix
static void checkCounterName()
check counter name
static void popName()
pop Name
static void pushMatrix()
push matrix
static void setGL2PS(bool active=true)
set GL2PS
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)
GUIVisualizationSettings & getDefault()
Returns the default scheme.
void saveViewport(const double x, const double y, const double z, const double rot)
Makes the given viewport the default.
void setDefault(const std::string &name)
Makes the scheme with the given name the default.
void setViewport(GUISUMOAbstractView *view)
Sets the default viewport.
A dialog to change the viewport.
void setOldValues(const Position &lookFrom, const Position &lookAt, double rotation)
Resets old values.
bool haveGrabbed() const
Returns the information whether one of the spin dialers is grabbed.
void setValues(double zoom, double xoff, double yoff, double rotation)
Sets the given values into the dialog.
void show()
overload show function to focus always in OK Button
The dialog to change the view (gui) settings.
void show()
show view settings dialog
void setCurrent(GUIVisualizationSettings *settings)
Sets current settings (called if reopened)
FXComboBox * getColoringSchemesCombo()
return combobox with the current coloring schemes (standard, fastest standard, real world....
virtual double getColorValue(const GUIVisualizationSettings &, int) const
static const GUIGlID INVALID_ID
virtual Boundary getCenteringBoundary() const =0
virtual void onLeftBtnPress(void *)
notify object about left click
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)=0
Returns an own popup-menu.
GUIGlID getGlID() const
Returns the numerical id of the object.
void unblockObject(GUIGlID id)
Marks an object as unblocked.
GUIGlObject * getNetObject() const
Returns the network object.
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
GUIGlObject * getObjectBlocking(GUIGlID id)
Returns the object from the container locking it.
FXLabel & getCartesianLabel()
get cartesian label
virtual double getDelay() const
Returns the delay (should be overwritten by subclasses if applicable)
bool isGaming() const
return whether the gui is in gaming mode
virtual void setBreakpoints(const std::vector< SUMOTime > &)
Sets the breakpoints of the parent application.
virtual void setStatusBarText(const std::string &)
get status bar text (can be implemented in children)
virtual void setDelay(double)
Sets the delay of the parent application.
FXLabel & getGeoLabel()
get geo label
virtual void setViewportFrom(double xPos, double yPos, double zPos)=0
Alternative method for setting the viewport.
virtual long onKeyPress(void *data)
called when user press a key
virtual void setRotation(double rotation)=0
Sets the rotation.
virtual void onRightBtnPress(void *data)
called when user press right button
virtual void centerTo(const Position &pos, double radius, bool applyZoom=true)=0
Centers the view to the given position, setting it to a size that covers the radius....
virtual double getRotation() const =0
Returns the rotation of the canvas stored in this changer.
virtual bool onLeftBtnRelease(void *data)
called when user releases left button
virtual double getZoom() const =0
Returns the zoom factor computed stored in this changer.
virtual void onLeftBtnPress(void *data)
mouse functions
virtual double getXPos() const =0
Returns the x-offset of the field to show stored in this changer.
virtual double getYPos() const =0
Returns the y-offset of the field to show stored in this changer.
virtual long onKeyRelease(void *data)
called when user releases a key
virtual void onMouseMove(void *data)
called when user moves mouse
virtual double getZPos() const =0
Returns the camera height corresponding to the current zoom factor.
virtual void onMouseWheel(void *data)
called when user changes mouse wheel
virtual bool onRightBtnRelease(void *data)
called when user releases right button
Boundary getViewport(bool fixRatio=true)
get viewport
virtual void setViewport(double zoom, double xPos, double yPos)=0
Sets the viewport Used for: Adapting a new viewport.
const std::vector< double > & getThresholds() const
const std::vector< T > & getColors() const
const std::vector< std::string > & getNames() const
void paintGLGrid()
paints a grid
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::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
static const double SENSITIVITY
virtual long onLeftBtnRelease(FXObject *, FXSelector, void *)
FXMutex myDecalsLock
The mutex to use before accessing the decals list in order to avoid thread conflicts.
void displayLegend()
Draws a line with ticks, and the length information.
std::vector< GUIGlObject * > getGUIGlObjectsUnderCursor()
returns the GUIGlObject under the cursor using GL_SELECT (including overlapped objects)
long myFrameDrawTime
counter for measuring rendering time
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.
virtual void saveFrame(const std::string &destFile, FXColor *buf)
Adds a frame to a video snapshot which will be initialized if neccessary.
virtual void recenterView()
recenters the view
virtual SUMOTime getCurrentTimeStep() const
get the current simulation time
GUIDialog_ViewSettings * myVisualizationChanger
Visualization changer.
std::vector< GUIGlID > getObjectsInBoundary(Boundary bound, bool singlePosition)
returns the ids of all objects in the given boundary
FXbool makeCurrent()
A reimplementation due to some internal reasons.
int myMouseHotspotX
Offset to the mouse-hotspot from the mouse position.
bool isInEditMode()
returns true, if the edit button was pressed
void updatePositionInformation() const
update position information
virtual long onMiddleBtnRelease(FXObject *, FXSelector, void *)
virtual long onMouseMove(FXObject *, FXSelector, void *)
GUIDialog_EditViewport * myViewportChooser
viewport chooser
GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings
bool isAdditionalGLVisualisationEnabled(GUIGlObject *const which) const
Check if an object is added in the additional GL visualitation.
FXCondition mySnapshotCondition
the semaphore when waiting for snapshots to finish
Position myPopupPosition
The current popup-menu position.
virtual void doInit()
doInit
FXint myWindowCursorPositionY
virtual int doPaintGL(int, const Boundary &)
paint GL
virtual void showViewportEditor()
show viewport editor
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.
GUIGlID getObjectUnderCursor()
returns the id of the front object under the cursor using GL_SELECT
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
void showToolTips(bool val)
show tool tips
void drawFPS()
Draws frames-per-second indicator.
virtual long onMouseWheel(FXObject *, FXSelector, void *)
double getGridWidth() const
get grid width
bool removeAdditionalGLVisualisation(GUIGlObject *const which)
Removes an object from the list of objects that show additional things.
double getDelay() const
Returns the delay of the parent application.
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 *)
bool myUseToolTips
use tool tips
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
const Position & getPopupPosition() const
get position of current popup
double m2p(double meter) const
meter-to-pixels conversion method
virtual void onGamingClick(Position)
on gaming click
bool myInEditMode
Information whether too-tip informations shall be generated.
GUIVisualizationSettings * myVisualizationSettings
visualization settings
void destroyPopup()
destoys the popup
Position getWindowCursorPosition() const
Returns the information whether rotation is allowd.
virtual long onKeyPress(FXObject *o, FXSelector sel, void *data)
keyboard functions
virtual long onMiddleBtnPress(FXObject *, FXSelector, void *)
void paintGL()
performs the painting of the simulation
virtual void stopTrack()
stop track
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
GUIGlID getObjectAtPosition(Position pos)
returns the id of the object at position using GL_SELECT
std::vector< GUIGlObject * > getGUIGlObjectsUnderSnappedCursor()
returns the GUIGlObject under the gripped cursor using GL_SELECT (including overlapped objects)
virtual long onKeyRelease(FXObject *o, FXSelector sel, void *data)
void showToolTipFor(const GUIGlID id)
invokes the tooltip for the given object
virtual void onGamingRightClick(Position)
virtual void openObjectDialogAtCursor()
open object dialog at the cursor position
void setWindowCursorPosition(FXint x, FXint y)
Returns the gl-id of the object under the given coordinates.
double getFPS() const
retrieve FPS
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....
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 *)
void displayLegends()
Draws the configured legends.
void displayColorLegend(const GUIColorScheme &scheme, bool leftSide)
Draws a legend for the given scheme.
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.
FXComboBox * getColoringSchemesCombo()
get coloring schemes combo
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
GUIGlChildWindow * myParent
The parent window.
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 openObjectDialog(GUIGlObject *o)
open object dialog for the given object
void remove(GUIDialog_EditViewport *)
remove viewport
virtual GUIGlID getTrackedID() const
get tracked id
void toggleSelection(GUIGlID id)
Toggles selection of an object.
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.
RGBColor backgroundColor
The background color to use.
static const double MISSING_DATA
bool dither
Information whether dithering shall be enabled.
GUIColorer vehicleColorer
The vehicle colorer.
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle
GUIVisualizationSizeSettings addSize
std::string name
The name of this setting.
bool drawForPositionSelection
whether drawing is performed for the purpose of selecting objects with a single click
bool gaming
whether the application is in gaming mode or not
GUIVisualizationTextSettings edgeValue
bool fps
Information whether frames-per-second should be drawn.
bool showGrid
Information whether a grid shall be shown.
bool showVehicleColorLegend
Information whether the vehicle color legend shall be drawn.
static bool UseMesoSim
this should be set at the same time as MSGlobals::gUseMesoSim
int getLaneEdgeMode() const
Returns the number of the active lane (edge) coloring schme.
double scale
information about a lane's width (temporary, used for a single view)
GUIColorScheme & getLaneEdgeScheme()
Returns the current lane (edge) coloring schme.
bool showSizeLegend
Information whether the size legend shall be drawn.
double gridXSize
Information about the grid spacings.
bool showColorLegend
Information whether the edge color legend shall be drawn.
double angle
The current view rotation angle.
static GeoConvHelper & getProcessing()
the coordinate transformation to use for input conversion and processing
void cartesian2geo(Position &cartesian) const
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
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)
A point in 2D or 3D with translation and scaling methods.
void setx(double x)
set position x
void set(double x, double y)
set positions x and y
static const Position INVALID
used to indicate that a position is valid
double x() const
Returns the x-position.
void add(const Position &pos)
Adds the given position to this one.
void setz(double z)
set position z
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.
void sety(double y)
set position y
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
unsigned char red() const
Returns the red-amount of the color.
unsigned char alpha() const
Returns the alpha-amount of the color.
unsigned char green() const
Returns the green-amount of the color.
unsigned char blue() const
Returns the blue-amount of the color.
static const RGBColor BLACK
static const RGBColor RED
named colors
A RT-tree for efficient storing of SUMO's GL-objects.
virtual int Search(const float a_min[2], const float a_max[2], const GUIVisualizationSettings &c) const
Find all within search rectangle.
static long getCurrentMillis()
Returns the current time in milliseconds.
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)
bool skip2D
Whether this image should be skipped in 2D-views.
double width
The width of the image (net coordinates in x-direction, in m)
bool initialised
Whether this image was initialised (inserted as a texture)
FXImage * image
The image pointer for later cleanup.
double rot
The rotation of the image in the ground plane (in degrees)
double layer
The layer of the image.
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.
int glID
whether the decal shall be drawn in screen coordinates, rather than network coordinates
bool screenRelative
Whether this image should be skipped in 2D-views.
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
bool show(const GUIGlObject *o) const
whether to show the text