Path: blob/main/src/utils/gui/div/GUIParam_PopupMenu.cpp
169684 views
/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file GUIParam_PopupMenu.cpp14/// @author Daniel Krajzewicz15/// @author Michael Behrisch16/// @date Mai 200317///18// A popup-menu for dynamic patameter table entries19/****************************************************************************/20#include <config.h>2122#include <iostream>23#include <string>24#include "GUIParameterTableWindow.h"25#include <utils/gui/globjects/GUIGlObject.h>26#include "GUIParam_PopupMenu.h"27#include <utils/gui/tracker/GUIParameterTracker.h>28#include <utils/gui/tracker/TrackerValueDesc.h>29#include <utils/gui/windows/GUIAppEnum.h>30#include <utils/gui/windows/GUIMainWindow.h>313233// ===========================================================================34// FOX callback mapping35// ===========================================================================36FXDEFMAP(GUIParam_PopupMenuInterface) GUIParam_PopupMenuInterfaceMap[] = {37FXMAPFUNC(SEL_COMMAND, MID_OPENTRACKER, GUIParam_PopupMenuInterface::onCmdOpenTracker),38};3940// Object implementation41FXIMPLEMENT(GUIParam_PopupMenuInterface, FXMenuPane, GUIParam_PopupMenuInterfaceMap, ARRAYNUMBER(GUIParam_PopupMenuInterfaceMap))424344// ===========================================================================45// method definitions46// ===========================================================================47GUIParam_PopupMenuInterface::GUIParam_PopupMenuInterface(GUIMainWindow& app,48GUIParameterTableWindow& parentWindow, GUIGlObject& o, const std::string& varName,49ValueSource<double>* src)50: FXMenuPane(&parentWindow), myObject(&o), myParentWindow(&parentWindow),51myApplication(&app), myVarName(varName), mySource(src) {52}535455GUIParam_PopupMenuInterface::~GUIParam_PopupMenuInterface() {56delete mySource;57}585960long61GUIParam_PopupMenuInterface::onCmdOpenTracker(FXObject*, FXSelector, void*) {62std::string trackerName = myVarName + " from " + myObject->getFullName();63TrackerValueDesc* newTracked = new TrackerValueDesc(myVarName, RGBColor::BLACK, myApplication->getCurrentSimTime(), myApplication->getTrackerInterval());64if (!GUIParameterTracker::addTrackedMultiplot(*myObject, mySource->copy(), newTracked)) {65GUIParameterTracker* tr = new GUIParameterTracker(*myApplication, trackerName);66tr->addTracked(*myObject, mySource->copy(), newTracked);67tr->create();68tr->show();69}70return 1;71}727374/****************************************************************************/757677