Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/guisim/GUIDetectorWrapper.cpp
169665 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-2025 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
/****************************************************************************/
14
/// @file GUIDetectorWrapper.cpp
15
/// @author Daniel Krajzewicz
16
/// @author Jakob Erdmann
17
/// @date Sept 2002
18
///
19
// The base class for detector wrapper
20
/****************************************************************************/
21
#include <config.h>
22
23
#include "GUIDetectorWrapper.h"
24
#include <gui/GUIApplicationWindow.h>
25
#include <utils/gui/windows/GUIAppEnum.h>
26
#include <gui/GUIGlobals.h>
27
#include <utils/gui/globjects/GUIGLObjectPopupMenu.h>
28
#include <utils/gui/windows/GUISUMOAbstractView.h>
29
#include <utils/gui/div/GUIParameterTableWindow.h>
30
#include <utils/gui/div/GUIGlobalSelection.h>
31
#include <utils/gui/div/GUIDesigns.h>
32
33
// ===========================================================================
34
// FOX callback mapping
35
// ===========================================================================
36
FXDEFMAP(GUIDetectorWrapper::PopupMenu) GUIDetectorWrapperPopupMenuMap[] = {
37
FXMAPFUNC(SEL_COMMAND, MID_VIRTUAL_DETECTOR, GUIDetectorWrapper::PopupMenu::onCmdSetOverride),
38
};
39
40
// Object implementation
41
FXIMPLEMENT(GUIDetectorWrapper::PopupMenu, GUIGLObjectPopupMenu, GUIDetectorWrapperPopupMenuMap, ARRAYNUMBER(GUIDetectorWrapperPopupMenuMap))
42
43
// ===========================================================================
44
// member method definitions
45
// ===========================================================================
46
GUIDetectorWrapper::GUIDetectorWrapper(GUIGlObjectType type, const std::string& id, FXIcon* icon) :
47
GUIGlObject_AbstractAdd(type, id, icon),
48
mySupportsOverride(false)
49
{}
50
51
52
GUIDetectorWrapper::~GUIDetectorWrapper() {}
53
54
55
GUIGLObjectPopupMenu*
56
GUIDetectorWrapper::getPopUpMenu(GUIMainWindow& app, GUISUMOAbstractView& parent) {
57
GUIGLObjectPopupMenu* ret = new PopupMenu(app, parent, this);
58
buildPopupHeader(ret, app);
59
buildCenterPopupEntry(ret);
60
buildNameCopyPopupEntry(ret);
61
buildSelectionPopupEntry(ret);
62
buildShowParamsPopupEntry(ret);
63
buildPositionCopyEntry(ret, app);
64
if (mySupportsOverride) {
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
76
double
77
GUIDetectorWrapper::getExaggeration(const GUIVisualizationSettings& s) const {
78
return s.addSize.getExaggeration(s, this);
79
}
80
81
82
/* -------------------------------------------------------------------------
83
* GUIDetectorWrapper::PopupMenu - methods
84
* ----------------------------------------------------------------------- */
85
GUIDetectorWrapper::PopupMenu::PopupMenu(
86
GUIMainWindow& app, GUISUMOAbstractView& parent, GUIGlObject* o) :
87
GUIGLObjectPopupMenu(app, parent, o) {
88
}
89
90
91
long
92
GUIDetectorWrapper::PopupMenu::onCmdSetOverride(FXObject*, FXSelector, void*) {
93
dynamic_cast<GUIDetectorWrapper*>(myObject)->toggleOverride();
94
myParent->update();
95
return 1;
96
}
97
98
99
/****************************************************************************/
100
101