Line data Source code
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 : /****************************************************************************/
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 0 : FXIMPLEMENT(GUIDetectorWrapper::PopupMenu, GUIGLObjectPopupMenu, GUIDetectorWrapperPopupMenuMap, ARRAYNUMBER(GUIDetectorWrapperPopupMenuMap))
42 :
43 : // ===========================================================================
44 : // member method definitions
45 : // ===========================================================================
46 1106 : GUIDetectorWrapper::GUIDetectorWrapper(GUIGlObjectType type, const std::string& id, FXIcon* icon) :
47 : GUIGlObject_AbstractAdd(type, id, icon),
48 1106 : mySupportsOverride(false)
49 1106 : {}
50 :
51 :
52 1104 : GUIDetectorWrapper::~GUIDetectorWrapper() {}
53 :
54 :
55 : GUIGLObjectPopupMenu*
56 0 : GUIDetectorWrapper::getPopUpMenu(GUIMainWindow& app, GUISUMOAbstractView& parent) {
57 0 : GUIGLObjectPopupMenu* ret = new PopupMenu(app, parent, *this);
58 0 : buildPopupHeader(ret, app);
59 0 : buildCenterPopupEntry(ret);
60 0 : buildNameCopyPopupEntry(ret);
61 0 : buildSelectionPopupEntry(ret);
62 0 : buildShowParamsPopupEntry(ret);
63 0 : buildPositionCopyEntry(ret, app);
64 0 : if (mySupportsOverride) {
65 0 : new FXMenuSeparator(ret);
66 0 : if (haveOverride()) {
67 0 : GUIDesigns::buildFXMenuCommand(ret, "Reset override", nullptr, ret, MID_VIRTUAL_DETECTOR);
68 : } else {
69 0 : GUIDesigns::buildFXMenuCommand(ret, "Override detection", nullptr, ret, MID_VIRTUAL_DETECTOR);
70 : }
71 : }
72 0 : return ret;
73 : }
74 :
75 :
76 : double
77 33207 : GUIDetectorWrapper::getExaggeration(const GUIVisualizationSettings& s) const {
78 33207 : return s.addSize.getExaggeration(s, this);
79 : }
80 :
81 :
82 : /* -------------------------------------------------------------------------
83 : * GUIDetectorWrapper::PopupMenu - methods
84 : * ----------------------------------------------------------------------- */
85 0 : GUIDetectorWrapper::PopupMenu::PopupMenu(
86 0 : GUIMainWindow& app, GUISUMOAbstractView& parent, GUIGlObject& o) :
87 0 : GUIGLObjectPopupMenu(app, parent, o) {
88 0 : }
89 :
90 :
91 : long
92 0 : GUIDetectorWrapper::PopupMenu::onCmdSetOverride(FXObject*, FXSelector, void*) {
93 0 : dynamic_cast<GUIDetectorWrapper*>(myObject)->toggleOverride();
94 0 : myParent->update();
95 0 : return 1;
96 : }
97 :
98 :
99 : /****************************************************************************/
|