71 #pragma GCC diagnostic push 72 #pragma GCC diagnostic ignored "-Wpedantic" 74 #include <gdal_priv.h> 76 #pragma GCC diagnostic pop 118 FXIMPLEMENT_ABSTRACT(
GUISUMOAbstractView, FXGLCanvas, GUISUMOAbstractViewMap, ARRAYNUMBER(GUISUMOAbstractViewMap))
125 FXGLCanvas(p, glVis, share, p,
MID_GLCANVAS, LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y, 0, 0, 0, 0),
130 myMouseHotspotX(app.getDefaultCursor()->getHotX()),
131 myMouseHotspotY(app.getDefaultCursor()->getHotY()),
134 myUseToolTips(false),
135 myAmInitialised(false),
136 myViewportChooser(
nullptr),
137 myWindowCursorPositionX(getWidth() / 2),
138 myWindowCursorPositionY(getHeight() / 2),
139 myVisualizationChanger(
nullptr) {
142 flags |= FLAG_ENABLED;
143 myInEditMode =
false;
147 myVisualizationSettings->
gaming = myApp->isGaming();
160 for (std::vector<GUISUMOAbstractView::Decal>::iterator it =
myDecals.begin(); it !=
myDecals.end(); ++it) {
215 double xNet = bound.
xmin() + bound.
getWidth() * x / getWidth();
217 double yNet = bound.
ymin() + bound.
getHeight() * (getHeight() - y) / getHeight();
273 if (getWidth() == 0 || getHeight() == 0) {
293 glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
294 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
299 glDisable(GL_DITHER);
302 glDisable(GL_LINE_SMOOTH);
339 std::vector<GUIGlObject*>
353 double maxLayer = -std::numeric_limits<double>::max();
355 for (
const auto& i : ids) {
370 double layer = (double)type;
375 layer =
dynamic_cast<Shape*
>(o)->getShapeLayer();
382 if (layer > maxLayer) {
397 std::vector<GUIGlID> result;
401 selection.
grow(radius);
405 for (
const auto& i : ids) {
429 std::vector<GUIGlObject*>
432 std::vector<GUIGlObject*> result;
436 selection.
grow(radius);
440 for (
const auto& i : ids) {
461 const int NB_HITS_MAX = 1024 * 1024;
463 static GUIGlID hits[NB_HITS_MAX];
464 static GLint nb_hits = 0;
465 glSelectBuffer(NB_HITS_MAX, hits);
478 nb_hits = glRenderMode(GL_RENDER);
482 std::vector<GUIGlID> result;
485 for (
int i = 0; i < nb_hits; ++i) {
488 for (
int j = 0; j < (int)numNames; j++) {
489 result.push_back(*ptr);
503 if (
object !=
nullptr) {
506 std::string label =
object->getFullName();
525 glEnable(GL_DEPTH_TEST);
540 glTranslated(0, 0, .55);
541 glColor3d(0.5, 0.5, 0.5);
544 while (ypos <= ymax) {
545 glVertex2d(xmin, ypos);
546 glVertex2d(xmax, ypos);
550 while (xpos <= xmax) {
551 glVertex2d(xpos, ymin);
552 glVertex2d(xpos, ymax);
556 glTranslated(0, 0, -.55);
565 const std::string text(
"10000000000");
567 int pixelSize = (int)
m2p((
double) length);
568 while (pixelSize <= 20) {
571 if (noDigits > (
int)text.length()) {
574 pixelSize = (int)
m2p((
double) length);
578 glMatrixMode(GL_PROJECTION);
581 glMatrixMode(GL_MODELVIEW);
587 glDisable(GL_TEXTURE_2D);
588 glDisable(GL_ALPHA_TEST);
590 glEnable(GL_DEPTH_TEST);
592 glTranslated(0, 0, z);
594 double len = (double) pixelSize / (
double)(getWidth() - 1) * (
double) 2.0;
596 double o = double(15) / double(getHeight());
598 double oo = double(5) / double(getHeight());
601 glVertex2d(-.98, -1. + o);
602 glVertex2d(-.98 + len, -1. + o);
604 glVertex2d(-.98, -1. + o);
605 glVertex2d(-.98, -1. + o2);
607 glVertex2d(-.98 + len, -1. + o);
608 glVertex2d(-.98 + len, -1. + o2);
612 const double fontHeight = 0.1 * 300. / getHeight();
613 const double fontWidth = 0.1 * 300. / getWidth();
621 glMatrixMode(GL_PROJECTION);
623 glMatrixMode(GL_MODELVIEW);
631 glMatrixMode(GL_PROJECTION);
634 glMatrixMode(GL_MODELVIEW);
639 glEnable(GL_DEPTH_TEST);
642 glTranslated(0, 0, z);
645 const bool fixed = scheme.
isFixed();
646 const int numColors = (int)scheme.
getColors().size();
649 const double right = 0.98;
650 const double left = 0.95;
651 const double top = -0.8;
652 const double bot = 0.8;
653 const double dy = (top - bot) / numColors;
654 const double bot2 = fixed ? bot : bot + dy / 2;
656 glVertex2d(right, top);
657 glVertex2d(right, bot2);
658 glVertex2d(left, bot2);
659 glVertex2d(left, top);
660 glVertex2d(right, top);
661 glVertex2d(left, top);
662 glVertex2d(right, bot2);
663 glVertex2d(left, bot2);
666 const double fontHeight = 0.20 * 300. / getHeight();
667 const double fontWidth = 0.20 * 300. / getWidth();
669 const int fadeSteps = fixed ? 1 : 10;
670 double colorStep = dy / fadeSteps;
671 for (
int i = 0; i < numColors; i++) {
673 const double topi = top - i * dy;
676 if (i + 1 < numColors) {
679 for (
double j = 0.0; j < fadeSteps; j++) {
682 glVertex2d(left, topi - j * colorStep);
683 glVertex2d(right, topi - j * colorStep);
684 glVertex2d(right, topi - (j + 1) * colorStep);
685 glVertex2d(left, topi - (j + 1) * colorStep);
691 glVertex2d(left, topi);
692 glVertex2d(right, topi);
693 glVertex2d(right, bot2);
694 glVertex2d(left, bot2);
699 std::string name = scheme.
getNames()[i];
700 std::string text = fixed ? name :
toString(threshold);
702 const double bgShift = 0.0;
703 const double textShift = 0.02;
706 glTranslated(0, 0, 0.1);
708 glVertex2d(left, topi + fontHeight * bgShift);
709 glVertex2d(left - fontWidth * text.size() / 2, topi + fontHeight * bgShift);
710 glVertex2d(left - fontWidth * text.size() / 2, topi + fontHeight * (1 + bgShift));
711 glVertex2d(left, topi + fontHeight * (1 + bgShift));
713 glTranslated(0, 0, -0.1);
718 glMatrixMode(GL_PROJECTION);
720 glMatrixMode(GL_MODELVIEW);
732 glMatrixMode(GL_PROJECTION);
735 glMatrixMode(GL_MODELVIEW);
738 const double fontHeight = 0.2 * 300. / getHeight();
739 const double fontWidth = 0.2 * 300. / getWidth();
743 glMatrixMode(GL_PROJECTION);
745 glMatrixMode(GL_MODELVIEW);
771 if (o !=
nullptr && dynamic_cast<GUIGlObject*>(o) !=
nullptr) {
772 if (applyZoom && zoomDist < 0) {
822 FXbool ret = FXGLCanvas::makeCurrent();
830 glViewport(0, 0, getWidth() - 1, getHeight() - 1);
877 FXEvent* e = (FXEvent*) data;
879 if ((e->state & CONTROLMASK) != 0) {
897 if (e->click_count == 2) {
898 handle(
this, FXSEL(SEL_DOUBLECLICKED, 0), data);
1020 myApp->getCursorPosition(x, y, b);
1038 return myPopup->onKeyPress(o, sel, data);
1040 FXGLCanvas::onKeyPress(o, sel, data);
1049 return myPopup->onKeyRelease(o, sel, data);
1051 FXGLCanvas::onKeyRelease(o, sel, data);
1060 #ifdef DEBUG_SNAPSHOT 1061 std::cout <<
"add snapshot time=" << time <<
" file=" << file <<
"\n";
1064 mySnapshots[time].push_back(std::make_tuple(file, width, height));
1071 resize(width, height);
1074 std::string errorMessage;
1075 FXString ext = FXPath::extension(destFile.c_str());
1076 const bool useGL2PS = ext ==
"ps" || ext ==
"eps" || ext ==
"pdf" || ext ==
"svg" || ext ==
"tex" || ext ==
"pgf";
1078 const bool useVideo = destFile ==
"" || ext ==
"h264" || ext ==
"hevc";
1089 glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
1090 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
1093 glEnable(GL_DITHER);
1095 glDisable(GL_DITHER);
1098 glDisable(GL_LINE_SMOOTH);
1104 GLint format = GL2PS_PS;
1107 }
else if (ext ==
"eps") {
1109 }
else if (ext ==
"pdf") {
1111 }
else if (ext ==
"tex") {
1113 }
else if (ext ==
"svg") {
1115 }
else if (ext ==
"pgf") {
1118 return "Could not save '" + destFile +
"'.\n Unrecognized format '" + std::string(ext.text()) +
"'.";
1120 FILE* fp = fopen(destFile.c_str(),
"wb");
1122 return "Could not save '" + destFile +
"'.\n Could not open file for writing";
1125 GLint buffsize = 0, state = GL2PS_OVERFLOW;
1127 glGetIntegerv(GL_VIEWPORT, viewport);
1128 while (state == GL2PS_OVERFLOW) {
1129 buffsize += 1024 * 1024;
1130 gl2psBeginPage(destFile.c_str(),
"sumo-gui; https://sumo.dlr.de", viewport, format, GL2PS_SIMPLE_SORT,
1131 GL2PS_DRAW_BACKGROUND | GL2PS_USE_CURRENT_VIEWPORT,
1132 GL_RGBA, 0, NULL, 0, 0, 0, buffsize, fp,
"out.eps");
1133 glMatrixMode(GL_MODELVIEW);
1135 glDisable(GL_TEXTURE_2D);
1136 glDisable(GL_ALPHA_TEST);
1137 glDisable(GL_BLEND);
1138 glEnable(GL_DEPTH_TEST);
1147 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
1149 const float minB[2] = { (float)viewPort.
xmin(), (float)viewPort.
ymin() };
1150 const float maxB[2] = { (float)viewPort.
xmax(), (float)viewPort.
ymax() };
1152 glEnable(GL_POLYGON_OFFSET_FILL);
1153 glEnable(GL_POLYGON_OFFSET_LINE);
1162 state = gl2psEndPage();
1168 return "Could not save '" + destFile +
"', gl2ps was not enabled at compile time.";
1181 FXMALLOC(&buf, FXColor, getWidth()*getHeight());
1183 glReadBuffer(GL_BACK);
1185 glReadPixels(0, 0, getWidth(), getHeight(), GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid*)buf);
1189 int mwidth = getWidth();
1190 int mheight = getHeight();
1192 FXColor* pbb = buf + mwidth * (mheight - 1);
1203 }
while (paa < pbb);
1209 errorMessage =
"video";
1210 }
catch (std::runtime_error& err) {
1211 errorMessage = err.what();
1216 errorMessage =
"Could not save '" + destFile +
"'.";
1219 errorMessage =
"Could not save '" + destFile +
"'.\n" + e.what();
1223 return errorMessage;
1237 #ifdef DEBUG_SNAPSHOT 1238 std::cout <<
"check snapshots time=" << time <<
" registeredTimes=" <<
mySnapshots.size() <<
"\n";
1245 std::vector<std::tuple<std::string, int, int> > files = snapIt->second;
1248 for (
const auto& entry : files) {
1249 #ifdef DEBUG_SNAPSHOT 1250 std::cout <<
"make snapshot time=" << time <<
" file=" << file <<
"\n";
1252 const std::string& error =
makeSnapshot(std::get<0>(entry), std::get<1>(entry), std::get<2>(entry));
1253 if (error !=
"" && error !=
"video") {
1261 #ifdef DEBUG_SNAPSHOT 1262 std::cout <<
" files=" <<
toString(files) <<
" myApplicationSnapshots=" <<
joinToString(*myApplicationSnapshots,
",") <<
"\n";
1300 const FXint minSize = 100;
1301 const FXint minTitlebarHeight = 20;
1302 int x =
MAX2(0,
MIN2(getApp()->reg().readIntEntry(
1303 "VIEWPORT_DIALOG_SETTINGS",
"x", 150),
1304 getApp()->getRootWindow()->getWidth() - minSize));
1305 int y =
MAX2(minTitlebarHeight,
MIN2(getApp()->reg().readIntEntry(
1306 "VIEWPORT_DIALOG_SETTINGS",
"y", 150),
1307 getApp()->getRootWindow()->getHeight() - minSize));
1421 GDALDataset* poDataset = (GDALDataset*)GDALOpen(d.
filename.c_str(), GA_ReadOnly);
1422 if (poDataset == 0) {
1425 const int xSize = poDataset->GetRasterXSize();
1426 const int ySize = poDataset->GetRasterYSize();
1428 if (d.
width <= 0.) {
1429 double adfGeoTransform[6];
1430 if (poDataset->GetGeoTransform(adfGeoTransform) == CE_None) {
1431 Position topLeft(adfGeoTransform[0], adfGeoTransform[3]);
1432 const double horizontalSize = xSize * adfGeoTransform[1];
1433 const double verticalSize = ySize * adfGeoTransform[5];
1434 Position bottomRight(topLeft.
x() + horizontalSize, topLeft.
y() + verticalSize);
1436 d.
width = bottomRight.x() - topLeft.
x();
1437 d.
height = topLeft.
y() - bottomRight.y();
1438 d.
centerX = (topLeft.
x() + bottomRight.x()) / 2;
1439 d.
centerY = (topLeft.
y() + bottomRight.y()) / 2;
1447 if (d.
width <= 0.) {
1454 const int picSize = xSize * ySize;
1456 if (!FXMALLOC(&result, FXColor, picSize)) {
1460 for (
int j = 0; j < picSize; j++) {
1461 result[j] = FXRGB(0, 0, 0);
1464 for (
int i = 1; i <= poDataset->GetRasterCount(); i++) {
1465 GDALRasterBand* poBand = poDataset->GetRasterBand(i);
1467 if (poBand->GetColorInterpretation() == GCI_RedBand) {
1469 }
else if (poBand->GetColorInterpretation() == GCI_GreenBand) {
1471 }
else if (poBand->GetColorInterpretation() == GCI_BlueBand) {
1473 }
else if (poBand->GetColorInterpretation() == GCI_AlphaBand) {
1480 assert(xSize == poBand->GetXSize() && ySize == poBand->GetYSize());
1481 if (poBand->RasterIO(GF_Read, 0, 0, xSize, ySize, ((
unsigned char*)result) + shift, xSize, ySize, GDT_Byte, 4, 4 * xSize) == CE_Failure) {
1486 GDALClose(poDataset);
1488 return new FXImage(getApp(), result, IMAGE_OWNED | IMAGE_KEEP | IMAGE_SHMI | IMAGE_SHMP, xSize, ySize);
1500 for (std::vector<GUISUMOAbstractView::Decal>::iterator l =
myDecals.begin(); l !=
myDecals.end(); ++l) {
1508 if (img ==
nullptr) {
1523 glTranslated(center.
x(), center.
y(), d.
layer);
1527 glRotated(d.
rot, 0, 0, 1);
1529 double halfWidth = d.
width / 2.;
1530 double halfHeight = d.
height / 2.;
1532 halfWidth =
p2m(halfWidth);
1533 halfHeight =
p2m(halfHeight);
1585 glMatrixMode(GL_PROJECTION);
1590 glOrtho(0, getWidth(), 0, getHeight(), -
GLO_MAX - 1,
GLO_MAX + 1);
1591 glMatrixMode(GL_MODELVIEW);
1593 double scaleX = (double)getWidth() / bound.
getWidth();
1594 double scaleY = (double)getHeight() / bound.
getHeight();
1595 glScaled(scaleX, scaleY, 1);
1596 glTranslated(-bound.
xmin(), -bound.
ymin(), 0);
1648 screenRelative(false),
GUIDialog_EditViewport * getViewportEditor()
get the viewport and create it on first access
static void drawTexturedBox(int which, double size)
Draws a named texture as a box with the given size.
void paintGLGrid()
paints a grid
A decal (an image) that can be shown.
virtual long onConfigure(FXObject *, FXSelector, void *)
mouse functions
void showToolTips(bool val)
show tool tips
double ymin() const
Returns minimum y-coordinate.
std::vector< GUIGlID > getObjectsAtPosition(Position pos, double radius)
returns the ids of the object at position within the given (rectangular) radius using GL_SELECT ...
double xmax() const
Returns maximum x-coordinate.
bool haveGrabbed() const
Returns the information whether one of the spin dialers is grabbed.
GUICompleteSchemeStorage gSchemeStorage
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.
bool showSizeLegend
Information whether the size legend shall be drawn.
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. Used for: Centering of vehicles and junctions */.
double scale
information about a lane's width (temporary, used for a single view)
FXImage * checkGDALImage(Decal &d)
check whether we can read image data or position with gdal
FXImage * image
The image pointer for later cleanup.
std::map< SUMOTime, std::vector< std::tuple< std::string, int, int > > > mySnapshots
Snapshots.
virtual long onDoubleClicked(FXObject *, FXSelector, void *)
void setDefault(const std::string &name)
Makes the scheme with the given name the default.
double z() const
Returns the z-position.
bool myAmInitialised
Internal information whether doInit() was called.
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
void add(const Position &pos)
Adds the given position to this one.
virtual void recenterView()
recenters the view
FXint myWindowCursorPositionY
virtual void setRotation(double rotation)=0
Sets the rotation.
std::vector< GUIGlID > getObjectsInBoundary(Boundary bound)
returns the ids of all objects in the given boundary
SUMORTree * myGrid
The visualization speed-up.
static const RGBColor WHITE
static GUIGlID add(FXImage *i)
Adds a texture to use.
GUIColorScheme & getLaneEdgeScheme()
Returns the current lane (edge) coloring schme.
void toggleSelection(GUIGlID id)
Toggles selection of an object.
bool gaming
whether the application is in gaming mode or not
virtual long onMouseMove(FXObject *, FXSelector, void *)
unsigned char alpha() const
Returns the alpha-amount of the color.
virtual long onMiddleBtnPress(FXObject *, FXSelector, void *)
Stores the information about how to visualize structures.
The dialog to change the view (gui) settings.
static GeoConvHelper & getProcessing()
the coordinate transformation to use for input conversion and processing
void setDelay(double delay)
Sets the delay of the parent application.
const double SUMO_const_laneWidth
void displayLegend()
Draws a line with ticks, and the length information.
bool x2cartesian(Position &from, bool includeInBoundary=true)
Converts the given coordinate into a cartesian and optionally update myConvBoundary.
void updatePositionInformation() const
update position information
double y() const
Returns the y-position.
void remove(GUIDialog_EditViewport *)
remove viewport
GUIVisualizationSettings * getVisualisationSettings() const
get visualitation settings
const std::vector< std::string > & getNames() const
GUIVisualizationTextSettings edgeValue
GUIMainWindow * myApp
The application.
static const double SENSITIVITY
double x() const
Returns the x-position.
virtual void saveFrame(const std::string &destFile, FXColor *buf)
Adds a frame to a video snapshot which will be initialized if neccessary.
double centerX
The center of the image in x-direction (net coordinates, in m)
bool screenRelative
Whether this image should be skipped in 2D-views.
long myFrameDrawTime
counter for measuring rendering time
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)
virtual long onLeftBtnPress(FXObject *, FXSelector, void *)
double getWidth() const
Returns the width of the boudary (x-axis)
bool myInEditMode
Information whether too-tip informations shall be generated.
virtual void openObjectDialog()
virtual Boundary getCenteringBoundary() const =0
virtual double getRotation() const =0
Returns the rotation of the canvas stored in this changer.
void setOldValues(const Position &lookFrom, const Position &lookAt, double rotation)
Resets old values.
virtual long onKeyRelease(FXObject *o, FXSelector sel, void *data)
unsigned char blue() const
Returns the blue-amount of the color.
bool addAdditionalGLVisualisation(const GUIGlObject *const which)
Adds an object to call its additional visualisation method.
int glID
whether the decal shall be drawn in screen coordinates, rather than network coordinates ...
static const RGBColor BLACK
virtual void copyViewportTo(GUISUMOAbstractView *view)
copy the viewport to the given view
virtual void onGamingClick(Position)
on gaming click
GUIDialog_ViewSettings * myVisualizationChanger
Visualization changer.
virtual double getZPos() const =0
Returns the camera height corresponding to the current zoom factor.
void set(double x, double y)
set positions x and y
virtual void stopTrack()
stop track
GUIDialog_EditViewport * myViewportChooser
viewport chooser
virtual void setDelay(double)
Sets the delay of the parent application.
A RT-tree for efficient storing of SUMO's GL-objects.
double getGridHeight() const
get grid Height
bool dither
Information whether dithering shall be enabled.
double height
The height of the image (net coordinates in y-direction, in m)
void waitForSnapshots(const SUMOTime snapshotTime)
#define UNUSED_PARAMETER(x)
A class that stores a 2D geometrical boundary.
int myMouseHotspotX
Offset to the mouse-hotspot from the mouse position.
void addDecals(const std::vector< Decal > &decals)
add decals
double getDelay() const
Returns the delay of the parent application.
bool removeAdditionalGLVisualisation(const GUIGlObject *const which)
Removes an object from the list of objects that show additional things.
#define WRITE_WARNING(msg)
FXCondition mySnapshotCondition
the semaphore when waiting for snapshots to finish
void drawFPS()
Draws frames-per-second indicator.
void setBreakpoints(const std::vector< SUMOTime > &breakpoints)
Sets the breakpoints of the parent application.
double layer
The layer of the image.
double p2m(double pixel) const
pixels-to-meters conversion method
void saveViewport(const double x, const double y, const double z, const double rot)
Makes the given viewport the default.
std::map< const GUIGlObject *, int > myAdditionallyDrawn
List of objects for which GUIGlObject::drawGLAdditional is called.
virtual void setBreakpoints(const std::vector< SUMOTime > &)
Sets the breakpoints of the parent application.
void cartesian2geo(Position &cartesian) const
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
FXLabel & getCartesianLabel()
FXMutex myDecalsLock
The mutex to use before accessing the decals list in order to avoid thread conflicts.
FXMutex mySnapshotsMutex
The mutex to use before accessing the decals list in order to avoid thread conflicts.
std::vector< GUIGlID > getObjectstUnderCursor()
returns the id of the objects under the cursor using GL_SELECT (including overlapped objects) ...
GUIVisualizationSizeSettings addSize
Boundary applyGLTransform(bool fixRatio=true)
applies gl-transformations to fit the Boundary given by myChanger onto the canvas. If fixRatio is true, this boundary will be enlarged to prevent anisotropic stretching. (this should be set to false when doing selections)
std::vector< Decal > myDecals
double getGridWidth() const
get grid width
GUIGlID getObjectAtPosition(Position pos)
returns the id of the object at position using GL_SELECT
static FXbool scalePower2(FXImage *image, int maxSize=(2<< 29))
int getLaneEdgeMode() const
Returns the number of the active lane (edge) coloring schme.
virtual GUIGlID getTrackedID() const
get tracked id
virtual void startTrack(int)
star track
virtual long onPaint(FXObject *, FXSelector, void *)
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
std::string name
The name of this setting.
double gridXSize
Information about the grid spacings.
void showToolTipFor(const GUIGlID id)
invokes the tooltip for the given object
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
virtual void setStatusBarText(const std::string &)
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
virtual long onKeyPress(FXObject *o, FXSelector sel, void *data)
keyboard functions
static void sleep(long ms)
virtual void setViewport(double zoom, double xPos, double yPos)=0
Sets the viewport Used for: Adapting a new viewport.
bool isInEditMode()
returns true, if the edit button was pressed
void show()
show view settings dialog
A point in 2D or 3D with translation and scaling methods.
void setx(double x)
set position x
std::string makeSnapshot(const std::string &destFile, const int width=-1, const int height=-1)
Takes a snapshots and writes it into the given file.
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)=0
Returns an own popup-menu.
FXComboBox * getColoringSchemesCombo()
get coloring schemes combo
double getFPS() const
retrieve FPS
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
double rot
The rotation of the image in the ground plane (in degrees)
virtual void centerTo(GUIGlID id, bool applyZoom, double zoomDist=20)
centers to the chosen artifact
bool isGaming() const
return whether the gui is in gaming mode
GUIPerspectiveChanger & getChanger() const
get changer
virtual bool onLeftBtnRelease(void *data)
called when user releases left button
bool initialised
Whether this image was initialised (inserted as a texture)
double xmin() const
Returns minimum x-coordinate.
void displayColorLegend()
Draws a legend for the current edge coloring scheme.
virtual bool onRightBtnRelease(void *data)
called when user releases right button
bool showColorLegend
Information whether the colo legend shall be drawn.
virtual void doInit()
doInit
double centerY
The center of the image in y-direction (net coordinates, in m)
bool fps
Information whether frames-per-second should be drawn.
Boundary & grow(double by)
extends the boundary by the given amount
virtual long onMouseWheel(FXObject *, FXSelector, void *)
virtual void checkSnapshots()
Checks whether it is time for a snapshot.
virtual ~GUISUMOAbstractView()
destructor
std::string filename
The path to the file the image is located at.
virtual double getZoom() const =0
Returns the zoom factor computed stored in this changer.
virtual void setViewportFromToRot(const Position &lookFrom, const Position &lookAt, double rotation)
applies the given viewport settings
double angle
The current view rotation angle.
virtual int doPaintGL(int, const Boundary &)
paint GL
Position screenPos2NetPos(int x, int y) const
Translate screen position to network position.
static FXbool saveImage(const std::string &file, int width, int height, FXColor *data)
GUIPerspectiveChanger * myChanger
The perspective changer.
bool myUseToolTips
use tool tips
virtual void onLeftBtnPress(void *data)
mouse functions
GUIGLObjectPopupMenu * myPopup
The current popup-menu.
RGBColor backgroundColor
The background color to use.
void destroyPopup()
destoys the popup
void setValues(double zoom, double xoff, double yoff, double rotation)
Sets the given values into the dialog.
FXint myWindowCursorPositionX
Position of the cursor relative to the window.
virtual long onMiddleBtnRelease(FXObject *, FXSelector, void *)
Boundary getViewport(bool fixRatio=true)
get viewport
double width
The width of the image (net coordinates in x-direction, in m)
virtual bool setColorScheme(const std::string &)
set color scheme
Position rotateAround2D(double rad, const Position &origin)
rotate this position by rad around origin and return the result
virtual void showViewportEditor()
show viewport editor
FXbool makeCurrent()
A reimplementation due to some internal reasons.
virtual long onLeftBtnRelease(FXObject *, FXSelector, void *)
virtual void onGamingRightClick(Position)
GUIVisualizationSettings & getDefault()
Returns the default scheme.
static const RGBColor RED
named colors
double m2p(double meter) const
meter-to-pixels conversion method
GUIGlObject * getNetObject() const
Returns the network object.
void setViewport(GUISUMOAbstractView *view)
Sets the default viewport.
GUIVisualizationSettings * myVisualizationSettings
visualization settings
Position myPopupPosition
The current popup-menu position.
double getHeight() const
Returns the height of the boundary (y-axis)
virtual void onMouseWheel(void *data)
called when user changes mouse wheel
bool isAdditionalGLVisualisationEnabled(GUIGlObject *const which) const
Check if an object is added in the additional GL visualitation.
unsigned char green() const
Returns the green-amount of the color.
virtual double getColorValue(const GUIVisualizationSettings &, int) const
void paintGL()
performs the painting of the simulation
virtual long onKeyPress(void *data)
called when user press a key
std::vector< GUIGlObject * > getGUIGlObjectsAtPosition(Position pos, double radius)
returns the GUIGlObjects at position within the given (rectangular) radius using GL_SELECT ...
const std::vector< T > & getColors() const
void sety(double y)
set position y
void setWindowCursorPosition(FXint x, FXint y)
Returns the gl-id of the object under the given coordinates.
void setCurrent(GUIVisualizationSettings *settings)
Sets current settings (called if reopened)
void show()
overload show function to focus always in OK Button
static const GUIGlID INVALID_ID
static FXImage * loadImage(FXApp *a, const std::string &file)
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
virtual double getDelay() const
Returns the delay (should be overwritten by subclasses if applicable)
bool showGrid
Information whether a grid shall be shown.
void drawDecals()
Draws the stored decals.
FXComboBox * getColoringSchemesCombo()
return combobox with the current coloring schemes (standard, fastest standard, real world...
static int getMaxTextureSize()
return maximum number of pixels in x and y direction
virtual double getYPos() const =0
Returns the y-offset of the field to show stored in this changer.
void addSnapshot(SUMOTime time, const std::string &file, const int width=-1, const int height=-1)
Sets the snapshot time to file map.
GUIGlID getGlID() const
Returns the numerical id of the object.
Position getCenter() const
Returns the center of the boundary.
unsigned char red() const
Returns the red-amount of the color.
bool skip2D
Whether this image should be skipped in 2D-views.
virtual void onMouseMove(void *data)
called when user moves mouse
virtual SUMOTime getCurrentTimeStep() const
get the current simulation time
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
Boundary getVisibleBoundary() const
get visible boundary
void updateToolTip()
A method that updates the tooltip.
A dialog to change the viewport.
virtual void onRightBtnPress(void *data)
called when user press right button
void unblockObject(GUIGlID id)
Marks an object as unblocked.
const std::vector< double > & getThresholds() const
static bool UseMesoSim
this should be set at the same time as MSGlobals::gUseMesoSim
virtual void setViewportFrom(double xPos, double yPos, double zPos)=0
Alternative method for setting the viewport.
void showViewschemeEditor()
show viewsscheme editor
virtual long onRightBtnPress(FXObject *, FXSelector, void *)
static long getCurrentMillis()
Returns the current time in milliseconds.
static void setGL2PS(bool active=true)
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
virtual long onMouseLeft(FXObject *, FXSelector, void *)
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
bool drawForSelecting
whether drawing is performed for the purpose of selecting objects
double ymax() const
Returns maximum y-coordinate.
#define WRITE_MESSAGE(msg)
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
GUIGlObject * getObjectBlocking(GUIGlID id)
Returns the object from the container locking it.
virtual long onKeyRelease(void *data)
called when user releases a key
virtual int Search(const float a_min[2], const float a_max[2], const GUIVisualizationSettings &c) const
Find all within search rectangle.
GUISelectedStorage gSelected
A global holder of selected objects.
static RGBColor interpolate(const RGBColor &minColor, const RGBColor &maxColor, double weight)
Interpolates between two colors.
virtual double getXPos() const =0
Returns the x-offset of the field to show stored in this changer.
FXDEFMAP(GUISUMOAbstractView) GUISUMOAbstractViewMap[]
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
Position getWindowCursorPosition() const
Returns the information whether rotation is allowd.
GUIGlChildWindow * myParent
The parent window.
virtual long onRightBtnRelease(FXObject *, FXSelector, void *)
static const Position INVALID
used to indicate that a position is valid
const Position & getPopupPosition() const
get position of current popup
void setz(double z)
set position z