/****************************************************************************/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 GUIDetectorWrapper.cpp14/// @author Daniel Krajzewicz15/// @author Jakob Erdmann16/// @date Sept 200217///18// The base class for detector wrapper19/****************************************************************************/20#include <config.h>2122#include "GUIDetectorWrapper.h"23#include <gui/GUIApplicationWindow.h>24#include <utils/gui/windows/GUIAppEnum.h>25#include <gui/GUIGlobals.h>26#include <utils/gui/globjects/GUIGLObjectPopupMenu.h>27#include <utils/gui/windows/GUISUMOAbstractView.h>28#include <utils/gui/div/GUIParameterTableWindow.h>29#include <utils/gui/div/GUIGlobalSelection.h>30#include <utils/gui/div/GUIDesigns.h>3132// ===========================================================================33// FOX callback mapping34// ===========================================================================35FXDEFMAP(GUIDetectorWrapper::PopupMenu) GUIDetectorWrapperPopupMenuMap[] = {36FXMAPFUNC(SEL_COMMAND, MID_VIRTUAL_DETECTOR, GUIDetectorWrapper::PopupMenu::onCmdSetOverride),37};3839// Object implementation40FXIMPLEMENT(GUIDetectorWrapper::PopupMenu, GUIGLObjectPopupMenu, GUIDetectorWrapperPopupMenuMap, ARRAYNUMBER(GUIDetectorWrapperPopupMenuMap))4142// ===========================================================================43// member method definitions44// ===========================================================================45GUIDetectorWrapper::GUIDetectorWrapper(GUIGlObjectType type, const std::string& id, FXIcon* icon) :46GUIGlObject_AbstractAdd(type, id, icon),47mySupportsOverride(false)48{}495051GUIDetectorWrapper::~GUIDetectorWrapper() {}525354GUIGLObjectPopupMenu*55GUIDetectorWrapper::getPopUpMenu(GUIMainWindow& app, GUISUMOAbstractView& parent) {56GUIGLObjectPopupMenu* ret = new PopupMenu(app, parent, this);57buildPopupHeader(ret, app);58buildCenterPopupEntry(ret);59buildNameCopyPopupEntry(ret);60buildSelectionPopupEntry(ret);61buildShowParamsPopupEntry(ret);62buildPositionCopyEntry(ret, app);63if (mySupportsOverride) {64new FXMenuSeparator(ret);65if (haveOverride()) {66GUIDesigns::buildFXMenuCommand(ret, "Reset override", nullptr, ret, MID_VIRTUAL_DETECTOR);67} else {68GUIDesigns::buildFXMenuCommand(ret, "Override detection", nullptr, ret, MID_VIRTUAL_DETECTOR);69}70}71return ret;72}737475double76GUIDetectorWrapper::getExaggeration(const GUIVisualizationSettings& s) const {77return s.addSize.getExaggeration(s, this);78}798081/* -------------------------------------------------------------------------82* GUIDetectorWrapper::PopupMenu - methods83* ----------------------------------------------------------------------- */84GUIDetectorWrapper::PopupMenu::PopupMenu(85GUIMainWindow& app, GUISUMOAbstractView& parent, GUIGlObject* o) :86GUIGLObjectPopupMenu(app, parent, o) {87}888990long91GUIDetectorWrapper::PopupMenu::onCmdSetOverride(FXObject*, FXSelector, void*) {92dynamic_cast<GUIDetectorWrapper*>(myObject)->toggleOverride();93myParent->update();94return 1;95}969798/****************************************************************************/99100101