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>
35 #include "GUIParam_PopupMenu.h"
40 
41 
42 // ===========================================================================
43 // FOX callback mapping
44 // ===========================================================================
45 FXDEFMAP(GUIParam_PopupMenuInterface) GUIParam_PopupMenuInterfaceMap[] = {
47 };
48 
49 // Object implementation
50 FXIMPLEMENT(GUIParam_PopupMenuInterface, FXMenuPane, GUIParam_PopupMenuInterfaceMap, ARRAYNUMBER(GUIParam_PopupMenuInterfaceMap))
51 
52 
53 // ===========================================================================
54 // method definitions
55 // ===========================================================================
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 
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);
74  tr->addTracked(*myObject, mySource->copy(), newTracked);
75  tr->create();
76  tr->show();
77  return 1;
78 }
79 
80 
81 /****************************************************************************/
82 
long onCmdOpenTracker(FXObject *, FXSelector, void *)
Called when a tracker for the value shall be opened.
virtual SUMOTime getCurrentSimTime() const =0
GUIGlObject * myObject
The object the table displays.
virtual ValueSource * copy() const =0
Representation of a timeline of floats with their names and moments.
A popup-menu for dynamic patameter table entries.
static const RGBColor BLACK
Definition: RGBColor.h:186
A window which displays the time line of one (or more) value(s)
GUIMainWindow * myApplication
The main application window; holder of some needed values.
void addTracked(GUIGlObject &o, ValueSource< double > *src, TrackerValueDesc *newTracked)
Adds a further time line to display.
ValueSource< double > * mySource
The source of the value.
void create()
Creates the window.
A Tracker shall be opened.
Definition: GUIAppEnum.h:292
std::string myVarName
The name of the value.
const std::string & getFullName() const
FXDEFMAP(GUIParam_PopupMenuInterface) GUIParam_PopupMenuInterfaceMap[]
virtual double getTrackerInterval() const =0
A window containing a gl-object&#39;s parameter.