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>
29 #include "GUIParam_PopupMenu.h"
34 
35 
36 // ===========================================================================
37 // FOX callback mapping
38 // ===========================================================================
39 FXDEFMAP(GUIParam_PopupMenuInterface) GUIParam_PopupMenuInterfaceMap[] = {
41 };
42 
43 // Object implementation
44 FXIMPLEMENT(GUIParam_PopupMenuInterface, FXMenuPane, GUIParam_PopupMenuInterfaceMap, ARRAYNUMBER(GUIParam_PopupMenuInterfaceMap))
45 
46 
47 // ===========================================================================
48 // method definitions
49 // ===========================================================================
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 
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);
68  tr->addTracked(*myObject, mySource->copy(), newTracked);
69  tr->create();
70  tr->show();
71  return 1;
72 }
73 
74 
75 /****************************************************************************/
76 
GUIGlObject.h
GUIParameterTableWindow
A window containing a gl-object's parameter.
Definition: GUIParameterTableWindow.h:63
GUIParam_PopupMenuInterface
A popup-menu for dynamic patameter table entries.
Definition: GUIParam_PopupMenu.h:48
GUIParameterTableWindow.h
RGBColor::BLACK
static const RGBColor BLACK
Definition: RGBColor.h:198
GUIMainWindow::getTrackerInterval
virtual double getTrackerInterval() const =0
GUIParam_PopupMenu.h
GUIGlObject::getFullName
const std::string & getFullName() const
Definition: GUIGlObject.cpp:138
GUIParam_PopupMenuInterface::myApplication
GUIMainWindow * myApplication
The main application window; holder of some needed values.
Definition: GUIParam_PopupMenu.h:89
GUIMainWindow.h
GUIAppEnum.h
GUIParam_PopupMenuInterface::mySource
ValueSource< double > * mySource
The source of the value.
Definition: GUIParam_PopupMenu.h:95
GUIParameterTracker::create
void create()
Creates the window.
Definition: GUIParameterTracker.cpp:92
GUIMainWindow::getCurrentSimTime
virtual SUMOTime getCurrentSimTime() const =0
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
TrackerValueDesc
Representation of a timeline of floats with their names and moments.
Definition: TrackerValueDesc.h:43
GUIGlObject
Definition: GUIGlObject.h:66
ValueSource::copy
virtual ValueSource * copy() const =0
GUIParameterTracker::addTracked
void addTracked(GUIGlObject &o, ValueSource< double > *src, TrackerValueDesc *newTracked)
Adds a further time line to display.
Definition: GUIParameterTracker.cpp:121
GUIParameterTracker
A window which displays the time line of one (or more) value(s)
Definition: GUIParameterTracker.h:49
GUIMainWindow
Definition: GUIMainWindow.h:47
TrackerValueDesc.h
GUIParam_PopupMenuInterface::onCmdOpenTracker
long onCmdOpenTracker(FXObject *, FXSelector, void *)
Called when a tracker for the value shall be opened.
Definition: GUIParam_PopupMenu.cpp:64
config.h
ValueSource
Definition: ValueSource.h:33
GUIParameterTracker.h
MID_OPENTRACKER
A Tracker shall be opened.
Definition: GUIAppEnum.h:443
GUIParam_PopupMenuInterface::myObject
GUIGlObject * myObject
The object the table displays.
Definition: GUIParam_PopupMenu.h:83
FXDEFMAP
FXDEFMAP(GUIParam_PopupMenuInterface) GUIParam_PopupMenuInterfaceMap[]