Line data Source code
1 : /****************************************************************************/
2 : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 : // Copyright (C) 2017-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 Junction.cpp
15 : /// @author Daniel Krajzewicz
16 : /// @author Mario Krumnow
17 : /// @author Jakob Erdmann
18 : /// @author Michael Behrisch
19 : /// @author Robert Hilbrich
20 : /// @date 30.05.2012
21 : ///
22 : // C++ TraCI client API implementation
23 : /****************************************************************************/
24 : #include <config.h>
25 :
26 : #define LIBTRACI 1
27 : #include <libsumo/TraCIConstants.h>
28 : #include <libsumo/Junction.h>
29 : #include "Domain.h"
30 : #include <libsumo/TraCIDefs.h>
31 :
32 : namespace libtraci {
33 :
34 : typedef Domain<libsumo::CMD_GET_JUNCTION_VARIABLE, libsumo::CMD_SET_JUNCTION_VARIABLE> Dom;
35 :
36 :
37 : // ===========================================================================
38 : // member definitions
39 : // ===========================================================================
40 : std::vector<std::string>
41 27 : Junction::getIDList() {
42 53 : return Dom::getStringVector(libsumo::TRACI_ID_LIST, "");
43 : }
44 :
45 :
46 : int
47 1 : Junction::getIDCount() {
48 2 : return Dom::getInt(libsumo::ID_COUNT, "");
49 : }
50 :
51 :
52 : libsumo::TraCIPosition
53 2004 : Junction::getPosition(const std::string& junctionID, bool includeZ) {
54 2004 : return includeZ ? Dom::getPos3D(libsumo::VAR_POSITION3D, junctionID) : Dom::getPos(libsumo::VAR_POSITION, junctionID);
55 : }
56 :
57 :
58 : libsumo::TraCIPositionVector
59 0 : Junction::getShape(const std::string& junctionID) {
60 0 : return Dom::getPolygon(libsumo::VAR_SHAPE, junctionID);
61 : }
62 :
63 :
64 : const std::vector<std::string>
65 1 : Junction::getIncomingEdges(const std::string& junctionID) {
66 1 : return Dom::getStringVector(libsumo::INCOMING_EDGES, junctionID);
67 : }
68 :
69 :
70 : const std::vector<std::string>
71 1 : Junction::getOutgoingEdges(const std::string& junctionID) {
72 1 : return Dom::getStringVector(libsumo::OUTGOING_EDGES, junctionID);
73 : }
74 :
75 :
76 2 : LIBTRACI_PARAMETER_IMPLEMENTATION(Junction, JUNCTION)
77 8135 : LIBTRACI_SUBSCRIPTION_IMPLEMENTATION(Junction, JUNCTION)
78 :
79 : }
80 :
81 :
82 : /****************************************************************************/
|