traci._junction

 1# -*- coding: utf-8 -*-
 2# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
 3# Copyright (C) 2011-2026 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.py
15# @author  Michael Behrisch
16# @author  Mario Krumnow
17# @author  Jakob Erdmann
18# @date    2011-03-17
19
20from __future__ import absolute_import
21from .domain import Domain
22from . import constants as tc
23
24
25class JunctionDomain(Domain):
26
27    def __init__(self):
28        Domain.__init__(self, "junction", tc.CMD_GET_JUNCTION_VARIABLE, tc.CMD_SET_JUNCTION_VARIABLE,
29                        tc.CMD_SUBSCRIBE_JUNCTION_VARIABLE, tc.RESPONSE_SUBSCRIBE_JUNCTION_VARIABLE,
30                        tc.CMD_SUBSCRIBE_JUNCTION_CONTEXT, tc.RESPONSE_SUBSCRIBE_JUNCTION_CONTEXT)
31
32    def getPosition(self, junctionID, includeZ=False):
33        """getPosition(string, bool) -> (double, double) or (double, double, double)
34
35        Returns the coordinates of the center of the junction.
36        """
37        return self._getUniversal(tc.VAR_POSITION3D if includeZ else tc.VAR_POSITION, junctionID)
38
39    def getShape(self, junctionID):
40        """getShape(string) -> tuple((double, double))
41
42        Tuple of 2D positions (cartesian) describing the geometry.
43        """
44        return self._getUniversal(tc.VAR_SHAPE, junctionID)
45
46    def getIncomingEdges(self, junctionID):
47        """getIncomingEdges(string) -> tuple(string)
48
49        Returns the ids of the edges that end at this junction
50        """
51        return self._getUniversal(tc.INCOMING_EDGES, junctionID)
52
53    def getOutgoingEdges(self, junctionID):
54        """getOutgoingEdges(string) -> tuple(string)
55
56        Returns the ids of the edges that start at this junction
57        """
58        return self._getUniversal(tc.OUTGOING_EDGES, junctionID)
class JunctionDomain(traci.domain.Domain):
26class JunctionDomain(Domain):
27
28    def __init__(self):
29        Domain.__init__(self, "junction", tc.CMD_GET_JUNCTION_VARIABLE, tc.CMD_SET_JUNCTION_VARIABLE,
30                        tc.CMD_SUBSCRIBE_JUNCTION_VARIABLE, tc.RESPONSE_SUBSCRIBE_JUNCTION_VARIABLE,
31                        tc.CMD_SUBSCRIBE_JUNCTION_CONTEXT, tc.RESPONSE_SUBSCRIBE_JUNCTION_CONTEXT)
32
33    def getPosition(self, junctionID, includeZ=False):
34        """getPosition(string, bool) -> (double, double) or (double, double, double)
35
36        Returns the coordinates of the center of the junction.
37        """
38        return self._getUniversal(tc.VAR_POSITION3D if includeZ else tc.VAR_POSITION, junctionID)
39
40    def getShape(self, junctionID):
41        """getShape(string) -> tuple((double, double))
42
43        Tuple of 2D positions (cartesian) describing the geometry.
44        """
45        return self._getUniversal(tc.VAR_SHAPE, junctionID)
46
47    def getIncomingEdges(self, junctionID):
48        """getIncomingEdges(string) -> tuple(string)
49
50        Returns the ids of the edges that end at this junction
51        """
52        return self._getUniversal(tc.INCOMING_EDGES, junctionID)
53
54    def getOutgoingEdges(self, junctionID):
55        """getOutgoingEdges(string) -> tuple(string)
56
57        Returns the ids of the edges that start at this junction
58        """
59        return self._getUniversal(tc.OUTGOING_EDGES, junctionID)
def getPosition(self, junctionID, includeZ=False):
33    def getPosition(self, junctionID, includeZ=False):
34        """getPosition(string, bool) -> (double, double) or (double, double, double)
35
36        Returns the coordinates of the center of the junction.
37        """
38        return self._getUniversal(tc.VAR_POSITION3D if includeZ else tc.VAR_POSITION, junctionID)

getPosition(string, bool) -> (double, double) or (double, double, double)

Returns the coordinates of the center of the junction.

def getShape(self, junctionID):
40    def getShape(self, junctionID):
41        """getShape(string) -> tuple((double, double))
42
43        Tuple of 2D positions (cartesian) describing the geometry.
44        """
45        return self._getUniversal(tc.VAR_SHAPE, junctionID)

getShape(string) -> tuple((double, double))

Tuple of 2D positions (cartesian) describing the geometry.

def getIncomingEdges(self, junctionID):
47    def getIncomingEdges(self, junctionID):
48        """getIncomingEdges(string) -> tuple(string)
49
50        Returns the ids of the edges that end at this junction
51        """
52        return self._getUniversal(tc.INCOMING_EDGES, junctionID)

getIncomingEdges(string) -> tuple(string)

Returns the ids of the edges that end at this junction

def getOutgoingEdges(self, junctionID):
54    def getOutgoingEdges(self, junctionID):
55        """getOutgoingEdges(string) -> tuple(string)
56
57        Returns the ids of the edges that start at this junction
58        """
59        return self._getUniversal(tc.OUTGOING_EDGES, junctionID)

getOutgoingEdges(string) -> tuple(string)

Returns the ids of the edges that start at this junction