Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GUIDetectorWrapper.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
19// The base class for detector wrapper
20/****************************************************************************/
21#include <config.h>
22
23#include "GUIDetectorWrapper.h"
26#include <gui/GUIGlobals.h>
32
33// ===========================================================================
34// FOX callback mapping
35// ===========================================================================
36FXDEFMAP(GUIDetectorWrapper::PopupMenu) GUIDetectorWrapperPopupMenuMap[] = {
38};
39
40// Object implementation
41FXIMPLEMENT(GUIDetectorWrapper::PopupMenu, GUIGLObjectPopupMenu, GUIDetectorWrapperPopupMenuMap, ARRAYNUMBER(GUIDetectorWrapperPopupMenuMap))
42
43// ===========================================================================
44// member method definitions
45// ===========================================================================
46GUIDetectorWrapper::GUIDetectorWrapper(GUIGlObjectType type, const std::string& id, FXIcon* icon) :
47 GUIGlObject_AbstractAdd(type, id, icon),
48 mySupportsOverride(false)
49{}
50
51
53
54
57 GUIGLObjectPopupMenu* ret = new PopupMenu(app, parent, *this);
58 buildPopupHeader(ret, app);
63 buildPositionCopyEntry(ret, app);
65 new FXMenuSeparator(ret);
66 if (haveOverride()) {
67 GUIDesigns::buildFXMenuCommand(ret, "Reset override", nullptr, ret, MID_VIRTUAL_DETECTOR);
68 } else {
69 GUIDesigns::buildFXMenuCommand(ret, "Override detection", nullptr, ret, MID_VIRTUAL_DETECTOR);
70 }
71 }
72 return ret;
73}
74
75
76double
80
81
82/* -------------------------------------------------------------------------
83 * GUIDetectorWrapper::PopupMenu - methods
84 * ----------------------------------------------------------------------- */
89
90
91long
93 dynamic_cast<GUIDetectorWrapper*>(myObject)->toggleOverride();
94 myParent->update();
95 return 1;
96}
97
98
99/****************************************************************************/
@ MID_VIRTUAL_DETECTOR
toggle detector override
Definition GUIAppEnum.h:673
FXDEFMAP(GUIDetectorWrapper::PopupMenu) GUIDetectorWrapperPopupMenuMap[]
GUIGlObjectType
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel, const bool disable=false)
build menu command
long onCmdSetOverride(FXObject *, FXSelector, void *)
called to set/reset virtual detector calls
PopupMenu(GUIMainWindow &app, GUISUMOAbstractView &parent, GUIGlObject &o)
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
virtual bool haveOverride() const
whether this detector has an active virtual detector call
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
~GUIDetectorWrapper()
Destructor.
bool mySupportsOverride
whether this detector supports virtual detector calls
virtual void toggleOverride() const
The popup menu of a globject.
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
void buildSelectionPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to (de)select the object.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, const GUIMainWindow &app) const
Builds an entry which allows to copy the cursor position if geo projection is used,...
Stores the information about how to visualize structures.
GUIVisualizationSizeSettings addSize
Definition json.hpp:4471
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values