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.h
15 : /// @author Daniel Krajzewicz
16 : /// @author Jakob Erdmann
17 : /// @author Michael Behrisch
18 : /// @date Sept 2002
19 : ///
20 : // The base class for detector wrapper
21 : /****************************************************************************/
22 : #pragma once
23 : #include <config.h>
24 :
25 : #include <utils/geom/Position.h>
26 : #include <utils/gui/globjects/GUIGlObject_AbstractAdd.h>
27 : #include <utils/gui/globjects/GUIGLObjectPopupMenu.h>
28 : #include <utils/gui/windows/GUISUMOAbstractView.h>
29 :
30 :
31 : // ===========================================================================
32 : // class definitions
33 : // ===========================================================================
34 : /**
35 : * @class GUIDetectorWrapper
36 : * This is the base class for detector wrapper; As detectors may have a
37 : * position only or additionally a length, different display mechanisms are
38 : * necessary. These must be implemented in class erived from this one,
39 : * according to the wrapped detectors' properties.
40 : */
41 : class GUIDetectorWrapper : public GUIGlObject_AbstractAdd {
42 :
43 : public:
44 : /// Constructor
45 : GUIDetectorWrapper(GUIGlObjectType type, const std::string& id, FXIcon* icon);
46 :
47 : /// Destructor
48 : ~GUIDetectorWrapper();
49 :
50 : /// @name inherited from GUIGlObject
51 : //@{
52 :
53 : /** @brief Returns an own popup-menu
54 : *
55 : * @param[in] app The application needed to build the popup-menu
56 : * @param[in] parent The parent window needed to build the popup-menu
57 : * @return The built popup-menu
58 : * @see GUIGlObject::getPopUpMenu
59 : */
60 : GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app, GUISUMOAbstractView& parent);
61 :
62 : /// @brief return exaggeration associated with this GLObject
63 : double getExaggeration(const GUIVisualizationSettings& s) const;
64 : /// @}
65 :
66 : /**
67 : * @class GUIBaseVehiclePopupMenu
68 : *
69 : * A popup-menu for detectors. In comparison to the normal popup-menu, this one
70 : * also allows to trigger virtual detector calls
71 : */
72 : class PopupMenu : public GUIGLObjectPopupMenu {
73 0 : FXDECLARE(PopupMenu)
74 :
75 : public:
76 : PopupMenu(GUIMainWindow& app, GUISUMOAbstractView& parent, GUIGlObject& o);
77 :
78 : /// @brief Destructor
79 0 : virtual ~PopupMenu() {};
80 :
81 : /// @brief called to set/reset virtual detector calls
82 : long onCmdSetOverride(FXObject*, FXSelector, void*);
83 :
84 :
85 : protected:
86 0 : FOX_CONSTRUCTOR(PopupMenu)
87 : };
88 :
89 : protected:
90 :
91 : /// @brief whether this detector has an active virtual detector call
92 0 : virtual bool haveOverride() const {
93 0 : return false;
94 : }
95 :
96 0 : virtual void toggleOverride() const { }
97 :
98 : /// @brief whether this detector supports virtual detector calls
99 : bool mySupportsOverride;
100 :
101 :
102 : };
|