Eclipse SUMO - Simulation of Urban MObility
GUIParam_PopupMenu.cpp
Go to the documentation of this file.
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3
// Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4
// This program and the accompanying materials
5
// are made available under the terms of the Eclipse Public License v2.0
6
// which accompanies this distribution, and is available at
7
// http://www.eclipse.org/legal/epl-v20.html
8
// SPDX-License-Identifier: EPL-2.0
9
/****************************************************************************/
16
// A popup-menu for dynamic patameter table entries
17
/****************************************************************************/
18
19
20
// ===========================================================================
21
// included modules
22
// ===========================================================================
23
#include <
config.h
>
24
25
#include <iostream>
26
#include <string>
27
#include "
GUIParameterTableWindow.h
"
28
#include <
utils/gui/globjects/GUIGlObject.h
>
29
#include "
GUIParam_PopupMenu.h
"
30
#include <
utils/gui/tracker/GUIParameterTracker.h
>
31
#include <
utils/gui/tracker/TrackerValueDesc.h
>
32
#include <
utils/gui/windows/GUIAppEnum.h
>
33
#include <
utils/gui/windows/GUIMainWindow.h
>
34
35
36
// ===========================================================================
37
// FOX callback mapping
38
// ===========================================================================
39
FXDEFMAP
(
GUIParam_PopupMenuInterface
) GUIParam_PopupMenuInterfaceMap[] = {
40
FXMAPFUNC(SEL_COMMAND,
MID_OPENTRACKER
,
GUIParam_PopupMenuInterface::onCmdOpenTracker
),
41
};
42
43
// Object implementation
44
FXIMPLEMENT(
GUIParam_PopupMenuInterface
, FXMenuPane, GUIParam_PopupMenuInterfaceMap, ARRAYNUMBER(GUIParam_PopupMenuInterfaceMap))
45
46
47
// ===========================================================================
48
// method definitions
49
// ===========================================================================
50
GUIParam_PopupMenuInterface
::
GUIParam_PopupMenuInterface
(
GUIMainWindow
& app,
51
GUIParameterTableWindow
& parentWindow,
GUIGlObject
& o, const std::
string
& varName,
52
ValueSource
<
double
>* src)
53
: FXMenuPane(&parentWindow), myObject(&o), myParentWindow(&parentWindow),
54
myApplication(&app), myVarName(varName), mySource(src) {
55
}
56
57
58
GUIParam_PopupMenuInterface::~GUIParam_PopupMenuInterface
() {
59
delete
mySource
;
60
}
61
62
63
long
64
GUIParam_PopupMenuInterface::onCmdOpenTracker
(FXObject*, FXSelector,
void
*) {
65
std::string trackerName =
myVarName
+
" from "
+
myObject
->
getFullName
();
66
GUIParameterTracker
* tr =
new
GUIParameterTracker
(*
myApplication
, trackerName);
67
TrackerValueDesc
* newTracked =
new
TrackerValueDesc
(
myVarName
,
RGBColor::BLACK
,
myApplication
->
getCurrentSimTime
(),
myApplication
->
getTrackerInterval
());
68
tr->
addTracked
(*
myObject
,
mySource
->
copy
(), newTracked);
69
tr->
create
();
70
tr->show();
71
return
1;
72
}
73
74
75
/****************************************************************************/
76
GUIParam_PopupMenuInterface::onCmdOpenTracker
long onCmdOpenTracker(FXObject *, FXSelector, void *)
Called when a tracker for the value shall be opened.
Definition:
GUIParam_PopupMenu.cpp:64
MID_OPENTRACKER
A Tracker shall be opened.
Definition:
GUIAppEnum.h:443
GUIMainWindow::getCurrentSimTime
virtual SUMOTime getCurrentSimTime() const =0
GUIParam_PopupMenuInterface::myObject
GUIGlObject * myObject
The object the table displays.
Definition:
GUIParam_PopupMenu.h:83
ValueSource::copy
virtual ValueSource * copy() const =0
GUIMainWindow
Definition:
GUIMainWindow.h:47
config.h
TrackerValueDesc
Representation of a timeline of floats with their names and moments.
Definition:
TrackerValueDesc.h:43
GUIParam_PopupMenuInterface
A popup-menu for dynamic patameter table entries.
Definition:
GUIParam_PopupMenu.h:48
RGBColor::BLACK
static const RGBColor BLACK
Definition:
RGBColor.h:198
GUIParameterTracker.h
ValueSource
Definition:
ValueSource.h:33
GUIParameterTracker
A window which displays the time line of one (or more) value(s)
Definition:
GUIParameterTracker.h:49
GUIParam_PopupMenuInterface::myApplication
GUIMainWindow * myApplication
The main application window; holder of some needed values.
Definition:
GUIParam_PopupMenu.h:89
GUIParameterTracker::addTracked
void addTracked(GUIGlObject &o, ValueSource< double > *src, TrackerValueDesc *newTracked)
Adds a further time line to display.
Definition:
GUIParameterTracker.cpp:121
GUIGlObject.h
GUIParam_PopupMenuInterface::mySource
ValueSource< double > * mySource
The source of the value.
Definition:
GUIParam_PopupMenu.h:95
TrackerValueDesc.h
GUIParameterTracker::create
void create()
Creates the window.
Definition:
GUIParameterTracker.cpp:92
GUIGlObject
Definition:
GUIGlObject.h:66
GUIParam_PopupMenuInterface::myVarName
std::string myVarName
The name of the value.
Definition:
GUIParam_PopupMenu.h:92
GUIParam_PopupMenuInterface::~GUIParam_PopupMenuInterface
~GUIParam_PopupMenuInterface()
Destructor.
Definition:
GUIParam_PopupMenu.cpp:58
GUIParam_PopupMenu.h
GUIAppEnum.h
GUIMainWindow.h
GUIGlObject::getFullName
const std::string & getFullName() const
Definition:
GUIGlObject.cpp:138
FXDEFMAP
FXDEFMAP(GUIParam_PopupMenuInterface) GUIParam_PopupMenuInterfaceMap[]
GUIMainWindow::getTrackerInterval
virtual double getTrackerInterval() const =0
GUIParameterTableWindow
A window containing a gl-object's parameter.
Definition:
GUIParameterTableWindow.h:63
GUIParameterTableWindow.h
src
utils
gui
div
GUIParam_PopupMenu.cpp
Generated on Wed Jan 15 2020 15:04:13 for Eclipse SUMO - Simulation of Urban MObility by
1.8.13