Eclipse SUMO - Simulation of Urban MObility
Junction.h
Go to the documentation of this file.
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 /****************************************************************************/
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 // ===========================================================================
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 
54 
55 #ifndef LIBTRACI
56 #ifndef SWIG
61  static void storeShape(const std::string& id, PositionVector& shape);
62 
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:
79  static NamedRTree* myTree;
80 #endif
81 #endif
82 private:
84  Junction() = delete;
85 };
86 }
#define LIBSUMO_ID_PARAMETER_API
Definition: TraCIDefs.h:116
#define LIBSUMO_SUBSCRIPTION_API
Definition: TraCIDefs.h:62
LIBSUMO_ID_PARAMETER_API static LIBSUMO_SUBSCRIPTION_API void storeShape(const std::string &id, PositionVector &shape)
Saves the shape of the requested object in the given container.
static const std::vector< std::string > getOutgoingEdges(const std::string &junctionID)
static SubscriptionResults mySubscriptionResults
Definition: Junction.h:77
static libsumo::TraCIPositionVector getShape(const std::string &junctionID)
static NamedRTree * myTree
Definition: Junction.h:79
static const std::vector< std::string > getIncomingEdges(const std::string &junctionID)
static std::shared_ptr< VariableWrapper > makeWrapper()
static libsumo::TraCIPosition getPosition(const std::string &junctionID, bool includeZ=false)
Junction()=delete
invalidated standard constructor
static NamedRTree * getTree()
Returns a tree filled with junction instances.
static ContextSubscriptionResults myContextSubscriptionResults
Definition: Junction.h:78
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper, tcpip::Storage *paramData)
static MSJunction * getJunction(const std::string &id)
The base class for an intersection.
Definition: MSJunction.h:58
A RT-tree for efficient storing of SUMO's Named objects.
Definition: NamedRTree.h:61
A list of positions.
std::map< std::string, libsumo::SubscriptionResults > ContextSubscriptionResults
Definition: TraCIDefs.h:338
std::map< std::string, libsumo::TraCIResults > SubscriptionResults
{object->{variable->value}}
Definition: TraCIDefs.h:337
A 2D or 3D-position, for 2D positions z == INVALID_DOUBLE_VALUE.
Definition: TraCIDefs.h:178
A list of positions.
Definition: TraCIDefs.h:234