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 /****************************************************************************/
15 // A popup-menu for dynamic patameter table entries
16 /****************************************************************************/
17 
18 
19 // ===========================================================================
20 // included modules
21 // ===========================================================================
22 #include <config.h>
23 
24 #include <iostream>
25 #include <string>
28 #include "GUIParam_PopupMenu.h"
33 
34 
35 // ===========================================================================
36 // FOX callback mapping
37 // ===========================================================================
38 FXDEFMAP(GUIParam_PopupMenuInterface) GUIParam_PopupMenuInterfaceMap[] = {
40 };
41 
42 // Object implementation
43 FXIMPLEMENT(GUIParam_PopupMenuInterface, FXMenuPane, GUIParam_PopupMenuInterfaceMap, ARRAYNUMBER(GUIParam_PopupMenuInterfaceMap))
44 
45 
46 // ===========================================================================
47 // method definitions
48 // ===========================================================================
50  GUIParameterTableWindow& parentWindow, GUIGlObject& o, const std::string& varName,
51  ValueSource<double>* src)
52  : FXMenuPane(&parentWindow), myObject(&o), myParentWindow(&parentWindow),
53  myApplication(&app), myVarName(varName), mySource(src) {
54 }
55 
56 
58  delete mySource;
59 }
60 
61 
62 long
63 GUIParam_PopupMenuInterface::onCmdOpenTracker(FXObject*, FXSelector, void*) {
64  std::string trackerName = myVarName + " from " + myObject->getFullName();
65  GUIParameterTracker* tr = new GUIParameterTracker(*myApplication, trackerName);
67  tr->addTracked(*myObject, mySource->copy(), newTracked);
68  tr->create();
69  tr->show();
70  return 1;
71 }
72 
73 
74 /****************************************************************************/
75 
GUIGlObject.h
GUIParameterTableWindow
A window containing a gl-object's parameter.
Definition: GUIParameterTableWindow.h:62
GUIParam_PopupMenuInterface
A popup-menu for dynamic patameter table entries.
Definition: GUIParam_PopupMenu.h:47
GUIParameterTableWindow.h
RGBColor::BLACK
static const RGBColor BLACK
Definition: RGBColor.h:197
GUIMainWindow::getTrackerInterval
virtual double getTrackerInterval() const =0
GUIParam_PopupMenu.h
GUIGlObject::getFullName
const std::string & getFullName() const
Definition: GUIGlObject.cpp:137
GUIParam_PopupMenuInterface::myApplication
GUIMainWindow * myApplication
The main application window; holder of some needed values.
Definition: GUIParam_PopupMenu.h:88
GUIMainWindow.h
GUIAppEnum.h
GUIParam_PopupMenuInterface::mySource
ValueSource< double > * mySource
The source of the value.
Definition: GUIParam_PopupMenu.h:94
GUIParameterTracker::create
void create()
Creates the window.
Definition: GUIParameterTracker.cpp:91
GUIMainWindow::getCurrentSimTime
virtual SUMOTime getCurrentSimTime() const =0
GUIParam_PopupMenuInterface::myVarName
std::string myVarName
The name of the value.
Definition: GUIParam_PopupMenu.h:91
GUIParam_PopupMenuInterface::~GUIParam_PopupMenuInterface
~GUIParam_PopupMenuInterface()
Destructor.
Definition: GUIParam_PopupMenu.cpp:57
TrackerValueDesc
Representation of a timeline of floats with their names and moments.
Definition: TrackerValueDesc.h:42
GUIGlObject
Definition: GUIGlObject.h:65
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:120
GUIParameterTracker
A window which displays the time line of one (or more) value(s)
Definition: GUIParameterTracker.h:48
GUIMainWindow
Definition: GUIMainWindow.h:46
TrackerValueDesc.h
GUIParam_PopupMenuInterface::onCmdOpenTracker
long onCmdOpenTracker(FXObject *, FXSelector, void *)
Called when a tracker for the value shall be opened.
Definition: GUIParam_PopupMenu.cpp:63
config.h
ValueSource
Definition: ValueSource.h:32
GUIParameterTracker.h
MID_OPENTRACKER
@ MID_OPENTRACKER
A Tracker shall be opened.
Definition: GUIAppEnum.h:458
GUIParam_PopupMenuInterface::myObject
GUIGlObject * myObject
The object the table displays.
Definition: GUIParam_PopupMenu.h:82
FXDEFMAP
FXDEFMAP(GUIParam_PopupMenuInterface) GUIParam_PopupMenuInterfaceMap[]