SUMO - Simulation of Urban MObility
GUIParam_PopupMenu.cpp
Go to the documentation of this file.
1 /****************************************************************************/
8 // A popup-menu for dynamic patameter table entries
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
11 // Copyright (C) 2001-2014 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
32 #include <iostream>
33 #include <string>
36 #include "GUIParam_PopupMenu.h"
41 
42 #ifdef CHECK_MEMORY_LEAKS
43 #include <foreign/nvwa/debug_new.h>
44 #endif // CHECK_MEMORY_LEAKS
45 
46 
47 // ===========================================================================
48 // FOX callback mapping
49 // ===========================================================================
50 FXDEFMAP(GUIParam_PopupMenuInterface) GUIParam_PopupMenuInterfaceMap[] = {
52 };
53 
54 // Object implementation
55 FXIMPLEMENT(GUIParam_PopupMenuInterface, FXMenuPane, GUIParam_PopupMenuInterfaceMap, ARRAYNUMBER(GUIParam_PopupMenuInterfaceMap))
56 
57 
58 // ===========================================================================
59 // method definitions
60 // ===========================================================================
62  GUIParameterTableWindow& parentWindow, GUIGlObject& o, const std::string& varName,
63  ValueSource<SUMOReal>* src)
64  : FXMenuPane(&parentWindow), myObject(&o), myParentWindow(&parentWindow),
65  myApplication(&app), myVarName(varName), mySource(src) {
66 }
67 
68 
70  delete mySource;
71 }
72 
73 
74 long
76  std::string trackerName = myVarName + " from " + myObject->getFullName();
77  GUIParameterTracker* tr = new GUIParameterTracker(*myApplication, trackerName);
79  tr->addTracked(*myObject, mySource->copy(), newTracked);
80  tr->create();
81  tr->show();
82  return 1;
83 }
84 
85 
86 /****************************************************************************/
87 
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
ValueSource< SUMOReal > * mySource
The source of the value.
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:196
A Tracker shall be opened.
Definition: GUIAppEnum.h:265
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 create()
Creates the window.
std::string myVarName
The name of the value.
void addTracked(GUIGlObject &o, ValueSource< SUMOReal > *src, TrackerValueDesc *newTracked)
Adds a further time line to display.
#define SUMOReal
Definition: config.h:215
FXDEFMAP(GUIParam_PopupMenuInterface) GUIParam_PopupMenuInterfaceMap[]
const std::string & getFullName() const
Returns the full name appearing in the tool tip.
Definition: GUIGlObject.h:107
A window containing a gl-object's parameter.