 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
70 #pragma GCC diagnostic push
71 #pragma GCC diagnostic ignored "-Wpedantic"
73 #include <gdal_priv.h>
75 #pragma GCC diagnostic pop
117 FXIMPLEMENT_ABSTRACT(
GUISUMOAbstractView, FXGLCanvas, GUISUMOAbstractViewMap, ARRAYNUMBER(GUISUMOAbstractViewMap))
124 FXGLCanvas(p, glVis, share, p,
MID_GLCANVAS, LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0),
129 myMouseHotspotX(app.getDefaultCursor()->getHotX()),
130 myMouseHotspotY(app.getDefaultCursor()->getHotY()),
133 myUseToolTips(false),
134 myAmInitialised(false),
135 myViewportChooser(
nullptr),
136 myWindowCursorPositionX(getWidth() / 2),
137 myWindowCursorPositionY(getHeight() / 2),
138 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();
275 if (getWidth() == 0 || getHeight() == 0) {
295 glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
296 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
301 glDisable(GL_DITHER);
304 glDisable(GL_LINE_SMOOTH);
340 std::vector<GUIGlObject*>
350 std::vector<GUIGlObject*>
360 positionBoundary.
add(pos);
365 double maxLayer = -std::numeric_limits<double>::max();
367 for (
const auto& i : ids) {
382 double layer = (double)type;
387 layer = dynamic_cast<Shape*>(o)->getShapeLayer();
394 if (layer > maxLayer) {
409 std::vector<GUIGlID> result;
413 selection.
grow(radius);
417 for (
const auto& i : ids) {
441 std::vector<GUIGlObject*>
444 std::vector<GUIGlObject*> result;
448 selection.
grow(radius);
452 for (
const auto& i : ids) {
473 const int NB_HITS_MAX = 1024 * 1024;
475 static GUIGlID hits[NB_HITS_MAX];
476 static GLint nb_hits = 0;
477 glSelectBuffer(NB_HITS_MAX, hits);
485 if (singlePosition) {
492 if (singlePosition) {
498 nb_hits = glRenderMode(GL_RENDER);
502 std::vector<GUIGlID> result;
505 for (
int i = 0; i < nb_hits; ++i) {
508 for (
int j = 0; j < (int)numNames; j++) {
509 result.push_back(*ptr);
523 if (
object !=
nullptr) {
526 std::string label =
object->getFullName();
545 glEnable(GL_DEPTH_TEST);
560 glTranslated(0, 0, .55);
561 glColor3d(0.5, 0.5, 0.5);
564 while (ypos <= ymax) {
565 glVertex2d(xmin, ypos);
566 glVertex2d(xmax, ypos);
570 while (xpos <= xmax) {
571 glVertex2d(xpos, ymin);
572 glVertex2d(xpos, ymax);
576 glTranslated(0, 0, -.55);
585 const std::string text(
"10000000000");
587 int pixelSize = (int)
m2p((
double) length);
588 while (pixelSize <= 20) {
591 if (noDigits > (
int)text.length()) {
594 pixelSize = (int)
m2p((
double) length);
598 glMatrixMode(GL_PROJECTION);
601 glMatrixMode(GL_MODELVIEW);
607 glDisable(GL_TEXTURE_2D);
608 glDisable(GL_ALPHA_TEST);
610 glEnable(GL_DEPTH_TEST);
612 glTranslated(0, 0, z);
614 double len = (double) pixelSize / (
double)(getWidth() - 1) * (
double) 2.0;
616 double o = double(15) / double(getHeight());
618 double oo = double(5) / double(getHeight());
621 glVertex2d(-.98, -1. + o);
622 glVertex2d(-.98 + len, -1. + o);
624 glVertex2d(-.98, -1. + o);
625 glVertex2d(-.98, -1. + o2);
627 glVertex2d(-.98 + len, -1. + o);
628 glVertex2d(-.98 + len, -1. + o2);
632 const double fontHeight = 0.1 * 300. / getHeight();
633 const double fontWidth = 0.1 * 300. / getWidth();
641 glMatrixMode(GL_PROJECTION);
643 glMatrixMode(GL_MODELVIEW);
651 glMatrixMode(GL_PROJECTION);
654 glMatrixMode(GL_MODELVIEW);
659 glEnable(GL_DEPTH_TEST);
662 glTranslated(0, 0, z);
665 const bool fixed = scheme.
isFixed();
666 const int numColors = (int)scheme.
getColors().size();
669 const double right = 0.98;
670 const double left = 0.95;
671 const double top = -0.8;
672 const double bot = 0.8;
673 const double dy = (top - bot) / numColors;
674 const double bot2 = fixed ? bot : bot + dy / 2;
676 glVertex2d(right, top);
677 glVertex2d(right, bot2);
678 glVertex2d(left, bot2);
679 glVertex2d(left, top);
680 glVertex2d(right, top);
681 glVertex2d(left, top);
682 glVertex2d(right, bot2);
683 glVertex2d(left, bot2);
686 const double fontHeight = 0.20 * 300. / getHeight();
687 const double fontWidth = 0.20 * 300. / getWidth();
689 const int fadeSteps = fixed ? 1 : 10;
690 double colorStep = dy / fadeSteps;
691 for (
int i = 0; i < numColors; i++) {
693 const double topi = top - i * dy;
696 if (i + 1 < numColors) {
699 for (
double j = 0.0; j < fadeSteps; j++) {
702 glVertex2d(left, topi - j * colorStep);
703 glVertex2d(right, topi - j * colorStep);
704 glVertex2d(right, topi - (j + 1) * colorStep);
705 glVertex2d(left, topi - (j + 1) * colorStep);
711 glVertex2d(left, topi);
712 glVertex2d(right, topi);
713 glVertex2d(right, bot2);
714 glVertex2d(left, bot2);
719 std::string name = scheme.
getNames()[i];
720 std::string text = fixed ? name :
toString(threshold);
722 const double bgShift = 0.0;
723 const double textShift = 0.02;
726 glTranslated(0, 0, 0.1);
728 glVertex2d(left, topi + fontHeight * bgShift);
729 glVertex2d(left - fontWidth * text.size() / 2, topi + fontHeight * bgShift);
730 glVertex2d(left - fontWidth * text.size() / 2, topi + fontHeight * (1 + bgShift));
731 glVertex2d(left, topi + fontHeight * (1 + bgShift));
733 glTranslated(0, 0, -0.1);
738 glMatrixMode(GL_PROJECTION);
740 glMatrixMode(GL_MODELVIEW);
752 glMatrixMode(GL_PROJECTION);
755 glMatrixMode(GL_MODELVIEW);
758 const double fontHeight = 0.2 * 300. / getHeight();
759 const double fontWidth = 0.2 * 300. / getWidth();
763 glMatrixMode(GL_PROJECTION);
765 glMatrixMode(GL_MODELVIEW);
791 if (o !=
nullptr && dynamic_cast<GUIGlObject*>(o) !=
nullptr) {
792 if (applyZoom && zoomDist < 0) {
842 FXbool ret = FXGLCanvas::makeCurrent();
850 glViewport(0, 0, getWidth() - 1, getHeight() - 1);
897 FXEvent* e = (FXEvent*) data;
899 if ((e->state & CONTROLMASK) != 0) {
914 if ((e->state & SHIFTMASK) != 0) {
935 if (e->click_count == 2) {
936 handle(
this, FXSEL(SEL_DOUBLECLICKED, 0), data);
1058 myApp->getCursorPosition(x, y, b);
1076 return myPopup->onKeyPress(o, sel, data);
1078 FXGLCanvas::onKeyPress(o, sel, data);
1087 return myPopup->onKeyRelease(o, sel, data);
1089 FXGLCanvas::onKeyRelease(o, sel, data);
1098 #ifdef DEBUG_SNAPSHOT
1099 std::cout <<
"add snapshot time=" << time <<
" file=" << file <<
"\n";
1102 mySnapshots[time].push_back(std::make_tuple(file, w, h));
1112 std::string errorMessage;
1113 FXString ext = FXPath::extension(destFile.c_str());
1114 const bool useGL2PS = ext ==
"ps" || ext ==
"eps" || ext ==
"pdf" || ext ==
"svg" || ext ==
"tex" || ext ==
"pgf";
1116 const bool useVideo = destFile ==
"" || ext ==
"h264" || ext ==
"hevc";
1127 glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
1128 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
1131 glEnable(GL_DITHER);
1133 glDisable(GL_DITHER);
1136 glDisable(GL_LINE_SMOOTH);
1142 GLint format = GL2PS_PS;
1145 }
else if (ext ==
"eps") {
1147 }
else if (ext ==
"pdf") {
1149 }
else if (ext ==
"tex") {
1151 }
else if (ext ==
"svg") {
1153 }
else if (ext ==
"pgf") {
1156 return "Could not save '" + destFile +
"'.\n Unrecognized format '" + std::string(ext.text()) +
"'.";
1158 FILE* fp = fopen(destFile.c_str(),
"wb");
1160 return "Could not save '" + destFile +
"'.\n Could not open file for writing";
1163 GLint buffsize = 0, state = GL2PS_OVERFLOW;
1165 glGetIntegerv(GL_VIEWPORT, viewport);
1166 while (state == GL2PS_OVERFLOW) {
1167 buffsize += 1024 * 1024;
1168 gl2psBeginPage(destFile.c_str(),
"sumo-gui; https://sumo.dlr.de", viewport, format, GL2PS_SIMPLE_SORT,
1169 GL2PS_DRAW_BACKGROUND | GL2PS_USE_CURRENT_VIEWPORT,
1170 GL_RGBA, 0, NULL, 0, 0, 0, buffsize, fp,
"out.eps");
1171 glMatrixMode(GL_MODELVIEW);
1173 glDisable(GL_TEXTURE_2D);
1174 glDisable(GL_ALPHA_TEST);
1175 glDisable(GL_BLEND);
1176 glEnable(GL_DEPTH_TEST);
1185 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
1187 const float minB[2] = { (float)viewPort.
xmin(), (float)viewPort.
ymin() };
1188 const float maxB[2] = { (float)viewPort.
xmax(), (float)viewPort.
ymax() };
1190 glEnable(GL_POLYGON_OFFSET_FILL);
1191 glEnable(GL_POLYGON_OFFSET_LINE);
1200 state = gl2psEndPage();
1206 return "Could not save '" + destFile +
"', gl2ps was not enabled at compile time.";
1219 FXMALLOC(&buf, FXColor, getWidth()*getHeight());
1221 glReadBuffer(GL_BACK);
1223 glReadPixels(0, 0, getWidth(), getHeight(), GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid*)buf);
1227 int mwidth = getWidth();
1228 int mheight = getHeight();
1230 FXColor* pbb = buf + mwidth * (mheight - 1);
1241 }
while (paa < pbb);
1247 errorMessage =
"video";
1248 }
catch (std::runtime_error& err) {
1249 errorMessage = err.what();
1254 errorMessage =
"Could not save '" + destFile +
"'.";
1257 errorMessage =
"Could not save '" + destFile +
"'.\n" + e.what();
1261 return errorMessage;
1275 #ifdef DEBUG_SNAPSHOT
1276 std::cout <<
"check snapshots time=" << time <<
" registeredTimes=" <<
mySnapshots.size() <<
"\n";
1283 std::vector<std::tuple<std::string, int, int> > files = snapIt->second;
1286 for (
const auto& entry : files) {
1287 #ifdef DEBUG_SNAPSHOT
1288 std::cout <<
"make snapshot time=" << time <<
" file=" << file <<
"\n";
1290 const std::string& error =
makeSnapshot(std::get<0>(entry), std::get<1>(entry), std::get<2>(entry));
1291 if (error !=
"" && error !=
"video") {
1299 #ifdef DEBUG_SNAPSHOT
1300 std::cout <<
" files=" <<
toString(files) <<
" myApplicationSnapshots=" <<
joinToString(*myApplicationSnapshots,
",") <<
"\n";
1338 const FXint minSize = 100;
1339 const FXint minTitlebarHeight = 20;
1340 int x =
MAX2(0,
MIN2(getApp()->reg().readIntEntry(
1341 "VIEWPORT_DIALOG_SETTINGS",
"x", 150),
1342 getApp()->getRootWindow()->getWidth() - minSize));
1343 int y =
MAX2(minTitlebarHeight,
MIN2(getApp()->reg().readIntEntry(
1344 "VIEWPORT_DIALOG_SETTINGS",
"y", 150),
1345 getApp()->getRootWindow()->getHeight() - minSize));
1459 GDALDataset* poDataset = (GDALDataset*)GDALOpen(d.
filename.c_str(), GA_ReadOnly);
1460 if (poDataset == 0) {
1463 const int xSize = poDataset->GetRasterXSize();
1464 const int ySize = poDataset->GetRasterYSize();
1466 if (d.
width <= 0.) {
1467 double adfGeoTransform[6];
1468 if (poDataset->GetGeoTransform(adfGeoTransform) == CE_None) {
1469 Position topLeft(adfGeoTransform[0], adfGeoTransform[3]);
1470 const double horizontalSize = xSize * adfGeoTransform[1];
1471 const double verticalSize = ySize * adfGeoTransform[5];
1472 Position bottomRight(topLeft.
x() + horizontalSize, topLeft.
y() + verticalSize);
1474 d.
width = bottomRight.x() - topLeft.
x();
1475 d.
height = topLeft.
y() - bottomRight.y();
1476 d.
centerX = (topLeft.
x() + bottomRight.x()) / 2;
1477 d.
centerY = (topLeft.
y() + bottomRight.y()) / 2;
1485 if (d.
width <= 0.) {
1492 const int picSize = xSize * ySize;
1494 if (!FXMALLOC(&result, FXColor, picSize)) {
1498 for (
int j = 0; j < picSize; j++) {
1499 result[j] = FXRGB(0, 0, 0);
1502 for (
int i = 1; i <= poDataset->GetRasterCount(); i++) {
1503 GDALRasterBand* poBand = poDataset->GetRasterBand(i);
1505 if (poBand->GetColorInterpretation() == GCI_RedBand) {
1507 }
else if (poBand->GetColorInterpretation() == GCI_GreenBand) {
1509 }
else if (poBand->GetColorInterpretation() == GCI_BlueBand) {
1511 }
else if (poBand->GetColorInterpretation() == GCI_AlphaBand) {
1518 assert(xSize == poBand->GetXSize() && ySize == poBand->GetYSize());
1519 if (poBand->RasterIO(GF_Read, 0, 0, xSize, ySize, ((
unsigned char*)result) + shift, xSize, ySize, GDT_Byte, 4, 4 * xSize) == CE_Failure) {
1524 GDALClose(poDataset);
1526 return new FXImage(getApp(), result, IMAGE_OWNED | IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP, xSize, ySize);
1538 for (std::vector<GUISUMOAbstractView::Decal>::iterator l =
myDecals.begin(); l !=
myDecals.end(); ++l) {
1546 if (img ==
nullptr) {
1561 glTranslated(center.
x(), center.
y(), d.
layer);
1565 glRotated(d.
rot, 0, 0, 1);
1567 double halfWidth = d.
width / 2.;
1568 double halfHeight = d.
height / 2.;
1570 halfWidth =
p2m(halfWidth);
1571 halfHeight =
p2m(halfHeight);
1623 glMatrixMode(GL_PROJECTION);
1628 glOrtho(0, getWidth(), 0, getHeight(), -
GLO_MAX - 1,
GLO_MAX + 1);
1629 glMatrixMode(GL_MODELVIEW);
1631 double scaleX = (double)getWidth() / bound.
getWidth();
1632 double scaleY = (double)getHeight() / bound.
getHeight();
1633 glScaled(scaleX, scaleY, 1);
1634 glTranslated(-bound.
xmin(), -bound.
ymin(), 0);
1686 screenRelative(false),
unsigned char alpha() const
Returns the alpha-amount of the color.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
Boundary getVisibleBoundary() const
get visible boundary
virtual void openObjectDialog()
virtual void doInit()
doInit
virtual double getYPos() const =0
Returns the y-offset of the field to show stored in this changer.
static FXImage * loadImage(FXApp *a, const std::string &file)
#define UNUSED_PARAMETER(x)
std::string name
The name of this setting.
FXbool makeCurrent()
A reimplementation due to some internal reasons.
bool drawForPositionSelection
whether drawing is performed for the purpose of selecting objects with a single click
bool fps
Information whether frames-per-second should be drawn.
virtual double getDelay() const
Returns the delay (should be overwritten by subclasses if applicable)
virtual void setViewportFromToRot(const Position &lookFrom, const Position &lookAt, double rotation)
applies the given viewport settings
virtual void showViewportEditor()
show viewport editor
static bool UseMesoSim
this should be set at the same time as MSGlobals::gUseMesoSim
virtual void copyViewportTo(GUISUMOAbstractView *view)
copy the viewport to the given view
GUIVisualizationSettings & getDefault()
Returns the default scheme.
double getGridHeight() const
get grid height
virtual void stopTrack()
stop track
int myMouseHotspotX
Offset to the mouse-hotspot from the mouse position.
Position rotateAround2D(double rad, const Position &origin)
rotate this position by rad around origin and return the result
virtual long onRightBtnPress(FXObject *, FXSelector, void *)
FXImage * image
The image pointer for later cleanup.
#define WRITE_WARNING(msg)
static void sleep(long ms)
virtual double getColorValue(const GUIVisualizationSettings &, int) const
std::map< GUIGlObject *, int > myAdditionallyDrawn
List of objects for which GUIGlObject::drawGLAdditional is called.
The dialog to change the view (gui) settings.
double ymin() const
Returns minimum y-coordinate.
int getLaneEdgeMode() const
Returns the number of the active lane (edge) coloring schme.
virtual double getZPos() const =0
Returns the camera height corresponding to the current zoom factor.
double angle
The current view rotation angle.
bool isInEditMode()
returns true, if the edit button was pressed
std::vector< GUIGlID > getObjectsUnderCursor()
returns the id of the objects under the cursor using GL_SELECT (including overlapped objects)
static const RGBColor BLACK
double z() const
Returns the z-position.
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle
virtual bool setColorScheme(const std::string &)
set color scheme
FXComboBox * getColoringSchemesCombo()
get coloring schemes combo
static const Position INVALID
used to indicate that a position is valid
void showViewschemeEditor()
show viewsscheme editor
std::vector< Decal > myDecals
virtual void setStatusBarText(const std::string &)
void waitForSnapshots(const SUMOTime snapshotTime)
GUIGlChildWindow * myParent
The parent window.
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)=0
Returns an own popup-menu.
double m2p(double meter) const
meter-to-pixels conversion method
void setx(double x)
set position x
virtual void onGamingRightClick(Position)
bool showGrid
Information whether a grid shall be shown.
std::vector< GUIGlObject * > getGUIGlObjectsUnderCursor()
returns the GUIGlObject under the cursor using GL_SELECT (including overlapped objects)
GUIGlID getObjectUnderCursor()
returns the id of the front object under the cursor using GL_SELECT
virtual void centerTo(GUIGlID id, bool applyZoom, double zoomDist=20)
centers to the chosen artifact
double centerY
The center of the image in y-direction (net coordinates, in m)
void showToolTips(bool val)
show tool tips
virtual void setDelay(double)
Sets the delay of the parent application.
static GeoConvHelper & getProcessing()
the coordinate transformation to use for input conversion and processing
std::string filename
The path to the file the image is located at.
void drawFPS()
Draws frames-per-second indicator.
double xmax() const
Returns maximum x-coordinate.
virtual void onRightBtnPress(void *data)
called when user press right button
void addSnapshot(SUMOTime time, const std::string &file, const int w=-1, const int h=-1)
Sets the snapshot time to file map.
double getHeight() const
Returns the height of the boundary (y-axis)
Boundary applyGLTransform(bool fixRatio=true)
applies gl-transformations to fit the Boundary given by myChanger onto the canvas....
virtual double getRotation() const =0
Returns the rotation of the canvas stored in this changer.
const double SUMO_const_laneWidth
virtual void checkSnapshots()
Checks whether it is time for a snapshot.
unsigned char red() const
Returns the red-amount of the color.
GUIGlID getObjectAtPosition(Position pos)
returns the id of the object at position using GL_SELECT
virtual void setRotation(double rotation)=0
Sets the rotation.
double height
The height of the image (net coordinates in y-direction, in m)
FXDEFMAP(GUISUMOAbstractView) GUISUMOAbstractViewMap[]
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
void setWindowCursorPosition(FXint x, FXint y)
Returns the gl-id of the object under the given coordinates.
bool x2cartesian(Position &from, bool includeInBoundary=true)
Converts the given coordinate into a cartesian and optionally update myConvBoundary.
void show()
show view settings dialog
void updateToolTip()
A method that updates the tooltip.
bool skip2D
Whether this image should be skipped in 2D-views.
void paintGL()
performs the painting of the simulation
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.
virtual void onMouseMove(void *data)
called when user moves mouse
void setOldValues(const Position &lookFrom, const Position &lookAt, double rotation)
Resets old values.
static void drawTexturedBox(int which, double size)
Draws a named texture as a box with the given size.
Boundary getViewport(bool fixRatio=true)
get viewport
virtual long onKeyPress(void *data)
called when user press a key
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 long onMouseWheel(FXObject *, FXSelector, void *)
void updatePositionInformation() const
update position information
static long getCurrentMillis()
Returns the current time in milliseconds.
static FXbool scalePower2(FXImage *image, int maxSize=(2<< 29))
const std::vector< double > & getThresholds() const
GUIColorScheme & getLaneEdgeScheme()
Returns the current lane (edge) coloring schme.
virtual long onRightBtnRelease(FXObject *, FXSelector, void *)
double layer
The layer of the image.
A RT-tree for efficient storing of SUMO's GL-objects.
bool myAmInitialised
Internal information whether doInit() was called.
static RGBColor interpolate(const RGBColor &minColor, const RGBColor &maxColor, double weight)
Interpolates between two colors.
A dialog to change the viewport.
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, int align=0, double width=-1)
double gridXSize
Information about the grid spacings.
RGBColor backgroundColor
The background color to use.
virtual bool onRightBtnRelease(void *data)
called when user releases right button
std::vector< GUIGlObject * > getGUIGlObjectsAtPosition(Position pos, double radius)
returns the GUIGlObjects at position within the given (rectangular) radius using GL_SELECT
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 std::vector< T > & getColors() const
bool screenRelative
Whether this image should be skipped in 2D-views.
virtual long onLeftBtnRelease(FXObject *, FXSelector, void *)
static const GUIGlID INVALID_ID
bool isGaming() const
return whether the gui is in gaming mode
virtual SUMOTime getCurrentTimeStep() const
get the current simulation time
bool myInEditMode
Information whether too-tip informations shall be generated.
void displayLegend()
Draws a line with ticks, and the length information.
double xmin() const
Returns minimum x-coordinate.
double rot
The rotation of the image in the ground plane (in degrees)
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
FXLabel & getCartesianLabel()
static int getMaxTextureSize()
return maximum number of pixels in x and y direction
bool showColorLegend
Information whether the colo legend shall be drawn.
GUIVisualizationSettings * getVisualisationSettings() const
get visualitation settings
GUIGlObject * getNetObject() const
Returns the network object.
virtual long onDoubleClicked(FXObject *, FXSelector, void *)
void set(double x, double y)
set positions x and y
virtual void setBreakpoints(const std::vector< SUMOTime > &)
Sets the breakpoints of the parent application.
virtual long onKeyRelease(void *data)
called when user releases a key
virtual void onMouseWheel(void *data)
called when user changes mouse wheel
FXint myWindowCursorPositionY
virtual long onMiddleBtnRelease(FXObject *, FXSelector, void *)
GUIGlID getGlID() const
Returns the numerical id of the object.
virtual long onConfigure(FXObject *, FXSelector, void *)
mouse functions
A class that stores a 2D geometrical boundary.
FXint myWindowCursorPositionX
Position of the cursor relative to the window.
FXCondition mySnapshotCondition
the semaphore when waiting for snapshots to finish
double getWidth() const
Returns the width of the boudary (x-axis)
double scale
information about a lane's width (temporary, used for a single view)
void cartesian2geo(Position &cartesian) const
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
A point in 2D or 3D with translation and scaling methods.
virtual long onMouseLeft(FXObject *, FXSelector, void *)
GUICompleteSchemeStorage gSchemeStorage
double x() const
Returns the x-position.
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
virtual double getZoom() const =0
Returns the zoom factor computed stored in this changer.
bool dither
Information whether dithering shall be enabled.
void remove(GUIDialog_EditViewport *)
remove viewport
static const RGBColor RED
named colors
static const double SENSITIVITY
GUIVisualizationSettings * myVisualizationSettings
visualization settings
void drawDecals()
Draws the stored decals.
static GUIGlID add(FXImage *i)
Adds a texture to use.
GUIGlObject * getObjectBlocking(GUIGlID id)
Returns the object from the container locking it.
void setDefault(const std::string &name)
Makes the scheme with the given name the default.
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
unsigned char green() const
Returns the green-amount of the color.
virtual long onKeyRelease(FXObject *o, FXSelector sel, void *data)
virtual void startTrack(int)
star track
const Position & getPopupPosition() const
get position of current popup
GUIDialog_EditViewport * getViewportEditor()
get the viewport and create it on first access
void unblockObject(GUIGlID id)
Marks an object as unblocked.
bool showSizeLegend
Information whether the size legend shall be drawn.
virtual void onGamingClick(Position)
on gaming click
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
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.
virtual void onLeftBtnPress(void *data)
mouse functions
bool removeAdditionalGLVisualisation(GUIGlObject *const which)
Removes an object from the list of objects that show additional things.
double y() const
Returns the y-position.
GUIPerspectiveChanger & getChanger() const
get changer
virtual Boundary getCenteringBoundary() const =0
unsigned char blue() const
Returns the blue-amount of the color.
double getFPS() const
retrieve FPS
bool addAdditionalGLVisualisation(GUIGlObject *const which)
Adds an object to call its additional visualisation method.
void setDelay(double delay)
Sets the delay of the parent application.
Position getCenter() const
Returns the center of the boundary.
double p2m(double pixel) const
pixels-to-meters conversion method
double getDelay() const
Returns the delay of the parent application.
FXImage * checkGDALImage(Decal &d)
check whether we can read image data or position with gdal
Position getWindowCursorPosition() const
Returns the information whether rotation is allowd.
void showToolTipFor(const GUIGlID id)
invokes the tooltip for the given object
void show()
overload show function to focus always in OK Button
GUIMainWindow * myApp
The application.
virtual void setViewport(double zoom, double xPos, double yPos)=0
Sets the viewport Used for: Adapting a new viewport.
void saveViewport(const double x, const double y, const double z, const double rot)
Makes the given viewport the default.
SUMORTree * myGrid
The visualization speed-up.
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
virtual ~GUISUMOAbstractView()
destructor
void paintGLGrid()
paints a grid
GUISelectedStorage gSelected
A global holder of selected objects.
FXComboBox * getColoringSchemesCombo()
return combobox with the current coloring schemes (standard, fastest standard, real world....
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
virtual long onMiddleBtnPress(FXObject *, FXSelector, void *)
void setBreakpoints(const std::vector< SUMOTime > &breakpoints)
Sets the breakpoints of the parent application.
bool myUseToolTips
use tool tips
static FXbool saveImage(const std::string &file, int width, int height, FXColor *data)
virtual long onKeyPress(FXObject *o, FXSelector sel, void *data)
keyboard functions
bool initialised
Whether this image was initialised (inserted as a texture)
std::vector< GUIGlObject * > getGUIGlObjectsUnderGrippedCursor()
returns the GUIGlObject under the gripped cursor using GL_SELECT (including overlapped objects)
void addDecals(const std::vector< Decal > &decals)
add decals
void setValues(double zoom, double xoff, double yoff, double rotation)
Sets the given values into the dialog.
GUIGLObjectPopupMenu * myPopup
The current popup-menu.
const std::vector< std::string > & getNames() const
virtual int Search(const float a_min[2], const float a_max[2], const GUIVisualizationSettings &c) const
Find all within search rectangle.
GUIVisualizationSizeSettings addSize
virtual void setViewportFrom(double xPos, double yPos, double zPos)=0
Alternative method for setting the viewport.
GUIDialog_ViewSettings * myVisualizationChanger
Visualization changer.
void add(const Position &pos)
Adds the given position to this one.
Boundary & grow(double by)
extends the boundary by the given amount
virtual void onLeftBtnPress(void *)
notify object about left click
virtual void recenterView()
recenters the view
FXMutex mySnapshotsMutex
The mutex to use before accessing the decals list in order to avoid thread conflicts.
virtual double getXPos() const =0
Returns the x-offset of the field to show stored in this changer.
std::vector< GUIGlID > getObjectsInBoundary(Boundary bound, bool singlePosition)
returns the ids of all objects in the given boundary
virtual void saveFrame(const std::string &destFile, FXColor *buf)
Adds a frame to a video snapshot which will be initialized if neccessary.
virtual long onLeftBtnPress(FXObject *, FXSelector, void *)
GUIDialog_EditViewport * myViewportChooser
viewport chooser
Position screenPos2NetPos(int x, int y) const
Translate screen position to network position.
virtual bool onLeftBtnRelease(void *data)
called when user releases left button
Stores the information about how to visualize structures.
void setViewport(GUISUMOAbstractView *view)
Sets the default viewport.
void toggleSelection(GUIGlID id)
Toggles selection of an object.
void destroyPopup()
destoys the popup
std::map< SUMOTime, std::vector< std::tuple< std::string, int, int > > > mySnapshots
Snapshots.
GUIPerspectiveChanger * myChanger
The perspective changer.
void sety(double y)
set position y
virtual long onMouseMove(FXObject *, FXSelector, void *)
void displayColorLegend()
Draws a legend for the current edge coloring scheme.
bool haveGrabbed() const
Returns the information whether one of the spin dialers is grabbed.
double width
The width of the image (net coordinates in x-direction, in m)
Position myPopupPosition
The current popup-menu position.
void setCurrent(GUIVisualizationSettings *settings)
Sets current settings (called if reopened)
void setz(double z)
set position z
double centerX
The center of the image in x-direction (net coordinates, in m)
bool gaming
whether the application is in gaming mode or not
A decal (an image) that can be shown.
int glID
whether the decal shall be drawn in screen coordinates, rather than network coordinates
#define WRITE_MESSAGE(msg)
static void setGL2PS(bool active=true)
GUIVisualizationTextSettings edgeValue
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)
draw Text box with given parameters
virtual int doPaintGL(int, const Boundary &)
paint GL
virtual GUIGlID getTrackedID() const
get tracked id
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
FXMutex myDecalsLock
The mutex to use before accessing the decals list in order to avoid thread conflicts.
virtual long onPaint(FXObject *, FXSelector, void *)
double getGridWidth() const
get grid width
static const RGBColor WHITE
double ymax() const
Returns maximum y-coordinate.
bool isAdditionalGLVisualisationEnabled(GUIGlObject *const which) const
Check if an object is added in the additional GL visualitation.