Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GUIMainWindow.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2026 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
20//
21/****************************************************************************/
22#include <config.h>
23
24#include <string>
25#include <algorithm>
27// fx3d includes windows.h so we need to guard against macro pollution
28#ifdef WIN32
29#define NOMINMAX
30#endif
31#include <fx3d.h>
32#ifdef WIN32
33#undef NOMINMAX
34#endif
44#include <regex>
45#include "GUIMainWindow.h"
46#include "GUIGlChildWindow.h"
47#include "GUISUMOAbstractView.h"
48
49
50// ===========================================================================
51// static member definitions
52// ===========================================================================
54
55// ===========================================================================
56// member method definitions
57// ===========================================================================
59 FXMainWindow(app, "sumo-gui main window", nullptr, nullptr, DECOR_ALL, 20, 20, 600, 400),
60 myAmFullScreen(false),
61 myTrackerLock(true),
62 myGLVisual(new FXGLVisual(app, VISUAL_DOUBLEBUFFER)),
63 myAmGaming(false),
64 myListInternal(false),
65 myListParking(true),
66 myListTeleporting(false) {
67 // build static tooltips
70 // build bold font
71 FXFontDesc fdesc;
72 app->getNormalFont()->getFontDesc(fdesc);
73 const double uiScale = app->reg().readRealEntry("SETTINGS", "uiscale", 1);
74 fdesc.size = (FXushort)(fdesc.size * uiScale);
75 myNormalFont = new FXFont(app, fdesc);
76 app->setNormalFont(myNormalFont);
77 fdesc.weight = FXFont::Bold;
78 GUIDesignHeight = (int)(fdesc.size / 90.0 * 18) + 5;
79 myBoldFont = new FXFont(app, fdesc);
80 // https://en.wikipedia.org/wiki/Noto_fonts should be widely available
81 myFallbackFont = new FXFont(app, "Noto Sans CJK JP");
82 // build docks
83 myTopDock = new FXDockSite(this, LAYOUT_SIDE_TOP | LAYOUT_FILL_X);
84 myBottomDock = new FXDockSite(this, LAYOUT_SIDE_BOTTOM | LAYOUT_FILL_X);
85 myLeftDock = new FXDockSite(this, LAYOUT_SIDE_LEFT | LAYOUT_FILL_Y);
86 myRightDock = new FXDockSite(this, LAYOUT_SIDE_RIGHT | LAYOUT_FILL_Y);
87 // avoid instance Windows twice
88 if (myInstance != nullptr) {
89 throw ProcessError("MainWindow initialized twice");
90 }
91 myInstance = this;
92 //myGLVisual->setStencilSize(8); // enable stencil buffer
93}
94
95
99 delete myNormalFont;
100 delete myBoldFont;
101 delete myFallbackFont;
102 delete myTopDock;
103 delete myBottomDock;
104 delete myLeftDock;
105 delete myRightDock;
106 myInstance = nullptr;
107}
108
109
110
111void
113 myGLWindows.push_back(child);
114}
115
116
117void
119 std::vector<GUIGlChildWindow*>::iterator i = std::find(myGLWindows.begin(), myGLWindows.end(), child);
120 if (i != myGLWindows.end()) {
121 myGLWindows.erase(i);
122 }
123}
124
125
126void
127GUIMainWindow::addChild(FXMainWindow* child) {
128 myTrackerLock.lock();
129 myTrackerWindows.push_back(child);
130 myTrackerLock.unlock();
131}
132
133
134void
135GUIMainWindow::removeChild(FXMainWindow* child) {
136 myTrackerLock.lock();
137 std::vector<FXMainWindow*>::iterator i = std::find(myTrackerWindows.begin(), myTrackerWindows.end(), child);
138 myTrackerWindows.erase(i);
139 myTrackerLock.unlock();
140}
141
142
143FXDockSite*
147
148
149std::vector<std::string>
151 std::vector<std::string> ret;
152 for (GUIGlChildWindow* const window : myGLWindows) {
153 ret.push_back(window->getTitle().text());
154 }
155 return ret;
156}
157
158
160GUIMainWindow::getViewByID(const std::string& id) const {
161 for (GUIGlChildWindow* const window : myGLWindows) {
162 if (std::string(window->getTitle().text()) == id) {
163 return window;
164 }
165 }
166 return nullptr;
167}
168
169
170void
171GUIMainWindow::removeViewByID(const std::string& id) {
172 for (GUIGlChildWindow* const window : myGLWindows) {
173 if (std::string(window->getTitle().text()) == id) {
174 window->close();
175 removeGLChild(window);
176 return;
177 }
178 }
179}
180
181
182FXFont*
186
187FXFont*
191
192const std::vector<GUIGlChildWindow*>&
194 return myGLWindows;
195}
196
197
198void
200 // inform views
201 myMDIClient->forallWindows(this, FXSEL(SEL_COMMAND, msg), nullptr);
202 // inform other windows
203 myTrackerLock.lock();
204 for (int i = 0; i < (int)myTrackerWindows.size(); i++) {
205 myTrackerWindows[i]->handle(this, FXSEL(SEL_COMMAND, msg), nullptr);
206 }
207 myTrackerLock.unlock();
208}
209
210
211FXGLVisual*
213 return myGLVisual;
214}
215
216
221
222
227
228
229FXTextField*
233
234
235FXTextField*
239
240
241bool
242GUIMainWindow::parseGeoCoordinate(const std::string& text, double& lat, double& lon) {
243 std::string s = StringUtils::to_lower_case(StringUtils::prune(text));
244 if (s.empty()) {
245 return false;
246 }
247 std::regex latRegex(R"((?:lat(?:itude)?)\s*[:=]?\s*([+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?))");
248 std::regex lonRegex(R"((?:lon(?:gitude)?)\s*[:=]?\s*([+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?))");
249 std::smatch latMatch, lonMatch;
250 if (std::regex_search(s, latMatch, latRegex) && std::regex_search(s, lonMatch, lonRegex)) {
251 try {
252 double l1 = std::stod(latMatch[1]);
253 double l2 = std::stod(lonMatch[1]);
254 if (l1 >= -90.0 && l1 <= 90.0 && l2 >= -180.0 && l2 <= 180.0) {
255 lat = l1;
256 lon = l2;
257 return true;
258 }
259 } catch (...) {
260 return false;
261 }
262 return false;
263 }
264 std::string clean = s;
265 for (char& c : clean) {
266 if (c == ',' || c == ';' || c == '/' || c == '\t') {
267 c = ' ';
268 }
269 }
270 StringTokenizer st(clean, " ");
271 std::vector<double> vals;
272 while (st.hasNext()) {
273 std::string token = st.next();
274 try {
275 size_t idx = 0;
276 double v = std::stod(token, &idx);
277 if (idx == token.size()) {
278 vals.push_back(v);
279 }
280 } catch (...) {}
281 }
282 if (vals.size() >= 2) {
283 double v1 = vals[0];
284 double v2 = vals[1];
285 if (std::abs(v1) > 90.0 && std::abs(v2) <= 90.0) {
286 lon = v1;
287 lat = v2;
288 } else if (std::abs(v2) > 90.0 && std::abs(v1) <= 90.0) {
289 lat = v1;
290 lon = v2;
291 } else {
292 lat = v1;
293 lon = v2;
294 }
295 if (lat >= -90.0 && lat <= 90.0 && lon >= -180.0 && lon <= 180.0) {
296 return true;
297 }
298 }
299 return false;
300}
301
302
303bool
304GUIMainWindow::parseCartesianCoordinate(const std::string& text, double& x, double& y) {
305 std::string s = StringUtils::to_lower_case(StringUtils::prune(text));
306 if (s.empty()) {
307 return false;
308 }
309 std::regex xRegex(R"((?:x)\s*[:=]?\s*([+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?))");
310 std::regex yRegex(R"((?:y)\s*[:=]?\s*([+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?))");
311 std::smatch xMatch, yMatch;
312 if (std::regex_search(s, xMatch, xRegex) && std::regex_search(s, yMatch, yRegex)) {
313 try {
314 x = std::stod(xMatch[1]);
315 y = std::stod(yMatch[1]);
316 return true;
317 } catch (...) {
318 return false;
319 }
320 }
321 std::string clean = s;
322 for (char& c : clean) {
323 if (c == ',' || c == ';' || c == '/' || c == '\t') {
324 c = ' ';
325 }
326 }
327 StringTokenizer st(clean, " ");
328 std::vector<double> vals;
329 while (st.hasNext()) {
330 std::string token = st.next();
331 try {
332 size_t idx = 0;
333 double v = std::stod(token, &idx);
334 if (idx == token.size()) {
335 vals.push_back(v);
336 }
337 } catch (...) {}
338 }
339 if (vals.size() >= 2) {
340 x = vals[0];
341 y = vals[1];
342 return true;
343 }
344 return false;
345}
346
347
348long
349GUIMainWindow::onCmdSetGeoCoordinate(FXObject*, FXSelector, void*) {
350 if (myGeoCoordinate) {
351 myGeoCoordinate->killFocus();
352 if (!GeoConvHelper::getFinal().usingGeoProjection()) {
353 setStatusBarText(TL("No projection defined"));
354 myGeoCoordinate->setText(TL("(No projection defined)"));
355 myGeoCoordinate->disable();
356 myGeoCoordinate->setEditable(false);
357 return 1;
358 }
359 const std::string text = myGeoCoordinate->getText().text();
360 double lat, lon;
361 if (parseGeoCoordinate(text, lat, lon)) {
362 Position p(lon, lat);
363 if (GeoConvHelper::getFinal().x2cartesian_const(p)) {
365 if (view) {
366 view->centerToPos(p, false);
367 view->update();
368 setStatusBarText(TLF("Centered view on %. Geo coordinates: lat %, lon %", toString(p), toString(lat, gPrecisionGeo), toString(lon, gPrecisionGeo)));
369 return 1;
370 }
371 }
372 }
373 setStatusBarText(TL("Invalid geo coordinate. Use 'lat, lon' or 'lat:... lon:...'"));
374 }
375 return 1;
376}
377
378
379long
380GUIMainWindow::onCmdSetCartesianCoordinate(FXObject*, FXSelector, void*) {
382 myCartesianCoordinate->killFocus();
383 const std::string text = myCartesianCoordinate->getText().text();
384 double x, y;
385 if (parseCartesianCoordinate(text, x, y)) {
386 Position p(x, y);
388 if (view) {
389 view->centerToPos(p, false);
390 view->update();
391 setStatusBarText(TLF("Centered view on x: %, y: %", toString(x), toString(y)));
392 return 1;
393 }
394 }
395 setStatusBarText(TL("Invalid cartesian coordinate. Use 'x, y' or 'x:... y:...'"));
396 }
397 return 1;
398}
399
400
401long
402GUIMainWindow::onCmdFocusCoordinate(FXObject* sender, FXSelector, void*) {
403 FXTextField* tf = dynamic_cast<FXTextField*>(sender);
404 if (tf && tf->isEnabled()) {
405 tf->setBackColor(FXRGB(255, 255, 255));
406 tf->selectAll();
407 }
408 return 1;
409}
410
411
412long
413GUIMainWindow::onCmdUnfocusCoordinate(FXObject* sender, FXSelector, void*) {
414 FXTextField* tf = dynamic_cast<FXTextField*>(sender);
415 if (tf && tf->getParent()) {
416 tf->setBackColor(tf->getParent()->getBackColor());
417 }
418 return 1;
419}
420
421
422FXLabel*
426
427
428FXHorizontalFrame*
432
433
434bool
436 return myAmGaming;
437}
438
439
440bool
444
445
446bool
448 return myListParking;
449}
450
451
452bool
456
457
460 if (myInstance != nullptr) {
461 return myInstance;
462 }
463 throw ProcessError("A GUIMainWindow instance was not yet constructed.");
464}
465
466
469 GUIGlChildWindow* w = dynamic_cast<GUIGlChildWindow*>(myMDIClient->getActiveChild());
470 if (w != nullptr) {
471 return w->getView();
472 }
473 if (!myGLWindows.empty()) {
474 return myGLWindows.front()->getView();
475 }
476 return nullptr;
477}
478
479
480void
482 int windowWidth = getApp()->reg().readIntEntry("SETTINGS", "width", 600);
483 int windowHeight = getApp()->reg().readIntEntry("SETTINGS", "height", 400);
485 if (oc.isSet("window-size")) {
486 std::vector<std::string> windowSize = oc.getStringVector("window-size");
487 if (windowSize.size() != 2) {
488 WRITE_ERROR(TL("option window-size requires INT,INT"));
489 } else {
490 try {
491 windowWidth = StringUtils::toInt(windowSize[0]);
492 windowHeight = StringUtils::toInt(windowSize[1]);
493 } catch (NumberFormatException& e) {
494 WRITE_ERROR("option window-size requires INT,INT " + toString(e.what()));
495 }
496 }
497 }
498 if (oc.isSet("window-size") || getApp()->reg().readIntEntry("SETTINGS", "maximized", 0) == 0 || oc.isSet("window-pos")) {
499 // when restoring previous pos, make sure the window fits fully onto the current screen
500 int x = MAX2(0, MIN2(getApp()->reg().readIntEntry("SETTINGS", "x", 150), getApp()->getRootWindow()->getWidth() - windowWidth));
501 int y = MAX2(50, MIN2(getApp()->reg().readIntEntry("SETTINGS", "y", 150), getApp()->getRootWindow()->getHeight() - windowHeight));
502 if (oc.isSet("window-pos")) {
503 std::vector<std::string> windowPos = oc.getStringVector("window-pos");
504 if (windowPos.size() != 2) {
505 WRITE_ERROR(TL("option window-pos requires INT,INT"));
506 } else {
507 try {
508 x = StringUtils::toInt(windowPos[0]);
509 y = StringUtils::toInt(windowPos[1]);
510 } catch (NumberFormatException& e) {
511 WRITE_ERROR("option window-pos requires INT,INT " + toString(e.what()));
512 }
513 }
514 }
515 move(x, y);
516 resize(windowWidth, windowHeight);
517 }
518}
519
520void
522 if (!myAmFullScreen) {
523 getApp()->reg().writeIntEntry("SETTINGS", "x", getX());
524 getApp()->reg().writeIntEntry("SETTINGS", "y", getY());
525 getApp()->reg().writeIntEntry("SETTINGS", "width", getWidth());
526 getApp()->reg().writeIntEntry("SETTINGS", "height", getHeight());
527 }
528}
529
530
531void
533 myLanguageMenu = new FXMenuPane(this);
534 GUIDesigns::buildFXMenuTitle(menuBar, TL("Langua&ge"), nullptr, myLanguageMenu);
535
536 GUIDesigns::buildFXMenuCommandShortcut(myLanguageMenu, "English", "", TL("Change language to english. (en)"),
538 GUIDesigns::buildFXMenuCommandShortcut(myLanguageMenu, "Deutsch", "", TL("Change language to german. (de)"),
540 GUIDesigns::buildFXMenuCommandShortcut(myLanguageMenu, "Español", "", TL("Change language to spanish. (es)"),
542 GUIDesigns::buildFXMenuCommandShortcut(myLanguageMenu, "Português", "", TL("Change language to portuguese. (pt)"),
544 GUIDesigns::buildFXMenuCommandShortcut(myLanguageMenu, "Français", "", TL("Change language to french. (fr)"),
546 GUIDesigns::buildFXMenuCommandShortcut(myLanguageMenu, "Italiano", "", TL("Change language to italian. (it)"),
548 GUIDesigns::buildFXMenuCommandShortcut(myLanguageMenu, "简体中文", "", TL("简体中文 (zh)"),
550 GUIDesigns::buildFXMenuCommandShortcut(myLanguageMenu, "繁體中文", "", TL("繁體中文 (zh-Hant)"),
552 GUIDesigns::buildFXMenuCommandShortcut(myLanguageMenu, "Türkçe", "", TL("Change language to turkish. (tr)"),
554 GUIDesigns::buildFXMenuCommandShortcut(myLanguageMenu, "日本語", "", TL("Change language to japanese. (ja)"),
556 GUIDesigns::buildFXMenuCommandShortcut(myLanguageMenu, "한국어", "", TL("Change language to korean. (ko)"),
558}
559
560
561long
562GUIMainWindow::onCmdChangeLanguage(FXObject*, FXSelector sel, void*) {
563 // set language
564 std::string langID;
565 std::string lang;
566 // continue depending of called button
567 switch (FXSELID(sel)) {
568 case MID_LANGUAGE_DE:
569 langID = "de";
570 lang = TL("german");
571 break;
572 case MID_LANGUAGE_ES:
573 langID = "es";
574 lang = TL("spanish");
575 break;
576 case MID_LANGUAGE_PT:
577 langID = "pt";
578 lang = TL("portuguese");
579 break;
580 case MID_LANGUAGE_FR:
581 langID = "fr";
582 lang = TL("french");
583 break;
584 case MID_LANGUAGE_IT:
585 langID = "it";
586 lang = TL("italian");
587 break;
588 case MID_LANGUAGE_ZH:
589 langID = "zh";
590 lang = TL("simplified chinese");
591 break;
592 case MID_LANGUAGE_ZHT:
593 langID = "zh-Hant";
594 lang = TL("traditional chinese");
595 break;
596 case MID_LANGUAGE_TR:
597 langID = "tr";
598 lang = TL("turkish");
599 break;
600 case MID_LANGUAGE_JA:
601 langID = "ja";
602 lang = TL("japanese");
603 break;
604 case MID_LANGUAGE_KO:
605 langID = "ko";
606 lang = TL("korean");
607 break;
608 default:
609 langID = "C";
610 lang = TL("english");
611 break;
612 }
613 // check if change language
614 if (langID != gLanguage) {
615 // update language
616 gLanguage = langID;
617 // show info
618 WRITE_MESSAGE(TL("Language changed to ") + lang);
619 // show dialog
620 const std::string header = TL("Restart needed");
621 const std::string body = TL("Changing display language needs restart to take effect.") + std::string("\n") +
622#ifdef DEBUG
623#ifdef WIN32
624 TL("For the Debug build you might also need to set the LANG environment variable.") + std::string("\n") +
625#endif
626#endif
627 TL("Under development. You can help to improve the translation at:") + std::string("\n") +
628 "https://hosted.weblate.org/projects/eclipse-sumo/";
629 FXMessageBox::information(getApp(), MBOX_OK, header.c_str(), "%s", body.c_str());
630 // update language in registry (common for sumo and netedit)
631 std::string appKey = getApp()->reg().getAppKey().text();
632 if (appKey == "SUMO GUI") {
633 // registry is written again later so we have to modify the "live" version
634 getApp()->reg().writeStringEntry("gui", "language", langID.c_str());
635 } else {
636 FXRegistry reg("SUMO GUI", "sumo-gui");
637 reg.read();
638 reg.writeStringEntry("gui", "language", langID.c_str());
639 reg.write();
640 }
641 }
642 return 1;
643}
644
645
646long
647GUIMainWindow::onUpdChangeLanguage(FXObject* obj, FXSelector, void*) {
648 // get language menu command
649 FXMenuCommand* menuCommand = dynamic_cast<FXMenuCommand*>(obj);
650 if (menuCommand) {
651 // check if change color
652 if ((gLanguage == "C") && (menuCommand->getIcon() == GUIIconSubSys::getIcon(GUIIcon::LANGUAGE_EN))) {
653 menuCommand->setTextColor(GUIDesignTextColorBlue);
654 } else if ((gLanguage == "de") && (menuCommand->getIcon() == GUIIconSubSys::getIcon(GUIIcon::LANGUAGE_DE))) {
655 menuCommand->setTextColor(GUIDesignTextColorBlue);
656 } else if ((gLanguage == "es") && (menuCommand->getIcon() == GUIIconSubSys::getIcon(GUIIcon::LANGUAGE_ES))) {
657 menuCommand->setTextColor(GUIDesignTextColorBlue);
658 } else if ((gLanguage == "pt") && (menuCommand->getIcon() == GUIIconSubSys::getIcon(GUIIcon::LANGUAGE_PT))) {
659 menuCommand->setTextColor(GUIDesignTextColorBlue);
660 } else if ((gLanguage == "fr") && (menuCommand->getIcon() == GUIIconSubSys::getIcon(GUIIcon::LANGUAGE_FR))) {
661 menuCommand->setTextColor(GUIDesignTextColorBlue);
662 } else if ((gLanguage == "it") && (menuCommand->getIcon() == GUIIconSubSys::getIcon(GUIIcon::LANGUAGE_IT))) {
663 menuCommand->setTextColor(GUIDesignTextColorBlue);
664 } else if ((gLanguage == "zh") && (menuCommand->getIcon() == GUIIconSubSys::getIcon(GUIIcon::LANGUAGE_ZH))) {
665 menuCommand->setTextColor(GUIDesignTextColorBlue);
666 } else if ((gLanguage == "zh-Hant") && (menuCommand->getIcon() == GUIIconSubSys::getIcon(GUIIcon::LANGUAGE_ZHT))) {
667 menuCommand->setTextColor(GUIDesignTextColorBlue);
668 } else if ((gLanguage == "tr") && (menuCommand->getIcon() == GUIIconSubSys::getIcon(GUIIcon::LANGUAGE_TR))) {
669 menuCommand->setTextColor(GUIDesignTextColorBlue);
670 } else if ((gLanguage == "ja") && (menuCommand->getIcon() == GUIIconSubSys::getIcon(GUIIcon::LANGUAGE_JA))) {
671 menuCommand->setTextColor(GUIDesignTextColorBlue);
672 } else if ((gLanguage == "ko") && (menuCommand->getIcon() == GUIIconSubSys::getIcon(GUIIcon::LANGUAGE_KO))) {
673 menuCommand->setTextColor(GUIDesignTextColorBlue);
674 } else {
675 menuCommand->setTextColor(GUIDesignTextColorBlack);
676 }
677 }
678 return 1;
679}
680
681
682/****************************************************************************/
@ MID_LANGUAGE_PT
change language to portuguese
@ MID_LANGUAGE_TR
change language to turkish
@ MID_LANGUAGE_ZHT
change language to chinese (traditional)
@ MID_LANGUAGE_ES
change language to spanish
@ MID_LANGUAGE_IT
change language to italian
@ MID_LANGUAGE_EN
change language to english
@ MID_LANGUAGE_DE
change language to german
@ MID_LANGUAGE_JA
change language to japanese
@ MID_LANGUAGE_ZH
change language to chinese (simplified)
@ MID_LANGUAGE_FR
change language to french
@ MID_LANGUAGE_KO
change language to korean
#define GUIDesignTextColorBlue
blue color (for default text)
Definition GUIDesigns.h:41
#define GUIDesignTextColorBlack
black color (for correct text)
Definition GUIDesigns.h:38
@ LANGUAGE_ZHT
@ LANGUAGE_EN
icons for languages
#define WRITE_MESSAGE(msg)
Definition MsgHandler.h:288
#define WRITE_ERROR(msg)
Definition MsgHandler.h:295
#define TL(string)
Definition MsgHandler.h:304
#define TLF(string,...)
Definition MsgHandler.h:306
std::string gLanguage
the language for GUI elements and messages
Definition StdDefs.cpp:39
int gPrecisionGeo
Definition StdDefs.cpp:29
int GUIDesignHeight
the default height for GUI elements
Definition StdDefs.cpp:41
T MIN2(T a, T b)
Definition StdDefs.h:80
T MAX2(T a, T b)
Definition StdDefs.h:86
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:49
static FXMenuTitle * buildFXMenuTitle(FXComposite *p, const std::string &text, FXIcon *icon, FXMenuPane *menuPane)
build menu title
static FXMenuCommand * buildFXMenuCommandShortcut(FXComposite *p, const std::string &text, const std::string &shortcut, const std::string &info, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
GUISUMOAbstractView * getView() const
return GUISUMOAbstractView
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
void setWindowSizeAndPos()
perform initial window positioning and sizing according to user options / previous call
const std::vector< GUIGlChildWindow * > & getViews() const
get views
bool myListParking
information whether the locator should list parking vehicles
static GUIMainWindow * myInstance
the singleton window instance
FXTextField * getGeoLabel()
get geo coordinate field
virtual ~GUIMainWindow()
destructor
FXDockSite * myRightDock
void removeViewByID(const std::string &id)
long onCmdUnfocusCoordinate(FXObject *, FXSelector, void *)
called when a coordinate field in the status bar loses focus
GUIGlChildWindow * getViewByID(const std::string &id) const
get specific view by ID
std::vector< FXMainWindow * > myTrackerWindows
list of tracker windows
FXTextField * getCartesianLabel()
get cartesian coordinate field
MFXStaticToolTip * getStaticTooltipView() const
get static toolTip for view
FXFont * myFallbackFont
Fallback font for extended characters support.
std::vector< std::string > getViewIDs() const
get view IDs
FXMenuPane * myLanguageMenu
Language menu common to all applications.
GUISUMOAbstractView * getActiveView() const
get the active view or 0
long onCmdSetGeoCoordinate(FXObject *, FXSelector, void *)
called when user enters a geo coordinate in the status bar
bool isGaming() const
return whether the gui is in gaming mode
bool myListTeleporting
information whether the locator should list teleporting vehicles
MFXStaticToolTip * myStaticTooltipMenu
static toolTip used in menus
FXMDIClient * myMDIClient
The multi view panel.
long onCmdSetCartesianCoordinate(FXObject *, FXSelector, void *)
called when user enters a cartesian coordinate in the status bar
FXFont * getBoldFont()
get bold front
FXDockSite * myLeftDock
void buildLanguageMenu(FXMenuBar *menuBar)
long onCmdChangeLanguage(FXObject *, FXSelector, void *)
bool listTeleporting() const
return whether to list teleporting vehicles
FXLabel * getTestLabel()
get test label
MFXStaticToolTip * myStaticTooltipView
static toolTip used in view
MFXStaticToolTip * getStaticTooltipMenu() const
get static toolTip for menus
FXFont * myBoldFont
Font used for popup-menu titles.
virtual void setStatusBarText(const std::string &)
get status bar text (can be implemented in children)
static GUIMainWindow * getInstance()
get instance
bool listParking() const
return whether to list parking vehicles
FXTextField * myCartesianCoordinate
Coordinate fields for the current cartesian, geo-coordinate and test coordinates.
FXDockSite * myBottomDock
bool listInternal() const
return whether to list internal structures
FXHorizontalFrame * myTestFrame
void addGLChild(GUIGlChildWindow *child)
Adds a further child window to the list (GUIGlChildWindow)
FXLabel * myTestCoordinate
FXFont * myNormalFont
default Font (after scaling)
FXMutex myTrackerLock
A lock to make the removal and addition of trackers secure.
FXDockSite * myTopDock
dock sites
bool myListInternal
information whether the locator should list internal structures
void storeWindowSizeAndPos()
record window position and size in registry
long onCmdFocusCoordinate(FXObject *, FXSelector, void *)
called when user focuses a coordinate field in the status bar
FXGLVisual * getGLVisual() const
get GL Visual
bool myAmFullScreen
FOX need this.
void removeGLChild(GUIGlChildWindow *child)
removes the given child window from the list (GUIGlChildWindow)
FXDockSite * getTopDock()
get top dock
FXHorizontalFrame * getTestFrame()
get test frame
FXFont * getFallbackFont()
get fallback front
static bool parseCartesianCoordinate(const std::string &text, double &x, double &y)
parse cartesian coordinate string ("x, y" or "x:... y:...")
void updateChildren(int msg=MID_SIMSTEP)
update childrens
FXTextField * myGeoCoordinate
FXGLVisual * myGLVisual
The gl-visual used.
static bool parseGeoCoordinate(const std::string &text, double &lat, double &lon)
parse geo coordinate string ("lat, lon" or "lat:... lon:...")
bool myAmGaming
information whether the gui is currently in gaming mode
void removeChild(FXMainWindow *child)
removes the given child window from the list (FXMainWindow)
GUIMainWindow(FXApp *app)
constructor
std::vector< GUIGlChildWindow * > myGLWindows
list of GLWindows
long onUpdChangeLanguage(FXObject *, FXSelector, void *)
void addChild(FXMainWindow *child)
Adds a further child window to the list (FXMainWindow)
virtual void centerToPos(const Position &pos, bool applyZoom, double zoomDist=20)
centers to the chosen position
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
MFXStaticToolTip (based on FXToolTip)
A storage for options typed value containers)
Definition OptionsCont.h:89
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
const StringVector & getStringVector(const std::string &name) const
Returns the list of string-value of the named option (only for Option_StringVector)
static OptionsCont & getOptions()
Retrieves the options.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
bool hasNext()
returns the information whether further substrings exist
std::string next()
returns the next substring when it exists. Otherwise the behaviour is undefined
static std::string to_lower_case(const std::string &str)
Transfers the content to lower case.
static std::string prune(const std::string &str)
Removes trailing and leading whitechars.
static int toInt(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter,...