1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2012-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
10 /// @file    Junction.h
11 /// @author  Daniel Krajzewicz
12 /// @author  Mario Krumnow
13 /// @author  Michael Behrisch
14 /// @date    30.05.2012
15 /// @version $Id$
16 ///
17 // C++ TraCI client API implementation
18 /****************************************************************************/
19 #ifndef Junction_h
20 #define Junction_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <vector>
29 #include <libsumo/TraCIDefs.h>
30 #include <libsumo/TraCIConstants.h>
31 
32 
33 // ===========================================================================
34 // class declarations
35 // ===========================================================================
36 class NamedRTree;
37 class MSJunction;
38 class PositionVector;
39 namespace libsumo {
40 class VariableWrapper;
41 }
42 
43 
44 // ===========================================================================
45 // class definitions
46 // ===========================================================================
47 /**
48  * @class Junction
49  * @brief C++ TraCI client API implementation
50  */
51 namespace libsumo {
52 class Junction {
53 public:
54     static std::vector<std::string> getIDList();
55     static int getIDCount();
56     static TraCIPosition getPosition(const std::string& junctionID, const bool includeZ = false);
57     static TraCIPositionVector getShape(const std::string& junctionID);
58 
59     LIBSUMO_SUBSCRIPTION_API
60 
61     /** @brief Returns a tree filled with junction instances
62      * @return The rtree of junctions
63      */
64     static NamedRTree* getTree();
65 
66     /** @brief Saves the shape of the requested object in the given container
67     *  @param id The id of the poi to retrieve
68     *  @param shape The container to fill
69     */
70     static void storeShape(const std::string& id, PositionVector& shape);
71 
72     static std::shared_ptr<VariableWrapper> makeWrapper();
73 
74     static bool handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper);
75 
76 private:
77     static MSJunction* getJunction(const std::string& id);
78 
79 private:
80     static SubscriptionResults mySubscriptionResults;
81     static ContextSubscriptionResults myContextSubscriptionResults;
82 
83 private:
84     /// @brief invalidated standard constructor
85     Junction() = delete;
86 };
87 }
88 
89 
90 #endif
91 
92 /****************************************************************************/
93