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