Line data Source code
1 : /****************************************************************************/
2 : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 : // Copyright (C) 2012-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 NBSign.h
15 : /// @author Jakob Erdmann
16 : /// @author Michael Behrisch
17 : /// @date Nov 2012
18 : ///
19 : // A class representing a street sign
20 : /****************************************************************************/
21 : #pragma once
22 : #include <config.h>
23 :
24 : #include <string>
25 : #include <utils/common/StringBijection.h>
26 :
27 : // ===========================================================================
28 : // class declarations
29 : // ===========================================================================
30 : class NBEdge;
31 : class OutputDevice;
32 :
33 :
34 : // ===========================================================================
35 : // class definitions
36 : // ===========================================================================
37 : /**
38 : * @class NBSign
39 : * @brief A class representing a single street sign
40 : */
41 8 : class NBSign {
42 : public:
43 :
44 : enum SignType {
45 : SIGN_TYPE_SPEED,
46 : SIGN_TYPE_YIELD,
47 : SIGN_TYPE_STOP,
48 : SIGN_TYPE_ALLWAY_STOP,
49 : SIGN_TYPE_ON_RAMP,
50 : SIGN_TYPE_PRIORITY,
51 : SIGN_TYPE_RIGHT_BEFORE_LEFT,
52 : SIGN_TYPE_LEFT_BEFORE_RIGHT,
53 : SIGN_TYPE_ROUNDABOUT,
54 : SIGN_TYPE_RAIL_CROSSING,
55 : SIGN_TYPE_SLOPE,
56 : SIGN_TYPE_CITY,
57 : SIGN_TYPE_INFO // terminator
58 : };
59 :
60 : /** @brief Constructor with id, and position
61 : *
62 : * @param[in] type The type of the sign
63 : * @param[in] offset The offset of the sign from the start of its edge
64 : * @param[in] label The (optional) label (for SPEED, SLOPE etc)
65 : */
66 : NBSign(SignType type, double offset, const std::string label = "");
67 :
68 :
69 : /// @brief Destructor
70 : ~NBSign();
71 :
72 : /// @brief write into device as POI positioned relative to the given edge
73 : void writeAsPOI(OutputDevice& into, const NBEdge* edge) const;
74 :
75 :
76 : private:
77 : /// @brief the type of the sign
78 : SignType myType;
79 :
80 : /// @brief The offset of the sign from the start of its edge
81 : double myOffset;
82 :
83 : /// @brief The (optional) label (for SPEED, SLOPE etc)
84 : std::string myLabel;
85 :
86 : static StringBijection<SignType> SignTypeStrings;
87 : static StringBijection<SignType> SignTypeColors;
88 : };
|