Line data Source code
1 : /****************************************************************************/
2 : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 : // Copyright (C) 2012-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 Junction.h
15 : /// @author Daniel Krajzewicz
16 : /// @author Mario Krumnow
17 : /// @author Michael Behrisch
18 : /// @date 30.05.2012
19 : ///
20 : // C++ TraCI client API implementation
21 : /****************************************************************************/
22 : #pragma once
23 : #include <vector>
24 : #include <libsumo/TraCIDefs.h>
25 : #include <libsumo/TraCIConstants.h>
26 :
27 :
28 : // ===========================================================================
29 : // class declarations
30 : // ===========================================================================
31 : #ifndef LIBTRACI
32 : class NamedRTree;
33 : class MSJunction;
34 : class PositionVector;
35 : #endif
36 :
37 : // ===========================================================================
38 : // class definitions
39 : // ===========================================================================
40 : /**
41 : * @class Junction
42 : * @brief C++ TraCI client API implementation
43 : */
44 : namespace LIBSUMO_NAMESPACE {
45 : class Junction {
46 : public:
47 : static libsumo::TraCIPosition getPosition(const std::string& junctionID, bool includeZ = false);
48 : static libsumo::TraCIPositionVector getShape(const std::string& junctionID);
49 : static const std::vector<std::string> getIncomingEdges(const std::string& junctionID);
50 : static const std::vector<std::string> getOutgoingEdges(const std::string& junctionID);
51 :
52 : LIBSUMO_ID_PARAMETER_API
53 0 : LIBSUMO_SUBSCRIPTION_API
54 :
55 : #ifndef LIBTRACI
56 : #ifndef SWIG
57 : /** @brief Saves the shape of the requested object in the given container
58 : * @param id The id of the poi to retrieve
59 : * @param shape The container to fill
60 : */
61 : static void storeShape(const std::string& id, PositionVector& shape);
62 :
63 : /** @brief Returns a tree filled with junction instances
64 : * @return The rtree of junctions
65 : */
66 : static NamedRTree* getTree();
67 : static void cleanup();
68 :
69 : static std::shared_ptr<VariableWrapper> makeWrapper();
70 :
71 : static bool handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper, tcpip::Storage* paramData);
72 :
73 : private:
74 : static MSJunction* getJunction(const std::string& id);
75 :
76 : private:
77 : static SubscriptionResults mySubscriptionResults;
78 : static ContextSubscriptionResults myContextSubscriptionResults;
79 : static NamedRTree* myTree;
80 : #endif
81 : #endif
82 : private:
83 : /// @brief invalidated standard constructor
84 : Junction() = delete;
85 : };
86 : }
|