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.dlr.de/
11 // Copyright (C) 2001-2017 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 
43 // ===========================================================================
44 // FOX callback mapping
45 // ===========================================================================
46 FXDEFMAP(GUIParam_PopupMenuInterface) GUIParam_PopupMenuInterfaceMap[] = {
48 };
49 
50 // Object implementation
51 FXIMPLEMENT(GUIParam_PopupMenuInterface, FXMenuPane, GUIParam_PopupMenuInterfaceMap, ARRAYNUMBER(GUIParam_PopupMenuInterfaceMap))
52 
53 
54 // ===========================================================================
55 // method definitions
56 // ===========================================================================
58  GUIParameterTableWindow& parentWindow, GUIGlObject& o, const std::string& varName,
59  ValueSource<double>* src)
60  : FXMenuPane(&parentWindow), myObject(&o), myParentWindow(&parentWindow),
61  myApplication(&app), myVarName(varName), mySource(src) {
62 }
63 
64 
66  delete mySource;
67 }
68 
69 
70 long
71 GUIParam_PopupMenuInterface::onCmdOpenTracker(FXObject*, FXSelector, void*) {
72  std::string trackerName = myVarName + " from " + myObject->getFullName();
73  GUIParameterTracker* tr = new GUIParameterTracker(*myApplication, trackerName);
75  tr->addTracked(*myObject, mySource->copy(), newTracked);
76  tr->create();
77  tr->show();
78  return 1;
79 }
80 
81 
82 /****************************************************************************/
83 
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:197
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.
A Tracker shall be opened.
Definition: GUIAppEnum.h:295
void create()
Creates the window.
std::string myVarName
The name of the value.
const std::string & getFullName() const
FXDEFMAP(GUIParam_PopupMenuInterface) GUIParam_PopupMenuInterfaceMap[]
A window containing a gl-object&#39;s parameter.