Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GUIParam_PopupMenu.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-2024 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
/****************************************************************************/
19
// A popup-menu for dynamic patameter table entries
20
/****************************************************************************/
21
#include <config.h>
22
23
#include <iostream>
24
#include <string>
25
#include "
GUIParameterTableWindow.h
"
26
#include <
utils/gui/globjects/GUIGlObject.h
>
27
#include "
GUIParam_PopupMenu.h
"
28
#include <
utils/gui/tracker/GUIParameterTracker.h
>
29
#include <
utils/gui/tracker/TrackerValueDesc.h
>
30
#include <
utils/gui/windows/GUIAppEnum.h
>
31
#include <
utils/gui/windows/GUIMainWindow.h
>
32
33
34
// ===========================================================================
35
// FOX callback mapping
36
// ===========================================================================
37
FXDEFMAP
(
GUIParam_PopupMenuInterface
) GUIParam_PopupMenuInterfaceMap[] = {
38
FXMAPFUNC(SEL_COMMAND,
MID_OPENTRACKER
,
GUIParam_PopupMenuInterface::onCmdOpenTracker
),
39
};
40
41
// Object implementation
42
FXIMPLEMENT(
GUIParam_PopupMenuInterface
, FXMenuPane, GUIParam_PopupMenuInterfaceMap, ARRAYNUMBER(GUIParam_PopupMenuInterfaceMap))
43
44
45
// ===========================================================================
46
// method definitions
47
// ===========================================================================
48
GUIParam_PopupMenuInterface
::
GUIParam_PopupMenuInterface
(
GUIMainWindow
& app,
49
GUIParameterTableWindow
& parentWindow,
GUIGlObject
& o, const
std
::
string
& varName,
50
ValueSource
<
double
>* src)
51
: FXMenuPane(&parentWindow), myObject(&o), myParentWindow(&parentWindow),
52
myApplication(&app), myVarName(varName), mySource(src) {
53
}
54
55
56
GUIParam_PopupMenuInterface::~GUIParam_PopupMenuInterface
() {
57
delete
mySource
;
58
}
59
60
61
long
62
GUIParam_PopupMenuInterface::onCmdOpenTracker
(FXObject*, FXSelector,
void
*) {
63
std::string trackerName =
myVarName
+
" from "
+
myObject
->
getFullName
();
64
TrackerValueDesc
* newTracked =
new
TrackerValueDesc
(
myVarName
,
RGBColor::BLACK
,
myApplication
->
getCurrentSimTime
(),
myApplication
->
getTrackerInterval
());
65
if
(!
GUIParameterTracker::addTrackedMultiplot
(*
myObject
,
mySource
->
copy
(), newTracked)) {
66
GUIParameterTracker
* tr =
new
GUIParameterTracker
(*
myApplication
, trackerName);
67
tr->
addTracked
(*
myObject
,
mySource
->
copy
(), newTracked);
68
tr->
create
();
69
tr->show();
70
}
71
return
1;
72
}
73
74
75
/****************************************************************************/
GUIAppEnum.h
MID_OPENTRACKER
@ MID_OPENTRACKER
A Tracker shall be opened.
Definition
GUIAppEnum.h:543
GUIGlObject.h
GUIMainWindow.h
FXDEFMAP
FXDEFMAP(GUIParam_PopupMenuInterface) GUIParam_PopupMenuInterfaceMap[]
GUIParam_PopupMenu.h
GUIParameterTableWindow.h
GUIParameterTracker.h
TrackerValueDesc.h
GUIGlObject
Definition
GUIGlObject.h:67
GUIGlObject::getFullName
const std::string & getFullName() const
Definition
GUIGlObject.h:94
GUIMainWindow
Definition
GUIMainWindow.h:46
GUIMainWindow::getTrackerInterval
virtual double getTrackerInterval() const =0
get tracker interval (must be implemented in all children)
GUIMainWindow::getCurrentSimTime
virtual SUMOTime getCurrentSimTime() const =0
get current sim time (must be implemented in all children)
GUIParam_PopupMenuInterface
A popup-menu for dynamic patameter table entries.
Definition
GUIParam_PopupMenu.h:46
GUIParam_PopupMenuInterface::myVarName
std::string myVarName
The name of the value.
Definition
GUIParam_PopupMenu.h:90
GUIParam_PopupMenuInterface::onCmdOpenTracker
long onCmdOpenTracker(FXObject *, FXSelector, void *)
Called when a tracker for the value shall be opened.
Definition
GUIParam_PopupMenu.cpp:62
GUIParam_PopupMenuInterface::~GUIParam_PopupMenuInterface
~GUIParam_PopupMenuInterface()
Destructor.
Definition
GUIParam_PopupMenu.cpp:56
GUIParam_PopupMenuInterface::myObject
GUIGlObject * myObject
The object the table displays.
Definition
GUIParam_PopupMenu.h:81
GUIParam_PopupMenuInterface::mySource
ValueSource< double > * mySource
The source of the value.
Definition
GUIParam_PopupMenu.h:93
GUIParam_PopupMenuInterface::myApplication
GUIMainWindow * myApplication
The main application window; holder of some needed values.
Definition
GUIParam_PopupMenu.h:87
GUIParameterTableWindow
A window containing a gl-object's parameter.
Definition
GUIParameterTableWindow.h:61
GUIParameterTracker
A window which displays the time line of one (or more) value(s)
Definition
GUIParameterTracker.h:46
GUIParameterTracker::addTracked
void addTracked(GUIGlObject &o, ValueSource< double > *src, TrackerValueDesc *newTracked)
Adds a further time line to display.
Definition
GUIParameterTracker.cpp:154
GUIParameterTracker::create
void create()
Creates the window.
Definition
GUIParameterTracker.cpp:104
GUIParameterTracker::addTrackedMultiplot
static bool addTrackedMultiplot(GUIGlObject &o, ValueSource< double > *src, TrackerValueDesc *newTracked)
all value source to multiplot trackers
Definition
GUIParameterTracker.cpp:136
RGBColor::BLACK
static const RGBColor BLACK
Definition
RGBColor.h:193
TrackerValueDesc
Representation of a timeline of floats with their names and moments.
Definition
TrackerValueDesc.h:42
ValueSource
Definition
ValueSource.h:29
ValueSource::copy
virtual ValueSource * copy() const =0
std
Definition
json.hpp:4471
src
utils
gui
div
GUIParam_PopupMenu.cpp
Generated on Mon Dec 23 2024 00:16:00 for Eclipse SUMO - Simulation of Urban MObility by
1.9.8